670 Commits

Author SHA1 Message Date
a26ff60b8f Don't repeat assets downloads 2023-04-03 20:35:54 +01:00
9439ee7927 Add padding to startup button
Otherwise google games popup will prevent you from clicking it
2023-04-03 20:34:36 +01:00
eeb1b54cd5 Bump submodule openttd 2023-04-03 16:11:25 +01:00
bcdfccc28e Bump to version 13.0 2023-04-03 15:13:33 +01:00
6a67ec9197 feat: Allow multiple full app names 2023-04-03 14:14:17 +01:00
Miguel Horta
c6fdfc4cbe Pin ndkVersion
Without indicating ndkVersion gradle won't find ndk path and it will
fail to extract debug symbols from binaries. The final result will be a
apk much bigger than needed.
2022-06-30 19:28:04 +01:00
Licaon_Kter
881d81cc50 Add tips 2022-06-20 11:32:53 +01:00
Licaon_Kter
d40a4b599e fix extra line 2022-06-20 11:32:53 +01:00
Licaon_Kter
62611e60f4 Initial Fastlane structure 2022-06-20 11:32:53 +01:00
Miguel Horta
e4939e3f3f Remove unnecessary projects and libs 2022-06-17 12:02:21 +01:00
Miguel Horta
8c03645bce Some older curl do not support --fail-with-body 2022-06-16 12:28:20 +01:00
Miguel Horta
38f8308926 Prepack every asset
It should now be possible to install and play a game without downloading
anything from the internet

Bump to rev111
2022-06-15 19:56:12 +01:00
Miguel Horta
32c747f580 Use f-droid's gradle
Drop wrapper usage
2022-05-11 16:51:00 +01:00
Miguel Horta
fbc7ee1d2b Allow clang-7 build for built-tools 2022-04-27 14:10:10 +01:00
Miguel Horta
899a3b3630 Allow building for F-Droid 2022-04-21 04:15:37 +01:00
Miguel Horta
84a08cad8e Update submodules url 2022-04-17 22:42:36 +01:00
Miguel Horta
e058499e89 Fix syntax error 2022-04-17 22:15:37 +01:00
Miguel Horta
c87e13d96f Fix post build condition 2022-04-17 18:53:17 +01:00
Miguel Horta
e080e70bda Small formatting changes 2022-04-17 15:45:24 +01:00
Miguel Horta
71411d22d5 Fix indentation
Add .editorconfig to easily enforce indentation rules
2022-04-17 14:43:04 +01:00
ca643807d2 Reduce the terseness of build.sh
Allowing easier reading and editing
2022-04-15 14:59:48 +01:00
1c488fe457 Drop usage of arch command 2022-04-15 14:59:20 +01:00
Miguel Horta
c9e4d8685a Fix packging 2022-04-12 20:20:26 +01:00
Miguel Horta
86452912a0 Bump openttd rev to 12.2 2022-04-12 20:10:10 +01:00
Miguel Horta
8d02011e82 Change whatever I saw that irked me 2022-04-12 20:03:30 +01:00
Miguel Horta
e2a3938297 Add some check to ensure proper build env 2022-04-12 20:01:22 +01:00
Sergii Pylypenko
798fd0f5e1 Merge pull request #138 from Grumbel/supertux-fmt-patch
Exclude optional fmt files from supertux build
2022-03-10 00:05:47 +02:00
Ingo Ruhnke
6916b2cce9 Exclude optional fmt files from supertux build 2022-03-09 22:17:41 +01:00
Sergii Pylypenko
d3d938c27d Merge pull request #137 from Semphriss/patch-1
Add *.cc files to source code
2022-03-09 20:21:50 +02:00
Semphriss
37c77c100f Add *.cc files to source code 2022-03-09 18:14:40 +00:00
Sergii Pylypenko
bc0f10c2bf Merge pull request #136 from Semphriss/patch-1
Add FMT libraries for SuperTux
2022-03-09 20:11:13 +02:00
Semphriss
f793806d7e Add FMT libraries for SuperTux 2022-03-09 17:55:10 +00:00
Sergii Pylypenko
1c9ff9d98e CI: fixed package script 2022-01-15 00:14:31 +02:00
Sergii Pylypenko
55303806d9 CI: cache does not work so well if there's nothing to cache 2022-01-15 00:12:06 +02:00
Sergii Pylypenko
8d10d1ff0f CI: separate caches for Boost and ICU 2022-01-15 00:03:58 +02:00
Sergii Pylypenko
bbaa42c1ec SDL: trying to use fancy Github secrets in CI 2022-01-14 23:58:44 +02:00
Sergii Pylypenko
10c751afc3 Fixed debug info not stripped in CI scripts, build .aab files 2022-01-14 23:23:36 +02:00
Sergii Pylypenko
532acc9192 SuperTux: dummy .gitignore to create an assetpack directory 2022-01-13 23:36:26 +02:00
Sergii Pylypenko
20ffa0a809 SDL: fixed build script 2022-01-13 22:39:13 +02:00
Sergii Pylypenko
999cefb359 SDL: better detect asset pack presence 2022-01-13 22:36:30 +02:00
Sergii Pylypenko
ad753cbdd8 SuperTux: sign .apk with the debug key by default 2022-01-12 01:08:09 +02:00
Sergii Pylypenko
a961c62043 Updated todo 2022-01-12 00:25:55 +02:00
Sergii Pylypenko
d30371b546 Added very basic SDL2 demo app 2022-01-12 00:00:46 +02:00
Sergii Pylypenko
37769ef1e1 Check out this one little trick that software developers really hate 2022-01-11 23:53:51 +02:00
Sergii Pylypenko
5073ac8df9 Please no, I don't want a zip file named literally '${APP_NAME}.zip' 2022-01-11 23:43:54 +02:00
Sergii Pylypenko
c130231878 Better .apk file name 2022-01-11 23:34:16 +02:00
Sergii Pylypenko
8a72407d0e Why is this a syntax error? 2022-01-11 23:28:14 +02:00
Sergii Pylypenko
8aecf92fee Set up debug app signing key in the CI script 2022-01-11 23:25:27 +02:00
Sergii Pylypenko
00873a5014 Added Android build tools to SDK path in CI script 2022-01-11 23:13:59 +02:00
Sergii Pylypenko
dece0f3418 Hacking away with dumb Gradle 2022-01-11 23:04:48 +02:00
Sergii Pylypenko
d3860a6bb4 Try to set env vars for Gradle 2022-01-11 22:55:26 +02:00
Sergii Pylypenko
c37381b20f Another way to accept SDK licenses 2022-01-11 22:48:35 +02:00
Sergii Pylypenko
3d7782a0db Github actions Android setup script is useless 2022-01-11 22:45:04 +02:00
Sergii Pylypenko
6dce6d6690 No, you cannot oveeride $PATH globally in Gitlab CI script 2022-01-11 22:21:17 +02:00
Sergii Pylypenko
3512b70469 Gradle plugin does not support Java 1.8, the readme lied to me 2022-01-11 22:17:53 +02:00
Sergii Pylypenko
2b96250b11 Fixed CI script, again 2022-01-11 22:13:38 +02:00
Sergii Pylypenko
27bb3eb642 Gitlab runner needs a special script to accept Android SDK licenses 2022-01-11 22:12:25 +02:00
Sergii Pylypenko
c7a57c155b Fixed CI file 2022-01-11 22:05:10 +02:00
Sergii Pylypenko
5793ce78fb Github script license will be ZLIB not GPL 2022-01-11 22:02:07 +02:00
Sergii Pylypenko
bc710aa7b6 SDL: Github CI workflow to build the basic SDL 1.2 test app 2022-01-11 22:00:20 +02:00
Sergii Pylypenko
45a8f1868e SDL: updated boost submodule 2022-01-11 21:23:59 +02:00
Sergii Pylypenko
4fa235395f SuperTux: unbump the version, and try with zero zip compression, to avoid double decompression 2022-01-11 21:21:12 +02:00
Sergii Pylypenko
26c565e2ba SuperTux: bump version, and attempt -O3 optimization 2022-01-11 21:17:06 +02:00
Sergii Pylypenko
03b1fde421 SDL: updated Boost submodule 2022-01-11 21:15:54 +02:00
Sergii Pylypenko
44047831b3 SuperTux: fixed more absolute paths in the build script 2022-01-11 20:21:20 +02:00
Sergii Pylypenko
e549b41333 SuperTux: fixed relative paths in the build script 2022-01-11 20:16:54 +02:00
Sergii Pylypenko
c22deddf28 SDL: harfbuzz is not a prebuilt library anymore 2022-01-11 20:00:19 +02:00
Sergii Pylypenko
20cc7839e5 SDL: changed lib directory name for OpenSSL for consistency 2022-01-11 19:50:41 +02:00
Sergii Pylypenko
da41bde2a0 SDL: empty Boost symlink was generated 2022-01-11 19:46:38 +02:00
Sergii Pylypenko
b1f3d180b3 SDL: better generation of symlinks for Boost 2022-01-11 19:43:34 +02:00
Sergii Pylypenko
021ebb853e SDL: fixed ICU compilation 2022-01-10 15:46:15 +02:00
Sergii Pylypenko
1d0efd062b SDL: Do not do git clean for ICU, it builds in a loop 2022-01-10 15:34:03 +02:00
Sergii Pylypenko
d7ef921317 SDL: do not build Boost, OpenSSL, and ICU for unused architectures 2022-01-10 15:20:03 +02:00
Sergii Pylypenko
04316911e9 Updated todo 2022-01-10 15:19:04 +02:00
Sergii Pylypenko
8edb321123 SuperTux: put a data archive inside the assetpack archive, there's no other way 2022-01-10 00:47:46 +02:00
Sergii Pylypenko
292775eb07 SuperTux: a script to repack app bundle to get rid of 'assets' directory 2022-01-09 23:55:35 +02:00
Sergii Pylypenko
fc054fc4f0 SDL: fixed Java crash 2022-01-09 21:26:30 +02:00
Sergii Pylypenko
7dae18fa7d SuperTux: updated scripts 2022-01-09 21:18:16 +02:00
Sergii Pylypenko
47e6527a6f SuperTux: updated build files 2022-01-09 20:47:00 +02:00
Sergii Pylypenko
bdb958b7d4 SuperFux: try to build with LTO 2022-01-09 20:02:22 +02:00
Sergii Pylypenko
2f2a2b4fa4 SDL: fixed a crash in SDL2 Java code 2022-01-09 19:42:33 +02:00
Sergii Pylypenko
8d50979447 SuperTux: updated build files 2022-01-09 18:57:22 +02:00
Sergii Pylypenko
272fea83c2 SDL: fixed SDL2 Java code 2022-01-09 18:56:58 +02:00
Sergii Pylypenko
8f8ea18517 Updated todo 2022-01-09 18:48:22 +02:00
Sergii Pylypenko
32339a9610 Updated SDL2 readme 2022-01-09 18:48:10 +02:00
Sergii Pylypenko
821196ab38 SDL: show download error dialog for SDL2 2022-01-09 18:45:54 +02:00
Sergii Pylypenko
91e6c9f28e Updated readme to add SDL2 information 2022-01-09 18:45:27 +02:00
Sergii Pylypenko
7babb91d22 Updated SDL2 submodules 2022-01-09 17:49:43 +02:00
Sergii Pylypenko
79c0dc8b96 SDL: data downloader from SDL2, it will not print anything to screen so please don't put big files there 2022-01-09 17:44:45 +02:00
Sergii Pylypenko
1f88f05321 Fixed Boost built for incorrect API level 2022-01-08 19:40:17 +02:00
Sergii Pylypenko
2d98c49a21 SuperTux: updated todo 2022-01-06 03:47:42 +02:00
Sergii Pylypenko
8f3d943292 SDL: updated zipalign arguments 2022-01-06 03:47:28 +02:00
Sergii Pylypenko
dcfb99b8e7 SDL: fixed commandline arguments in SDL2 2022-01-05 03:36:08 +02:00
Sergii Pylypenko
3093207884 SDL: fixed sdl2_image compilation 2022-01-05 02:43:55 +02:00
Sergii Pylypenko
9dda18bc61 Fixed compilation 2022-01-05 01:46:51 +02:00
Sergii Pylypenko
11bd50e1f5 Added SDL2_mixer library submodule, replaced ogg and mpg123 libraries with versions from SDL2_mixer 2022-01-05 01:45:19 +02:00
Sergii Pylypenko
964f88c9f7 SDL: added Proguard rule to not remove SDL2 Java classes 2022-01-05 01:43:43 +02:00
Sergii Pylypenko
77a2647367 SDL: fixes to SDL2 activity 2022-01-05 01:22:32 +02:00
Sergii Pylypenko
24f0179cab SDL: updated the list of static libraries 2022-01-05 01:22:08 +02:00
Sergii Pylypenko
00b4f92348 Updated todo 2022-01-05 01:13:05 +02:00
Sergii Pylypenko
f8868bf7a0 SuperTux: updated build script 2022-01-03 02:25:05 +02:00
Sergii Pylypenko
901aecadc0 SuperTux: updated build script 2022-01-03 02:22:01 +02:00
Sergii Pylypenko
094d04a4c2 SDL2 Java implementation 2022-01-03 02:12:10 +02:00
Sergii Pylypenko
ef8b1d2c7d Do not build libsdl_main.so for SDL2 2022-01-03 00:28:09 +02:00
Sergii Pylypenko
4cdad6573b Fixed app build script 2022-01-03 00:07:15 +02:00
Sergii Pylypenko
c8c1cac242 Clear OpenAL when changing SDL version 2022-01-03 00:06:57 +02:00
Sergii Pylypenko
466c97d06f Fixed OpenAL not linking with SDL2 2022-01-03 00:06:17 +02:00
Sergii Pylypenko
dd57a9afbd SuperTux: updated build files 2022-01-02 02:06:25 +02:00
Sergii Pylypenko
624c560aef Replaced harfbuzz and freetype with libraries from SDL2_ttf submodule 2022-01-02 01:49:54 +02:00
Sergii Pylypenko
4c8936706a Added SDL2_ttf library 2022-01-02 01:40:46 +02:00
Sergii Pylypenko
d84eac20a4 Fixed SDL2 and sdl-1.2 version in build files, SDL2 is uppercase but sdl-1.2 is lowercase and the only one who I can blame is myself 2022-01-02 01:34:45 +02:00
Sergii Pylypenko
04fc1e2dbb Moved SDL2_image path, again 2022-01-02 00:15:27 +02:00
Sergii Pylypenko
919bf9a378 SDL2: custom activity that overrides SDLActivity 2022-01-02 00:12:38 +02:00
Sergii Pylypenko
a235249f57 Moving sdl2_image to the subdirectory 2022-01-01 21:51:08 +02:00
Sergii Pylypenko
aa0fe18bf6 Replace jpeg and png libraries with the libraries from SDL2_image 2022-01-01 21:36:48 +02:00
Sergii Pylypenko
2195d19f25 Added external repos for SDL2 and SDL2_image 2022-01-01 21:35:31 +02:00
Sergii Pylypenko
1cc02b548c Removed outdated SDL2 sources 2022-01-01 21:22:00 +02:00
Sergii Pylypenko
71f1a35b44 SuperTux: more fixes to project files 2022-01-01 21:16:49 +02:00
Sergii Pylypenko
51e23ec3ec SuperTux: updated project files, it does not compile yet 2022-01-01 05:00:48 +02:00
Sergii Pylypenko
7efe1a42a3 Small fix to boost scripts 2022-01-01 05:00:31 +02:00
Sergii Pylypenko
33ceea2f40 Fixed boost_locale not compiled 2022-01-01 04:48:32 +02:00
Sergii Pylypenko
40d637742e Added libglm for SuperTux 2022-01-01 04:48:10 +02:00
Sergii Pylypenko
7e90cf5cd5 Fixed libboost build script 2021-12-31 23:53:18 +02:00
Sergii Pylypenko
f8125547e5 Updated boost version 2021-12-31 21:54:36 +02:00
Sergii Pylypenko
02bed5f5f0 Updated Boost library 2021-12-31 21:46:19 +02:00
Sergii Pylypenko
bd33a3a38b Xserver: updated submodule 2021-12-31 21:39:19 +02:00
Sergii Pylypenko
87fb5d176d OpenSSL: updated build scripts to NDK 23 2021-12-21 23:06:43 +02:00
Sergii Pylypenko
caaac4cbd9 SDL: shut up Google Play security warning 2021-12-11 01:43:21 +02:00
Sergii Pylypenko
b63e1c0ed8 SDL: generate .aab file with the debug symbols, but strip .apk file 2021-12-11 00:44:00 +02:00
Sergii Pylypenko
dd1d2c1be6 OpenTTD: updated project files 2021-12-11 00:43:42 +02:00
Sergii Pylypenko
eb0114a628 Updated todo - OBB files are deprecated 2021-11-28 01:37:28 +02:00
Sergii Pylypenko
bfa4bbe20a SDL: auto-switch data path to internal storage if writing to SD card fails 2021-11-28 01:33:53 +02:00
Sergii Pylypenko
87b27b3418 SDL: updated project files to Android NDK 31 2021-11-27 23:13:15 +02:00
Sergii Pylypenko
f7be0781d9 Fixed compilation 2021-08-22 01:44:37 +03:00
Sergii Pylypenko
3ac05002f0 Updated Gradle plugin 2021-08-22 01:25:03 +03:00
Sergii Pylypenko
22e2154d7e Merge pull request #132 from krosk/sdl_android
Fix: simutrans video glitch
2021-08-20 00:50:55 +03:00
Alexis He
c2689dc7a5 Fix: simutrans video glitch 2021-08-17 10:23:12 +02:00
Sergii Pylypenko
c470f348c4 Simutrans: updated build scripts 2021-06-10 01:17:59 +03:00
Sergii Pylypenko
077acc6880 SDL: support for install-time asset pack for Android app bundle 2021-06-07 00:20:09 +03:00
Sergii Pylypenko
211ab6b8be OpenArena: bump version 2021-06-02 00:32:00 +03:00
Sergii Pylypenko
50df6e53d0 SDL: fixed on-screen key layout and keycode remap dialogs, moved screen gestures to a separate variable 2021-05-31 02:36:56 +03:00
Sergii Pylypenko
05615e643d OpenArena: updated project file 2021-05-31 02:36:24 +03:00
Sergii Pylypenko
b325c826e4 OpenArena: script to deploy new VM to dedicated servers 2021-05-30 23:16:21 +03:00
Sergii Pylypenko
22ea75c91f OpenTTD: bump version 2021-05-27 01:10:53 +03:00
Sergii Pylypenko
fc47eac67f SDL: do not move mouse position when toggling text input, it will unfocus the text input field in the game 2021-05-24 00:41:22 +03:00
Sergii Pylypenko
5e27a1f850 SDL: increased on-screen keyboard to 12 keys 2021-05-23 03:12:03 +03:00
Sergii Pylypenko
cc6cebb094 OpenArena: updated project files 2021-05-22 03:08:05 +03:00
Sergii Pylypenko
4cf9c797ce SDL: fixed video output coordinates 2021-05-22 02:58:26 +03:00
Sergii Pylypenko
206ee15e1f SDL: option to draw in the display cutout area that actually works 2021-05-22 02:05:10 +03:00
Sergii Pylypenko
ed8df2e026 SDL: no-notch theme, it does not work 2021-05-21 03:50:28 +03:00
Sergii Pylypenko
3906994ec4 OpenArena: updated readme 2021-05-21 03:47:27 +03:00
Sergii Pylypenko
21adbe6a1e SDL: more attempts to draw in the display cutout 2021-05-21 03:42:55 +03:00
Sergii Pylypenko
c5d8e8b3c7 SDL: futile attempt to draw over display cutout area 2021-05-21 02:27:12 +03:00
Sergii Pylypenko
134b5c6bb6 OpenArena: updated project files 2021-05-20 23:28:54 +03:00
Sergii Pylypenko
d18f028de7 SDL: updated readme with the section about mounting .obb files 2021-05-20 23:28:29 +03:00
Sergii Pylypenko
f1ca4e520d SDL: fixed Android permissions for .obb files 2021-05-20 23:28:08 +03:00
Sergii Pylypenko
11c23767fb SDL: fixed .obb file mounting 2021-05-20 23:27:53 +03:00
Sergii Pylypenko
b9dfad3516 SDL: new download method 'mnt:' to mount .obb file created by jobb tool, the mount path is returned in ANDROID_OBB_MOUNT_DIR env variable 2021-05-20 02:32:35 +03:00
Sergii Pylypenko
326ebb7607 SDL: do not include empty directory entries when adding custom binaries 2021-05-19 23:39:43 +03:00
Sergii Pylypenko
c728df6a80 OpenArena: updated to compile with NDK r22 2021-05-19 00:07:32 +03:00
Sergii Pylypenko
a692b244eb Updated todo 2021-05-19 00:07:26 +03:00
Sergii Pylypenko
c08e0e6db3 SDL: do not delete .obb file, do not request storage write permission to read .obb file 2021-05-19 00:06:09 +03:00
Sergii Pylypenko
1215590f90 OpenArena: updated the project patch 2021-05-16 01:56:05 +03:00
Sergii Pylypenko
d863f8f2fe SDL: do not delete .obb file data 2021-05-16 01:55:34 +03:00
Sergii Pylypenko
09672ef3ee OpenTTD: fixed a crash 2021-05-16 00:24:05 +03:00
Sergii Pylypenko
76f5ae99ab OpenTTD: removed test AI scripts that gave users wrong error message 2021-05-13 01:21:00 +03:00
Sergii Pylypenko
222e626ff2 OpenTTD: another update 2021-05-11 01:45:58 +03:00
Sergii Pylypenko
8d9c8259af OpenTTD: updated git repo 2021-05-08 00:06:03 +03:00
Sergii Pylypenko
522bef87f9 SDL: updated Gradle plugin 2021-05-07 23:36:54 +03:00
Sergii Pylypenko
dfe6f6b1c1 OpenTTD: updated to 1.11.2 2021-05-07 23:14:17 +03:00
Sergii Pylypenko
09ad04bf1a OpenTTD: moved fonts into a separate package 2021-05-02 01:38:01 +03:00
Sergii Pylypenko
0605f7e6d8 OpenTTD: bump version 2021-04-26 01:14:55 +03:00
Sergii Pylypenko
a5a0daffa2 OpenTTD: set video depth to 24bpp, increased startup timeout to make it easier to access SDL menu 2021-04-03 22:13:22 +03:00
Sergii Pylypenko
c6a7d713d1 OpenTTD: fixed music 2021-04-02 22:19:51 +03:00
Sergii Pylypenko
e451732de7 OpenTTD: bump version 2021-04-01 21:47:06 +03:00
Sergii Pylypenko
5c2dd33dff OpenTTD: bump version 2021-03-15 22:32:43 +02:00
Sergii Pylypenko
a3d5595519 XSDL: option to disable PulseAudio 2021-03-13 01:24:39 +02:00
Sergii Pylypenko
a8207ceeae OpenSSL: fixed headers 2021-03-13 01:02:39 +02:00
Sergii Pylypenko
c77c68b9f6 SDL: updated OpenSSL build scripts 2021-03-12 23:46:28 +02:00
Sergii Pylypenko
3dfadf7da1 SDL: fixed compiler warning 2021-03-12 22:39:35 +02:00
Sergii Pylypenko
f84b9c5406 OpenTTD JGR: bump version 2021-03-08 22:22:26 +02:00
Sergii Pylypenko
3ceb3c73ff OpenTTD: bump version 2021-03-04 00:32:26 +02:00
Sergii Pylypenko
597b140a6c OpenTTD: bump version 2021-03-03 02:22:38 +02:00
Sergii Pylypenko
cbc8ec5944 OpenTTD: bump version 2021-03-03 01:45:41 +02:00
Sergii Pylypenko
047bf70ef8 OpenTTD-JGR: bump version, fixed build scripts 2021-03-01 01:01:50 +02:00
pelya
23e010f203 OpenTyrian: fixed compilation 2021-02-14 00:09:52 +02:00
pelya
55026dec85 Updated todo 2021-02-13 23:48:47 +02:00
pelya
46826b2d17 SDL: fixed scroll wheel input for Bluetooth mouse 2021-02-13 23:47:06 +02:00
pelya
138cd60d30 SDL: always call AndroidBuild.shto rebuild dependencies 2021-02-05 23:51:48 +02:00
pelya
bb3c954a59 OpenTTD: fixed libfontconfig not linking on Android 2021-02-05 23:19:10 +02:00
pelya
14c94d5deb Updated todo 2021-02-04 01:42:43 +02:00
pelya
4d4f33ed90 SDL: check SONAME of a library generated by AndroidBuild.sh 2021-01-28 01:02:23 +02:00
pelya
d502c0acb1 OpenTTD: fixed host compilation 2021-01-25 21:55:21 +02:00
pelya
ae8b343156 OpenTTD: updated build system to use cmake 2021-01-25 21:33:35 +02:00
pelya
170f7d680e Updated todo 2021-01-23 00:17:17 +02:00
pelya
3a3269901a Updated todo 2021-01-23 00:14:15 +02:00
pelya
636559b5af SDL: put debug info from shared libraries into app bundle, updated build scripts to remove hacks and better integrate with Gradle 2021-01-08 02:29:59 +02:00
pelya
2b45093c2c OpenTTD-JGR: fixed slow compilation 2021-01-06 02:27:35 +02:00
pelya
4a5c9ea8c5 OpenTTD-JGR: enable all architectures 2021-01-06 01:33:06 +02:00
pelya
c4cb02f731 OpenTTD-JGR: fixed data path 2021-01-06 01:00:51 +02:00
pelya
c928f762f9 SDL: zipalign will refuse to align signed debug build, make it not an error 2021-01-06 01:00:04 +02:00
pelya
67f32a7cc8 OpenTTD-JGR: fixed compilation with CMake 2021-01-05 01:09:19 +02:00
pelya
12993efb3a SDL: updated setEnvironment.sh scripts to skip helper libraries 2021-01-05 00:46:54 +02:00
pelya
c1890b2a4d SDL: NDK warning will stay, because Gradle fails 2021-01-05 00:46:21 +02:00
pelya
c476167ea1 SDL: fixed ndk-build warning 2021-01-01 02:45:17 +02:00
pelya
2aa6ae455c SDL: do not add include dirs for c++shared and libapplication.so libs in setEnvironment.sh scripts 2021-01-01 02:43:29 +02:00
pelya
eae038b006 SDL: Do not generate include path for c++_shared in setEnvironment.sh scripts 2021-01-01 02:29:17 +02:00
pelya
82c4111733 OpenTTD: removed useless variable from the build script 2021-01-01 01:49:17 +02:00
pelya
8746ad9623 SDL: updated Google Play Games API wrapper code 2021-01-01 01:48:37 +02:00
pelya
03dca0c4ed SDL: updated Gradle project files to use Android SDK 30 2020-12-31 23:03:29 +02:00
pelya
7a548f6259 SDL: updated setEnvironment-XXX.sh scripts to NDK 22 to use LLVM binutils 2020-12-31 22:59:02 +02:00
pelya
0502bd9416 SDL: update to NDK r22 - switch from GNU binutils strip to llvm-strip 2020-12-31 22:13:50 +02:00
pelya
c937f769c6 SDL: fixed incorrect mouse position when SdlVideoResizeKeepAspect is used 2020-10-28 22:17:16 +02:00
Gerhard Stein
c6950836a0 Fixes issue when MultiABI is set to no, indicating the correct target platform 2020-09-28 06:45:32 +00:00
Gerhard Stein
39f7b7d6ef Small fix 2020-09-19 10:13:11 +00:00
Gerhard Stein
702329a932 Fixes a problem where a function was not overloaded 2020-09-19 09:58:22 +00:00
Gerhard Stein
abb3f4196b Another solution when licenses won't get accepted 2020-09-19 09:38:39 +02:00
pelya
5936ff80b5 OpenTTD: bump version 2020-08-25 00:44:23 +03:00
pelya
4fab6dc422 Updated todo 2020-08-24 22:47:43 +03:00
pelya
e6823997de Debian: it runs fine on Android 10 without target version downgrade 2020-08-09 21:44:34 +03:00
pelya
068d7dba9e Updated todo 2020-08-09 21:43:22 +03:00
pelya
21e930fb6b Updated todo 2020-07-22 20:33:28 +03:00
Sergii Pylypenko
a1516f415e Debian: script to generate .apk with embedded image 2020-07-22 19:41:14 +03:00
pelya
7c23b880c7 SDL: clean build directories for prebuilt libraries, they bloat the source archive 2020-07-22 19:16:56 +03:00
pelya
29a26e824d XSDL: updated project files, removed Gimp project files 2020-07-22 19:09:50 +03:00
pelya
1d6b705ff3 SDL: removed touch event ratelimit hack, it introduces random input lag 2020-07-22 18:55:19 +03:00
pelya
3a57177042 OpenTTD: better Chinese font (which is not tracked by Git, grab .apk and unpack it) 2020-07-22 00:50:06 +03:00
pelya
e00fcf1afe XSDL: fixed buggy config dialog 2020-07-22 00:03:11 +03:00
pelya
2bce9d6854 Removed xmoto project, I'm not planning to update it 2020-07-07 22:50:54 +03:00
pelya
29fcb570f8 XSDL: updated readme 2020-07-07 22:30:43 +03:00
pelya
07952badae SDL: fixed dark text on dark background in notification, updated Gradle files 2020-07-07 22:29:20 +03:00
pelya
e02d772173 XSDL: fixed build script, updated readme 2020-07-07 18:55:55 +03:00
pelya
b7607f9618 OpenSSL: fixed dependencies 2020-07-07 18:47:16 +03:00
pelya
807ad3113c XSDL: updated readme 2020-07-07 01:28:27 +03:00
pelya
13f410df61 XSDL: updated readme 2020-07-07 01:26:30 +03:00
pelya
b30a5bdf47 XSDL: updated readme 2020-07-07 01:17:44 +03:00
pelya
602ceec9ed XSDL: updated readme 2020-07-07 01:13:51 +03:00
pelya
4717519311 XSDL: updated readme 2020-07-07 00:22:47 +03:00
pelya
7203affdc7 PulseAudio: updated submodule 2020-07-07 00:19:04 +03:00
pelya
9440f2227d XSDL: updated submodule 2020-07-07 00:04:07 +03:00
pelya
a617b46dec XSDL: updated readme 2020-07-07 00:03:48 +03:00
pelya
72cba7bfd5 OpenTTD: Welcome to the future! Use 24bpp animated blitter by default, instead of old non-animated but fast 16bpp blitter 2020-06-02 23:29:43 +03:00
pelya
9731a00c15 OpenTTD: bump version 2020-06-02 23:16:43 +03:00
Jeongin Lee
5544e91d05 Merge pull request #117 from jil8885/sdl_android
OpenTTD JGR : Bump version
2020-05-04 19:27:44 +09:00
Jeongin Lee
8e53731b2a OpenTTD JGR: Bump version 2020-05-04 19:25:43 +09:00
Jeongin Lee
6ffc00e13b OpenTTD JGR:Bump version 2020-05-04 19:25:36 +09:00
Jeongin Lee
9c2adfdcc8 Merge pull request #115 from jil8885/sdl_android
OpenTTD JGR : Bump version
2020-04-30 09:05:32 +09:00
Jeongin Lee
fd6e3a02cd OpenTTD JGR : Bump version 2020-04-30 09:04:01 +09:00
pelya
6b7505dc1f SDL: fixed build scripts 2020-04-17 00:52:53 +03:00
pelya
70f933c12a SDL: updated Gradle and Play Games library, this fixes cloud saves 2020-04-16 23:07:01 +03:00
pelya
b60e0a1956 OpenTTD: bump version 2020-04-01 20:47:24 +03:00
pelya
58b42e93aa OpenTTD: fixed wrong ICU data version 2020-03-26 12:46:43 +02:00
pelya
af2fc34eb5 OpenTTD: another fix for libtimidity 2020-03-25 00:12:14 +02:00
pelya
b0c05e67da OpenTTD: fixed libtimidity 2020-03-25 00:04:20 +02:00
pelya
517eb7572c OpenTTD: bump version 2020-03-24 23:51:55 +02:00
pelya
409b173e25 SDL: pxz removed from Debian 10, use xz -T 0 for multithreading compression 2020-03-19 19:19:14 +02:00
pelya
6282c041cf OpenTTD JGR: updated submodules 2020-03-19 19:03:36 +02:00
pelya
83c8c657d4 Updated git submodules, moved Boost to official repo URL 2020-03-19 18:40:10 +02:00
pelya
4ea94c197d Updated git submodules 2020-03-19 18:34:58 +02:00
Sergii Pylypenko
71d79c3703 XSDL: enable screen buttons by default 2020-03-10 19:53:42 +02:00
Sergii Pylypenko
2a58d4a24b Updated todo 2020-02-28 23:45:00 +02:00
Sergii Pylypenko
d809f372a8 Updated todo 2020-02-27 21:10:34 +02:00
Sergii Pylypenko
bb09438e1b SDL: SDL_WarpMouse() will move cursor coordinates for captured mouse on Android O 2020-02-27 21:09:39 +02:00
Sergii Pylypenko
610e43e388 XSDL: fixed 24bpp videomode 2020-02-26 23:06:15 +02:00
Sergii Pylypenko
ee825d7cee XSDL: fixed mouse in XSDL startup menu 2020-02-26 22:16:40 +02:00
Sergii Pylypenko
ddd9b70af3 SDL: capture mouse input on Android O, so notification bar won't pop up every time mouse cursor hits top of screen 2020-02-26 21:47:29 +02:00
Sergii Pylypenko
2133b4bdbf SDL: after many many years, you can specify keystore password in ANDROID_KEYSTORE_PASS env variable to automate your signing 2020-02-26 20:21:46 +02:00
Sergii Pylypenko
1610fbf5b2 Updated todo 2020-02-24 23:00:23 +02:00
Sergii Pylypenko
d49291b64e SDL: Enable HideSystemMousePointer by default if no value is set 2020-02-20 22:41:22 +02:00
Sergii Pylypenko
b340f77972 XSDL: Reworked overlay Ctrl/Alt/Shift buttons 2020-02-20 22:39:57 +02:00
Sergii Pylypenko
bc8d652517 Updated project files 2020-02-18 23:09:56 +02:00
Sergii Pylypenko
2b0d961f8b SDL: send correct key event unicode value for non-English physical keyboards 2020-02-18 23:08:23 +02:00
Sergii Pylypenko
bb387b5f07 XSDL: fixed app not starting after app update 2020-02-18 23:00:07 +02:00
Sergii Pylypenko
a64f771e39 Merge branch 'sdl_android' of github.com:pelya/commandergenius 2020-02-10 23:30:02 +02:00
Sergii Pylypenko
954676633e Updated todo 2020-02-10 23:29:48 +02:00
Jeongin Lee
14692c5794 Merge pull request #110 from jil8885/dev
Modify config file : OpenTTD JGR
Bump version : OpenTTD JGR
2020-01-14 20:16:18 +09:00
Jeongin Lee
690ab0fdc4 OpenTTD JGR:Bump version 2020-01-11 16:32:21 +09:00
Sergii Pylypenko
9e879a3758 Updated todo 2020-01-09 21:03:50 +02:00
Sergii Pylypenko
4081383cd4 Debian: on-screen button to show keyboard 2020-01-09 21:02:26 +02:00
Sergii Pylypenko
4a13c9b8d1 Debian: do not update old system image, added convenient launch script 2020-01-09 19:43:58 +02:00
Sergii Pylypenko
7207c9cbaa XSDL: Updated readme 2020-01-09 17:27:13 +02:00
Sergii Pylypenko
341ea4820e Updated todo 2020-01-09 17:02:27 +02:00
Sergii Pylypenko
de0a2aa094 Debian: it works eh 2020-01-09 16:53:09 +02:00
Jeongin Lee
12ee2980ed fix version code 2020-01-08 20:19:30 +09:00
Jeongin Lee
f3490e5a97 Update settings config:OpenTTD JGR 2020-01-07 20:51:04 +09:00
Jeongin Lee
6d8fc056b7 Update cfg:OpenTTD JGR 2020-01-07 20:48:26 +09:00
Sergii Pylypenko
a1f3b803f3 SDL: removed filtering from relative mouse touch input, becasue it makes input laggy 2020-01-06 21:04:45 +02:00
Sergii Pylypenko
74283b9a01 Debian: removed old loading screen 2020-01-06 20:48:00 +02:00
Sergii Pylypenko
3b33a27350 Debian: updated build scripts 2020-01-06 20:47:17 +02:00
Sergii Pylypenko
f1b5cb5eef Debian: updated launch command 2019-12-31 22:10:21 +02:00
Sergii Pylypenko
30ca76a91b Debian: updated postinstall script 2019-12-31 22:00:57 +02:00
Sergii Pylypenko
cd7d7f23b1 Updated postinstall script 2019-12-31 21:25:47 +02:00
Sergii Pylypenko
1aaf5fecb8 Debian: updated postinstall script 2019-12-31 20:36:29 +02:00
Sergii Pylypenko
ae4e375c8e Debian: updated postinstall script 2019-12-31 19:54:17 +02:00
Sergii Pylypenko
12a164f19c Debian noroot: updated build script 2019-12-26 23:44:40 +02:00
Sergii Pylypenko
7d1d1dcce3 Debian noroot: Updated build scripts 2019-12-26 23:38:22 +02:00
Sergii Pylypenko
d00a448056 Debian noroot: updated build scripts 2019-12-26 23:34:53 +02:00
Jeongin Lee
84c3b8f4d9 Merge pull request #109 from jil8885/dev
OpenTTD JGR : bump version
2019-12-18 20:08:29 +09:00
Jeongin Lee
e34e808c15 OpenTTD JGR : bump version 2019-12-18 20:03:35 +09:00
Sergii Pylypenko
24dbe40bd9 Merge pull request #108 from jil8885/dev
Bump version : OpenTTD JGR
2019-12-09 19:28:01 +02:00
Jeongin Lee
d25053ce9f Bump version : OpenTTD JGR 2019-12-04 17:34:08 +09:00
Sergii Pylypenko
720c08d15a Updated todo 2019-11-20 23:15:03 +02:00
Sergii Pylypenko
97c152e6a6 OpenTTD JGR: bump version 2019-11-13 22:37:29 +02:00
Sergii Pylypenko
428f6b89d7 Updated todo 2019-11-07 22:00:24 +02:00
Sergii Pylypenko
99882fa19e Ballfield: removed debug 2019-11-07 21:59:06 +02:00
Sergii Pylypenko
8b8597fbc3 SDL: permission dialog in start menu to write to external storage / SD card / USB stick 2019-11-07 21:57:37 +02:00
Sergii Pylypenko
c2d67139f7 Updated todo 2019-11-07 18:37:46 +02:00
Sergii Pylypenko
11acddec22 Updated todo 2019-11-07 17:44:02 +02:00
Sergii Pylypenko
c4ae2ef53c Updated todo 2019-11-07 16:54:51 +02:00
Sergii Pylypenko
924a106e01 Updated todo 2019-11-06 23:08:10 +02:00
Sergii Pylypenko
3926496d5f XSDL: only binaries named like 'libXXX.so' are getting extracted by Android app manager,
so rename all binaries to libXXX.so and make a bunch of symlinks
2019-11-06 22:32:08 +02:00
Sergii Pylypenko
249f602165 SDL: copy precompiled binaries in bundle generation script 2019-11-06 22:30:47 +02:00
Sergii Pylypenko
d30158b7dd SDL: clear AndroidData/lib when changing project settings 2019-11-05 23:35:46 +02:00
Sergii Pylypenko
769a99cbd8 XSDL: fixed PulseAudio 2019-10-29 22:17:43 +02:00
Sergii Pylypenko
ae4f496106 OpenTTD JGR: updated data file version 2019-10-25 18:16:37 +03:00
Gerhard Stein
34f00a6c54 Merge pull request #107 from jil8885/sdl_android
OpenTTD JGR : upgrade version
2019-10-24 18:46:39 +02:00
Jeongin Lee
e32502ed64 OpenTTD JGR : upgrade version 2019-10-23 19:29:08 +09:00
Sergii Pylypenko
117074777f XSDL: updated PulseAuio port number 2019-10-18 21:59:39 +03:00
Sergii Pylypenko
32442641dc OpenTTD: updated build script 2019-10-17 21:19:43 +03:00
Sergii Pylypenko
b5012d86ad OpenTTD-JGR: updated build scripts, bump version 2019-10-17 20:28:05 +03:00
Sergii Pylypenko
5b2b990b29 XSDL: pass native audio sample rate using setenv 2019-10-16 23:46:15 +03:00
Sergii Pylypenko
b3e81dfab1 Fixed OpenSSL compilation, for real now 2019-10-16 23:43:27 +03:00
Sergii Pylypenko
9bbfbd2131 OpenSSL: fixed compilation 2019-10-16 23:10:47 +03:00
Sergii Pylypenko
6d3990058b OpenSSL: simplified build scripts 2019-10-15 22:01:32 +03:00
Sergii Pylypenko
5458d5ffe3 Updated OpenSSL 2019-10-15 20:40:04 +03:00
Sergii Pylypenko
7c88857742 SDL: copy executable binaries to lib dir in apk, according to https://issuetracker.google.com/issues/128554619 2019-10-15 17:57:55 +03:00
Sergii Pylypenko
01dc04fe17 XSDL: copy DIPLAY variable to clipboard on start 2019-10-11 22:48:39 +03:00
Sergii Pylypenko
5e9c45f330 updated todo 2019-10-08 23:45:26 +03:00
Sergii Pylypenko
91bfe0b6c4 XSDL: fixed event loop 2019-10-08 23:41:14 +03:00
Sergii Pylypenko
a967016781 XSDL: fixed help message 2019-10-08 18:39:36 +03:00
Sergii Pylypenko
1e71441946 OpenTTD: bump version 2019-10-07 21:07:31 +03:00
Sergii Pylypenko
5413bfb6f3 SDL: removed script to sign .apk with upload cert, it's replaced with signBundle.sh 2019-09-23 21:28:09 +03:00
Sergii Pylypenko
63f9c475c1 XSDL: added port number to config 2019-09-09 23:36:07 +03:00
Sergii Pylypenko
ce74e0fee3 SDL: fixed CreateForegroundService permissions on Android 29 2019-09-09 18:24:46 +03:00
Sergii Pylypenko
b7084f90e1 SDL: updated Gradle to 5.1.1 to support OpenJDK 11 2019-09-09 18:24:23 +03:00
Sergii Pylypenko
a46c43f459 XSDL: fixed compilaiton with new sources 2019-09-09 18:22:55 +03:00
Sergii Pylypenko
4e8bf7a5ae OpenTTD: updated build scripts 2019-09-04 15:30:31 +03:00
Sergii Pylypenko
1157101b4b SDL: fixed bundle signing script 2019-09-03 23:50:25 +03:00
Sergii Pylypenko
43810f8585 OpenTTD JGR: added back music support 2019-09-03 23:21:46 +03:00
Sergii Pylypenko
a07c617cbf SDL: script to create app bundle 2019-09-03 22:48:45 +03:00
Sergii Pylypenko
747e660578 OpenTTD JGR: updated project files 2019-09-03 21:33:51 +03:00
Sergii Pylypenko
3f8e0ea9a9 OpenTTD JGR: disabled fluidsynth, because it crashes 2019-09-03 21:23:51 +03:00
Sergii Pylypenko
f2074457a4 OpenTTD JGR: updated build files 2019-09-03 21:20:27 +03:00
Sergii Pylypenko
8cc60c9d4b OpenTTD JGR: updated project files 2019-09-02 23:28:14 +03:00
Sergii Pylypenko
4527f9f619 OpenTTD: updated project files 2019-09-02 23:26:19 +03:00
Sergii Pylypenko
d2495a80ce OpenTTD JGR: updated project files 2019-09-02 23:25:12 +03:00
Sergii Pylypenko
7c74e86010 OpenTTD: bump version 2019-09-02 23:11:07 +03:00
Sergii Pylypenko
0dd74132ab OpenTTD: bump version 2019-08-31 23:35:11 +03:00
Sergii Pylypenko
959a7a8c66 OpenTTD: select video mode with square pixel size 2019-08-31 20:57:28 +03:00
Sergii Pylypenko
697ba47bf8 OpenTTD: reworked ugly hack 2019-08-31 19:32:15 +03:00
Sergii Pylypenko
31f306976f SDL: updated target Androidi API to Android Q API level 29 2019-08-31 19:03:36 +03:00
Sergii Pylypenko
cde94796a7 OpenTTD: bump version 2019-07-17 23:43:23 +03:00
Sergii Pylypenko
dcdcaa2c1a OpenTTD: bump version 2019-07-09 20:26:38 +03:00
Sergii Pylypenko
f89164b152 xerces: replaced SDL_iconv with internal iconv to fix linking 2019-07-02 22:12:26 +03:00
Sergii Pylypenko
dd184b184e xerces: fixed compilation 2019-06-14 16:44:43 +03:00
Sergii Pylypenko
ff8594202d OpenTTD: bump version 2019-05-13 23:11:17 +03:00
Sergii Pylypenko
63e5356a5b SDL: include Proguard Java code mapping into source archive in createSourceArchive.sh script 2019-05-13 23:10:06 +03:00
Sergii Pylypenko
89ecc43d8f SDL: fixed crash on Android 4 2019-05-13 23:09:10 +03:00
Sergii Pylypenko
8c34faa475 OpenTTD: updated build scripts 2019-04-26 22:54:54 +03:00
Sergii Pylypenko
65fe44f66a SDL: removed debug from pkg-config script 2019-04-25 23:42:32 +03:00
Sergii Pylypenko
f0ff49906c OpenTTD: updated, c++_shared now must be added to the list of libraries 2019-04-25 19:12:22 +03:00
Sergii Pylypenko
2ff9d7cb2c SDL: better scaled video resolutions 2019-04-25 19:12:05 +03:00
Sergii Pylypenko
d0f0e4cfea SDL: better logs 2019-04-25 18:47:16 +03:00
Sergii Pylypenko
7662f2acae SDL: fixed pkg-config script to output dependencies for iculx and icui18n 2019-04-25 18:41:31 +03:00
Sergii Pylypenko
3bed7f054e SDL: better logs when loading library 2019-04-25 18:41:09 +03:00
Sergii Pylypenko
f78c911f0a SDL: filter out c++_shared library from setEnvironment LDFLAGS 2019-04-25 18:40:18 +03:00
Sergii Pylypenko
90f5ab5684 SDL: updated setEnvironment scripts to use NDK r19 standalone toolchain 2019-04-24 23:32:40 +03:00
Sergii Pylypenko
20d59c5920 OpenTTD: update to 1.9.1 2019-04-24 20:41:57 +03:00
Sergii Pylypenko
b5a391b0dd Updated todo 2019-04-08 19:48:44 +03:00
Sergii Pylypenko
20eef1b149 Updated todo 2019-03-29 21:50:16 +02:00
Sergii Pylypenko
f0425aa9af Updated todo 2019-03-11 20:14:48 +02:00
Sergii Pylypenko
d9ce299843 SDL: put binaries.zip to lib/<ARCH>/ so Play Store will (maybe, not tested) strip binaries for unsupported architectures 2019-02-25 21:26:54 +02:00
Sergii Pylypenko
9c3259a969 SDL: updated path to .apk file in helper scripts 2019-02-25 19:41:59 +02:00
Sergii Pylypenko
bb46839637 SDL: fixed path to .apk file in build script 2019-02-25 19:39:18 +02:00
Sergii Pylypenko
22a34468d2 SDL: updated Gradle build files 2019-02-25 19:30:41 +02:00
Sergii Pylypenko
ab3e3aa1a7 XSDL: fixed build for 32-bit architectures 2019-02-25 19:30:19 +02:00
Sergii Pylypenko
56ae8d528e XSDL: fixed xkbcomp 2019-02-25 17:00:59 +02:00
Sergii Pylypenko
15ee9faf9b XSDL: updated busybox 2019-02-20 21:16:04 +02:00
Sergii Pylypenko
4d6a8dcd88 XSDL: do not restart in a loop, if we fail then stop 2019-02-20 20:28:21 +02:00
Sergii Pylypenko
639a2e7e69 SDL: fixed service notification on Android 8 2019-02-20 20:22:13 +02:00
Sergii Pylypenko
054ac50e0a XSDL: fixed linking 2019-02-20 19:22:57 +02:00
Sergii Pylypenko
9397c0079c SDL: fixed wrong header include when ANDROID macro is not defined 2019-02-19 18:43:30 +02:00
Sergii Pylypenko
e887896edf Xserver: work-in-progress update 2019-02-18 22:09:59 +02:00
Sergii Pylypenko
8be8471285 SDL: added padding to 'Stop app' button in the persistent notification 2019-02-18 22:09:25 +02:00
Sergii Pylypenko
2f49dd6e30 SDL: support for NDK r19, switched from c++_static to c++_shared, as recommended in NDK docs 2019-02-06 23:27:14 +02:00
Sergii Pylypenko
657ab95852 OpenLieroX: updated submodule 2019-02-06 23:27:02 +02:00
Sergii Pylypenko
3425c4b372 SuperTux: enabled boost_locale 2019-02-06 23:26:23 +02:00
Sergii Pylypenko
5ba2b00a1e Updated TODO 2019-02-06 23:20:14 +02:00
Sergii Pylypenko
d431337433 SDL: fixed on-screen key layout customization dialog in SDL settings 2019-02-06 23:19:39 +02:00
pelya
1f32270a80 Merge branch 'sdl_android' of github.com:pelya/commandergenius 2019-01-30 21:57:58 +02:00
Sergii Pylypenko
0186aa0786 Updated todo 2019-01-04 18:43:06 +02:00
Sergii Pylypenko
8c632cd6e0 Updated todo 2019-01-03 17:18:34 +02:00
Sergii Pylypenko
b5fec3dd68 Updated todo 2018-12-24 23:15:06 +02:00
Sergii Pylypenko
6b1bd79e2f OpenLieroX: fixed opening app from Chrome notification 2018-12-17 23:41:24 +02:00
Sergii Pylypenko
da55d86723 SDL: account for rounded screen corners for text input 2018-12-13 20:49:08 +02:00
Sergii Pylypenko
63178dd22b Updated boost 2018-12-13 19:48:19 +02:00
Sergii Pylypenko
f3ee09e047 Updated todo 2018-12-13 18:39:46 +02:00
Sergii Pylypenko
5b778604b5 Updated todo 2018-12-11 19:14:08 +02:00
Sergii Pylypenko
264f7aa43f SDL: disabled spammy debug output 2018-12-05 20:19:39 +02:00
Sergii Pylypenko
eec2e53f0f SDL: fixed optimization flags for debug builds, I can finally run ndk-gdb because I've got a new phone yay 2018-12-05 20:15:36 +02:00
Sergii Pylypenko
bf0eb74ea8 SDL: fix for loading libiconv 2018-12-05 19:49:59 +02:00
Sergii Pylypenko
969d785ec1 SDL: notice that MP# is patent-free now 2018-12-05 19:25:37 +02:00
pelya
76d93ca1fa Updated todo 2018-11-29 19:50:39 +02:00
Sergii Pylypenko
61c5b7352b SDL: fixed build warning 2018-11-19 20:09:34 +02:00
Sergii Pylypenko
68d6923357 SDL: converted Guichan to static library, because we are using static libc++ so all C++ code must be linked inside libapplication.so 2018-11-19 19:55:32 +02:00
Sergii Pylypenko
fd5babab77 SDL: removed android-support symlink, it will generate a duplicate module name error 2018-11-19 19:42:28 +02:00
Sergii Pylypenko
71a72389e3 SDL: updated submodules 2018-11-09 20:27:49 +02:00
Sergii Pylypenko
2b18728ed5 SDL: removed gnustl_static from makefiles 2018-10-12 17:14:04 +03:00
Sergii Pylypenko
4be95b0d36 SDL: updated submodules 2018-10-11 18:25:51 +03:00
Sergii Pylypenko
d1554371a5 SDL: fixed libboost compilaiton 2018-10-11 18:08:52 +03:00
Sergii Pylypenko
51790527e9 SDL: do not build prebuilt libs if they are not used by the app 2018-10-11 17:28:41 +03:00
Sergii Pylypenko
de301f6c59 SDL: fixed NDK build warning 2018-10-10 23:17:26 +03:00
Sergii Pylypenko
37ad3763ab SDL: removed armeabi from build files 2018-10-10 22:47:51 +03:00
Sergii Pylypenko
f9a91856ec SDL: removed ffmpeg, it's long broken and thankfully unused 2018-10-10 22:46:58 +03:00
Gerhard Stein
f0a8e491e9 for newer systems 2018-10-06 13:02:56 +02:00
Sergii Pylypenko
b0f344098f SDL: updated setEnvironment scripts 2018-09-24 18:53:41 +03:00
Sergii Pylypenko
9087c622ae SDL: updated iconv submodule to compile on NDK r18 2018-09-24 18:52:59 +03:00
Sergii Pylypenko
16d326c1c5 SDL: fixed OpenSSL compilation with NDK r18 2018-09-24 18:52:37 +03:00
Sergii Pylypenko
8333b99596 Updated boost submodule 2018-09-20 22:52:44 +03:00
Sergii Pylypenko
c3f89273e3 SDL: support for NDK r18, set minimum API level to 16 (Android 4.1), which is the minimum level NDK r18 supports 2018-09-20 22:41:55 +03:00
Sergii Pylypenko
0c172d10fb SDL: fixed libpng to work with NDK r18 2018-09-20 22:37:47 +03:00
Sergii Pylypenko
bef5f545c5 SDL: fixed SdlVideoResizeKeepAspect=y messing up mouse position after restoring app from background 2018-09-20 21:01:04 +03:00
Sergii Pylypenko
aa7919811f Updated todo 2018-09-07 18:06:30 +03:00
Sergii Pylypenko
d169cf6d89 XMoto: now it runs, although poorly 2018-08-15 22:20:33 +03:00
Sergii Pylypenko
b66d0f6af0 XMoto: now it compiles 2018-08-15 21:37:09 +03:00
pelya
286b105fc5 XMoto: updated package name 2018-08-12 02:28:51 +03:00
pelya
2f0fa55d2e XMoto: updated keycodes 2018-08-12 02:27:40 +03:00
Sergii Pylypenko
35400851ca XMoto: added submodule and project file, it does not compile yet 2018-08-10 23:39:59 +03:00
Sergii Pylypenko
0299387ea8 LUA: enabled LUA 5.1 compatibility mode 2018-08-10 22:25:43 +03:00
Sergii Pylypenko
40b87eb9ac SDL: Added sqlite3-sdl to Java library mapping 2018-08-10 18:20:51 +03:00
Sergii Pylypenko
e61973a837 SDL: Added sqlite3 library 2018-08-10 18:20:27 +03:00
Sergii Pylypenko
61a08630ed SDL: fixed LUA include dir 2018-08-10 18:12:13 +03:00
Sergii Pylypenko
1fe8654d71 CommanderGenius: updated submodules 2018-08-09 20:53:07 +03:00
Sergii Pylypenko
2c182128c6 OpenLieroX: bump version 2018-08-02 23:10:09 +03:00
Sergii Pylypenko
98062856c6 OpenLieroX: bump version 2018-07-23 22:02:46 +03:00
Sergii Pylypenko
0dd82bd0f7 SDL: de-press all on-screen keys when they are hidden 2018-07-05 23:43:09 +03:00
Sergii Pylypenko
a5a7fea8a7 OpenTTD: bump version 2018-07-05 16:58:16 +03:00
Sergii Pylypenko
659bf32161 OpenTTD: updated JGP version 2018-07-05 16:54:14 +03:00
Sergii Pylypenko
1950b85d8b SDL: removed deprecated architectures from build script 2018-07-05 16:53:47 +03:00
Sergii Pylypenko
4527235f0e SuperTux: updated submodule 2018-07-04 22:01:37 +03:00
Sergii Pylypenko
11090a082e SuperTux: bump version, commandline must contain ./ or gamedata search path won't initialize 2018-07-04 18:36:44 +03:00
Sergii Pylypenko
9b9768ed8d Updated todo 2018-07-02 22:14:36 +03:00
Sergii Pylypenko
372a73207b SDL: fixed built-in emulated keyboard 2018-07-02 22:13:24 +03:00
Sergii Pylypenko
7f4b9162ba SDL: separate permission to read OBB file 2018-07-02 18:14:27 +03:00
Sergii Pylypenko
d4afed131a SuperTux: bump version 2018-07-02 17:49:24 +03:00
Sergii Pylypenko
52cda7c82f SDL: fixed command-line editor dialog 2018-07-02 17:49:02 +03:00
pelya
d74fcef25b Updated todo 2018-07-01 01:33:15 +03:00
Sergii Pylypenko
fc7e6e63b2 SuperTux: The Final Update 2018-06-29 23:32:13 +03:00
Sergii Pylypenko
d98d33b244 SuperTux: removed hgacks to save space 2018-06-29 23:02:49 +03:00
Sergii Pylypenko
e700d64cfb SuperTux: updated to master branch 2018-06-27 23:39:09 +03:00
Sergii Pylypenko
d9d6289924 SDL: fixed OpenAL compilation 2018-06-27 23:38:57 +03:00
Sergii Pylypenko
ed9446c4a3 SDL: set env variable ANDROID_OBB_DIR to the directory with OBB files 2018-06-27 23:38:15 +03:00
Sergii Pylypenko
8c64964f4b SDL: updated boost 2018-06-27 23:37:30 +03:00
Sergii Pylypenko
98a442e80d SDL: updated libcurl to 7.60.0 2018-06-27 22:50:39 +03:00
Sergii Pylypenko
f391b0b3ca SDL: fixed my previous OpenSSL fix 2018-06-27 22:35:21 +03:00
Sergii Pylypenko
a328e741aa SDL: fixed 64-bit macro in OpenSSL config header 2018-06-27 22:02:33 +03:00
Sergii Pylypenko
c475fbf816 SDL: fixed OpenSSL compilation 2018-06-27 21:42:10 +03:00
Sergii Pylypenko
65520b847e Updated pulseaudio submodule 2018-06-25 17:17:27 +03:00
Sergii Pylypenko
88ab438ba1 OpenTTD: forgot few files 2018-06-25 17:12:54 +03:00
Sergii Pylypenko
9865a6dcfe SDL: convenient symlink to the compiled app file, updated .gitignore 2018-06-25 17:12:22 +03:00
Sergii Pylypenko
cff1d6b9b9 SDL: removed unmaintained C-Dogs subproject, and few other old projects 2018-06-25 17:11:12 +03:00
Sergii Pylypenko
853e3f3307 OpenTTD: updated jgrpp project 2018-06-25 17:10:34 +03:00
Sergii Pylypenko
b0b78fbf0b SDL: fixed compiler warning 2018-06-21 22:35:42 +03:00
Sergii Pylypenko
19ad345143 SDL: Fixed clang C++ exception support in setEnvironment build scripts 2018-06-21 20:36:50 +03:00
Sergii Pylypenko
3988790916 SDL: updated iconv submodule 2018-06-14 22:08:19 +03:00
Sergii Pylypenko
114f1541c3 SDL: MIPS and ARMv5 architectures are dead and removed from NDK r17b - updated all build scripts 2018-06-14 22:02:51 +03:00
Sergii Pylypenko
4a0abd4561 SDL: symlink to icuuc sources 2018-06-13 23:37:25 +03:00
Sergii Pylypenko
059c60acc2 SDL: Removed duplicate icuuc submodule 2018-06-13 23:36:57 +03:00
Sergii Pylypenko
49664669ab SDL: download git submodules from Makefile.prebuilt directly, if they are not downloaded yet 2018-06-13 23:23:49 +03:00
Sergii Pylypenko
83690c7843 SDL: Removed a trailing space in readme, because it is irritating 2018-06-04 18:31:11 +03:00
Sergii Pylypenko
836173c6bd SDL: 64-bit architectures do not have libandroid_support.a in new NDK 2018-06-04 18:28:09 +03:00
Sergii Pylypenko
54daeba17c OpenTTD: fixed 64-build compilation 2018-06-01 23:43:39 +03:00
Sergii Pylypenko
ab388c164b OpenTTD: updated to 1.8.0, fixed config file erasing after app update 2018-06-01 23:15:03 +03:00
Sergii Pylypenko
451189dd41 openlierox: bump version 2018-05-17 22:51:17 +03:00
Sergii Pylypenko
5857572dc9 Merge branch 'sdl_android' of github.com:pelya/commandergenius 2018-05-17 22:41:48 +03:00
Sergii Pylypenko
d7a074409e openlierox: support openlierox:// data scheme 2018-05-17 22:41:24 +03:00
pelya
93c3984615 OpenLieroX: bump version 2018-04-22 00:32:11 +03:00
pelya
16f944d3c6 SDL: disabled autodetecting screen orientation, multiwindow mode is broken anyway 2018-04-22 00:30:47 +03:00
lubomyr
781877ebb6 GUICHAN: fixed blinking virtual keyboard with guichan library 2018-03-27 00:34:01 +03:00
Sergii Pylypenko
5e0cf567cb Updated test app 2018-03-06 17:58:28 +02:00
Sergii Pylypenko
5452ff026f SDL: fixed libexpat renamed to libexpat-sdl 2018-03-06 17:39:25 +02:00
Sergii Pylypenko
0c407de81c OpenLieroX: added libmad for mp3 support 2018-02-27 20:27:12 +02:00
Sergii Pylypenko
d705fee605 Merge branch 'sdl_android' of github.com:pelya/commandergenius 2018-02-27 20:08:18 +02:00
pelya
e4d00b6202 OpenLieroX: bump version 2018-02-25 22:52:57 +02:00
pelya
73d25fe6cc OpenLieroX: bump version 2018-02-25 00:03:56 +02:00
Sergii Pylypenko
c12c63c66d Merge branch 'sdl_android' of github.com:pelya/commandergenius 2018-02-15 18:30:48 +02:00
Sergii Pylypenko
e9843f8a61 OpenLieroX: bump version 2018-02-15 18:29:37 +02:00
Gerhard Stein
da45b67d94 git pushMerge branch 'sdl_android' of github.com:pelya/commandergenius
into sdl_android
2018-02-12 22:02:46 +01:00
Gerhard Stein
816ce71085 Commander Genius update 2018-02-12 22:02:00 +01:00
Sergii Pylypenko
fb816c7a6a Merge branch 'sdl_android' of github.com:pelya/commandergenius 2018-02-12 22:34:56 +02:00
Sergii Pylypenko
5d05a7cff2 SDL: fixed setEnvironment.sh scripts to work with GCC, fixed BasiliskII compilation 2018-02-12 22:32:40 +02:00
Gerhard Stein
4503bcbc56 Commander Genius Update 2018-02-10 10:16:44 +01:00
Gerhard Stein
d359e80b9b Merge branch 'sdl_android' of github.com:pelya/commandergenius into
sdl_android
2018-02-05 21:45:43 +01:00
Gerhard Stein
4b3a2136c7 Commander Genius update 2018-02-05 21:45:19 +01:00
pelya
f7b1b69008 Merge branch 'sdl_android' of github.com:pelya/commandergenius into android 2018-02-05 01:23:07 +02:00
pelya
2face2a79a SDL: more logs to sound initialization, updated submodules 2018-02-05 01:19:43 +02:00
Gerhard Stein
30b7f93467 Commander Genius. Crash fix 2018-02-04 19:48:39 +01:00
pelya
671d537df9 Merge branch 'sdl_android' of github.com:pelya/commandergenius into android 2018-02-04 20:14:32 +02:00
pelya
38663832d2 OpenLieroX: bump version 2018-02-04 20:13:07 +02:00
Gerhard Stein
91735433b1 Updated Commander Genius 2018-02-04 13:27:50 +01:00
Gerhard Stein
c22928a018 Merge branch 'sdl_android' of github.com:pelya/commandergenius into sdl_android 2018-02-04 12:43:15 +01:00
Gerhard Stein
eab9c26fa3 Updated Commander Genius 2018-02-04 12:42:52 +01:00
pelya
e000bf3ea4 SDL: better main thread name 2018-02-03 21:25:16 +02:00
Sergii Pylypenko
fba592f1c5 OpenLieroX: switched to stable branch 0.58 2018-02-02 23:47:02 +02:00
Sergii Pylypenko
a5c932a0fa Updated todo 2018-01-31 20:29:34 +02:00
Sergii Pylypenko
ad4a0bc52c SDL: fixed pure C libraries containing exception information 2018-01-29 22:45:06 +02:00
Sergii Pylypenko
fd8735fe6f OpenTTD: bump version 2018-01-29 21:40:56 +02:00
Sergii Pylypenko
334e7114d8 libpng: fixed linker error with atof(), which is inlined before Android-21 but is a proper function in later API 2018-01-29 20:42:49 +02:00
Sergii Pylypenko
49c47093c0 Updated sign scripts to use apksigner instead of jarsigner 2018-01-29 17:53:55 +02:00
Sergii Pylypenko
fc1bedf1ca Android TV manifest improvements 2018-01-29 17:49:46 +02:00
Sergii Pylypenko
4c73f4c220 OpenLieroX: bump version 2018-01-29 16:55:42 +02:00
Sergii Pylypenko
1d3e4fce94 Fixed keyboard graphics converter script 2018-01-29 16:54:43 +02:00
Sergii Pylypenko
c582c7e40e Merge branch 'sdl_android' of github.com:pelya/commandergenius 2018-01-19 23:23:43 +02:00
Sergii Pylypenko
3116b316bb Openierox: bump version 2018-01-19 23:23:24 +02:00
pelya
eadd178cfc SDL: Always build prebuilt libraries 2018-01-17 02:11:51 +02:00
Sergii Pylypenko
76053bb69f Merge branch 'sdl_android' of github.com:pelya/commandergenius 2018-01-16 16:38:16 +02:00
Sergii Pylypenko
6459e79ea9 Openlierox: updated screen keys 2018-01-16 16:37:37 +02:00
lubomyr
dcad4c156c Basilisk II: Updated to version 1.0.0.05. Updated app icon, configuration, assets, and build script 2018-01-13 19:30:28 +02:00
Sergii Pylypenko
da05e8dfc6 Boost: Updated submodule 2018-01-11 23:13:37 +02:00
Sergii Pylypenko
3af69bf25c OpenTTD: fixed pinch-zoom 2017-12-26 22:01:56 +02:00
Sergii Pylypenko
f31a9b10cb OpenTTD: bump version 2017-12-26 21:17:06 +02:00
Sergii Pylypenko
a67e53fe48 SDL: yet more fixes to setEnvironment.sh scripts 2017-12-26 18:09:40 +02:00
Sergii Pylypenko
fd79ad08d2 OpenTTD: updated build script for clang 2017-12-26 18:09:21 +02:00
Sergii Pylypenko
3556067039 SDL: more fixes to setEnvironment.sh scripts 2017-12-26 17:47:56 +02:00
Sergii Pylypenko
cdf1c7347d SDL: updated setEnvironment.sh build scriots with CLANG and NDK r16b support, ARMv5 and MIPS will be deprecated in NDK r17 so not updated 2017-12-26 17:34:46 +02:00
Sergii Pylypenko
1cf8c094a3 OpenTTD: bump version for JGR patchpack 2017-12-26 17:33:24 +02:00
Sergii Pylypenko
4799ff9e9f OpenLieroX: bump version 2017-11-28 17:43:23 +02:00
Sergii Pylypenko
96b9a2e36d SDL: exclude autogenerated prebuilt libraries from source archive 2017-11-28 16:20:11 +02:00
Sergii Pylypenko
3b65df4624 SDL: simplified ChangeAppsettings.sh script 2017-11-28 16:12:14 +02:00
Sergii Pylypenko
3165576211 SDL: Fixed an error with trying to load static libraries 2017-11-28 16:06:31 +02:00
pelya
b176328777 OpenLieroX: all three architectures won't fit into 100 Mb, so I'm building several .apk files 2017-11-25 09:10:06 +02:00
pelya
6a76b40436 SDL: fixed gamepad analog sticks with the same keycodes interfering with each other 2017-11-25 08:38:27 +02:00
pelya
b9538af7c3 SDL: fixed SDL_WarpMouse() not working 2017-11-25 08:17:52 +02:00
pelya
d0f7f72bd7 SDL: fixed gamepad arrow keys not working for dpad, if it reports analog values 2017-11-25 08:14:38 +02:00
pelya
144f485758 Updated boost, iconv, and icu submodules 2017-11-25 07:43:43 +02:00
Sergii Pylypenko
9a2e67c05d OpenLierox: first release 2017-11-24 23:45:23 +02:00
Sergii Pylypenko
bc94fe76d6 libpng: Fixed compilation 2017-11-24 23:45:13 +02:00
Sergii Pylypenko
e15c2ff3d6 Updated libpng 2017-11-24 15:51:10 +02:00
Sergii Pylypenko
7301ae0c62 New port: OpenLieroX 2017-11-22 18:16:51 +02:00
Sergii Pylypenko
d416f94ce4 SDL: move joystick lower 2017-11-22 17:57:50 +02:00
Sergii Pylypenko
374dbd86b3 Added libgd 2017-11-22 15:45:06 +02:00
Sergii Pylypenko
66f7cc1cfd SDL: Added keycodes for PS4 gamepad 2017-11-22 15:44:22 +02:00
Sergii Pylypenko
e0d9c99a7c SDL: updated the list of precompiled libraries 2017-11-22 15:30:51 +02:00
Sergii Pylypenko
4c182a5370 libboost: fixed makefile 2017-11-22 15:30:00 +02:00
Sergii Pylypenko
7aa2cd0726 Build prebuilt libraries only if they are requested, build Boost libraries automatically 2017-11-21 23:33:30 +02:00
Sergii Pylypenko
df9ffa1c2b SDL: added keycodes for gamepad analog sticks to SDL_ANDROID_SetIndividualGamepadKeymap(), while API is still fresh 2017-11-16 21:36:15 +02:00
Sergii Pylypenko
e618b3a2d0 Boost: removed precompiled libraries, updated submodule. Use 'make -f Makefile.prebuilt' from project/jni to generate precompiled libraries, you will need NDK r16-beta2. 2017-11-14 22:41:47 +02:00
Sergii Pylypenko
0fd27781c6 Updated todo 2017-11-10 22:13:01 +02:00
Sergii Pylypenko
9f5414c407 Liero: bump version 2017-11-10 22:12:23 +02:00
Sergii Pylypenko
f02e93636f SDL: bigger screen buttons touch area, smaller button images 2017-11-10 22:09:50 +02:00
Sergii Pylypenko
9f486346f1 Liero: bump version 2017-11-10 16:42:26 +02:00
Sergii Pylypenko
49fb9a98e8 Liero: disabled readme text for TV 2017-11-09 20:50:52 +02:00
Sergii Pylypenko
7d7b6e7997 Liero: support for two gamepads 2017-11-08 22:52:55 +02:00
Sergii Pylypenko
169a2bf551 SDL: fixed compilation with GCC toolchain 2017-11-08 22:47:53 +02:00
Sergii Pylypenko
b12fc6e402 SDL: support for 4 gamepads, I have tested with only three gamepads so 4-th gamepad could fail 2017-11-08 22:09:32 +02:00
Sergii Pylypenko
b742ebaf72 SDL: unfinished support for multiple gamepads 2017-11-03 23:49:24 +02:00
Sergii Pylypenko
9c86e109dd SDL: small update to readme 2017-11-02 22:54:36 +02:00
Sergii Pylypenko
f5570a7dae SDL: fixed several bugs in text input window by disabling custom onKey handlers 2017-11-02 22:07:12 +02:00
Sergii Pylypenko
2a60bdec8a SDL: Fixed OK button not focused for readme dialog 2017-11-01 18:11:16 +02:00
Sergii Pylypenko
b3b9730c19 SDL: helper scripts to uninstall/reinstall .apk 2017-11-01 17:42:27 +02:00
Sergii Pylypenko
212e761d33 SDL: fixed a crash on an emulator 2017-11-01 17:42:10 +02:00
Sergii Pylypenko
25a86103ec SDL: More Android TV features in manifest 2017-11-01 16:15:22 +02:00
Sergii Pylypenko
54c1b4b0b8 SDL: Fixed key remap dialog 2017-10-31 23:46:46 +02:00
Sergii Pylypenko
95ebb73426 SDL: refactoring of input event code 2017-10-31 23:36:22 +02:00
Sergii Pylypenko
d378ee692f SDL: redefine gamepad Start/Select and DPAD keycodes in AndroidiAppSettings.cfg 2017-10-31 19:49:49 +02:00
Sergii Pylypenko
70b37b6565 Liero: removed unnecessary library 2017-10-31 18:55:26 +02:00
Sergii Pylypenko
637eb27e07 Liero: added TV banner, disabled linear filtering 2017-10-31 18:53:05 +02:00
Sergii Pylypenko
bb08c6ab43 Liero: updated config 2017-10-30 23:31:33 +02:00
pelya
0aba1e43d7 Liero: touchscreen version 2017-10-29 00:06:31 +03:00
pelya
5cda8aa8be Liero: updated config 2017-10-28 23:58:56 +03:00
pelya
6fe05d83e3 Updated submodules 2017-10-28 22:45:30 +03:00
pelya
ef3c4cf714 Added OpenLiero project 2017-10-28 04:05:33 +03:00
Gerhard Stein
7babe228b6 Readme update 2017-10-27 18:55:32 +02:00
Sergii Pylypenko
6356415030 OpenTTD: bump version 2017-10-23 16:14:56 +03:00
Gerhard Stein
af61cce12a Commander Genius update 2017-10-19 19:09:34 +02:00
Gerhard Stein
173d4f193b Hints about licensing issues in case of any 2017-10-19 19:09:12 +02:00
Gerhard Stein
c66e3d5ae1 Improved Readme a bit, Commander Genius update 2017-10-14 14:00:46 +02:00
Sergii Pylypenko
4b47ea502c Typo 2017-10-04 21:59:31 +03:00
Sergii Pylypenko
8d9f655db9 OpenTTD: Bump version 2017-10-04 21:50:16 +03:00
Sergii Pylypenko
1ae4bbbfc8 OpenTTD: fixed broken update 2017-10-03 15:44:58 +03:00
Sergii Pylypenko
a6f20b699b OpenTTD: disabled arm64 arch, maybe this will fix some of the crashes 2017-10-02 21:41:32 +03:00
Sergii Pylypenko
a209bee64f OpenTTD: do not show the announcement in the next version 2017-09-28 21:57:22 +03:00
Sergii Pylypenko
1db6fb623c OpenTTD: bump version 2017-09-28 19:48:45 +03:00
Sergii Pylypenko
4336c5e9b8 OpenTTD: updated icon 2017-09-28 16:23:00 +03:00
Sergii Pylypenko
18837e9b8c OpenTTD: updated icon 2017-09-28 16:15:47 +03:00
Sergii Pylypenko
d8b6a2d088 OpenTTD: update 2017-09-27 23:43:48 +03:00
Sergii Pylypenko
bc9842ee59 SDL: Fixed Proguard rules 2017-09-27 23:18:04 +03:00
Sergii Pylypenko
5af764f5ff SDL: reverted useless code 2017-09-27 22:50:01 +03:00
Sergii Pylypenko
fb9d42b6f5 Fixed compilation 2017-09-27 22:49:06 +03:00
Sergii Pylypenko
3a9b31a41f SDL: random fix to text input that does not work 2017-09-27 22:31:38 +03:00
Sergii Pylypenko
b8c5dd1d70 SDL: better text input soft keyboard code 2017-09-27 22:25:43 +03:00
Sergii Pylypenko
209a16fd9f SDL: fixed Google Play Game Services linking 2017-09-27 22:09:57 +03:00
Sergii Pylypenko
bd36a07c7b OpenTTD: new icon, JGR patch pack announcement 2017-09-27 15:57:45 +03:00
Sergii Pylypenko
4701548e01 SDL: switched build system from Ant to Gradle, because Google forced this piece of shit on me with SDK update
If you are getting build errors, delete the directory project/app/build
2017-09-26 23:30:34 +03:00
Sergii Pylypenko
5223f423d8 SDL: Attempt to fix async text input 2017-09-26 22:27:53 +03:00
Sergii Pylypenko
7953493704 OpenTTD: added JGR patchpack project 2017-09-25 23:25:51 +03:00
lubomyr
5d82a28be3 basilisk ii updated to 1.0.0.04 2017-09-22 16:50:50 +03:00
Sergii Pylypenko
468791d212 uqm-hd: updated build script and Android patch 2017-09-20 20:30:29 +03:00
lubomyr
34824e3300 implemented api for setSystemMousePointerVisibility 2017-09-18 19:51:17 +03:00
Sergii Pylypenko
0d524669d0 Ninslash: updated 2017-08-10 22:00:26 +03:00
Sergii Pylypenko
457c6c32af Ninslash: bump version 2017-08-10 21:13:29 +03:00
Sergii Pylypenko
91d27beb04 SDL: Updated submodules, compilation fix for iconv and icu 2017-07-21 21:15:27 +03:00
Gerhard Stein
3b7eed55a5 to_string() fix 2017-07-20 19:49:12 +02:00
Gerhard Stein
32488523e1 Commadner Genius udpate 2017-07-20 18:27:45 +02:00
Sergii Pylypenko
efbdcb1a71 Merge pull request #76 from gyf9835/patch-2
Update strings.xml
2017-07-11 19:50:03 +03:00
gyf9835
2cc2d7bca5 Update strings.xml
Update
2017-07-11 23:36:30 +08:00
pelya
6850c719d4 Updated submodules 2017-07-09 22:36:08 +03:00
Gerhard Stein
bc5f26d089 Boost updates 2017-07-07 18:22:29 +02:00
Gerhard Stein
a322e85cd7 Merge branch 'sdl_android' of github.com:pelya/commandergenius into
sdl_android
2017-07-07 18:14:31 +02:00
Sergii Pylypenko
75eddb701a OpenTTD: Ninslash: bump version 2017-07-03 22:15:34 +03:00
Gerhard Stein
8e87817255 Merge branch 'sdl_android' of github.com:pelya/commandergenius into sdl_android 2017-07-01 13:09:38 +02:00
lubomyr
90b8790fc0 removed scummvm submodule 2017-06-24 18:19:40 +03:00
Sergii Pylypenko
2920b61519 OpenTTD: updated 2017-06-23 19:09:58 +03:00
Sergii Pylypenko
d738bd6f53 SDL: fixed iconv/icu compilation 2017-06-23 18:20:36 +03:00
Sergii Pylypenko
181532e165 SDL: replaced git@github.com: URL with https://github.com/ in all submodules, for easier repo checkout 2017-06-23 17:59:16 +03:00
Sergii Pylypenko
630d0fb234 SDL: added back armv5 architecture for libiconv and libicu 2017-06-23 17:58:50 +03:00
Sergii Pylypenko
ca601438d7 SDL: Reverted centering mouse cursor when sending pinch-zoom gesture 2017-06-22 23:06:46 +03:00
Sergii Pylypenko
8fbefc99de SDL: added a separate sign script for signing with upload certificate 2017-06-21 18:48:24 +03:00
Sergii Pylypenko
c985b70f59 SDL: updated Play Services libraries 2017-06-21 18:40:32 +03:00
Sergii Pylypenko
a6db262f17 OpenTTD: updated to 1.7.1, updated to new icu libraries 2017-06-21 18:40:01 +03:00
Sergii Pylypenko
eafba393be SDL: fixed compilation 2017-06-21 17:54:45 +03:00
Sergii Pylypenko
b224a4d100 SDL: Fixed compilation 2017-06-21 17:53:23 +03:00
Sergii Pylypenko
5132ae8020 SDL: center mouse cursor between ouch points when sending pinch-zoom gesture keycode 2017-06-21 17:51:40 +03:00
Sergii Pylypenko
35e838c20d SDL: Added .gitignore to iconv and icu 2017-06-21 17:50:12 +03:00
Sergii Pylypenko
d89960517c SDL: updated libiconv and libicu, removed prebuilt binaries, now they should be built on the fly 2017-06-21 17:48:55 +03:00
lubomyr
2efd15f6b5 removed bochs sub-module 2017-06-05 16:55:48 +03:00
Sergii Pylypenko
a361998ee2 Ninslash: bump version 2017-05-29 23:37:46 +03:00
pelya
55194b43e3 Ninslash: bump version 2017-05-27 21:44:00 +03:00
pelya
cdb6e76177 SDL: removed few unused shell scripts 2017-05-27 21:39:32 +03:00
lubomyr
132988b141 fixed app icon visibility and run from desktop when uses feature AppOpenFileExtension 2017-05-27 13:57:10 +03:00
Sergii Pylypenko
5ab39a579a SDL: new option AppOpenFileExtension to open a file with specific extension using the app 2017-05-26 20:45:04 +03:00
Sergii Pylypenko
d179d4d2c7 SDL: Fixed sign.sh for upload certificate 2017-05-25 22:37:25 +03:00
Sergii Pylypenko
39b5b5efb5 Ability to sign with new Google Play upload key 2017-05-22 23:50:34 +03:00
Sergii Pylypenko
b42a8623df Ninslash: bump version 2017-05-17 23:33:28 +03:00
pelya
8f54771340 Ninslash: oh the policies 2017-05-15 09:53:06 +03:00
pelya
d94bfa11f7 SDL: new option HideSystemMousePointer for hiding Android system mouse pointer when USB mouse is used, tested only on emulator so might not work at all 2017-05-14 23:03:14 +03:00
lubomyr
360fc0b112 gl4es updated, added latest changes by ptitSeb 2017-05-13 13:42:21 +03:00
lubomyr
9e2035c21d SDL: added support 1280x800 and 1366x768 video resolutions 2017-05-13 12:36:16 +03:00
pelya
0eaf0356fc Ninslash: bump version 2017-05-10 02:15:41 +03:00
Sergii Pylypenko
74c2b15e22 Ninslash: update 2017-04-11 23:17:17 +03:00
Sergii Pylypenko
a26e52ca94 Ninslash: updated 2017-04-11 11:03:32 +02:00
Sergii Pylypenko
4fcb4fce72 OpenTTD: updated 2017-04-07 23:42:56 +03:00
Gerhard Stein
2b0ad6e7d3 Merge branch 'sdl_android' of github.com:pelya/commandergenius into sdl_android 2017-04-07 20:36:59 +02:00
Sergii Pylypenko
c398280513 OpenTTD: bump version 2017-04-05 23:26:50 +03:00
pelya
f432fb316b OpenTTD: bump version 2017-04-02 23:54:35 +03:00
pelya
46e4118ba8 OpenTTD: bump version 2017-04-02 02:52:05 +03:00
Sergii Pylypenko
78d3c8ca27 SDL: updated Google Play Services scripts 2017-03-31 22:25:15 +03:00
pelya
5497773f96 OpenTTD: updated default config 2017-03-31 03:18:45 +03:00
Sergii Pylypenko
28015f4cca OpenTTD: updated downloads text 2017-03-30 19:41:36 +02:00
Sergii Pylypenko
f37cf67a7e SDL: new video mode for OpenTTD 2017-03-27 23:42:45 +03:00
Sergii Pylypenko
ecb29827af Ninslash: yet another update 2017-03-27 22:59:09 +03:00
Sergii Pylypenko
d4897280f0 SDL: Small helper script to reinstall an .apk with different certificate 2017-03-27 22:13:00 +03:00
Sergii Pylypenko
485d66ea25 Updated OpenTTD default config 2017-03-22 23:32:41 +02:00
Sergii Pylypenko
09f8a53a22 Fixed android-shmem compilation with NDK r14b, updated OpenTTD 2017-03-22 22:28:31 +02:00
Sergii Pylypenko
d7ea0a43fb OpenTTD: bump version 2017-03-21 20:24:09 +01:00
lubomyr
bf211679e1 openssl updated to 1.0.2k, implemented x86_64 platform support 2017-03-20 00:01:22 +02:00
lubomyr
32f1ca882e updated api (25) in build.sh script, it fixed openssl compilation 2017-03-11 19:04:19 +02:00
lubomyr
4e9dad66bb added dummy curl-config 2017-03-05 14:00:24 +02:00
lubomyr
2b64c864f0 gl4es updated, added latest changes by ptitSeb 2017-02-28 17:08:38 +02:00
Gerhard Stein
58beecc25a Merge branch 'sdl_android' of github.com:pelya/commandergenius into sdl_android 2017-02-25 12:23:55 +01:00
lubomyr
69137dfa78 gl4es updated, added latest changes by ptitSeb 2017-02-24 21:27:22 +02:00
lubomyr
4ab58838d1 added simlink in miniupnpc library 2017-02-24 21:25:59 +02:00
Sergii Pylypenko
5edfb74432 SDL: re-create download outdir if SD card is replaced 2017-02-24 17:01:23 +02:00
Sergii Pylypenko
2d9acc5aee Ninslash: bump version 2017-02-20 23:23:04 +02:00
pelya
7629e64762 Updated readme to mention Bash on Windows. 2017-02-19 23:56:19 +02:00
pelya
c67f348338 SuperTux: Added compilation instructions 2017-02-19 23:50:10 +02:00
pelya
f4727eb466 Merge branch 'sdl_android' of github.com:pelya/commandergenius 2017-02-19 23:47:37 +02:00
pelya
9aa0a1ae36 Updated submodules, fixed OpenTTD compilation 2017-02-19 23:46:43 +02:00
Gerhard Stein
27fea957aa Merge branch 'sdl_android' of github.com:pelya/commandergenius into sdl_android 2017-02-05 15:15:23 +01:00
Gerhard Stein
f472f15963 Version update 2017-02-05 15:14:48 +01:00
23046 changed files with 19595 additions and 6669702 deletions

7
.editorconfig Normal file
View File

@@ -0,0 +1,7 @@
root = true
[*]
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
charset = utf-8

156
.github/workflows/ballfield.yml vendored Normal file
View File

@@ -0,0 +1,156 @@
# Copyright (C) 2021-2021 Sergii Pylypenko <x.pelya.x@gmail.com>
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, and must not be
# misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source distribution.
name: ballfield
on:
push:
branches:
- '*'
tags:
- '*'
pull_request: {}
jobs:
build:
env:
APP_NAME: ballfield
# It takes one hour per one architecture to build Boost and ICU libraries, and Github limits CI script duration to 6 hours
ARCH_LIST: armeabi-v7a arm64-v8a x86 x86_64
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v2
with:
fetch-depth: 1
submodules: false
- name: Check out submodules
# There are many more submodules in this repo, we don't need them all
run: >
git submodule update --init --recursive --depth=1
project/jni/boost/src project/jni/iconv/src
project/jni/sdl2 project/jni/sdl2_image
project/jni/sdl2_mixer project/jni/sdl2_ttf
- name: Symlink the application dir
run: |
ln -s ${APP_NAME} project/jni/application/src
- name: Set architectures list
run: |
sed -i "s/MultiABI=.*/MultiABI='${ARCH_LIST}'/g" project/jni/application/src/AndroidAppSettings.cfg
# - name: Get Boost revision
# id: boost-rev
# run: echo "::set-output name=BOOST_REV::`git -C project/jni/boost/src rev-parse HEAD`"
#
# - name: Get ICU revision
# id: icu-rev
# run: echo "::set-output name=ICU_REV::`git -C project/jni/iconv/src rev-parse HEAD`"
#
# - name: Copy Boost libraries from cache
# uses: actions/cache@v2
# id: cache-boost
# with:
# # The same SDL revision will produce the same libraries
# key: ${{steps.boost-rev.outputs.BOOST_REV}}
# path: |
# build-android/project/jni/boost/include
# build-android/project/jni/boost/lib
#
# - name: Copy ICU libraries from cache
# uses: actions/cache@v2
# id: cache-icu
# with:
# # The same SDL revision will produce the same libraries
# key: ${{steps.icu-rev.outputs.ICU_REV}}
# path: |
# build-android/project/jni/iconv/include
# build-android/project/jni/iconv/lib
# build-android/project/jni/icuuc/include
# build-android/project/jni/icuuc/lib
#
# - name: Touch cached Boost timestamps
# if: steps.cache-boost.outputs.cache-hit == 'true' || steps.cache-icu.outputs.cache-hit == 'true'
# working-directory: build-android
# run: touch project/jni/boost/lib/*/* || true
#
# - name: Touch cached ICU timestamps
# if: steps.cache-boost.outputs.cache-hit == 'true' || steps.cache-icu.outputs.cache-hit == 'true'
# working-directory: build-android
# run: touch project/jni/iconv/lib/*/* project/jni/icuuc/lib/*/* || true
- name: Patch Java files and build Boost, ICU, and OpenSSL
run: |
export PATH=$ANDROID_NDK_LATEST_HOME:$PATH
./changeAppSettings.sh
- name: Set up Gradle and Android SDK licenses
working-directory: project
run: |
for Y in `seq 20`; do echo y; done | sudo $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses
./gradlew assembleRelease || true
for Y in `seq 20`; do echo y; done | sudo $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses --sdk_root=`pwd`
mkdir -p $HOME/.android
keytool -genkey -v -keystore $HOME/.android/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Debug, OU=Debug, O=Debug, L=Debug, ST=Debug, C=Debug"
echo "sdk.dir=$ANDROID_SDK_ROOT" > local.properties
echo "proguard.config=proguard.cfg;proguard-local.cfg" >> local.properties
- name: Hyper turbo build script GOOOOOOOOOOOO
run: |
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/31.0.0:$PATH
./build.sh
- name: App signing keys
run: |
echo "$ANDROID_KEYSTORE_B64" | base64 -d > keystore.jks || true
echo "$ANDROID_UPLOAD_KEYSTORE_B64" | base64 -d > upload_keystore.jks || true
find keystore.jks -empty -delete || true
find upload_keystore.jks -empty -delete || true
env:
ANDROID_KEYSTORE_B64: "${{secrets.ANDROID_KEYSTORE_B64}}"
ANDROID_UPLOAD_KEYSTORE_B64: "${{secrets.ANDROID_UPLOAD_KEYSTORE_B64}}"
- name: Package
run: |
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/31.0.0:$PATH
if [ -e keystore.jks ]; then
export ANDROID_KEYSTORE_FILE=`pwd`/keystore.jks
fi
if [ -e upload_keystore.jks ]; then
export ANDROID_UPLOAD_KEYSTORE_FILE=`pwd`/upload_keystore.jks
fi
mkdir -p upload/
./sign.sh
mv *.apk upload/
./signBundle.sh
mv *.aab upload/
env:
ANDROID_KEYSTORE_PASS: "${{secrets.ANDROID_KEYSTORE_PASS}}"
ANDROID_KEYSTORE_ALIAS: "${{secrets.ANDROID_KEYSTORE_ALIAS}}"
ANDROID_UPLOAD_KEYSTORE_PASS: "${{secrets.ANDROID_UPLOAD_KEYSTORE_PASS}}"
ANDROID_UPLOAD_KEYSTORE_ALIAS: "${{secrets.ANDROID_UPLOAD_KEYSTORE_ALIAS}}"
# Github actions is dumb and won't let you download single files from artifacts, so break up the artifacts instead
- uses: actions/upload-artifact@v2
with:
name: ${{env.APP_NAME}}
path: upload
if-no-files-found: error

156
.github/workflows/sdl2-demo.yml vendored Normal file
View File

@@ -0,0 +1,156 @@
# Copyright (C) 2021-2021 Sergii Pylypenko <x.pelya.x@gmail.com>
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, and must not be
# misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source distribution.
name: sdl2-demo
on:
push:
branches:
- '*'
tags:
- '*'
pull_request: {}
jobs:
build:
env:
APP_NAME: sdl2-demo
# It takes one hour per one architecture to build Boost and ICU libraries, and Github limits CI script duration to 6 hours
ARCH_LIST: armeabi-v7a arm64-v8a x86 x86_64
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v2
with:
fetch-depth: 1
submodules: false
- name: Check out submodules
# There are many more submodules in this repo, we don't need them all
run: >
git submodule update --init --recursive --depth=1
project/jni/boost/src project/jni/iconv/src
project/jni/sdl2 project/jni/sdl2_image
project/jni/sdl2_mixer project/jni/sdl2_ttf
- name: Symlink the application dir
run: |
ln -s ${APP_NAME} project/jni/application/src
- name: Set architectures list
run: |
sed -i "s/MultiABI=.*/MultiABI='${ARCH_LIST}'/g" project/jni/application/src/AndroidAppSettings.cfg
# - name: Get Boost revision
# id: boost-rev
# run: echo "::set-output name=BOOST_REV::`git -C project/jni/boost/src rev-parse HEAD`"
#
# - name: Get ICU revision
# id: icu-rev
# run: echo "::set-output name=ICU_REV::`git -C project/jni/iconv/src rev-parse HEAD`"
#
# - name: Copy Boost libraries from cache
# uses: actions/cache@v2
# id: cache-boost
# with:
# # The same SDL revision will produce the same libraries
# key: ${{steps.boost-rev.outputs.BOOST_REV}}
# path: |
# build-android/project/jni/boost/include
# build-android/project/jni/boost/lib
#
# - name: Copy ICU libraries from cache
# uses: actions/cache@v2
# id: cache-icu
# with:
# # The same SDL revision will produce the same libraries
# key: ${{steps.icu-rev.outputs.ICU_REV}}
# path: |
# build-android/project/jni/iconv/include
# build-android/project/jni/iconv/lib
# build-android/project/jni/icuuc/include
# build-android/project/jni/icuuc/lib
#
# - name: Touch cached Boost timestamps
# if: steps.cache-boost.outputs.cache-hit == 'true' || steps.cache-icu.outputs.cache-hit == 'true'
# working-directory: build-android
# run: touch project/jni/boost/lib/*/* || true
#
# - name: Touch cached ICU timestamps
# if: steps.cache-boost.outputs.cache-hit == 'true' || steps.cache-icu.outputs.cache-hit == 'true'
# working-directory: build-android
# run: touch project/jni/iconv/lib/*/* project/jni/icuuc/lib/*/* || true
- name: Patch Java files and build Boost, ICU, and OpenSSL
run: |
export PATH=$ANDROID_NDK_LATEST_HOME:$PATH
./changeAppSettings.sh
- name: Set up Gradle and Android SDK licenses
working-directory: project
run: |
for Y in `seq 20`; do echo y; done | sudo $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses
./gradlew assembleRelease || true
for Y in `seq 20`; do echo y; done | sudo $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses --sdk_root=`pwd`
mkdir -p $HOME/.android
keytool -genkey -v -keystore $HOME/.android/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Debug, OU=Debug, O=Debug, L=Debug, ST=Debug, C=Debug"
echo "sdk.dir=$ANDROID_SDK_ROOT" > local.properties
echo "proguard.config=proguard.cfg;proguard-local.cfg" >> local.properties
- name: Hyper turbo build script GOOOOOOOOOOOO
run: |
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/31.0.0:$PATH
./build.sh
- name: App signing keys
run: |
echo "$ANDROID_KEYSTORE_B64" | base64 -d > keystore.jks || true
echo "$ANDROID_UPLOAD_KEYSTORE_B64" | base64 -d > upload_keystore.jks || true
find keystore.jks -empty -delete || true
find upload_keystore.jks -empty -delete || true
env:
ANDROID_KEYSTORE_B64: "${{secrets.ANDROID_KEYSTORE_B64}}"
ANDROID_UPLOAD_KEYSTORE_B64: "${{secrets.ANDROID_UPLOAD_KEYSTORE_B64}}"
- name: Package
run: |
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/31.0.0:$PATH
if [ -e keystore.jks ]; then
export ANDROID_KEYSTORE_FILE=`pwd`/keystore.jks
fi
if [ -e upload_keystore.jks ]; then
export ANDROID_UPLOAD_KEYSTORE_FILE=`pwd`/upload_keystore.jks
fi
mkdir -p upload/
./sign.sh
mv *.apk upload/
./signBundle.sh
mv *.aab upload/
env:
ANDROID_KEYSTORE_PASS: "${{secrets.ANDROID_KEYSTORE_PASS}}"
ANDROID_KEYSTORE_ALIAS: "${{secrets.ANDROID_KEYSTORE_ALIAS}}"
ANDROID_UPLOAD_KEYSTORE_PASS: "${{secrets.ANDROID_UPLOAD_KEYSTORE_PASS}}"
ANDROID_UPLOAD_KEYSTORE_ALIAS: "${{secrets.ANDROID_UPLOAD_KEYSTORE_ALIAS}}"
# Github actions is dumb and won't let you download single files from artifacts, so break up the artifacts instead
- uses: actions/upload-artifact@v2
with:
name: ${{env.APP_NAME}}
path: upload
if-no-files-found: error

5
.gitignore vendored
View File

@@ -11,6 +11,7 @@
/project/jni/Settings.mk
/project/jni/application/*/libapplication*.so
/project/jni/application/src
/project/jni/boost_*
/project/res/drawable-xhdpi/ouya_icon.png
/project/res/drawable/app_icon.png
/project/proguard-project.txt
@@ -19,3 +20,7 @@
/project/jni/android-support
/project/res/drawable/banner.png
/project/res/drawable-xhdpi/ouya_icon.png
/project/app/build.gradle
/project/app/.gradle
/project/app/build
/project/assetpack/build

96
.gitmodules vendored
View File

@@ -1,79 +1,25 @@
[submodule "project/jni/application/NewRAW"]
path = project/jni/application/NewRAW
url = git@github.com:usineur/android-newraw.git
[submodule "project/jni/boost/src"]
path = project/jni/boost/src
url = git@github.com:pelya/Boost-for-Android.git
branch = master2
update = merge
[submodule "project/jni/application/commandergenius/commandergenius"]
path = project/jni/application/commandergenius/commandergenius
url = git@github.com:gerstrong/Commander-Genius.git
[submodule "project/jni/application/openarena/engine"]
path = project/jni/application/openarena/engine
url = git@github.com:pelya/openarena-engine.git
[submodule "project/jni/application/scummvm/scummvm"]
path = project/jni/application/scummvm/scummvm
url = git@github.com:scummvm/scummvm.git
[submodule "project/jni/application/openarena/vm"]
path = project/jni/application/openarena/vm
url = git@github.com:pelya/openarena-vm
[submodule "project/jni/application/teeworlds/src"]
path = project/jni/application/teeworlds/src
url = git@github.com:pelya/teeworlds.git
[submodule "project/jni/application/c-dogs/src"]
path = project/jni/application/c-dogs/src
url = git@github.com:cxong/cdogs-sdl.git
[submodule "project/jni/application/xserver/xserver"]
path = project/jni/application/xserver/xserver
url = git@github.com:pelya/xserver.git
branch = xsdl2
update = merge
[submodule "android-shmem"]
path = project/jni/shmem
url = git@github.com:pelya/android-shmem.git
branch = master
update = merge
[submodule "project/jni/application/hid-pc-keyboard/src"]
path = project/jni/application/hid-pc-keyboard/src
url = git@github.com:pelya/android-keyboard-gadget.git
branch = master
update = merge
[submodule "project/jni/iconv/src"]
path = project/jni/iconv/src
url = git@github.com:pelya/libiconv-libicu-android.git
[submodule "project/jni/icuuc/src"]
path = project/jni/icuuc/src
url = git@github.com:pelya/libiconv-libicu-android.git
[submodule "project/jni/application/openttd/src"]
path = project/jni/application/openttd/src
url = git@github.com:pelya/openttd-android.git
[submodule "project/jni/application/uae4all2"]
path = project/jni/application/uae4all2
url = git@github.com:lubomyr/uae4all2.git
[submodule "project/jni/application/basiliskii/basiliskii"]
path = project/jni/application/basiliskii/basiliskii
url = git@github.com:pelya/BasiliskII-android.git
[submodule "project/jni/vncserver/src"]
path = project/jni/vncserver/src
url = git@github.com:LibVNC/libvncserver.git
[submodule "project/jni/application/vice/vice"]
path = project/jni/application/vice/vice
url = git@github.com:lubomyr/vice-2.4.git
[submodule "project/jni/application/xserver/pulseaudio"]
path = project/jni/application/xserver/pulseaudio
url = git@github.com:pelya/pulseaudio-android.git
[submodule "project/jni/application/bochs/bochs"]
path = project/jni/application/bochs/bochs
url = git@github.com:lubomyr/bochs.git
[submodule "project/jni/application/supertux/supertux"]
path = project/jni/application/supertux/supertux
url = git@github.com:pelya/supertux.git
[submodule "project/jni/application/fheroes2/fheroes2"]
path = project/jni/application/fheroes2/fheroes2
url = http://github.com/gerstrong/fheroes2plus.git
[submodule "project/jni/application/ninslash/src"]
path = project/jni/application/ninslash/src
url = git@github.com:pelya/Ninslash.git
url = https://github.com/pelya/libiconv-libicu-android.git
branch = master
update = merge
[submodule "project/jni/application/openttd/src"]
path = project/jni/application/openttd/src
url = https://github.com/n-ice-community/openttd-android.git
branch = 12
[submodule "project/jni/sdl2"]
path = project/jni/sdl2
url = https://github.com/libsdl-org/SDL.git
branch = main
[submodule "project/jni/sdl2_image"]
path = project/jni/sdl2_image
url = https://github.com/libsdl-org/SDL_image
branch = main
[submodule "project/jni/sdl2_ttf"]
path = project/jni/sdl2_ttf
url = https://github.com/libsdl-org/SDL_ttf.git
branch = main
[submodule "project/jni/sdl2_mixer"]
path = project/jni/sdl2_mixer
url = https://github.com/libsdl-org/SDL_mixer.git
branch = master

View File

@@ -1,107 +0,0 @@
#!/usr/bin/python
# aar2jar.py (c) kak2 <doanngocbao@gmail.com>
# https://github.com/kak2/aar2jar
import sys, getopt, os
import shutil
import zipfile
mswindows = (sys.platform == "win32")
def main(argv):
project_name = ''
output_dir = ''
if len(argv) == 0:
help()
sys.exit(2)
try:
opts, args = getopt.getopt(argv,"hi:o:",["iname=","odir="])
except getopt.GetoptError:
help()
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
help()
sys.exit()
elif opt in ("-i", "--iname"):
project_name = arg
elif opt in ("-o", "--odir"):
output_dir = arg
convert(project_name, output_dir)
def help():
print 'convert.py -i <your-project-name-without-aar> -o <output-dir>'
def convert(project_name, output_dir):
if not existProject(project_name):
print project_name, " is not existed in current directory"
sys.exit(2)
createOrCleanOutputDir(output_dir)
# Convert your project first
convert_project(project_name, output_dir)
# Move all jar and convert other aar files
files = os.listdir(os.curdir)
for file in files:
file_name, extension = os.path.splitext(file)
print file_name, extension
if extension == '.jar':
shutil.move(file, os.path.join(output_dir, project_name, 'libs', file))
elif extension == '.aar':
if file_name != project_name:
convert_project(file_name, output_dir)
def convert_project(project_name, output_dir):
# Extract your project's file
your_file_dest_path = os.path.join(output_dir, project_name)
os.makedirs(your_file_dest_path)
with zipfile.ZipFile(project_name + '.aar' , "r") as z:
z.extractall(your_file_dest_path)
#
# Make it into ant library project
#
if not os.path.exists(os.path.join(your_file_dest_path, 'src')):
os.makedirs(os.path.join(your_file_dest_path, 'src')) # Make src directory in project, but leave it empty
if not os.path.exists(os.path.join(your_file_dest_path, 'libs')):
os.makedirs(os.path.join(your_file_dest_path, 'libs')) # Make lib directory in project if it does not exists
# Rename classes.jar to project_name.jar and move it into libs directory
os.rename(os.path.join(your_file_dest_path, 'classes.jar'), os.path.join(your_file_dest_path, project_name + '.jar'))
shutil.move(os.path.join(your_file_dest_path, project_name + '.jar'), os.path.join(your_file_dest_path, 'libs/' + project_name + '.jar'))
# Call android update. So we have to install android first, then add it into PATH
command = "android update lib-project -p " + os.path.join(output_dir, project_name) + " -t android-25"
os.system(command)
# Update project.properties file
with open(os.path.join(output_dir, project_name, 'project.properties'), "a") as myfile:
myfile.write("android.library=true\n")
def createOrCleanOutputDir(output_dir):
files = os.listdir(os.curdir)
if os.path.exists(output_dir):
deleteDir(output_dir)
os.makedirs(output_dir)
def remove_readonly(fn, path, excinfo):
#removes readonly tag from files/folders so they can be deleted
if fn is os.rmdir:
os.chmod(path, stat.S_IWRITE)
os.rmdir(path)
elif fn is os.remove:
os.chmod(path, stat.S_IWRITE)
os.remove(path)
def deleteDir(directory):
shutil.rmtree(directory, onerror=remove_readonly)
def existProject(project_name):
project_file = project_name + ".aar"
files = os.listdir(os.curdir)
try:
files.index(project_file)
return True
except ValueError:
return False
if __name__ == "__main__":
main(sys.argv[1:])

1
app-release.apk Symbolic link
View File

@@ -0,0 +1 @@
project/app/build/outputs/apk/release/app-release.apk

View File

@@ -1,35 +0,0 @@
#!/bin/sh
APK=$1
if [ -z "$APK" ] ; then
APK=project/bin/MainActivity-debug.apk
fi
echo Moving shared libraries on $APK to SD card
APK=`pwd`/$APK
[ -e $APK ] || { echo File $APK does not exist; exit 1; }
TMPDIR=app2sd-$$
mkdir -p $TMPDIR
cd $TMPDIR
unzip $APK "lib/armeabi/*" || { echo "This apk file has already been app2sd-ed, or improperly compiled"; exit 1; }
zip -j bindata.zip lib/armeabi/*
mkdir assets
split -b 1048576 -d -a 1 bindata.zip assets/bindata
rm bindata.zip
zip -d $APK "lib/armeabi/*" "META-INF/*"
zip -0 $APK assets/bindata*
jarsigner -verbose -keystore ~/.android/debug.keystore -storepass "android" $APK androiddebugkey
zipalign 4 $APK $APK-tmp
mv -f $APK-tmp $APK
cd ..
rm -rf $TMPDIR

View File

@@ -29,3 +29,7 @@ Requested features, might never get implemented, see todo.txt for features that
- OpenArena: Shift and Ctrl keys on USB keyboard do not work for text input.
- OpenArena: When entering with USB keyboard into chatbox, first 't' disappears.
- USB Keyboard: options for camera feed size and for redefining remote menu hotkey.
- UQM HD: add fonts from http://mosc-portal.bursa.ru/showthread.php?t=206 and switch back to joystick controls, set 4:3 aspect ratio as default.

299
build.sh
View File

@@ -1,34 +1,49 @@
#!/bin/sh
#set -eu # Bashism, does not work with default shell on Ubuntu 12.04
#!/usr/bin/env bash
# Handle any error or die
set -e
THIS_BUILD_DIR=$(dirname "$0")
install_apk=false
run_apk=false
sign_apk=false
sign_bundle=false
build_release=true
quick_rebuild=false
QUICK_REBUILD_ARGS=
do_zipalign=true
named_variant="sdl"
base_app_name=""
if [ "$#" -gt 0 -a "$1" = "-s" ]; then
shift
sign_apk=true
# Fix Gradle compilation error
if [ -z "$ANDROID_NDK_HOME" ]; then
export ANDROID_NDK_HOME="$(which ndk-build | sed 's@/ndk-build@@')"
fi
if [ "$#" -gt 0 -a "$1" = "-i" ]; then
shift
install_apk=true
fi
if [ "$#" -gt 0 -a "$1" = "-r" ]; then
shift
install_apk=true
run_apk=true
fi
if [ "$#" -gt 0 -a "$1" = "-q" ]; then
shift
quick_rebuild=true
QUICK_REBUILD_ARGS=APP_ABI=armeabi-v7a
fi
while getopts "sirqbhzv:" OPT
do
case $OPT in
s) sign_apk=true;;
i) install_apk=true;;
r) install_apk=true ; run_apk=true;;
q) echo "Quick rebuild does not work anymore with Gradle!";;
b) sign_bundle=true;;
z) do_zipalign=false;;
v) named_variant=${OPTARG};;
h)
echo "Usage: $0 [-s] [-i] [-r] [-q] [debug|release] [app-name]"
echo " -s: sign .apk file after building"
echo " -b: sign .aab app bundle file after building"
echo " -i: install APK file to device after building"
echo " -r: run APK file on device after building"
echo " -z: skip zipalign and apksigner"
echo " -v <v>: choose variant, either sdl or fdroid"
echo " debug: build debug package"
echo " release: build release package (default)"
echo " app-name: directory under project/jni/application to be compiled"
exit 0
;;
esac
done
shift $(expr $OPTIND - 1)
if [ "$#" -gt 0 -a "$1" = "release" ]; then
shift
@@ -41,7 +56,7 @@ if [ "$#" -gt 0 -a "$1" = "debug" ]; then
export NDK_DEBUG=1
fi
if [ "$#" -gt 0 -a "$1" '!=' "-h" ]; then
if [ "$#" -gt 0 ]; then
echo "Switching build target to $1"
if [ -e project/jni/application/$1 ]; then
rm -f project/jni/application/src
@@ -49,60 +64,55 @@ if [ "$#" -gt 0 -a "$1" '!=' "-h" ]; then
else
echo "Error: no app $1 under project/jni/application"
echo "Available applications:"
cd project/jni/application
pushd project/jni/application
for f in *; do
if [ -e "$f/AndroidAppSettings.cfg" ]; then
echo "$f"
fi
done
popd
exit 1
fi
shift
fi
if [ "$#" -gt 0 -a "$1" = "-h" ]; then
echo "Usage: $0 [-s] [-i] [-r] [-q] [debug|release] [app-name]"
echo " -s: sign APK file after building"
echo " -i: install APK file to device after building"
echo " -r: run APK file on device after building"
echo " -q: quick-rebuild C code, without rebuilding Java files"
echo " debug: build debug package"
echo " release: build release package (default)"
echo " app-name: directory under project/jni/application to be compiled"
exit 0
fi
base_app_name=$(grep -Po 'AppFullName\=\K[[:alnum:].]+\.(?=[[:alnum:]]+)' AndroidAppSettings.cfg)
NDK_TOOLCHAIN_VERSION=$GCCVER
[ -z "$NDK_TOOLCHAIN_VERSION" ] && NDK_TOOLCHAIN_VERSION=4.9
function project_needs_setup {
local app_name=$(grep -Po 'AppFullName\=\K[.[:alnum:]]+' AndroidAppSettings.cfg)
# Set here your own NDK path if needed
# export PATH=$PATH:~/src/endless_space/android-ndk-r7
NDKBUILDPATH=$PATH
export `grep "AppFullName=" AndroidAppSettings.cfg`
if ( grep "package $AppFullName;" project/src/Globals.java > /dev/null 2>&1 && \
[ "`readlink AndroidAppSettings.cfg`" -ot "project/src/Globals.java" ] && \
[ -z "`find project/java/* project/AndroidManifestTemplate.xml -cnewer project/src/Globals.java`" ] ) ; then true ; else
./changeAppSettings.sh -a || exit 1
if [ -z "${base_app_name}" ]; then
echo "Could not determine App base name";
exit 2
fi
[ ! -e project/local.properties ] || \
! grep -q "package ${app_name};" project/src/Globals.java || \
! grep -q "package ${base_app_name}${named_variant};" project/src/Globals.java || \
[ "$(readlink AndroidAppSettings.cfg)" -nt "project/src/Globals.java" ] || \
[ -n "$(find project/java/* \
project/javaSDL2/* \
project/jni/sdl2/android-project/app/src/main/java/org/libsdl/app/* \
project/AndroidManifestTemplate.xml \
-cnewer \
project/src/Globals.java \
)" \
]
}
if project_needs_setup;
then
APP_FULL_NAME="${base_app_name}${named_variant}" ./changeAppSettings.sh -a
sleep 1
touch project/src/Globals.java
fi
if $build_release ; then
sed -i 's/android:debuggable="true"/android:debuggable="false"/g' project/AndroidManifest.xml
else
sed -i 's/android:debuggable="false"/android:debuggable="true"/g' project/AndroidManifest.xml
fi
[ -e project/local.properties ] || {
android update project -p project -t android-23 || exit 1
rm -f project/src/Globals.java
}
MYARCH=linux-x86_64
if [ -z "$NCPU" ]; then
NCPU=4
NCPU=8
if uname -s | grep -i "linux" > /dev/null ; then
MYARCH=linux-x86_64
NCPU=`cat /proc/cpuinfo | grep -c -i processor`
NCPU=$(cat /proc/cpuinfo | grep -c -i processor)
fi
if uname -s | grep -i "darwin" > /dev/null ; then
MYARCH=darwin-x86_64
@@ -111,100 +121,85 @@ if [ -z "$NCPU" ]; then
MYARCH=windows-x86_64
fi
fi
export BUILD_NUM_CPUS=$NCPU
$quick_rebuild || rm -r -f project/bin/* # New Android SDK introduced some lame-ass optimizations to the build system which we should take care about
[ -x project/jni/application/src/AndroidPreBuild.sh ] && {
cd project/jni/application/src
./AndroidPreBuild.sh || { echo "AndroidPreBuild.sh returned with error" ; exit 1 ; }
cd ../../../..
}
strip_libs() {
grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
echo Stripping libapplication-armeabi.so by hand && \
rm obj/local/armeabi/libapplication.so && \
cp jni/application/src/libapplication-armeabi.so obj/local/armeabi/libapplication.so && \
cp jni/application/src/libapplication-armeabi.so libs/armeabi/libapplication.so && \
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-${NDK_TOOLCHAIN_VERSION}/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi/libapplication.so
grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
grep "MultiABI=" ../AndroidAppSettings.cfg | grep "y\\|all\\|armeabi-v7a" > /dev/null && \
echo Stripping libapplication-armeabi-v7a.so by hand && \
rm obj/local/armeabi-v7a/libapplication.so && \
cp jni/application/src/libapplication-armeabi-v7a.so obj/local/armeabi-v7a/libapplication.so && \
cp jni/application/src/libapplication-armeabi-v7a.so libs/armeabi-v7a/libapplication.so && \
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-${NDK_TOOLCHAIN_VERSION}/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi-v7a/libapplication.so
grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
grep "MultiABI=" ../AndroidAppSettings.cfg | grep "all\\|mips" > /dev/null && \
echo Stripping libapplication-mips.so by hand && \
rm obj/local/mips/libapplication.so && \
cp jni/application/src/libapplication-mips.so obj/local/mips/libapplication.so && \
cp jni/application/src/libapplication-mips.so libs/mips/libapplication.so && \
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/mipsel-linux-android-${NDK_TOOLCHAIN_VERSION}/prebuilt/$MYARCH/bin/mipsel-linux-android-strip --strip-unneeded libs/mips/libapplication.so
grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
grep "MultiABI=" ../AndroidAppSettings.cfg | grep "all\\|x86" > /dev/null && \
echo Stripping libapplication-x86.so by hand && \
rm obj/local/x86/libapplication.so && \
cp jni/application/src/libapplication-x86.so obj/local/x86/libapplication.so && \
cp jni/application/src/libapplication-x86.so libs/x86/libapplication.so && \
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/x86-${NDK_TOOLCHAIN_VERSION}/prebuilt/$MYARCH/bin/i686-linux-android-strip --strip-unneeded libs/x86/libapplication.so
grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
grep "MultiABI=" ../AndroidAppSettings.cfg | grep "all\\|x86_64" > /dev/null && \
echo Stripping libapplication-x86_64.so by hand && \
rm obj/local/x86_64/libapplication.so && \
cp jni/application/src/libapplication-x86_64.so obj/local/x86_64/libapplication.so && \
cp jni/application/src/libapplication-x86_64.so libs/x86_64/libapplication.so && \
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/x86_64-${NDK_TOOLCHAIN_VERSION}/prebuilt/$MYARCH/bin/x86_64-linux-android-strip --strip-unneeded libs/x86_64/libapplication.so
grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
grep "MultiABI=" ../AndroidAppSettings.cfg | grep "all\\|arm64-v8a" > /dev/null && \
echo Stripping libapplication-arm64-v8a.so by hand && \
rm obj/local/arm64-v8a/libapplication.so && \
cp jni/application/src/libapplication-arm64-v8a.so obj/local/arm64-v8a/libapplication.so && \
cp jni/application/src/libapplication-arm64-v8a.so libs/arm64-v8a/libapplication.so && \
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/aarch64-linux-android-${NDK_TOOLCHAIN_VERSION}/prebuilt/$MYARCH/bin/aarch64-linux-android-strip --strip-unneeded libs/arm64-v8a/libapplication.so
grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
grep "MultiABI=" ../AndroidAppSettings.cfg | grep "all\\|mips64" > /dev/null && \
echo Stripping libapplication-mips64.so by hand && \
rm obj/local/mips64/libapplication.so && \
cp jni/application/src/libapplication-mips64.so obj/local/mips64/libapplication.so && \
cp jni/application/src/libapplication-mips64.so libs/mips64/libapplication.so && \
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/mips64el-linux-android-${NDK_TOOLCHAIN_VERSION}/prebuilt/$MYARCH/bin/mips64el-linux-android-strip --strip-unneeded libs/mips64/libapplication.so
return 0
}
if [ -x project/jni/application/src/AndroidPreBuild.sh ]; then
pushd project/jni/application/src
./AndroidPreBuild.sh
popd
fi
cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU nice -n19 ndk-build -j$NCPU V=1 $QUICK_REBUILD_ARGS && \
strip_libs && \
cd .. && ./copyAssets.sh && cd project && \
{ if $build_release ; then \
$quick_rebuild && { \
ln -s -f libs lib ; \
zip -u -r bin/MainActivity-release-unsigned.apk lib assets || exit 1 ; \
} || ant release || exit 1 ; \
[ '!' -x jni/application/src/AndroidPostBuild.sh ] || {
cd jni/application/src ; \
./AndroidPostBuild.sh `pwd`/../../../bin/MainActivity-release-unsigned.apk || exit 1 ; \
cd ../../.. ; \
} || exit 1 ; \
jarsigner -verbose -keystore ~/.android/debug.keystore -storepass android -sigalg MD5withRSA -digestalg SHA1 bin/MainActivity-release-unsigned.apk androiddebugkey || exit 1 ; \
rm -f bin/MainActivity-debug.apk ; \
zipalign 4 bin/MainActivity-release-unsigned.apk bin/MainActivity-debug.apk || exit 1 ; \
else \
$quick_rebuild && { \
ln -s -f libs lib ; \
zip -u -r bin/MainActivity-debug-unaligned.apk lib assets || exit 1 ; \
jarsigner -verbose -keystore ~/.android/debug.keystore -storepass android -sigalg MD5withRSA -digestalg SHA1 bin/MainActivity-debug-unaligned.apk androiddebugkey || exit 1 ; \
rm -f bin/MainActivity-debug.apk ; \
zipalign 4 bin/MainActivity-debug-unaligned.apk bin/MainActivity-debug.apk || exit 1 ; \
} || ant debug || exit 1 ; \
fi ; } && \
{ if $sign_apk; then cd .. && ./sign.sh && cd project ; else true ; fi ; } && \
{ $install_apk && [ -n "`adb devices | tail -n +2`" ] && \
{ cd bin && adb install -r MainActivity-debug.apk | grep 'Failure' && \
adb uninstall `grep AppFullName ../../AndroidAppSettings.cfg | sed 's/.*=//'` && adb install -r MainActivity-debug.apk ; } ; \
true ; } && \
{ $run_apk && { \
ActivityName="`grep AppFullName ../../AndroidAppSettings.cfg | sed 's/.*=//'`/.MainActivity" ; \
RUN_APK="adb shell am start -n $ActivityName" ; \
echo "Running $ActivityName on the USB-connected device:" ; \
echo "$RUN_APK" ; \
eval $RUN_APK ; } ; \
true ; } || exit 1
if grep -q 'CustomBuildScript=y' ./AndroidAppSettings.cfg; then
${ANDROID_NDK_HOME}/ndk-build -C project -j$NCPU V=1 CUSTOM_BUILD_SCRIPT_FIRST_PASS=1 NDK_APP_STRIP_MODE=none
make -C project/jni/application -f CustomBuildScript.mk
fi
${ANDROID_NDK_HOME}/ndk-build -C project -j$NCPU V=1 NDK_APP_STRIP_MODE=none
./copyAssets.sh
pushd project
if $build_release ; then
if [ -x ./gradlew ]; then
./gradlew assembleRelease
else
gradle assembleRelease
fi
if [ -x jni/application/src/AndroidPostBuild.sh ]; then
pushd jni/application/src
./AndroidPostBuild.sh ${THIS_BUILD_DIR}/project/app/build/outputs/apk/release/app-release-unsigned.apk
popd
fi
../copyAssets.sh pack-binaries app/build/outputs/apk/release/app-release-unsigned.apk
rm -f app/build/outputs/apk/release/app-release.apk
if $do_zipalign; then
zipalign -p 4 app/build/outputs/apk/release/app-release-unsigned.apk app/build/outputs/apk/release/app-release.apk
apksigner sign --ks ~/.android/debug.keystore --ks-key-alias androiddebugkey --ks-pass pass:android app/build/outputs/apk/release/app-release.apk
fi
else
if [ -x ./gradlew ]; then
./gradlew assembleDebug
else
gradle assembleDebug
fi
if [ -x jni/application/src/AndroidPostBuild.sh ]; then
pushd jni/application/src
./AndroidPostBuild.sh ${THIS_BUILD_DIR}/project/app/build/outputs/apk/debug/app-debug.apk
popd
fi
mkdir -p app/build/outputs/apk/release
../copyAssets.sh pack-binaries app/build/outputs/apk/debug/app-debug.apk
rm -f app/build/outputs/apk/release/app-release.apk
if $do_zipalign; then
zipalign -p 4 app/build/outputs/apk/debug/app-debug.apk app/build/outputs/apk/release/app-release.apk
apksigner sign --ks ~/.android/debug.keystore --ks-key-alias androiddebugkey --ks-pass pass:android app/build/outputs/apk/release/app-release.apk
fi
fi
if $sign_apk; then
pushd ..
./sign.sh
popd
fi
if $sign_bundle; then
pushd ..
./signBundle.sh
popd
fi
if $install_apk && [ -n "$(adb devices | tail -n +2)" ]; then
if $sign_apk; then
APPNAME=$(grep AppName ../AndroidAppSettings.cfg | sed 's/.*=//' | tr -d '"' | tr " '/" '---')
APPVER=$(grep AppVersionName ../AndroidAppSettings.cfg | sed 's/.*=//' | tr -d '"' | tr " '/" '---')
adb install -r ../$APPNAME-$APPVER.apk ;
else
adb install -r app/build/outputs/apk/release/app-release.apk
fi
fi
if $run_apk; then
ActivityName="$(grep AppFullName ../AndroidAppSettings.cfg | sed 's/.*=//')/.MainActivity"
RUN_APK="adb shell am start -n $ActivityName"
echo "Running $ActivityName on the USB-connected device:"
echo "$RUN_APK"
eval $RUN_APK
fi

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,16 +1,40 @@
#!/bin/sh
ARCHES="arm64-v8a armeabi-v7a x86 x86_64"
if [ "$1" = "pack-binaries" -o "$1" = "pack-binaries-bundle" ]; then
[ -e jni/application/src/AndroidData/lib ] || exit 0
[ -e jni/application/src/AndroidData/binaries*.zip ] && {
echo "Error: binaries.zip no longer supported in Android 10"
echo "Copy your executable binaries to AndroidData/lib/arm64-v8a"
echo "Then execute them using \$LIBDIR or getenv(\"LIBDIR\")"
exit 0
}
APK="`pwd`/$2"
echo "Copying binaries to .apk file"
cd jni/application/src/AndroidData/ || exit 1
if [ "$1" = "pack-binaries-bundle" ]; then
rm -rf base
mkdir -p base
cp -L -r lib base/
zip -r -D "$APK" base || exit 1
rm -rf base
else
zip -r -D "$APK" lib || exit 1
fi
cd ../../../../
exit 0
fi
echo "Copying app data files from project/jni/application/src/AndroidData to project/assets"
mkdir -p project/assets
rm -f -r project/assets/*
if [ -d "project/jni/application/src/AndroidData" ] ; then
cp -L -r project/jni/application/src/AndroidData/* project/assets/
exit 0 # Do not split assets, this was needed only for Andorid 2.3 with it's stupid limitations
for F in project/assets/*; do
if [ `cat $F | wc -c` -gt 1000000 ] ; then
echo "The file $F is bigger than 1 megabyte - splitting it into smaller chunks"
split -b 1000000 -a 3 -d $F $F && rm $F || { echo "Error: 'split' command not installed" ; exit 1 ; }
fi
for F in project/jni/application/src/AndroidData/*; do
[ "$F" = "project/jni/application/src/AndroidData/lib" ] && continue
[ "$F" = "project/jni/application/src/AndroidData/assetpack" ] && continue
cp -L -r "$F" project/assets/
done
fi
exit 0

View File

@@ -5,16 +5,19 @@ APPVER=`grep AppVersionName AndroidAppSettings.cfg | sed 's/.*=//' | tr -d '"' |
ARCHIVER=gzip
EXT=gz
which xz > /dev/null && ARCHIVER="xz -z" && EXT=xz
which pxz > /dev/null && ARCHIVER=pxz && EXT=xz || echo "Install pxz for faster archiving: sudo apt-get isntall pxz"
which xz > /dev/null && ARCHIVER="xz -z -T 0" && EXT=xz
#which pxz > /dev/null && ARCHIVER=pxz && EXT=xz || echo "Install pxz for faster archiving: sudo apt-get install pxz"
# TODO: Boost, Python and ffmpeg are stored in repository as precompiled binaries, the proper way to fix that is to build them using scripts, and remove that binaries
# --exclude="*.a" --exclude="*.so"
tar -c --exclude-vcs --exclude="*.o" --exclude="*.d" --exclude="*.dep" \
--exclude="libboost_*.a" --exclude="libcharset.so" --exclude="libiconv.so" \
--exclude="libicu*.a" --exclude="libharfbuzz.a" --exclude="libcrypto.so*" --exclude="libssl.so*" \
`git ls-files --exclude-standard | grep -v '^project/jni/application/.*'` \
`find project/jni/application -maxdepth 1 -type f -o -type l` \
project/jni/application/src \
project/jni/application/`readlink project/jni/application/src` \
project/AndroidManifest.xml project/src \
project/obj/local/armeabi-v7a/*.so project/obj/local/x86/*.so \
project/obj/local/armeabi-v7a/*.so project/obj/local/arm64-v8a/*.so project/obj/local/x86/*.so project/obj/local/x86_64/*.so \
project/app/build/outputs/mapping/release/mapping.txt \
"$@" | $ARCHIVER > $APPNAME-$APPVER-src.tar.$EXT

View File

@@ -0,0 +1 @@
Initial F-Droid release

View File

@@ -0,0 +1,11 @@
NOTE: This is a fork of https://github.com/pelya/openttd-android since development there is on hold currently.
OpenTTD is an open source reimplementation of the Microprose game Transport Tycoon Deluxe (TTD). As president of a start-up transportation company in (typically) 1950, you have a choice of building rail, road, air and maritime transportation routes to build up your transportation empire. Outsmart your competition by beating them to attractive passenger and commodities routes to become the game's highest-ranking transport company by the year 2050.
OpenTTD is based on Chris Sawyer's Transport Tycoon Deluxe and introduces a whole set of new features, including multiplayer support, better stations and vehicles, larger maps and a host of other options.
Posting a full list of features would be futile as it would mean updating this page almost daily, and even then some things might be forgotten. Play with the game to experience all the features yourself, or take a look at the <a href="https://wiki.openttd.org/en/Manual/">Manual</a> for a more thorough listing and explanation of the features and possibilities available.
Tips:
* Scroll the map with two fingers, when you are building roads or stations.
* Close dialogs by dragging them to the screen edge.

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 KiB

View File

@@ -0,0 +1 @@
A simulation game based on the popular game "Transport Tycoon Deluxe"

3
project/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
/.gradle
/build

View File

@@ -7,17 +7,21 @@
>
<application android:label="@string/app_name"
android:icon="@drawable/icon"
android:debuggable="true"
android:allowBackup="true"
android:banner="@drawable/banner"
android:isGame="true"
android:extractNativeLibs="true"
android:supportsRtl="true"
android:theme="@style/AppTheme"
>
<activity android:name=".MainActivity"
<activity android:name="MainActivity"
android:label="@string/app_name"
android:alwaysRetainTaskState="true"
android:launchMode="singleTask"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection"
android:windowSoftInputMode="stateUnspecified"
android:theme="@style/AppTheme"
android:exported="true"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -27,20 +31,33 @@
<category android:name="android.intent.category.LEANBACK_LAUNCHER" /> <!-- Android TV requires this -->
<category android:name="tv.ouya.intent.category.GAME" /> <!-- For that one user who still got an OUYA in his living room and won't throw it away just because someone else decides that it's dead -->
</intent-filter>
<!-- ==OPENFILE== --> <intent-filter>
<!-- ==OPENFILE== --> <action android:name="android.intent.action.VIEW" />
<!-- ==OPENFILE== --> <category android:name="android.intent.category.DEFAULT" />
<!-- ==OPENFILE== --> <category android:name="android.intent.category.BROWSABLE" />
<!-- ==OPENFILE== --> <data android:scheme="file" />
<!-- ==OPENFILE== --> <data android:mimeType="*/*" />
<!-- ==OPENFILE== --> <data android:host="*" />
<!-- ==OPENFILE== --> <data android:pathPattern=".*\\.==OPENFILE-EXT==" />
<!-- ==OPENFILE== --> <data android:pathPattern=".*\\..*\\.==OPENFILE-EXT==" />
<!-- ==OPENFILE== --> <data android:pathPattern=".*\\..*\\..*\\.==OPENFILE-EXT==" />
<!-- ==OPENFILE== --> <data android:pathPattern=".*\\..*\\..*\\..*\\.==OPENFILE-EXT==" />
<!-- ==OPENFILE== --> </intent-filter>
</activity>
<!-- ==ADMOB== --> <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection"/>
<!-- ==ADMOB== --> <meta-data android:name="com.google.android.gms.version" android:value="4323000" /> <!-- Change this value to the actual Google Play SDK version -->
<!-- ==ADMOB== --> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
<!-- ==GOOGLEPLAYGAMESERVICES== --> <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="@string/google_play_game_services_app_id" />
<!-- ==GOOGLEPLAYGAMESERVICES== --> <meta-data android:name="com.google.android.gms.appstate.APP_ID" android:value="@string/google_play_game_services_app_id" />
<!-- ==GOOGLEPLAYGAMESERVICES== --> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" /> <!-- Samsung's multiwindow -->
<activity android:name=".RestartMainActivity"
<activity android:name="RestartMainActivity"
android:label="@string/app_name"
android:alwaysRetainTaskState="true"
android:launchMode="singleTask"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection"
android:windowSoftInputMode="stateUnspecified"
android:process=":RestartMainActivity"
android:exported="true"
/>
<service android:name=".DummyService"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection"
@@ -48,20 +65,29 @@
/>
</application>
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="25"/>
<!-- ==INTERNET== --> <uses-permission android:name="android.permission.INTERNET" />
<!-- ==EXTERNAL_STORAGE== --> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- ==EXTERNAL_STORAGE== --> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!-- ==NOT_EXTERNAL_STORAGE== --> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="18" /> <!-- App has write access to it's own dir on SD card without this permission on Android 4.4 and above -->
<!-- ==NOT_EXTERNAL_STORAGE== --> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />
<!-- ==NOT_EXTERNAL_STORAGE== --> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="18" /> <!-- App has write access to it's own dir on SD card without this permission on Android 4.4 and above -->
<!-- ==READ_OBB== --> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />
<!-- ==READ_OBB== --> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <!-- OBB file requires explicit permission before Marshmallow -->
<!-- ==RECORD_AUDIO== --> <uses-permission android:name="android.permission.RECORD_AUDIO" />
<!-- ==ADMOB== --> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- ==FOREGROUND_SERVICE== --> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<!-- <uses-permission android:name="android.permission.VIBRATE"></uses-permission> --> <!-- Vibrator not supported yet by SDL -->
<uses-feature android:name="android.hardware.touchscreen" android:required="false" /> <!-- Allow TV boxes -->
<uses-feature android:name="android.hardware.faketouch" android:required="false"/> <!-- Allow TV boxes -->
<uses-feature android:name="android.software.leanback" android:required="false" /> <!-- Android TV requires this -->
<uses-feature android:name="android.hardware.microphone" android:required="false" /> <!-- Android TV requires this -->
<uses-feature android:name="android.hardware.gamepad" android:required="false"/> <!-- Android TV requires this -->
<uses-feature android:name="android.hardware.telephony" android:required="false"/> <!-- Android TV requires this -->
<uses-feature android:name="android.hardware.camera" android:required="false"/> <!-- Android TV requires this -->
<uses-feature android:name="android.hardware.nfc" android:required="false"/> <!-- Android TV requires this -->
<uses-feature android:name="android.hardware.location.gps" android:required="false"/> <!-- Android TV requires this -->
<uses-feature android:name="android.hardware.sensor" android:required="false"/> <!-- Android TV requires this -->
<!-- ==SCREEN-SIZE-SMALL== --> <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" />
<!-- ==SCREEN-SIZE-NORMAL== --> <supports-screens android:smallScreens="false" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" />
<!-- ==SCREEN-SIZE-LARGE== --> <supports-screens android:smallScreens="false" android:normalScreens="false" android:largeScreens="true" android:xlargeScreens="true" />

View File

@@ -0,0 +1,39 @@
plugins {
id 'com.android.application'
}
android {
compileSdk 31
ndkVersion "23.1.7779620"
defaultConfig {
applicationId "net.olofson.ballfield"
minSdk 16
targetSdk 31
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), '../proguard-local.cfg', '../proguard.cfg'
}
releaseWithDebugInfo {
initWith release
ndk {
debugSymbolLevel 'FULL'
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
assetPacks = [":assetpack"] // ==ASSETPACK==
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.gms:play-services-games:21.0.0' // ==GOOGLEPLAYGAMESERVICES==
}

View File

@@ -0,0 +1 @@
../../../AndroidManifest.xml

1
project/app/src/main/assets Symbolic link
View File

@@ -0,0 +1 @@
../../../assets

1
project/app/src/main/java Symbolic link
View File

@@ -0,0 +1 @@
../../../src/

View File

@@ -0,0 +1 @@
../../../libs/

1
project/app/src/main/res Symbolic link
View File

@@ -0,0 +1 @@
../../../res

View File

@@ -0,0 +1,8 @@
apply plugin: 'com.android.asset-pack'
assetPack {
packName = "assetpack"
dynamicDelivery {
deliveryType = "install-time"
}
}

View File

@@ -0,0 +1 @@
../../../jni/application/src/AndroidData/assetpack

17
project/build.gradle Normal file
View File

@@ -0,0 +1,17 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

View File

@@ -1,92 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="MainActivity" default="help">
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<property file="local.properties" />
<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
This is the place to change some Ant specific build properties.
Here are some properties you may want to change/update:
source.dir
The name of the source directory. Default is 'src'.
out.dir
The name of the output directory. Default is 'bin'.
For other overridable properties, look at the beginning of the rules
files in the SDK, at tools/ant/build.xml
Properties related to the SDK location or the project target should
be updated using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems.
-->
<property file="ant.properties" />
<!-- if sdk.dir was not set from one of the property file, then
get it from the ANDROID_HOME env var.
This must be done before we load project.properties since
the proguard config can use sdk.dir -->
<property environment="env" />
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
<isset property="env.ANDROID_HOME" />
</condition>
<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.
This contains project specific properties such as project target, and library
dependencies. Lower level build properties are stored in ant.properties
(or in .classpath for Eclipse projects).
This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" />
<!-- quick check on sdk.dir -->
<fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
unless="sdk.dir"
/>
<!--
Import per project custom build rules if present at the root of the project.
This is the place to put custom intermediary targets such as:
-pre-build
-pre-compile
-post-compile (This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir})
-post-package
-post-build
-pre-clean
-->
<import file="custom_rules.xml" optional="true" />
<!-- Import the actual build file.
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<import> task.
- customize it to your needs.
- Customize the whole content of build.xml
- copy/paste the content of the rules files (minus the top node)
into this file, replacing the <import> task.
- customize to your needs.
***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
in order to avoid having your file be overridden by tools such as "android update project"
-->
<!-- version-tag: 1 -->
<import file="${sdk.dir}/tools/ant/build.xml" />
</project>

19
project/gradle.properties Normal file
View File

@@ -0,0 +1,19 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

Binary file not shown.

View File

@@ -0,0 +1,6 @@
#Sat Nov 27 22:44:43 EET 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

185
project/gradlew vendored Executable file
View File

@@ -0,0 +1,185 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# 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
#
# https://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.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

89
project/gradlew.bat vendored Normal file
View File

@@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -29,6 +29,7 @@ import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.os.Environment;
import android.view.View;
import android.widget.TextView;
import java.net.URLConnection;
@@ -52,10 +53,16 @@ import java.util.Arrays;
import android.text.SpannedString;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.Manifest;
import android.content.pm.PackageManager;
import android.os.storage.StorageManager;
import android.os.storage.OnObbStateChangeListener;
import android.content.res.AssetManager;
import android.content.pm.PackageManager;
import android.content.pm.ApplicationInfo;
class CountingInputStream extends BufferedInputStream
{
@@ -170,7 +177,6 @@ class DataDownloader extends Thread
{
Parent = _Parent;
Status = new StatusWriter( _Status, _Parent );
//Status.setText( "Connecting to " + Globals.DataDownloadUrl );
outFilesDir = Globals.DataDir;
DownloadComplete = false;
this.start();
@@ -186,7 +192,6 @@ class DataDownloader extends Thread
@Override
public void run()
{
Parent.keyListener = new BackKeyListener(Parent);
String [] downloadFiles = Globals.DataDownloadUrl;
int total = 0;
int count = 0;
@@ -209,7 +214,16 @@ class DataDownloader extends Thread
downloadFiles[i].contains("<ARCH>") &&
! DownloadDataFile(downloadFiles[i].replace("<ARCH>", android.os.Build.CPU_ABI2), DOWNLOAD_FLAG_FILENAME + String.valueOf(i) + ".flag", count+1, total, i) ) )
{
DownloadFailed = true;
if (!Parent.getFilesDir().getAbsolutePath().equals(Globals.DataDir))
{
Globals.DataDir = Parent.getFilesDir().getAbsolutePath();
Globals.DownloadToSdcard = false;
Log.i("SDL", "Switching download destination directory to internal storage and restarting the app: " + Globals.DataDir);
Settings.Save(Parent);
Intent intent = new Intent(Parent, RestartMainActivity.class);
Parent.startActivity(intent);
System.exit(0);
}
return;
}
}
@@ -217,7 +231,6 @@ class DataDownloader extends Thread
}
}
DownloadComplete = true;
Parent.keyListener = null;
initParent();
}
@@ -261,20 +274,6 @@ class DataDownloader extends Thread
if( ! matched )
throw new IOException();
Status.setText( res.getString(R.string.download_unneeded) );
for( int i = 1; i < downloadUrls.length; i++ )
{
if( downloadUrls[i].indexOf("obb:") == 0 ) // APK expansion file provided by Google Play
{
String url = getObbFilePath(downloadUrls[i]);
if (new File(url).length() > 256)
{
Writer writer = new OutputStreamWriter(new FileOutputStream(url), "UTF-8");
writer.write("Extracted and truncated\n");
writer.close();
Log.i("SDL", "Truncated file from expansion: " + url);
}
}
}
return true;
} catch ( IOException e ) {
forceOverwrite = true;
@@ -287,7 +286,7 @@ class DataDownloader extends Thread
Log.i("SDL", "Downloading data to: '" + outFilesDir + "'");
try {
File outDir = new File( outFilesDir );
if( !(outDir.exists() && outDir.isDirectory()) )
if( !outDir.exists() )
outDir.mkdirs();
OutputStream out = new FileOutputStream( getOutFilePath(".nomedia") );
out.flush();
@@ -304,6 +303,9 @@ class DataDownloader extends Thread
boolean DoNotUnzip = false;
boolean FileInAssets = false;
boolean FileInExpansion = false;
boolean MountObb = false;
final boolean[] ObbMounted = new boolean[] { false };
final boolean[] ObbMountedError = new boolean[] { false };
String url = "";
int downloadUrlIndex = 1;
@@ -329,31 +331,61 @@ class DataDownloader extends Thread
partialDownloadLen = partialDownload.length();
}
Status.setText( downloadCount + "/" + downloadTotal + ": " + res.getString(R.string.connecting_to, url) );
if( url.indexOf("obb:") == 0 ) // APK expansion file provided by Google Play
if( url.equals("assetpack") )
{
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M)
if( Parent.assetPackPath != null )
{
int permissionCheck = Parent.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE);
if (permissionCheck != PackageManager.PERMISSION_GRANTED && !Parent.writeExternalStoragePermissionDialogAnswered)
{
Parent.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
while( !Parent.writeExternalStoragePermissionDialogAnswered )
{
try{ Thread.sleep(300); } catch (InterruptedException e) {}
}
}
Log.i("SDL", "Found asset pack: " + Parent.assetPackPath);
return true;
}
Log.i("SDL", "Asset pack is not installed");
downloadUrlIndex++;
continue;
}
else if( url.indexOf("obb:") == 0 || url.indexOf("mnt:") == 0 ) // APK expansion file provided by Google Play
{
boolean tmpMountObb = ( url.indexOf("mnt:") == 0 );
url = getObbFilePath(url);
InputStream stream1 = null;
try {
stream1 = new FileInputStream(url);
stream1.read();
stream1.close();
Log.i("SDL", "Fetching file from expansion: " + url);
FileInExpansion = true;
MountObb = tmpMountObb;
break;
} catch( Exception e ) {
} catch( IOException ee ) {
Log.i("SDL", "Failed to open file, requesting storage read permission: " + url);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M)
{
int permissionCheck = Parent.checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE);
if (permissionCheck != PackageManager.PERMISSION_GRANTED && !Parent.readExternalStoragePermissionDialogAnswered)
{
Parent.requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 0);
while( !Parent.readExternalStoragePermissionDialogAnswered )
{
try{ Thread.sleep(300); } catch (InterruptedException e) {}
}
}
}
} catch( Exception eee ) {
Log.i("SDL", "Failed to open file: " + url);
downloadUrlIndex++;
continue;
}
try {
stream1 = new FileInputStream(url);
stream1.read();
stream1.close();
Log.i("SDL", "Fetching file from expansion: " + url);
FileInExpansion = true;
MountObb = tmpMountObb;
break;
} catch( Exception eee ) {
Log.i("SDL", "Failed to open file: " + url);
downloadUrlIndex++;
continue;
@@ -422,6 +454,51 @@ class DataDownloader extends Thread
}
}
if( MountObb )
{
Log.i("SDL", "Mounting OBB file: " + url);
StorageManager sm = (StorageManager) Parent.getSystemService(Context.STORAGE_SERVICE);
if( !sm.mountObb(url, null, new OnObbStateChangeListener()
{
public void onObbStateChange(String path, int state)
{
if (state == OnObbStateChangeListener.MOUNTED ||
state == OnObbStateChangeListener.ERROR_ALREADY_MOUNTED)
{
ObbMounted[0] = true;
}
else
{
ObbMountedError[0] = true;
}
}
}) )
{
Log.i("SDL", "Cannot mount OBB file '" + url + "'");
Status.setText( res.getString(R.string.error_dl_from, url) );
return false;
}
while( !ObbMounted[0] )
{
try{ Thread.sleep(300); } catch (InterruptedException e) {}
if( ObbMountedError[0] )
{
Log.i("SDL", "Cannot mount OBB file '" + url + "'");
Status.setText( res.getString(R.string.error_dl_from, url) );
return false;
}
}
Parent.ObbMountPath = sm.getMountedObbPath(url);
if( Parent.ObbMountPath == null )
{
Log.i("SDL", "Cannot mount OBB file '" + url + "'");
Status.setText( res.getString(R.string.error_dl_from, url) );
return false;
}
Log.i("SDL", "Mounted OBB file '" + url + "' to path " + Parent.ObbMountPath);
return true;
}
if( FileInExpansion )
{
Log.i("SDL", "Count file size: '" + url);
@@ -513,15 +590,7 @@ class DataDownloader extends Thread
try {
stream.close();
if( FileInExpansion )
{
Writer writer = new OutputStreamWriter(new FileOutputStream(url), "UTF-8");
writer.write("Extracted and truncated\n");
writer.close();
Log.i("SDL", "Truncated file from expansion: " + url);
}
} catch( java.io.IOException e ) {
Log.i("SDL", "Error truncating file from expansion: " + url);
};
return true;
@@ -781,7 +850,7 @@ class DataDownloader extends Thread
public MainActivity Parent;
public void run()
{
Parent.initSDL();
Parent.downloadFinishedInitSDL();
}
}
Callback cb = new Callback();
@@ -799,57 +868,13 @@ class DataDownloader extends Thread
private String getObbFilePath(final String url)
{
// "obb:" or "mnt:" - same length
return Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/obb/" +
Parent.getPackageName() + "/" + url.substring("obb:".length()) + "." + Parent.getPackageName() + ".obb";
}
public class BackKeyListener implements MainActivity.KeyEventsListener
{
MainActivity p;
public BackKeyListener(MainActivity _p)
{
p = _p;
}
public void onKeyEvent(final int keyCode)
{
if( DownloadFailed )
System.exit(1);
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.cancel_download));
builder.setMessage(p.getResources().getString(R.string.cancel_download) + (DownloadCanBeResumed ? " " + p.getResources().getString(R.string.cancel_download_resume) : ""));
builder.setPositiveButton(p.getResources().getString(R.string.yes), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
System.exit(1);
dialog.dismiss();
}
});
builder.setNegativeButton(p.getResources().getString(R.string.no), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
public StatusWriter Status;
public boolean DownloadComplete = false;
public boolean DownloadFailed = false;
public boolean DownloadCanBeResumed = false;
private MainActivity Parent;
private String outFilesDir = null;

View File

@@ -92,6 +92,8 @@ import android.inputmethodservice.Keyboard;
import android.app.Notification;
import android.app.PendingIntent;
import android.widget.RemoteViews;
import android.os.Build;
import android.app.NotificationChannel;
public class DummyService extends Service
{
@@ -110,13 +112,29 @@ public class DummyService extends Service
System.exit(0);
}
Log.v("SDL", "Starting dummy service - displaying notification");
Notification ntf = new Notification();
ntf.icon = R.drawable.icon;
ntf.flags |= Notification.FLAG_NO_CLEAR;
Notification.Builder builder;
if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.O )
{
String channelId = "app_running_ntf";
NotificationChannel channel = new NotificationChannel(channelId,
getString(R.string.notification_app_is_running, getString(getApplicationInfo().labelRes)),
NotificationManager.IMPORTANCE_LOW);
NotificationManager mgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mgr.createNotificationChannel(channel);
builder = new Notification.Builder(this, channelId);
}
else
{
builder = new Notification.Builder(this);
}
Notification ntf = builder
.setSmallIcon(R.drawable.icon)
.setTicker(getString(getApplicationInfo().labelRes))
.setOngoing(true)
.build();
PendingIntent killIntent = PendingIntent.getService(this, 5, new Intent(Intent.ACTION_DELETE, null, this, DummyService.class), PendingIntent.FLAG_CANCEL_CURRENT);
PendingIntent showIntent = PendingIntent.getActivity(this, 0, new Intent("", null, this, MainActivity.class), PendingIntent.FLAG_CANCEL_CURRENT);
ntf.deleteIntent = killIntent;
ntf.tickerText = getString(getApplicationInfo().labelRes);
RemoteViews view = new RemoteViews(getPackageName(), R.layout.notification);
view.setCharSequence(R.id.notificationText, "setText", getString(R.string.notification_app_is_running, getString(getApplicationInfo().labelRes)));
view.setOnClickPendingIntent(R.id.notificationText, showIntent);

View File

@@ -40,6 +40,7 @@ import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.app.KeyguardManager;
import android.graphics.Rect;
/**
* An implementation of SurfaceView that uses the dedicated surface for
@@ -1015,7 +1016,7 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
mRenderMode = RENDERMODE_CONTINUOUSLY;
mRenderer = renderer;
mRenderer.setSwapBuffersCallback(this);
setName("GLThread");
setName("SDLVideoThread");
}
@Override

View File

@@ -32,9 +32,14 @@ class Globals
public static String ApplicationName = "CommanderGenius";
public static String AppLibraries[] = { "sdl-1.2", };
public static String AppMainLibraries[] = { "application", "sdl_main" };
public static String LibraryNamesMap[][] = { { "crypto", "crypto.so.sdl.1" }, { "ssl", "ssl.so.sdl.1" }, { "curl", "curl-sdl" } }; // Because some libraries are named differently to not clash with system libs
public static final boolean Using_SDL_1_3 = false;
public static final boolean Using_SDL_2_0 = false;
public static String LibraryNamesMap[][] = {
{ "crypto", "crypto.so.sdl.1" },
{ "ssl", "ssl.so.sdl.1" },
{ "curl", "curl-sdl" },
{ "expat", "expat-sdl" },
{ "sqlite3", "sqlite3-sdl" },
}; // Because some libraries are named differently to not clash with system libs
public static final boolean UsingSDL2 = false;
public static String[] DataDownloadUrl = { "Data files are 2 Mb|https://sourceforge.net/projects/libsdl-android/files/CommanderGenius/commandergenius-data.zip/download", "High-quality GFX and music - 40 Mb|https://sourceforge.net/projects/libsdl-android/files/CommanderGenius/commandergenius-hqp.zip/download" };
public static boolean SwVideoMode = false;
public static boolean NeedDepthBuffer = false;
@@ -42,7 +47,7 @@ class Globals
public static boolean NeedGles2 = false;
public static boolean NeedGles3 = false;
public static boolean CompatibilityHacksVideo = false;
public static boolean CompatibilityHacksForceScreenUpdateMouseClick = true;
public static boolean CompatibilityHacksForceScreenUpdateMouseClick = false;
public static boolean CompatibilityHacksStaticInit = false;
public static boolean CompatibilityHacksTextInputEmulatesHwKeyboard = false;
public static int TextInputKeyboard = 0;
@@ -85,13 +90,15 @@ class Globals
public static boolean HorizontalOrientation = true;
public static boolean AutoDetectOrientation = false;
public static boolean ImmersiveMode = true;
public static boolean DrawInDisplayCutout = false;
public static boolean HideSystemMousePointer = false;
public static boolean DownloadToSdcard = true;
public static boolean PhoneHasArrowKeys = false;
public static boolean UseAccelerometerAsArrowKeys = false;
public static boolean UseTouchscreenKeyboard = true;
public static int TouchscreenKeyboardSize = 1;
public static final int TOUCHSCREEN_KEYBOARD_CUSTOM = 4;
public static int TouchscreenKeyboardDrawSize = 1;
public static int TouchscreenKeyboardDrawSize = 2;
public static int TouchscreenKeyboardTheme = 2;
public static int TouchscreenKeyboardTransparency = 2;
public static boolean FloatingScreenJoystick = false;
@@ -124,12 +131,66 @@ class Globals
public static boolean KeepAspectRatio = KeepAspectRatioDefaultSetting;
public static boolean TvBorders = true;
public static int RemapHwKeycode[] = new int[SDL_Keys.JAVA_KEYCODE_LAST];
public static int RemapScreenKbKeycode[] = new int[6];
public static int ScreenKbControlsLayout[][] = AppUsesThirdJoystick ? // Values for 800x480 resolution
new int[][] { { 0, 303, 177, 480 }, { 0, 0, 48, 48 }, { 400, 392, 488, 480 }, { 312, 392, 400, 480 }, { 400, 304, 488, 392 }, { 312, 304, 400, 392 }, { 400, 216, 488, 304 }, { 312, 216, 400, 304 }, { 623, 303, 800, 480 }, { 623, 126, 800, 303 } } :
AppUsesSecondJoystick ?
new int[][] { { 0, 303, 177, 480 }, { 0, 0, 48, 48 }, { 400, 392, 488, 480 }, { 312, 392, 400, 480 }, { 400, 304, 488, 392 }, { 312, 304, 400, 392 }, { 400, 216, 488, 304 }, { 312, 216, 400, 304 }, { 623, 303, 800, 480 } } :
new int[][] { { 0, 303, 177, 480 }, { 0, 0, 48, 48 }, { 712, 392, 800, 480 }, { 624, 392, 712, 480 }, { 712, 304, 800, 392 }, { 624, 304, 712, 392 }, { 712, 216, 800, 304 }, { 624, 216, 712, 304 } };
public static int RemapScreenKbKeycode[] = new int[12];
// Values for 800x480 resolution
public static int ScreenKbControlsLayout[][] =
AppUsesThirdJoystick ? new int[][]
{
{ 0, 303, 177, 480 }, // Main joystick/DPAD
{ 0, 0, 48, 48 }, // Text input button
{ 400, 392, 488, 480 }, // Button 0
{ 312, 392, 400, 480 }, // Button 1
{ 400, 304, 488, 392 }, // Button 2
{ 312, 304, 400, 392 }, // Button 3
{ 400, 216, 488, 304 }, // Button 4
{ 312, 216, 400, 304 }, // Button 5
{ 623, 303, 800, 480 }, // Joystick 2
{ 623, 126, 800, 303 }, // Joystick 3
{ 400, 392, 488, 480 }, // Button 6 - copy of button 0, to be redefined in the code
{ 312, 392, 400, 480 }, // Button 7 - copy of button 1, to be redefined in the code
{ 400, 304, 488, 392 }, // Button 8 - copy of button 2, to be redefined in the code
{ 312, 304, 400, 392 }, // Button 9 - copy of button 3, to be redefined in the code
{ 400, 216, 488, 304 }, // Button 10 - copy of button 4, to be redefined in the code
{ 312, 216, 400, 304 }, // Button 11 - copy of button 5, to be redefined in the code
}
: AppUsesSecondJoystick ? new int[][]
{
{ 0, 303, 177, 480 }, // Main joystick/DPAD
{ 0, 0, 48, 48 }, // Text input button
{ 400, 392, 488, 480 }, // Button 0
{ 312, 392, 400, 480 }, // Button 1
{ 400, 304, 488, 392 }, // Button 2
{ 312, 304, 400, 392 }, // Button 3
{ 400, 216, 488, 304 }, // Button 4
{ 312, 216, 400, 304 }, // Button 5
{ 623, 303, 800, 480 }, // Joystick 2
{ 0, 0, 0, 0, }, // Joystick 3
{ 400, 392, 488, 480 }, // Button 6 - copy of button 0, to be redefined in the code
{ 312, 392, 400, 480 }, // Button 7 - copy of button 1, to be redefined in the code
{ 400, 304, 488, 392 }, // Button 8 - copy of button 2, to be redefined in the code
{ 312, 304, 400, 392 }, // Button 9 - copy of button 3, to be redefined in the code
{ 400, 216, 488, 304 }, // Button 10 - copy of button 4, to be redefined in the code
{ 312, 216, 400, 304 }, // Button 11 - copy of button 5, to be redefined in the code
}
: new int[][]
{
{ 0, 303, 177, 480 }, // Main joystick/DPAD
{ 0, 0, 48, 48 }, // Text input button
{ 712, 392, 800, 480 }, // Button 0
{ 624, 392, 712, 480 }, // Button 1
{ 712, 304, 800, 392 }, // Button 2
{ 624, 304, 712, 392 }, // Button 3
{ 712, 216, 800, 304 }, // Button 4
{ 624, 216, 712, 304 }, // Button 5
{ 0, 0, 0, 0, }, // Joystick 2
{ 0, 0, 0, 0, }, // Joystick 3
{ 536, 392, 624, 480 }, // Button 6
{ 448, 392, 536, 480 }, // Button 7
{ 536, 304, 624, 392 }, // Button 8
{ 448, 304, 536, 392 }, // Button 9
{ 536, 216, 624, 304 }, // Button 10
{ 448, 216, 536, 304 }, // Button 11
};
public static boolean ScreenKbControlsShown[] = new boolean[ScreenKbControlsLayout.length]; /* Also joystick and text input button added */
public static int RemapMultitouchGestureKeycode[] = new int[4];
public static boolean MultitouchGesturesUsed[] = new boolean[4];

View File

@@ -1,614 +0,0 @@
/*
Simple DirectMedia Layer
Java source code (C) 2009-2014 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package net.sourceforge.clonekeenplus;
import java.lang.String;
import java.util.ArrayList;
import java.util.Arrays;
import java.lang.reflect.Field;
// Autogenerated by hand with a command:
// grep 'SDLK_' SDL_keysym.h | sed 's/SDLK_\([a-zA-Z0-9_]\+\).*[=] \([0-9]\+\).*/public static final int SDLK_\1 = \2;/' >> Keycodes.java
class SDL_1_2_Keycodes
{
public static final int SDLK_UNKNOWN = 0;
public static final int SDLK_BACKSPACE = 8;
public static final int SDLK_TAB = 9;
public static final int SDLK_CLEAR = 12;
public static final int SDLK_RETURN = 13;
public static final int SDLK_PAUSE = 19;
public static final int SDLK_ESCAPE = 27;
public static final int SDLK_SPACE = 32;
public static final int SDLK_EXCLAIM = 33;
public static final int SDLK_QUOTEDBL = 34;
public static final int SDLK_HASH = 35;
public static final int SDLK_DOLLAR = 36;
public static final int SDLK_AMPERSAND = 38;
public static final int SDLK_QUOTE = 39;
public static final int SDLK_LEFTPAREN = 40;
public static final int SDLK_RIGHTPAREN = 41;
public static final int SDLK_ASTERISK = 42;
public static final int SDLK_PLUS = 43;
public static final int SDLK_COMMA = 44;
public static final int SDLK_MINUS = 45;
public static final int SDLK_PERIOD = 46;
public static final int SDLK_SLASH = 47;
public static final int SDLK_0 = 48;
public static final int SDLK_1 = 49;
public static final int SDLK_2 = 50;
public static final int SDLK_3 = 51;
public static final int SDLK_4 = 52;
public static final int SDLK_5 = 53;
public static final int SDLK_6 = 54;
public static final int SDLK_7 = 55;
public static final int SDLK_8 = 56;
public static final int SDLK_9 = 57;
public static final int SDLK_COLON = 58;
public static final int SDLK_SEMICOLON = 59;
public static final int SDLK_LESS = 60;
public static final int SDLK_EQUALS = 61;
public static final int SDLK_GREATER = 62;
public static final int SDLK_QUESTION = 63;
public static final int SDLK_AT = 64;
public static final int SDLK_LEFTBRACKET = 91;
public static final int SDLK_BACKSLASH = 92;
public static final int SDLK_RIGHTBRACKET = 93;
public static final int SDLK_CARET = 94;
public static final int SDLK_UNDERSCORE = 95;
public static final int SDLK_BACKQUOTE = 96;
public static final int SDLK_a = 97;
public static final int SDLK_b = 98;
public static final int SDLK_c = 99;
public static final int SDLK_d = 100;
public static final int SDLK_e = 101;
public static final int SDLK_f = 102;
public static final int SDLK_g = 103;
public static final int SDLK_h = 104;
public static final int SDLK_i = 105;
public static final int SDLK_j = 106;
public static final int SDLK_k = 107;
public static final int SDLK_l = 108;
public static final int SDLK_m = 109;
public static final int SDLK_n = 110;
public static final int SDLK_o = 111;
public static final int SDLK_p = 112;
public static final int SDLK_q = 113;
public static final int SDLK_r = 114;
public static final int SDLK_s = 115;
public static final int SDLK_t = 116;
public static final int SDLK_u = 117;
public static final int SDLK_v = 118;
public static final int SDLK_w = 119;
public static final int SDLK_x = 120;
public static final int SDLK_y = 121;
public static final int SDLK_z = 122;
public static final int SDLK_DELETE = 127;
public static final int SDLK_WORLD_0 = 160;
public static final int SDLK_WORLD_1 = 161;
public static final int SDLK_WORLD_2 = 162;
public static final int SDLK_WORLD_3 = 163;
public static final int SDLK_WORLD_4 = 164;
public static final int SDLK_WORLD_5 = 165;
public static final int SDLK_WORLD_6 = 166;
public static final int SDLK_WORLD_7 = 167;
public static final int SDLK_WORLD_8 = 168;
public static final int SDLK_WORLD_9 = 169;
public static final int SDLK_WORLD_10 = 170;
public static final int SDLK_WORLD_11 = 171;
public static final int SDLK_WORLD_12 = 172;
public static final int SDLK_WORLD_13 = 173;
public static final int SDLK_WORLD_14 = 174;
public static final int SDLK_WORLD_15 = 175;
public static final int SDLK_WORLD_16 = 176;
public static final int SDLK_WORLD_17 = 177;
public static final int SDLK_WORLD_18 = 178;
public static final int SDLK_WORLD_19 = 179;
public static final int SDLK_WORLD_20 = 180;
public static final int SDLK_WORLD_21 = 181;
public static final int SDLK_WORLD_22 = 182;
public static final int SDLK_WORLD_23 = 183;
public static final int SDLK_WORLD_24 = 184;
public static final int SDLK_WORLD_25 = 185;
public static final int SDLK_WORLD_26 = 186;
public static final int SDLK_WORLD_27 = 187;
public static final int SDLK_WORLD_28 = 188;
public static final int SDLK_WORLD_29 = 189;
public static final int SDLK_WORLD_30 = 190;
public static final int SDLK_WORLD_31 = 191;
public static final int SDLK_WORLD_32 = 192;
public static final int SDLK_WORLD_33 = 193;
public static final int SDLK_WORLD_34 = 194;
public static final int SDLK_WORLD_35 = 195;
public static final int SDLK_WORLD_36 = 196;
public static final int SDLK_WORLD_37 = 197;
public static final int SDLK_WORLD_38 = 198;
public static final int SDLK_WORLD_39 = 199;
public static final int SDLK_WORLD_40 = 200;
public static final int SDLK_WORLD_41 = 201;
public static final int SDLK_WORLD_42 = 202;
public static final int SDLK_WORLD_43 = 203;
public static final int SDLK_WORLD_44 = 204;
public static final int SDLK_WORLD_45 = 205;
public static final int SDLK_WORLD_46 = 206;
public static final int SDLK_WORLD_47 = 207;
public static final int SDLK_WORLD_48 = 208;
public static final int SDLK_WORLD_49 = 209;
public static final int SDLK_WORLD_50 = 210;
public static final int SDLK_WORLD_51 = 211;
public static final int SDLK_WORLD_52 = 212;
public static final int SDLK_WORLD_53 = 213;
public static final int SDLK_WORLD_54 = 214;
public static final int SDLK_WORLD_55 = 215;
public static final int SDLK_WORLD_56 = 216;
public static final int SDLK_WORLD_57 = 217;
public static final int SDLK_WORLD_58 = 218;
public static final int SDLK_WORLD_59 = 219;
public static final int SDLK_WORLD_60 = 220;
public static final int SDLK_WORLD_61 = 221;
public static final int SDLK_WORLD_62 = 222;
public static final int SDLK_WORLD_63 = 223;
public static final int SDLK_WORLD_64 = 224;
public static final int SDLK_WORLD_65 = 225;
public static final int SDLK_WORLD_66 = 226;
public static final int SDLK_WORLD_67 = 227;
public static final int SDLK_WORLD_68 = 228;
public static final int SDLK_WORLD_69 = 229;
public static final int SDLK_WORLD_70 = 230;
public static final int SDLK_WORLD_71 = 231;
public static final int SDLK_WORLD_72 = 232;
public static final int SDLK_WORLD_73 = 233;
public static final int SDLK_WORLD_74 = 234;
public static final int SDLK_WORLD_75 = 235;
public static final int SDLK_WORLD_76 = 236;
public static final int SDLK_WORLD_77 = 237;
public static final int SDLK_WORLD_78 = 238;
public static final int SDLK_WORLD_79 = 239;
public static final int SDLK_WORLD_80 = 240;
public static final int SDLK_WORLD_81 = 241;
public static final int SDLK_WORLD_82 = 242;
public static final int SDLK_WORLD_83 = 243;
public static final int SDLK_WORLD_84 = 244;
public static final int SDLK_WORLD_85 = 245;
public static final int SDLK_WORLD_86 = 246;
public static final int SDLK_WORLD_87 = 247;
public static final int SDLK_WORLD_88 = 248;
public static final int SDLK_WORLD_89 = 249;
public static final int SDLK_WORLD_90 = 250;
public static final int SDLK_WORLD_91 = 251;
public static final int SDLK_WORLD_92 = 252;
public static final int SDLK_WORLD_93 = 253;
public static final int SDLK_WORLD_94 = 254;
public static final int SDLK_WORLD_95 = 255;
public static final int SDLK_KP0 = 256;
public static final int SDLK_KP1 = 257;
public static final int SDLK_KP2 = 258;
public static final int SDLK_KP3 = 259;
public static final int SDLK_KP4 = 260;
public static final int SDLK_KP5 = 261;
public static final int SDLK_KP6 = 262;
public static final int SDLK_KP7 = 263;
public static final int SDLK_KP8 = 264;
public static final int SDLK_KP9 = 265;
public static final int SDLK_KP_PERIOD = 266;
public static final int SDLK_KP_DIVIDE = 267;
public static final int SDLK_KP_MULTIPLY = 268;
public static final int SDLK_KP_MINUS = 269;
public static final int SDLK_KP_PLUS = 270;
public static final int SDLK_KP_ENTER = 271;
public static final int SDLK_KP_EQUALS = 272;
public static final int SDLK_UP = 273;
public static final int SDLK_DOWN = 274;
public static final int SDLK_RIGHT = 275;
public static final int SDLK_LEFT = 276;
public static final int SDLK_INSERT = 277;
public static final int SDLK_HOME = 278;
public static final int SDLK_END = 279;
public static final int SDLK_PAGEUP = 280;
public static final int SDLK_PAGEDOWN = 281;
public static final int SDLK_F1 = 282;
public static final int SDLK_F2 = 283;
public static final int SDLK_F3 = 284;
public static final int SDLK_F4 = 285;
public static final int SDLK_F5 = 286;
public static final int SDLK_F6 = 287;
public static final int SDLK_F7 = 288;
public static final int SDLK_F8 = 289;
public static final int SDLK_F9 = 290;
public static final int SDLK_F10 = 291;
public static final int SDLK_F11 = 292;
public static final int SDLK_F12 = 293;
public static final int SDLK_F13 = 294;
public static final int SDLK_F14 = 295;
public static final int SDLK_F15 = 296;
public static final int SDLK_NUMLOCK = 300;
public static final int SDLK_CAPSLOCK = 301;
public static final int SDLK_SCROLLOCK = 302;
public static final int SDLK_RSHIFT = 303;
public static final int SDLK_LSHIFT = 304;
public static final int SDLK_RCTRL = 305;
public static final int SDLK_LCTRL = 306;
public static final int SDLK_RALT = 307;
public static final int SDLK_LALT = 308;
public static final int SDLK_RMETA = 309;
public static final int SDLK_LMETA = 310;
public static final int SDLK_LSUPER = 311;
public static final int SDLK_RSUPER = 312;
public static final int SDLK_MODE = 313;
public static final int SDLK_COMPOSE = 314;
public static final int SDLK_HELP = 315;
public static final int SDLK_PRINT = 316;
public static final int SDLK_SYSREQ = 317;
public static final int SDLK_BREAK = 318;
public static final int SDLK_MENU = 319;
public static final int SDLK_POWER = 320;
public static final int SDLK_EURO = 321;
public static final int SDLK_UNDO = 322;
// Mouse buttons can be mapped to on-screen keys
public static final int SDLK_MOUSE_LEFT = 500;
public static final int SDLK_MOUSE_MIDDLE = 501;
public static final int SDLK_MOUSE_RIGHT = 502;
public static final int SDLK_MOUSE_WHEEL_UP = 503;
public static final int SDLK_MOUSE_WHEEL_DOWN = 504;
public static final int SDLK_MOUSE_X1 = 505;
public static final int SDLK_MOUSE_X2 = 506;
public static final int SDLK_NO_REMAP = 512;
}
// Autogenerated by hand with a command:
// grep 'SDL_SCANCODE_' SDL_scancode.h | sed 's/SDL_SCANCODE_\([a-zA-Z0-9_]\+\).*[=] \([0-9]\+\).*/public static final int SDLK_\1 = \2;/' >> Keycodes.java
class SDL_1_3_Keycodes
{
public static final int SDLK_UNKNOWN = 0;
public static final int SDLK_A = 4;
public static final int SDLK_B = 5;
public static final int SDLK_C = 6;
public static final int SDLK_D = 7;
public static final int SDLK_E = 8;
public static final int SDLK_F = 9;
public static final int SDLK_G = 10;
public static final int SDLK_H = 11;
public static final int SDLK_I = 12;
public static final int SDLK_J = 13;
public static final int SDLK_K = 14;
public static final int SDLK_L = 15;
public static final int SDLK_M = 16;
public static final int SDLK_N = 17;
public static final int SDLK_O = 18;
public static final int SDLK_P = 19;
public static final int SDLK_Q = 20;
public static final int SDLK_R = 21;
public static final int SDLK_S = 22;
public static final int SDLK_T = 23;
public static final int SDLK_U = 24;
public static final int SDLK_V = 25;
public static final int SDLK_W = 26;
public static final int SDLK_X = 27;
public static final int SDLK_Y = 28;
public static final int SDLK_Z = 29;
public static final int SDLK_1 = 30;
public static final int SDLK_2 = 31;
public static final int SDLK_3 = 32;
public static final int SDLK_4 = 33;
public static final int SDLK_5 = 34;
public static final int SDLK_6 = 35;
public static final int SDLK_7 = 36;
public static final int SDLK_8 = 37;
public static final int SDLK_9 = 38;
public static final int SDLK_0 = 39;
public static final int SDLK_RETURN = 40;
public static final int SDLK_ESCAPE = 41;
public static final int SDLK_BACKSPACE = 42;
public static final int SDLK_TAB = 43;
public static final int SDLK_SPACE = 44;
public static final int SDLK_MINUS = 45;
public static final int SDLK_EQUALS = 46;
public static final int SDLK_LEFTBRACKET = 47;
public static final int SDLK_RIGHTBRACKET = 48;
public static final int SDLK_BACKSLASH = 49;
public static final int SDLK_NONUSHASH = 50;
public static final int SDLK_SEMICOLON = 51;
public static final int SDLK_APOSTROPHE = 52;
public static final int SDLK_GRAVE = 53;
public static final int SDLK_COMMA = 54;
public static final int SDLK_PERIOD = 55;
public static final int SDLK_SLASH = 56;
public static final int SDLK_CAPSLOCK = 57;
public static final int SDLK_F1 = 58;
public static final int SDLK_F2 = 59;
public static final int SDLK_F3 = 60;
public static final int SDLK_F4 = 61;
public static final int SDLK_F5 = 62;
public static final int SDLK_F6 = 63;
public static final int SDLK_F7 = 64;
public static final int SDLK_F8 = 65;
public static final int SDLK_F9 = 66;
public static final int SDLK_F10 = 67;
public static final int SDLK_F11 = 68;
public static final int SDLK_F12 = 69;
public static final int SDLK_PRINTSCREEN = 70;
public static final int SDLK_SCROLLLOCK = 71;
public static final int SDLK_PAUSE = 72;
public static final int SDLK_INSERT = 73;
public static final int SDLK_HOME = 74;
public static final int SDLK_PAGEUP = 75;
public static final int SDLK_DELETE = 76;
public static final int SDLK_END = 77;
public static final int SDLK_PAGEDOWN = 78;
public static final int SDLK_RIGHT = 79;
public static final int SDLK_LEFT = 80;
public static final int SDLK_DOWN = 81;
public static final int SDLK_UP = 82;
public static final int SDLK_NUMLOCKCLEAR = 83;
public static final int SDLK_KP_DIVIDE = 84;
public static final int SDLK_KP_MULTIPLY = 85;
public static final int SDLK_KP_MINUS = 86;
public static final int SDLK_KP_PLUS = 87;
public static final int SDLK_KP_ENTER = 88;
public static final int SDLK_KP_1 = 89;
public static final int SDLK_KP_2 = 90;
public static final int SDLK_KP_3 = 91;
public static final int SDLK_KP_4 = 92;
public static final int SDLK_KP_5 = 93;
public static final int SDLK_KP_6 = 94;
public static final int SDLK_KP_7 = 95;
public static final int SDLK_KP_8 = 96;
public static final int SDLK_KP_9 = 97;
public static final int SDLK_KP_0 = 98;
public static final int SDLK_KP_PERIOD = 99;
public static final int SDLK_NONUSBACKSLASH = 100;
public static final int SDLK_APPLICATION = 101;
public static final int SDLK_POWER = 102;
public static final int SDLK_KP_EQUALS = 103;
public static final int SDLK_F13 = 104;
public static final int SDLK_F14 = 105;
public static final int SDLK_F15 = 106;
public static final int SDLK_F16 = 107;
public static final int SDLK_F17 = 108;
public static final int SDLK_F18 = 109;
public static final int SDLK_F19 = 110;
public static final int SDLK_F20 = 111;
public static final int SDLK_F21 = 112;
public static final int SDLK_F22 = 113;
public static final int SDLK_F23 = 114;
public static final int SDLK_F24 = 115;
public static final int SDLK_EXECUTE = 116;
public static final int SDLK_HELP = 117;
public static final int SDLK_MENU = 118;
public static final int SDLK_SELECT = 119;
public static final int SDLK_STOP = 120;
public static final int SDLK_AGAIN = 121;
public static final int SDLK_UNDO = 122;
public static final int SDLK_CUT = 123;
public static final int SDLK_COPY = 124;
public static final int SDLK_PASTE = 125;
public static final int SDLK_FIND = 126;
public static final int SDLK_MUTE = 127;
public static final int SDLK_VOLUMEUP = 128;
public static final int SDLK_VOLUMEDOWN = 129;
public static final int SDLK_KP_COMMA = 133;
public static final int SDLK_KP_EQUALSAS400 = 134;
public static final int SDLK_INTERNATIONAL1 = 135;
public static final int SDLK_INTERNATIONAL2 = 136;
public static final int SDLK_INTERNATIONAL3 = 137;
public static final int SDLK_INTERNATIONAL4 = 138;
public static final int SDLK_INTERNATIONAL5 = 139;
public static final int SDLK_INTERNATIONAL6 = 140;
public static final int SDLK_INTERNATIONAL7 = 141;
public static final int SDLK_INTERNATIONAL8 = 142;
public static final int SDLK_INTERNATIONAL9 = 143;
public static final int SDLK_LANG1 = 144;
public static final int SDLK_LANG2 = 145;
public static final int SDLK_LANG3 = 146;
public static final int SDLK_LANG4 = 147;
public static final int SDLK_LANG5 = 148;
public static final int SDLK_LANG6 = 149;
public static final int SDLK_LANG7 = 150;
public static final int SDLK_LANG8 = 151;
public static final int SDLK_LANG9 = 152;
public static final int SDLK_ALTERASE = 153;
public static final int SDLK_SYSREQ = 154;
public static final int SDLK_CANCEL = 155;
public static final int SDLK_CLEAR = 156;
public static final int SDLK_PRIOR = 157;
public static final int SDLK_RETURN2 = 158;
public static final int SDLK_SEPARATOR = 159;
public static final int SDLK_OUT = 160;
public static final int SDLK_OPER = 161;
public static final int SDLK_CLEARAGAIN = 162;
public static final int SDLK_CRSEL = 163;
public static final int SDLK_EXSEL = 164;
public static final int SDLK_KP_00 = 176;
public static final int SDLK_KP_000 = 177;
public static final int SDLK_THOUSANDSSEPARATOR = 178;
public static final int SDLK_DECIMALSEPARATOR = 179;
public static final int SDLK_CURRENCYUNIT = 180;
public static final int SDLK_CURRENCYSUBUNIT = 181;
public static final int SDLK_KP_LEFTPAREN = 182;
public static final int SDLK_KP_RIGHTPAREN = 183;
public static final int SDLK_KP_LEFTBRACE = 184;
public static final int SDLK_KP_RIGHTBRACE = 185;
public static final int SDLK_KP_TAB = 186;
public static final int SDLK_KP_BACKSPACE = 187;
public static final int SDLK_KP_A = 188;
public static final int SDLK_KP_B = 189;
public static final int SDLK_KP_C = 190;
public static final int SDLK_KP_D = 191;
public static final int SDLK_KP_E = 192;
public static final int SDLK_KP_F = 193;
public static final int SDLK_KP_XOR = 194;
public static final int SDLK_KP_POWER = 195;
public static final int SDLK_KP_PERCENT = 196;
public static final int SDLK_KP_LESS = 197;
public static final int SDLK_KP_GREATER = 198;
public static final int SDLK_KP_AMPERSAND = 199;
public static final int SDLK_KP_DBLAMPERSAND = 200;
public static final int SDLK_KP_VERTICALBAR = 201;
public static final int SDLK_KP_DBLVERTICALBAR = 202;
public static final int SDLK_KP_COLON = 203;
public static final int SDLK_KP_HASH = 204;
public static final int SDLK_KP_SPACE = 205;
public static final int SDLK_KP_AT = 206;
public static final int SDLK_KP_EXCLAM = 207;
public static final int SDLK_KP_MEMSTORE = 208;
public static final int SDLK_KP_MEMRECALL = 209;
public static final int SDLK_KP_MEMCLEAR = 210;
public static final int SDLK_KP_MEMADD = 211;
public static final int SDLK_KP_MEMSUBTRACT = 212;
public static final int SDLK_KP_MEMMULTIPLY = 213;
public static final int SDLK_KP_MEMDIVIDE = 214;
public static final int SDLK_KP_PLUSMINUS = 215;
public static final int SDLK_KP_CLEAR = 216;
public static final int SDLK_KP_CLEARENTRY = 217;
public static final int SDLK_KP_BINARY = 218;
public static final int SDLK_KP_OCTAL = 219;
public static final int SDLK_KP_DECIMAL = 220;
public static final int SDLK_KP_HEXADECIMAL = 221;
public static final int SDLK_LCTRL = 224;
public static final int SDLK_LSHIFT = 225;
public static final int SDLK_LALT = 226;
public static final int SDLK_LGUI = 227;
public static final int SDLK_RCTRL = 228;
public static final int SDLK_RSHIFT = 229;
public static final int SDLK_RALT = 230;
public static final int SDLK_RGUI = 231;
public static final int SDLK_MODE = 257;
public static final int SDLK_AUDIONEXT = 258;
public static final int SDLK_AUDIOPREV = 259;
public static final int SDLK_AUDIOSTOP = 260;
public static final int SDLK_AUDIOPLAY = 261;
public static final int SDLK_AUDIOMUTE = 262;
public static final int SDLK_MEDIASELECT = 263;
public static final int SDLK_WWW = 264;
public static final int SDLK_MAIL = 265;
public static final int SDLK_CALCULATOR = 266;
public static final int SDLK_COMPUTER = 267;
public static final int SDLK_AC_SEARCH = 268;
public static final int SDLK_AC_HOME = 269;
public static final int SDLK_AC_BACK = 270;
public static final int SDLK_AC_FORWARD = 271;
public static final int SDLK_AC_STOP = 272;
public static final int SDLK_AC_REFRESH = 273;
public static final int SDLK_AC_BOOKMARKS = 274;
public static final int SDLK_BRIGHTNESSDOWN = 275;
public static final int SDLK_BRIGHTNESSUP = 276;
public static final int SDLK_DISPLAYSWITCH = 277;
public static final int SDLK_KBDILLUMTOGGLE = 278;
public static final int SDLK_KBDILLUMDOWN = 279;
public static final int SDLK_KBDILLUMUP = 280;
public static final int SDLK_EJECT = 281;
public static final int SDLK_SLEEP = 282;
// Mouse buttons can be mapped to on-screen keys
public static final int SDLK_MOUSE_LEFT = 500;
public static final int SDLK_MOUSE_MIDDLE = 501;
public static final int SDLK_MOUSE_RIGHT = 502;
public static final int SDLK_MOUSE_WHEEL_UP = 503;
public static final int SDLK_MOUSE_WHEEL_DOWN = 504;
public static final int SDLK_MOUSE_X1 = 505;
public static final int SDLK_MOUSE_X2 = 506;
public static final int SDLK_NO_REMAP = 512;
}
class SDL_Keys
{
public static String [] names = null;
public static Integer [] values = null;
public static String [] namesSorted = null;
public static Integer [] namesSortedIdx = null;
public static Integer [] namesSortedBackIdx = null;
static final int JAVA_KEYCODE_LAST = 255; // Android 2.3 added several new gaming keys, Android 3.1 added even more - keep in sync with javakeycodes.h
static String getName(int v)
{
for( int f = 0; f < values.length; f++ )
{
if( values[f] == v )
return names[f];
}
return names[0];
}
static
{
ArrayList<String> Names = new ArrayList<String> ();
ArrayList<Integer> Values = new ArrayList<Integer> ();
Field [] fields = SDL_1_2_Keycodes.class.getDeclaredFields();
if( Globals.Using_SDL_1_3 )
{
fields = SDL_1_3_Keycodes.class.getDeclaredFields();
}
try {
for(Field f: fields)
{
if( !f.getName().startsWith("SDLK_") )
{
continue;
}
Values.add(f.getInt(null));
Names.add(f.getName().substring(5).toUpperCase());
}
} catch(IllegalAccessException e) {};
// Sort by value
for( int i = 0; i < Values.size(); i++ )
{
for( int j = i; j < Values.size(); j++ )
{
if( Values.get(i) > Values.get(j) )
{
int x = Values.get(i);
Values.set(i, Values.get(j));
Values.set(j, x);
String s = Names.get(i);
Names.set(i, Names.get(j));
Names.set(j, s);
}
}
}
names = Names.toArray(new String[0]);
values = Values.toArray(new Integer[0]);
namesSorted = Names.toArray(new String[0]);
namesSortedIdx = new Integer[values.length];
namesSortedBackIdx = new Integer[values.length];
Arrays.sort(namesSorted);
for( int i = 0; i < namesSorted.length; i++ )
{
for( int j = 0; j < namesSorted.length; j++ )
{
if( namesSorted[i].equals( names[j] ) )
{
namesSortedIdx[i] = j;
namesSortedBackIdx[j] = i;
break;
}
}
}
}
}

File diff suppressed because it is too large Load Diff

56
project/java/Mouse.java Normal file
View File

@@ -0,0 +1,56 @@
/*
Simple DirectMedia Layer
Java source code (C) 2009-2014 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package net.sourceforge.clonekeenplus;
class Mouse
{
public static final int LEFT_CLICK_NORMAL = 0;
public static final int LEFT_CLICK_NEAR_CURSOR = 1;
public static final int LEFT_CLICK_WITH_MULTITOUCH = 2;
public static final int LEFT_CLICK_WITH_PRESSURE = 3;
public static final int LEFT_CLICK_WITH_KEY = 4;
public static final int LEFT_CLICK_WITH_TIMEOUT = 5;
public static final int LEFT_CLICK_WITH_TAP = 6;
public static final int LEFT_CLICK_WITH_TAP_OR_TIMEOUT = 7;
public static final int RIGHT_CLICK_NONE = 0;
public static final int RIGHT_CLICK_WITH_MULTITOUCH = 1;
public static final int RIGHT_CLICK_WITH_PRESSURE = 2;
public static final int RIGHT_CLICK_WITH_KEY = 3;
public static final int RIGHT_CLICK_WITH_TIMEOUT = 4;
public static final int SDL_FINGER_DOWN = 0;
public static final int SDL_FINGER_UP = 1;
public static final int SDL_FINGER_MOVE = 2;
public static final int SDL_FINGER_HOVER = 3;
public static final int ZOOM_NONE = 0;
public static final int ZOOM_MAGNIFIER = 1;
public static final int MOUSE_HW_INPUT_FINGER = 0;
public static final int MOUSE_HW_INPUT_STYLUS = 1;
public static final int MOUSE_HW_INPUT_MOUSE = 2;
public static final int MAX_HOVER_DISTANCE = 1024;
public static final int HOVER_REDRAW_SCREEN = 1024 * 10;
public static final float MAX_PRESSURE = 1024.0f;
}

618
project/java/SDL_Keys.java Normal file
View File

@@ -0,0 +1,618 @@
/*
Simple DirectMedia Layer
Java source code (C) 2009-2014 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package net.sourceforge.clonekeenplus;
import java.lang.String;
import java.util.ArrayList;
import java.util.Arrays;
import java.lang.reflect.Field;
// Autogenerated by hand with a command:
// grep 'SDLK_' SDL_keysym.h | sed 's/SDLK_\([a-zA-Z0-9_]\+\).*[=] \([0-9]\+\).*/public static final int SDLK_\1 = \2;/' >> Keycodes.java
class SDL_1_2_Keycodes
{
public static final int SDLK_UNKNOWN = 0;
public static final int SDLK_BACKSPACE = 8;
public static final int SDLK_TAB = 9;
public static final int SDLK_CLEAR = 12;
public static final int SDLK_RETURN = 13;
public static final int SDLK_PAUSE = 19;
public static final int SDLK_ESCAPE = 27;
public static final int SDLK_SPACE = 32;
public static final int SDLK_EXCLAIM = 33;
public static final int SDLK_QUOTEDBL = 34;
public static final int SDLK_HASH = 35;
public static final int SDLK_DOLLAR = 36;
public static final int SDLK_AMPERSAND = 38;
public static final int SDLK_QUOTE = 39;
public static final int SDLK_LEFTPAREN = 40;
public static final int SDLK_RIGHTPAREN = 41;
public static final int SDLK_ASTERISK = 42;
public static final int SDLK_PLUS = 43;
public static final int SDLK_COMMA = 44;
public static final int SDLK_MINUS = 45;
public static final int SDLK_PERIOD = 46;
public static final int SDLK_SLASH = 47;
public static final int SDLK_0 = 48;
public static final int SDLK_1 = 49;
public static final int SDLK_2 = 50;
public static final int SDLK_3 = 51;
public static final int SDLK_4 = 52;
public static final int SDLK_5 = 53;
public static final int SDLK_6 = 54;
public static final int SDLK_7 = 55;
public static final int SDLK_8 = 56;
public static final int SDLK_9 = 57;
public static final int SDLK_COLON = 58;
public static final int SDLK_SEMICOLON = 59;
public static final int SDLK_LESS = 60;
public static final int SDLK_EQUALS = 61;
public static final int SDLK_GREATER = 62;
public static final int SDLK_QUESTION = 63;
public static final int SDLK_AT = 64;
public static final int SDLK_LEFTBRACKET = 91;
public static final int SDLK_BACKSLASH = 92;
public static final int SDLK_RIGHTBRACKET = 93;
public static final int SDLK_CARET = 94;
public static final int SDLK_UNDERSCORE = 95;
public static final int SDLK_BACKQUOTE = 96;
public static final int SDLK_a = 97;
public static final int SDLK_b = 98;
public static final int SDLK_c = 99;
public static final int SDLK_d = 100;
public static final int SDLK_e = 101;
public static final int SDLK_f = 102;
public static final int SDLK_g = 103;
public static final int SDLK_h = 104;
public static final int SDLK_i = 105;
public static final int SDLK_j = 106;
public static final int SDLK_k = 107;
public static final int SDLK_l = 108;
public static final int SDLK_m = 109;
public static final int SDLK_n = 110;
public static final int SDLK_o = 111;
public static final int SDLK_p = 112;
public static final int SDLK_q = 113;
public static final int SDLK_r = 114;
public static final int SDLK_s = 115;
public static final int SDLK_t = 116;
public static final int SDLK_u = 117;
public static final int SDLK_v = 118;
public static final int SDLK_w = 119;
public static final int SDLK_x = 120;
public static final int SDLK_y = 121;
public static final int SDLK_z = 122;
public static final int SDLK_DELETE = 127;
public static final int SDLK_WORLD_0 = 160;
public static final int SDLK_WORLD_1 = 161;
public static final int SDLK_WORLD_2 = 162;
public static final int SDLK_WORLD_3 = 163;
public static final int SDLK_WORLD_4 = 164;
public static final int SDLK_WORLD_5 = 165;
public static final int SDLK_WORLD_6 = 166;
public static final int SDLK_WORLD_7 = 167;
public static final int SDLK_WORLD_8 = 168;
public static final int SDLK_WORLD_9 = 169;
public static final int SDLK_WORLD_10 = 170;
public static final int SDLK_WORLD_11 = 171;
public static final int SDLK_WORLD_12 = 172;
public static final int SDLK_WORLD_13 = 173;
public static final int SDLK_WORLD_14 = 174;
public static final int SDLK_WORLD_15 = 175;
public static final int SDLK_WORLD_16 = 176;
public static final int SDLK_WORLD_17 = 177;
public static final int SDLK_WORLD_18 = 178;
public static final int SDLK_WORLD_19 = 179;
public static final int SDLK_WORLD_20 = 180;
public static final int SDLK_WORLD_21 = 181;
public static final int SDLK_WORLD_22 = 182;
public static final int SDLK_WORLD_23 = 183;
public static final int SDLK_WORLD_24 = 184;
public static final int SDLK_WORLD_25 = 185;
public static final int SDLK_WORLD_26 = 186;
public static final int SDLK_WORLD_27 = 187;
public static final int SDLK_WORLD_28 = 188;
public static final int SDLK_WORLD_29 = 189;
public static final int SDLK_WORLD_30 = 190;
public static final int SDLK_WORLD_31 = 191;
public static final int SDLK_WORLD_32 = 192;
public static final int SDLK_WORLD_33 = 193;
public static final int SDLK_WORLD_34 = 194;
public static final int SDLK_WORLD_35 = 195;
public static final int SDLK_WORLD_36 = 196;
public static final int SDLK_WORLD_37 = 197;
public static final int SDLK_WORLD_38 = 198;
public static final int SDLK_WORLD_39 = 199;
public static final int SDLK_WORLD_40 = 200;
public static final int SDLK_WORLD_41 = 201;
public static final int SDLK_WORLD_42 = 202;
public static final int SDLK_WORLD_43 = 203;
public static final int SDLK_WORLD_44 = 204;
public static final int SDLK_WORLD_45 = 205;
public static final int SDLK_WORLD_46 = 206;
public static final int SDLK_WORLD_47 = 207;
public static final int SDLK_WORLD_48 = 208;
public static final int SDLK_WORLD_49 = 209;
public static final int SDLK_WORLD_50 = 210;
public static final int SDLK_WORLD_51 = 211;
public static final int SDLK_WORLD_52 = 212;
public static final int SDLK_WORLD_53 = 213;
public static final int SDLK_WORLD_54 = 214;
public static final int SDLK_WORLD_55 = 215;
public static final int SDLK_WORLD_56 = 216;
public static final int SDLK_WORLD_57 = 217;
public static final int SDLK_WORLD_58 = 218;
public static final int SDLK_WORLD_59 = 219;
public static final int SDLK_WORLD_60 = 220;
public static final int SDLK_WORLD_61 = 221;
public static final int SDLK_WORLD_62 = 222;
public static final int SDLK_WORLD_63 = 223;
public static final int SDLK_WORLD_64 = 224;
public static final int SDLK_WORLD_65 = 225;
public static final int SDLK_WORLD_66 = 226;
public static final int SDLK_WORLD_67 = 227;
public static final int SDLK_WORLD_68 = 228;
public static final int SDLK_WORLD_69 = 229;
public static final int SDLK_WORLD_70 = 230;
public static final int SDLK_WORLD_71 = 231;
public static final int SDLK_WORLD_72 = 232;
public static final int SDLK_WORLD_73 = 233;
public static final int SDLK_WORLD_74 = 234;
public static final int SDLK_WORLD_75 = 235;
public static final int SDLK_WORLD_76 = 236;
public static final int SDLK_WORLD_77 = 237;
public static final int SDLK_WORLD_78 = 238;
public static final int SDLK_WORLD_79 = 239;
public static final int SDLK_WORLD_80 = 240;
public static final int SDLK_WORLD_81 = 241;
public static final int SDLK_WORLD_82 = 242;
public static final int SDLK_WORLD_83 = 243;
public static final int SDLK_WORLD_84 = 244;
public static final int SDLK_WORLD_85 = 245;
public static final int SDLK_WORLD_86 = 246;
public static final int SDLK_WORLD_87 = 247;
public static final int SDLK_WORLD_88 = 248;
public static final int SDLK_WORLD_89 = 249;
public static final int SDLK_WORLD_90 = 250;
public static final int SDLK_WORLD_91 = 251;
public static final int SDLK_WORLD_92 = 252;
public static final int SDLK_WORLD_93 = 253;
public static final int SDLK_WORLD_94 = 254;
public static final int SDLK_WORLD_95 = 255;
public static final int SDLK_KP0 = 256;
public static final int SDLK_KP1 = 257;
public static final int SDLK_KP2 = 258;
public static final int SDLK_KP3 = 259;
public static final int SDLK_KP4 = 260;
public static final int SDLK_KP5 = 261;
public static final int SDLK_KP6 = 262;
public static final int SDLK_KP7 = 263;
public static final int SDLK_KP8 = 264;
public static final int SDLK_KP9 = 265;
public static final int SDLK_KP_PERIOD = 266;
public static final int SDLK_KP_DIVIDE = 267;
public static final int SDLK_KP_MULTIPLY = 268;
public static final int SDLK_KP_MINUS = 269;
public static final int SDLK_KP_PLUS = 270;
public static final int SDLK_KP_ENTER = 271;
public static final int SDLK_KP_EQUALS = 272;
public static final int SDLK_UP = 273;
public static final int SDLK_DOWN = 274;
public static final int SDLK_RIGHT = 275;
public static final int SDLK_LEFT = 276;
public static final int SDLK_INSERT = 277;
public static final int SDLK_HOME = 278;
public static final int SDLK_END = 279;
public static final int SDLK_PAGEUP = 280;
public static final int SDLK_PAGEDOWN = 281;
public static final int SDLK_F1 = 282;
public static final int SDLK_F2 = 283;
public static final int SDLK_F3 = 284;
public static final int SDLK_F4 = 285;
public static final int SDLK_F5 = 286;
public static final int SDLK_F6 = 287;
public static final int SDLK_F7 = 288;
public static final int SDLK_F8 = 289;
public static final int SDLK_F9 = 290;
public static final int SDLK_F10 = 291;
public static final int SDLK_F11 = 292;
public static final int SDLK_F12 = 293;
public static final int SDLK_F13 = 294;
public static final int SDLK_F14 = 295;
public static final int SDLK_F15 = 296;
public static final int SDLK_NUMLOCK = 300;
public static final int SDLK_CAPSLOCK = 301;
public static final int SDLK_SCROLLOCK = 302;
public static final int SDLK_RSHIFT = 303;
public static final int SDLK_LSHIFT = 304;
public static final int SDLK_RCTRL = 305;
public static final int SDLK_LCTRL = 306;
public static final int SDLK_RALT = 307;
public static final int SDLK_LALT = 308;
public static final int SDLK_RMETA = 309;
public static final int SDLK_LMETA = 310;
public static final int SDLK_LSUPER = 311;
public static final int SDLK_RSUPER = 312;
public static final int SDLK_MODE = 313;
public static final int SDLK_COMPOSE = 314;
public static final int SDLK_HELP = 315;
public static final int SDLK_PRINT = 316;
public static final int SDLK_SYSREQ = 317;
public static final int SDLK_BREAK = 318;
public static final int SDLK_MENU = 319;
public static final int SDLK_POWER = 320;
public static final int SDLK_EURO = 321;
public static final int SDLK_UNDO = 322;
// Mouse buttons can be mapped to on-screen keys
public static final int SDLK_MOUSE_LEFT = 500;
public static final int SDLK_MOUSE_MIDDLE = 501;
public static final int SDLK_MOUSE_RIGHT = 502;
public static final int SDLK_MOUSE_WHEEL_UP = 503;
public static final int SDLK_MOUSE_WHEEL_DOWN = 504;
public static final int SDLK_MOUSE_X1 = 505;
public static final int SDLK_MOUSE_X2 = 506;
public static final int SDLK_NO_REMAP = 512;
}
// Autogenerated by hand with a command:
// grep 'SDL_SCANCODE_' SDL_scancode.h | sed 's/SDL_SCANCODE_\([a-zA-Z0-9_]\+\).*[=] \([0-9]\+\).*/public static final int SDLK_\1 = \2;/' >> Keycodes.java
class SDL_2_Keycodes
{
public static final int SDLK_UNKNOWN = 0;
public static final int SDLK_A = 4;
public static final int SDLK_B = 5;
public static final int SDLK_C = 6;
public static final int SDLK_D = 7;
public static final int SDLK_E = 8;
public static final int SDLK_F = 9;
public static final int SDLK_G = 10;
public static final int SDLK_H = 11;
public static final int SDLK_I = 12;
public static final int SDLK_J = 13;
public static final int SDLK_K = 14;
public static final int SDLK_L = 15;
public static final int SDLK_M = 16;
public static final int SDLK_N = 17;
public static final int SDLK_O = 18;
public static final int SDLK_P = 19;
public static final int SDLK_Q = 20;
public static final int SDLK_R = 21;
public static final int SDLK_S = 22;
public static final int SDLK_T = 23;
public static final int SDLK_U = 24;
public static final int SDLK_V = 25;
public static final int SDLK_W = 26;
public static final int SDLK_X = 27;
public static final int SDLK_Y = 28;
public static final int SDLK_Z = 29;
public static final int SDLK_1 = 30;
public static final int SDLK_2 = 31;
public static final int SDLK_3 = 32;
public static final int SDLK_4 = 33;
public static final int SDLK_5 = 34;
public static final int SDLK_6 = 35;
public static final int SDLK_7 = 36;
public static final int SDLK_8 = 37;
public static final int SDLK_9 = 38;
public static final int SDLK_0 = 39;
public static final int SDLK_RETURN = 40;
public static final int SDLK_ESCAPE = 41;
public static final int SDLK_BACKSPACE = 42;
public static final int SDLK_TAB = 43;
public static final int SDLK_SPACE = 44;
public static final int SDLK_MINUS = 45;
public static final int SDLK_EQUALS = 46;
public static final int SDLK_LEFTBRACKET = 47;
public static final int SDLK_RIGHTBRACKET = 48;
public static final int SDLK_BACKSLASH = 49;
public static final int SDLK_NONUSHASH = 50;
public static final int SDLK_SEMICOLON = 51;
public static final int SDLK_APOSTROPHE = 52;
public static final int SDLK_GRAVE = 53;
public static final int SDLK_COMMA = 54;
public static final int SDLK_PERIOD = 55;
public static final int SDLK_SLASH = 56;
public static final int SDLK_CAPSLOCK = 57;
public static final int SDLK_F1 = 58;
public static final int SDLK_F2 = 59;
public static final int SDLK_F3 = 60;
public static final int SDLK_F4 = 61;
public static final int SDLK_F5 = 62;
public static final int SDLK_F6 = 63;
public static final int SDLK_F7 = 64;
public static final int SDLK_F8 = 65;
public static final int SDLK_F9 = 66;
public static final int SDLK_F10 = 67;
public static final int SDLK_F11 = 68;
public static final int SDLK_F12 = 69;
public static final int SDLK_PRINTSCREEN = 70;
public static final int SDLK_SCROLLLOCK = 71;
public static final int SDLK_PAUSE = 72;
public static final int SDLK_INSERT = 73;
public static final int SDLK_HOME = 74;
public static final int SDLK_PAGEUP = 75;
public static final int SDLK_DELETE = 76;
public static final int SDLK_END = 77;
public static final int SDLK_PAGEDOWN = 78;
public static final int SDLK_RIGHT = 79;
public static final int SDLK_LEFT = 80;
public static final int SDLK_DOWN = 81;
public static final int SDLK_UP = 82;
public static final int SDLK_NUMLOCKCLEAR = 83;
public static final int SDLK_KP_DIVIDE = 84;
public static final int SDLK_KP_MULTIPLY = 85;
public static final int SDLK_KP_MINUS = 86;
public static final int SDLK_KP_PLUS = 87;
public static final int SDLK_KP_ENTER = 88;
public static final int SDLK_KP_1 = 89;
public static final int SDLK_KP_2 = 90;
public static final int SDLK_KP_3 = 91;
public static final int SDLK_KP_4 = 92;
public static final int SDLK_KP_5 = 93;
public static final int SDLK_KP_6 = 94;
public static final int SDLK_KP_7 = 95;
public static final int SDLK_KP_8 = 96;
public static final int SDLK_KP_9 = 97;
public static final int SDLK_KP_0 = 98;
public static final int SDLK_KP_PERIOD = 99;
public static final int SDLK_NONUSBACKSLASH = 100;
public static final int SDLK_APPLICATION = 101;
public static final int SDLK_POWER = 102;
public static final int SDLK_KP_EQUALS = 103;
public static final int SDLK_F13 = 104;
public static final int SDLK_F14 = 105;
public static final int SDLK_F15 = 106;
public static final int SDLK_F16 = 107;
public static final int SDLK_F17 = 108;
public static final int SDLK_F18 = 109;
public static final int SDLK_F19 = 110;
public static final int SDLK_F20 = 111;
public static final int SDLK_F21 = 112;
public static final int SDLK_F22 = 113;
public static final int SDLK_F23 = 114;
public static final int SDLK_F24 = 115;
public static final int SDLK_EXECUTE = 116;
public static final int SDLK_HELP = 117;
public static final int SDLK_MENU = 118;
public static final int SDLK_SELECT = 119;
public static final int SDLK_STOP = 120;
public static final int SDLK_AGAIN = 121;
public static final int SDLK_UNDO = 122;
public static final int SDLK_CUT = 123;
public static final int SDLK_COPY = 124;
public static final int SDLK_PASTE = 125;
public static final int SDLK_FIND = 126;
public static final int SDLK_MUTE = 127;
public static final int SDLK_VOLUMEUP = 128;
public static final int SDLK_VOLUMEDOWN = 129;
public static final int SDLK_KP_COMMA = 133;
public static final int SDLK_KP_EQUALSAS400 = 134;
public static final int SDLK_INTERNATIONAL1 = 135;
public static final int SDLK_INTERNATIONAL2 = 136;
public static final int SDLK_INTERNATIONAL3 = 137;
public static final int SDLK_INTERNATIONAL4 = 138;
public static final int SDLK_INTERNATIONAL5 = 139;
public static final int SDLK_INTERNATIONAL6 = 140;
public static final int SDLK_INTERNATIONAL7 = 141;
public static final int SDLK_INTERNATIONAL8 = 142;
public static final int SDLK_INTERNATIONAL9 = 143;
public static final int SDLK_LANG1 = 144;
public static final int SDLK_LANG2 = 145;
public static final int SDLK_LANG3 = 146;
public static final int SDLK_LANG4 = 147;
public static final int SDLK_LANG5 = 148;
public static final int SDLK_LANG6 = 149;
public static final int SDLK_LANG7 = 150;
public static final int SDLK_LANG8 = 151;
public static final int SDLK_LANG9 = 152;
public static final int SDLK_ALTERASE = 153;
public static final int SDLK_SYSREQ = 154;
public static final int SDLK_CANCEL = 155;
public static final int SDLK_CLEAR = 156;
public static final int SDLK_PRIOR = 157;
public static final int SDLK_RETURN2 = 158;
public static final int SDLK_SEPARATOR = 159;
public static final int SDLK_OUT = 160;
public static final int SDLK_OPER = 161;
public static final int SDLK_CLEARAGAIN = 162;
public static final int SDLK_CRSEL = 163;
public static final int SDLK_EXSEL = 164;
public static final int SDLK_KP_00 = 176;
public static final int SDLK_KP_000 = 177;
public static final int SDLK_THOUSANDSSEPARATOR = 178;
public static final int SDLK_DECIMALSEPARATOR = 179;
public static final int SDLK_CURRENCYUNIT = 180;
public static final int SDLK_CURRENCYSUBUNIT = 181;
public static final int SDLK_KP_LEFTPAREN = 182;
public static final int SDLK_KP_RIGHTPAREN = 183;
public static final int SDLK_KP_LEFTBRACE = 184;
public static final int SDLK_KP_RIGHTBRACE = 185;
public static final int SDLK_KP_TAB = 186;
public static final int SDLK_KP_BACKSPACE = 187;
public static final int SDLK_KP_A = 188;
public static final int SDLK_KP_B = 189;
public static final int SDLK_KP_C = 190;
public static final int SDLK_KP_D = 191;
public static final int SDLK_KP_E = 192;
public static final int SDLK_KP_F = 193;
public static final int SDLK_KP_XOR = 194;
public static final int SDLK_KP_POWER = 195;
public static final int SDLK_KP_PERCENT = 196;
public static final int SDLK_KP_LESS = 197;
public static final int SDLK_KP_GREATER = 198;
public static final int SDLK_KP_AMPERSAND = 199;
public static final int SDLK_KP_DBLAMPERSAND = 200;
public static final int SDLK_KP_VERTICALBAR = 201;
public static final int SDLK_KP_DBLVERTICALBAR = 202;
public static final int SDLK_KP_COLON = 203;
public static final int SDLK_KP_HASH = 204;
public static final int SDLK_KP_SPACE = 205;
public static final int SDLK_KP_AT = 206;
public static final int SDLK_KP_EXCLAM = 207;
public static final int SDLK_KP_MEMSTORE = 208;
public static final int SDLK_KP_MEMRECALL = 209;
public static final int SDLK_KP_MEMCLEAR = 210;
public static final int SDLK_KP_MEMADD = 211;
public static final int SDLK_KP_MEMSUBTRACT = 212;
public static final int SDLK_KP_MEMMULTIPLY = 213;
public static final int SDLK_KP_MEMDIVIDE = 214;
public static final int SDLK_KP_PLUSMINUS = 215;
public static final int SDLK_KP_CLEAR = 216;
public static final int SDLK_KP_CLEARENTRY = 217;
public static final int SDLK_KP_BINARY = 218;
public static final int SDLK_KP_OCTAL = 219;
public static final int SDLK_KP_DECIMAL = 220;
public static final int SDLK_KP_HEXADECIMAL = 221;
public static final int SDLK_LCTRL = 224;
public static final int SDLK_LSHIFT = 225;
public static final int SDLK_LALT = 226;
public static final int SDLK_LGUI = 227;
public static final int SDLK_RCTRL = 228;
public static final int SDLK_RSHIFT = 229;
public static final int SDLK_RALT = 230;
public static final int SDLK_RGUI = 231;
public static final int SDLK_MODE = 257;
public static final int SDLK_AUDIONEXT = 258;
public static final int SDLK_AUDIOPREV = 259;
public static final int SDLK_AUDIOSTOP = 260;
public static final int SDLK_AUDIOPLAY = 261;
public static final int SDLK_AUDIOMUTE = 262;
public static final int SDLK_MEDIASELECT = 263;
public static final int SDLK_WWW = 264;
public static final int SDLK_MAIL = 265;
public static final int SDLK_CALCULATOR = 266;
public static final int SDLK_COMPUTER = 267;
public static final int SDLK_AC_SEARCH = 268;
public static final int SDLK_AC_HOME = 269;
public static final int SDLK_AC_BACK = 270;
public static final int SDLK_AC_FORWARD = 271;
public static final int SDLK_AC_STOP = 272;
public static final int SDLK_AC_REFRESH = 273;
public static final int SDLK_AC_BOOKMARKS = 274;
public static final int SDLK_BRIGHTNESSDOWN = 275;
public static final int SDLK_BRIGHTNESSUP = 276;
public static final int SDLK_DISPLAYSWITCH = 277;
public static final int SDLK_KBDILLUMTOGGLE = 278;
public static final int SDLK_KBDILLUMDOWN = 279;
public static final int SDLK_KBDILLUMUP = 280;
public static final int SDLK_EJECT = 281;
public static final int SDLK_SLEEP = 282;
public static final int SDLK_APP1 = 283;
public static final int SDLK_APP2 = 284;
public static final int SDLK_AUDIOREWIND = 285;
public static final int SDLK_AUDIOFASTFORWARD = 286;
// Mouse buttons can be mapped to on-screen keys
public static final int SDLK_MOUSE_LEFT = 500;
public static final int SDLK_MOUSE_MIDDLE = 501;
public static final int SDLK_MOUSE_RIGHT = 502;
public static final int SDLK_MOUSE_WHEEL_UP = 503;
public static final int SDLK_MOUSE_WHEEL_DOWN = 504;
public static final int SDLK_MOUSE_X1 = 505;
public static final int SDLK_MOUSE_X2 = 506;
public static final int SDLK_NO_REMAP = 512;
}
class SDL_Keys
{
public static String [] names = null;
public static Integer [] values = null;
public static String [] namesSorted = null;
public static Integer [] namesSortedIdx = null;
public static Integer [] namesSortedBackIdx = null;
static final int JAVA_KEYCODE_LAST = 255; // Android 2.3 added several new gaming keys, Android 3.1 added even more - keep in sync with javakeycodes.h
static String getName(int v)
{
for( int f = 0; f < values.length; f++ )
{
if( values[f] == v )
return names[f];
}
return names[0];
}
static
{
ArrayList<String> Names = new ArrayList<String> ();
ArrayList<Integer> Values = new ArrayList<Integer> ();
Field [] fields = SDL_1_2_Keycodes.class.getDeclaredFields();
if( Globals.UsingSDL2 )
{
fields = SDL_2_Keycodes.class.getDeclaredFields();
}
try {
for(Field f: fields)
{
if( !f.getName().startsWith("SDLK_") )
{
continue;
}
Values.add(f.getInt(null));
Names.add(f.getName().substring(5).toUpperCase());
}
} catch(IllegalAccessException e) {};
// Sort by value
for( int i = 0; i < Values.size(); i++ )
{
for( int j = i; j < Values.size(); j++ )
{
if( Values.get(i) > Values.get(j) )
{
int x = Values.get(i);
Values.set(i, Values.get(j));
Values.set(j, x);
String s = Names.get(i);
Names.set(i, Names.get(j));
Names.set(j, s);
}
}
}
names = Names.toArray(new String[0]);
values = Values.toArray(new Integer[0]);
namesSorted = Names.toArray(new String[0]);
namesSortedIdx = new Integer[values.length];
namesSortedBackIdx = new Integer[values.length];
Arrays.sort(namesSorted);
for( int i = 0; i < namesSorted.length; i++ )
{
for( int j = 0; j < namesSorted.length; j++ )
{
if( namesSorted[i].equals( names[j] ) )
{
namesSortedIdx[i] = j;
namesSortedBackIdx[j] = i;
break;
}
}
}
}
}

View File

@@ -75,6 +75,7 @@ import android.widget.Toast;
import android.content.pm.PackageManager;
import android.os.Build;
import android.content.Intent;
import android.content.pm.PackageInfo;
// TODO: too much code here, split into multiple files, possibly auto-generated menus?
@@ -85,6 +86,8 @@ public class Settings
static boolean settingsLoaded = false;
static boolean settingsChanged = false;
static final int SETTINGS_FILE_VERSION = 5;
static boolean convertButtonSizeFromOldSdlVersion = false;
static int settingsAppVersion = 0;
static void Save(final MainActivity p)
{
@@ -187,6 +190,9 @@ public class Settings
out.writeBoolean(Globals.AutoDetectOrientation);
out.writeBoolean(Globals.TvBorders);
out.writeBoolean(Globals.ForceHardwareMouse);
convertButtonSizeFromOldSdlVersion = false;
out.writeBoolean(convertButtonSizeFromOldSdlVersion);
out.writeBoolean(Globals.DrawInDisplayCutout);
out.close();
settingsLoaded = true;
@@ -196,13 +202,157 @@ public class Settings
} catch ( IOException e ) {};
}
static void Load( final MainActivity p )
static boolean LoadConfig( final MainActivity p )
{
if(settingsLoaded) // Prevent starting twice
Globals.OptionalDataDownload = new boolean[Globals.DataDownloadUrl.length];
for( int i = 0; i < Globals.DataDownloadUrl.length; i++ )
{
if( Globals.DataDownloadUrl[i].indexOf("!") == 0 )
{
Globals.OptionalDataDownload[i] = true;
}
}
try {
ObjectInputStream settingsFile = new ObjectInputStream(new FileInputStream( p.getFilesDir().getAbsolutePath() + "/" + SettingsFileName ));
if( settingsFile.readInt() != SETTINGS_FILE_VERSION )
throw new IOException();
Globals.DownloadToSdcard = settingsFile.readBoolean();
Globals.PhoneHasArrowKeys = settingsFile.readBoolean();
settingsFile.readBoolean();
Globals.UseAccelerometerAsArrowKeys = settingsFile.readBoolean();
Globals.UseTouchscreenKeyboard = settingsFile.readBoolean();
Globals.TouchscreenKeyboardSize = settingsFile.readInt();
convertButtonSizeFromOldSdlVersion = true; // Will be changed to false if we read the remainder of the config file
Globals.AccelerometerSensitivity = settingsFile.readInt();
Globals.AccelerometerCenterPos = settingsFile.readInt();
settingsFile.readInt();
Globals.AudioBufferConfig = settingsFile.readInt();
Globals.TouchscreenKeyboardTheme = settingsFile.readInt();
Globals.RightClickMethod = settingsFile.readInt();
Globals.ShowScreenUnderFinger = settingsFile.readInt();
Globals.LeftClickMethod = settingsFile.readInt();
Globals.MoveMouseWithJoystick = settingsFile.readBoolean();
Globals.ClickMouseWithDpad = settingsFile.readBoolean();
Globals.ClickScreenPressure = settingsFile.readInt();
Globals.ClickScreenTouchspotSize = settingsFile.readInt();
Globals.KeepAspectRatio = settingsFile.readBoolean();
Globals.MoveMouseWithJoystickSpeed = settingsFile.readInt();
Globals.MoveMouseWithJoystickAccel = settingsFile.readInt();
int readKeysSize = settingsFile.readInt();
for( int i = 0; i < readKeysSize; i++ )
{
Globals.RemapHwKeycode[i] = settingsFile.readInt();
}
int readScreenKbRemapKeysSize = settingsFile.readInt();
if( readScreenKbRemapKeysSize > Globals.RemapScreenKbKeycode.length )
throw new IOException();
for( int i = 0; i < readScreenKbRemapKeysSize; i++ )
{
Globals.RemapScreenKbKeycode[i] = settingsFile.readInt();
}
int readScreenKbShownSize = settingsFile.readInt();
if( readScreenKbShownSize > Globals.ScreenKbControlsShown.length )
throw new IOException();
for( int i = 0; i < readScreenKbShownSize; i++ )
{
Globals.ScreenKbControlsShown[i] = settingsFile.readBoolean();
}
Globals.TouchscreenKeyboardTransparency = settingsFile.readInt();
if( settingsFile.readInt() != Globals.RemapMultitouchGestureKeycode.length )
throw new IOException();
for( int i = 0; i < Globals.RemapMultitouchGestureKeycode.length; i++ )
{
Globals.RemapMultitouchGestureKeycode[i] = settingsFile.readInt();
Globals.MultitouchGesturesUsed[i] = settingsFile.readBoolean();
}
Globals.MultitouchGestureSensitivity = settingsFile.readInt();
for( int i = 0; i < Globals.TouchscreenCalibration.length; i++ )
Globals.TouchscreenCalibration[i] = settingsFile.readInt();
StringBuilder b = new StringBuilder();
int len = settingsFile.readInt();
for( int i = 0; i < len; i++ )
b.append( settingsFile.readChar() );
Globals.DataDir = b.toString();
b = new StringBuilder();
len = settingsFile.readInt();
for( int i = 0; i < len; i++ )
b.append( settingsFile.readChar() );
Globals.CommandLine = b.toString();
int screenKbControlsLayoutSize = settingsFile.readInt();
if( screenKbControlsLayoutSize > Globals.ScreenKbControlsLayout.length )
throw new IOException();
for( int i = 0; i < screenKbControlsLayoutSize; i++ )
for( int ii = 0; ii < 4; ii++ )
Globals.ScreenKbControlsLayout[i][ii] = settingsFile.readInt();
Globals.LeftClickKey = settingsFile.readInt();
Globals.RightClickKey = settingsFile.readInt();
Globals.VideoLinearFilter = settingsFile.readBoolean();
Globals.LeftClickTimeout = settingsFile.readInt();
Globals.RightClickTimeout = settingsFile.readInt();
Globals.RelativeMouseMovement = settingsFile.readBoolean();
Globals.RelativeMouseMovementSpeed = settingsFile.readInt();
Globals.RelativeMouseMovementAccel = settingsFile.readInt();
Globals.MultiThreadedVideo = settingsFile.readBoolean();
Globals.OptionalDataDownload = new boolean[settingsFile.readInt()];
for(int i = 0; i < Globals.OptionalDataDownload.length; i++)
Globals.OptionalDataDownload[i] = settingsFile.readBoolean();
settingsFile.readBoolean(); // Unused
Globals.TouchscreenKeyboardDrawSize = settingsFile.readInt();
settingsAppVersion = settingsFile.readInt();
// Gyroscope calibration data, now unused
settingsFile.readFloat();
settingsFile.readFloat();
settingsFile.readFloat();
settingsFile.readFloat();
settingsFile.readFloat();
settingsFile.readFloat();
settingsFile.readFloat();
settingsFile.readFloat();
settingsFile.readFloat();
Globals.OuyaEmulation = settingsFile.readBoolean();
Globals.HoverJitterFilter = settingsFile.readBoolean();
Globals.MoveMouseWithGyroscope = settingsFile.readBoolean();
Globals.MoveMouseWithGyroscopeSpeed = settingsFile.readInt();
Globals.FingerHover = settingsFile.readBoolean();
Globals.FloatingScreenJoystick = settingsFile.readBoolean();
Globals.GenerateSubframeTouchEvents = settingsFile.readBoolean();
Globals.VideoDepthBpp = settingsFile.readInt();
Globals.HorizontalOrientation = settingsFile.readBoolean();
Globals.ImmersiveMode = settingsFile.readBoolean();
Globals.AutoDetectOrientation = settingsFile.readBoolean();
Globals.TvBorders = settingsFile.readBoolean();
Globals.ForceHardwareMouse = settingsFile.readBoolean();
convertButtonSizeFromOldSdlVersion = settingsFile.readBoolean();
Globals.DrawInDisplayCutout = settingsFile.readBoolean();
Log.i("SDL", "libSDL: Settings.LoadConfig(): loaded settings successfully");
settingsFile.close();
return true;
} catch( FileNotFoundException e ) {
Log.i("SDL", "libSDL: settings file not found: " + e);
} catch( SecurityException e ) {
Log.i("SDL", "libSDL: settings file cannot be opened: " + e);
} catch( IOException e ) {
Log.i("SDL", "libSDL: settings file cannot be read: " + e);
}
return false;
}
static void ProcessConfig( final MainActivity p )
{
if( settingsLoaded ) // Prevent starting twice
{
return;
}
Log.i("SDL", "libSDL: Settings.Load(): enter");
Log.i("SDL", "libSDL: Settings.ProcessConfig(): enter");
nativeInitKeymap();
for( int i = 0; i < SDL_Keys.JAVA_KEYCODE_LAST; i++ )
{
@@ -224,12 +374,14 @@ public class Settings
}
Globals.ScreenKbControlsShown[0] = (Globals.AppNeedsArrowKeys || Globals.AppUsesJoystick);
Globals.ScreenKbControlsShown[1] = Globals.AppNeedsTextInput;
for( int i = 2; i < Globals.ScreenKbControlsShown.length; i++ )
for( int i = 2; i < 8; i++ )
Globals.ScreenKbControlsShown[i] = ( i - 2 < Globals.AppTouchscreenKeyboardKeysAmount );
if( Globals.AppUsesSecondJoystick )
Globals.ScreenKbControlsShown[8] = true;
if( Globals.AppUsesThirdJoystick )
Globals.ScreenKbControlsShown[9] = true;
for( int i = 10; i < Globals.ScreenKbControlsShown.length; i++ )
Globals.ScreenKbControlsShown[i] = ( i - 4 < Globals.AppTouchscreenKeyboardKeysAmount );
for( int i = 0; i < Globals.RemapMultitouchGestureKeycode.length; i++ )
{
int sdlKey = nativeGetKeymapKeyMultitouchGesture(i);
@@ -270,130 +422,20 @@ public class Settings
// ICS update sends events in a proper way
Globals.RemapHwKeycode[112] = SDL_1_2_Keycodes.SDLK_UNKNOWN;
}
convertButtonSizeFromOldSdlVersion = false;
try {
ObjectInputStream settingsFile = new ObjectInputStream(new FileInputStream( p.getFilesDir().getAbsolutePath() + "/" + SettingsFileName ));
if( settingsFile.readInt() != SETTINGS_FILE_VERSION )
throw new IOException();
Globals.DownloadToSdcard = settingsFile.readBoolean();
Globals.PhoneHasArrowKeys = settingsFile.readBoolean();
settingsFile.readBoolean();
Globals.UseAccelerometerAsArrowKeys = settingsFile.readBoolean();
Globals.UseTouchscreenKeyboard = settingsFile.readBoolean();
Globals.TouchscreenKeyboardSize = settingsFile.readInt();
Globals.AccelerometerSensitivity = settingsFile.readInt();
Globals.AccelerometerCenterPos = settingsFile.readInt();
settingsFile.readInt();
Globals.AudioBufferConfig = settingsFile.readInt();
Globals.TouchscreenKeyboardTheme = settingsFile.readInt();
Globals.RightClickMethod = settingsFile.readInt();
Globals.ShowScreenUnderFinger = settingsFile.readInt();
Globals.LeftClickMethod = settingsFile.readInt();
Globals.MoveMouseWithJoystick = settingsFile.readBoolean();
Globals.ClickMouseWithDpad = settingsFile.readBoolean();
Globals.ClickScreenPressure = settingsFile.readInt();
Globals.ClickScreenTouchspotSize = settingsFile.readInt();
Globals.KeepAspectRatio = settingsFile.readBoolean();
Globals.MoveMouseWithJoystickSpeed = settingsFile.readInt();
Globals.MoveMouseWithJoystickAccel = settingsFile.readInt();
int readKeys = settingsFile.readInt();
for( int i = 0; i < readKeys; i++ )
{
Globals.RemapHwKeycode[i] = settingsFile.readInt();
}
if( settingsFile.readInt() != Globals.RemapScreenKbKeycode.length )
throw new IOException();
for( int i = 0; i < Globals.RemapScreenKbKeycode.length; i++ )
{
Globals.RemapScreenKbKeycode[i] = settingsFile.readInt();
}
if( settingsFile.readInt() != Globals.ScreenKbControlsShown.length )
throw new IOException();
for( int i = 0; i < Globals.ScreenKbControlsShown.length; i++ )
{
Globals.ScreenKbControlsShown[i] = settingsFile.readBoolean();
}
Globals.TouchscreenKeyboardTransparency = settingsFile.readInt();
if( settingsFile.readInt() != Globals.RemapMultitouchGestureKeycode.length )
throw new IOException();
for( int i = 0; i < Globals.RemapMultitouchGestureKeycode.length; i++ )
{
Globals.RemapMultitouchGestureKeycode[i] = settingsFile.readInt();
Globals.MultitouchGesturesUsed[i] = settingsFile.readBoolean();
}
Globals.MultitouchGestureSensitivity = settingsFile.readInt();
for( int i = 0; i < Globals.TouchscreenCalibration.length; i++ )
Globals.TouchscreenCalibration[i] = settingsFile.readInt();
StringBuilder b = new StringBuilder();
int len = settingsFile.readInt();
for( int i = 0; i < len; i++ )
b.append( settingsFile.readChar() );
Globals.DataDir = b.toString();
settingsLoaded = LoadConfig(p);
b = new StringBuilder();
len = settingsFile.readInt();
for( int i = 0; i < len; i++ )
b.append( settingsFile.readChar() );
Globals.CommandLine = b.toString();
if( settingsFile.readInt() != Globals.ScreenKbControlsLayout.length )
throw new IOException();
for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ )
for( int ii = 0; ii < 4; ii++ )
Globals.ScreenKbControlsLayout[i][ii] = settingsFile.readInt();
Globals.LeftClickKey = settingsFile.readInt();
Globals.RightClickKey = settingsFile.readInt();
Globals.VideoLinearFilter = settingsFile.readBoolean();
Globals.LeftClickTimeout = settingsFile.readInt();
Globals.RightClickTimeout = settingsFile.readInt();
Globals.RelativeMouseMovement = settingsFile.readBoolean();
Globals.RelativeMouseMovementSpeed = settingsFile.readInt();
Globals.RelativeMouseMovementAccel = settingsFile.readInt();
Globals.MultiThreadedVideo = settingsFile.readBoolean();
Globals.OptionalDataDownload = new boolean[settingsFile.readInt()];
for(int i = 0; i < Globals.OptionalDataDownload.length; i++)
Globals.OptionalDataDownload[i] = settingsFile.readBoolean();
settingsFile.readBoolean(); // Unused
Globals.TouchscreenKeyboardDrawSize = settingsFile.readInt();
int cfgVersion = settingsFile.readInt();
// Gyroscope calibration data, now unused
settingsFile.readFloat();
settingsFile.readFloat();
settingsFile.readFloat();
settingsFile.readFloat();
settingsFile.readFloat();
settingsFile.readFloat();
settingsFile.readFloat();
settingsFile.readFloat();
settingsFile.readFloat();
Globals.OuyaEmulation = settingsFile.readBoolean();
Globals.HoverJitterFilter = settingsFile.readBoolean();
Globals.MoveMouseWithGyroscope = settingsFile.readBoolean();
Globals.MoveMouseWithGyroscopeSpeed = settingsFile.readInt();
Globals.FingerHover = settingsFile.readBoolean();
Globals.FloatingScreenJoystick = settingsFile.readBoolean();
Globals.GenerateSubframeTouchEvents = settingsFile.readBoolean();
Globals.VideoDepthBpp = settingsFile.readInt();
Globals.HorizontalOrientation = settingsFile.readBoolean();
Globals.ImmersiveMode = settingsFile.readBoolean();
Globals.AutoDetectOrientation = settingsFile.readBoolean();
Globals.TvBorders = settingsFile.readBoolean();
Globals.ForceHardwareMouse = settingsFile.readBoolean();
settingsLoaded = true;
Log.i("SDL", "libSDL: Settings.Load(): loaded settings successfully");
settingsFile.close();
Log.i("SDL", "libSDL: old cfg version " + cfgVersion + ", our version " + p.getApplicationVersion());
if( cfgVersion != p.getApplicationVersion() )
if (settingsLoaded)
{
Log.i("SDL", "libSDL: Settings.ProcessConfig(): loaded settings successfully");
Log.i("SDL", "libSDL: old app version " + settingsAppVersion + ", new app version " + p.getApplicationVersion());
if( settingsAppVersion != p.getApplicationVersion() )
{
DeleteFilesOnUpgrade(p);
if( Globals.ResetSdlConfigForThisVersion )
{
Log.i("SDL", "libSDL: old cfg version " + cfgVersion + ", our version " + p.getApplicationVersion() + " and we need to clean up config file");
Log.i("SDL", "libSDL: old app version " + settingsAppVersion + ", new app version " + p.getApplicationVersion() + " and we need to clean up config file");
// Delete settings file, and restart the application
DeleteSdlConfigOnUpgradeAndRestart(p);
}
@@ -401,20 +443,21 @@ public class Settings
}
return;
} catch( FileNotFoundException e ) {
Log.i("SDL", "libSDL: settings file not found: " + e);
} catch( SecurityException e ) {
Log.i("SDL", "libSDL: settings file cannot be opened: " + e);
} catch ( IOException e ) {
Log.i("SDL", "libSDL: settings file cannot be read: " + e);
DeleteFilesOnUpgrade(p);
if( Globals.ResetSdlConfigForThisVersion )
{
Log.i("SDL", "libSDL: old cfg version unknown or too old, our version " + p.getApplicationVersion() + " and we need to clean up config file");
DeleteSdlConfigOnUpgradeAndRestart(p);
}
};
}
Log.i("SDL", "libSDL: settings cannot be loaded");
DeleteFilesOnUpgrade(p);
if (convertButtonSizeFromOldSdlVersion && Globals.TouchscreenKeyboardSize + 1 < Globals.TOUCHSCREEN_KEYBOARD_CUSTOM)
{
Globals.TouchscreenKeyboardSize ++; // New default button size is bigger, but we are keeping old button size for existing installations
//if (Globals.AppTouchscreenKeyboardKeysAmount <= 4 && Globals.TouchscreenKeyboardSize + 1 < Globals.TOUCHSCREEN_KEYBOARD_CUSTOM)
// Globals.TouchscreenKeyboardSize ++; // If there are only 4 buttons they are even bigger
}
if( Globals.ResetSdlConfigForThisVersion && settingsAppVersion != 0 )
{
Log.i("SDL", "libSDL: old cfg version unknown or too old, our version " + p.getApplicationVersion() + " and we need to clean up config file");
DeleteSdlConfigOnUpgradeAndRestart(p);
}
if( Globals.DataDir.length() == 0 )
{
@@ -593,8 +636,9 @@ public class Settings
Globals.TouchscreenKeyboardDrawSize,
Globals.TouchscreenKeyboardTheme,
Globals.TouchscreenKeyboardTransparency,
Globals.FloatingScreenJoystick ? 1 : 0 );
SetupTouchscreenKeyboardGraphics(p);
Globals.FloatingScreenJoystick ? 1 : 0,
Globals.AppTouchscreenKeyboardKeysAmount );
DemoGLSurfaceView.SetupTouchscreenKeyboardGraphics(p);
for( int i = 0; i < Globals.RemapScreenKbKeycode.length; i++ )
nativeSetKeymapKeyScreenKb(i, SDL_Keys.values[Globals.RemapScreenKbKeycode[i]]);
if( Globals.TouchscreenKeyboardSize == Globals.TOUCHSCREEN_KEYBOARD_CUSTOM )
@@ -629,9 +673,10 @@ public class Settings
Log.i("SDL", "libSDL: setting envvar LANGUAGE to '" + lang + "'");
nativeSetEnv( "LANG", lang );
nativeSetEnv( "LANGUAGE", lang );
// TODO: get current user name and set envvar USER, the API is not availalbe on Android 1.6 so I don't bother with this
nativeSetEnv( "ARCH", android.os.Build.CPU_ABI );
nativeSetEnv( "APPDIR", p.getFilesDir().getAbsolutePath() );
nativeSetEnv( "SECURE_STORAGE_DIR", p.getFilesDir().getAbsolutePath() );
nativeSetEnv( "LIBDIR", p.getApplicationInfo().nativeLibraryDir );
nativeSetEnv( "DATADIR", Globals.DataDir );
nativeSetEnv( "UNSECURE_STORAGE_DIR", Globals.DataDir );
SdcardAppPath.get().setEnv(p);
@@ -646,9 +691,27 @@ public class Settings
nativeSetEnv( "ANDROID_PACKAGE_NAME", p.getPackageName() );
nativeSetEnv( "ANDROID_PACKAGE_PATH", p.getPackageCodePath() );
nativeSetEnv( "ANDROID_MY_OWN_APP_FILE", p.getPackageResourcePath() ); // This may be different from p.getPackageCodePath() on multi-user systems, but should still be the same .apk file
nativeSetEnv( "ANDROID_OBB_DIR", Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/obb/" + p.getPackageName() );
try {
nativeSetEnv( "ANDROID_OBB_DIR", p.getObbDir().getAbsolutePath() );
} catch (Exception eeeeeee) {}
if( p.ObbMountPath != null )
{
nativeSetEnv( "ANDROID_OBB_MOUNT_DIR", p.ObbMountPath );
}
if( p.assetPackPath != null )
{
nativeSetEnv( "ANDROID_ASSET_PACK_PATH", p.assetPackPath );
}
try {
nativeSetEnv( "ANDROID_APP_NAME", p.getString(p.getApplicationInfo().labelRes) );
} catch (Exception eeeeee) {}
try {
PackageInfo pInfo = p.getPackageManager().getPackageInfo(p.getPackageName(), 0);
nativeSetEnv( "ANDROID_PACKAGE_VERSION_NAME", pInfo.versionName );
nativeSetEnv( "ANDROID_PACKAGE_VERSION_CODE", String.valueOf(pInfo.versionCode) );
} catch (PackageManager.NameNotFoundException eeeeeeee) {
}
Log.d("SDL", "libSDL: Is running on OUYA: " + p.isRunningOnOUYA());
if( p.isRunningOnOUYA() )
{
@@ -682,63 +745,6 @@ public class Settings
} catch (Exception eeeee) {}
}
static byte [] loadRaw(Activity p, int res)
{
byte [] buf = new byte[65536 * 2];
byte [] a = new byte[1048576 * 5]; // We need 5Mb buffer for Keen theme, and this Java code is inefficient
int written = 0;
try{
InputStream is = new GZIPInputStream(p.getResources().openRawResource(res));
int readed = 0;
while( (readed = is.read(buf)) >= 0 )
{
if( written + readed > a.length )
{
byte [] b = new byte [written + readed];
System.arraycopy(a, 0, b, 0, written);
a = b;
}
System.arraycopy(buf, 0, a, written, readed);
written += readed;
}
} catch(Exception e) {};
byte [] b = new byte [written];
System.arraycopy(a, 0, b, 0, written);
return b;
}
static void SetupTouchscreenKeyboardGraphics(Activity p)
{
if( Globals.UseTouchscreenKeyboard )
{
if(Globals.TouchscreenKeyboardTheme < 0)
Globals.TouchscreenKeyboardTheme = 0;
if(Globals.TouchscreenKeyboardTheme > 9)
Globals.TouchscreenKeyboardTheme = 9;
if( Globals.TouchscreenKeyboardTheme == 0 )
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.ultimatedroid));
if( Globals.TouchscreenKeyboardTheme == 1 )
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.simpletheme));
if( Globals.TouchscreenKeyboardTheme == 2 )
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.sun));
if( Globals.TouchscreenKeyboardTheme == 3 )
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.keen));
if( Globals.TouchscreenKeyboardTheme == 4 )
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.retro));
if( Globals.TouchscreenKeyboardTheme == 5 )
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.gba));
if( Globals.TouchscreenKeyboardTheme == 6 )
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.psx));
if( Globals.TouchscreenKeyboardTheme == 7 )
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.snes));
if( Globals.TouchscreenKeyboardTheme == 8 )
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.dualshock));
if( Globals.TouchscreenKeyboardTheme == 9 )
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.n64));
}
}
abstract static class SdcardAppPath
{
public static SdcardAppPath get()
@@ -947,6 +953,7 @@ public class Settings
Save(MainActivity.instance);
}
// libsdl-1.2.so, does not exist in SDL2
private static native void nativeSetAccelerometerSettings(int sensitivity, int centerPos);
private static native void nativeSetMouseUsed(int RightClickMethod, int ShowScreenUnderFinger, int LeftClickMethod,
int MoveMouseWithJoystick, int ClickMouseWithDpad, int MaxForce, int MaxRadius,
@@ -958,7 +965,7 @@ public class Settings
int HoverJitterFilter, int RightMouseButtonLongPress,
int MoveMouseWithGyroscope, int MoveMouseWithGyroscopeSpeed,
int ForceScreenUpdateMouseClick, int ScreenFollowsMouse);
private static native void nativeSetJoystickUsed(int amount);
public static native void nativeSetJoystickUsed(int amount);
private static native void nativeSetAccelerometerUsed();
private static native void nativeSetMultitouchUsed();
private static native void nativeSetTouchscreenKeyboardUsed();
@@ -967,8 +974,8 @@ public class Settings
private static native void nativeSetCompatibilityHacks();
private static native void nativeSetVideoMultithreaded();
private static native void nativeSetVideoForceSoftwareMode();
private static native void nativeSetupScreenKeyboard(int size, int drawsize, int theme, int transparency, int floatingScreenJoystick);
private static native void nativeSetupScreenKeyboardButtons(byte[] img);
public static native void nativeSetupScreenKeyboard(int size, int drawsize, int theme, int transparency, int floatingScreenJoystick, int buttonAmount);
public static native void nativeSetupScreenKeyboardButtons(byte[] img);
private static native void nativeInitKeymap();
private static native int nativeGetKeymapKey(int key);
private static native void nativeSetKeymapKey(int javakey, int key);
@@ -976,10 +983,12 @@ public class Settings
private static native void nativeSetKeymapKeyScreenKb(int keynum, int key);
private static native void nativeSetScreenKbKeyUsed(int keynum, int used);
private static native void nativeSetScreenKbKeyLayout(int keynum, int x1, int y1, int x2, int y2);
public static native int nativeGetScreenKeyboardButtonLayout(int button, int coord);
private static native int nativeGetKeymapKeyMultitouchGesture(int keynum);
private static native void nativeSetKeymapKeyMultitouchGesture(int keynum, int key);
private static native void nativeSetMultitouchGestureSensitivity(int sensitivity);
private static native void nativeSetTouchscreenCalibration(int x1, int y1, int x2, int y2);
public static native void nativeSetTouchscreenCalibration(int x1, int y1, int x2, int y2);
// libsdl_native_helpers.so, exists in both versions
public static native void nativeSetEnv(final String name, final String value);
public static native int nativeChmod(final String name, int mode);
public static native void nativeChdir(final String dir);

View File

@@ -248,6 +248,7 @@ class SettingsMenu
new SettingsMenuKeyboard.ScreenGesturesConfig(),
new SettingsMenuMisc.VideoSettingsConfig(),
new SettingsMenuMisc.CommandlineConfig(),
new SettingsMenuMisc.StorageAccessConfig(),
new SettingsMenuMisc.ResetToDefaultsConfig(),
new OkButton(),
};

View File

@@ -57,6 +57,7 @@ import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.Button;
import android.view.View;
import android.view.Gravity;
import android.widget.LinearLayout;
import android.text.Editable;
import android.text.SpannedString;
@@ -276,10 +277,10 @@ class SettingsMenuKeyboard extends SettingsMenu
void run (final MainActivity p)
{
p.setText(p.getResources().getString(R.string.remap_hwkeys_press));
p.keyListener = new KeyRemapTool(p);
p.getVideoLayout().setOnKeyListener(new KeyRemapTool(p));
}
public static class KeyRemapTool implements MainActivity.KeyEventsListener
public static class KeyRemapTool implements View.OnKeyListener
{
MainActivity p;
public KeyRemapTool(MainActivity _p)
@@ -287,9 +288,10 @@ class SettingsMenuKeyboard extends SettingsMenu
p = _p;
}
public void onKeyEvent(final int keyCode)
@Override
public boolean onKey(View v, int keyCode, KeyEvent event)
{
p.keyListener = null;
p.getVideoLayout().setOnKeyListener(null);
int keyIndex = keyCode;
if( keyIndex < 0 )
keyIndex = 0;
@@ -336,6 +338,7 @@ class SettingsMenuKeyboard extends SettingsMenu
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
return true;
}
public void ShowAllKeys(final int KeyIndex)
{
@@ -383,26 +386,22 @@ class SettingsMenuKeyboard extends SettingsMenu
p.getResources().getString(R.string.remap_screenkb_button) + " 4",
p.getResources().getString(R.string.remap_screenkb_button) + " 5",
p.getResources().getString(R.string.remap_screenkb_button) + " 6",
p.getResources().getString(R.string.remap_screenkb_joystick) + " 2",
p.getResources().getString(R.string.remap_screenkb_joystick) + " 3",
p.getResources().getString(R.string.remap_screenkb_button) + " 7",
p.getResources().getString(R.string.remap_screenkb_button) + " 8",
p.getResources().getString(R.string.remap_screenkb_button) + " 9",
p.getResources().getString(R.string.remap_screenkb_button) + " 10",
p.getResources().getString(R.string.remap_screenkb_button) + " 11",
p.getResources().getString(R.string.remap_screenkb_button) + " 12",
};
boolean defaults[] = Arrays.copyOf(Globals.ScreenKbControlsShown, Globals.ScreenKbControlsShown.length);
if( Globals.AppUsesSecondJoystick )
{
items = Arrays.copyOf(items, items.length + 1);
items[items.length - 1] = p.getResources().getString(R.string.remap_screenkb_joystick) + " 2";
defaults = Arrays.copyOf(defaults, defaults.length + 1);
defaults[defaults.length - 1] = true;
}
if( Globals.AppUsesThirdJoystick )
{
items = Arrays.copyOf(items, items.length + 1);
items[items.length - 1] = p.getResources().getString(R.string.remap_screenkb_joystick) + " 3";
defaults = Arrays.copyOf(defaults, defaults.length + 1);
defaults[defaults.length - 1] = true;
}
for( int i = 0; i < Math.min(6, Globals.AppTouchscreenKeyboardKeysNames.length); i++ )
items[i+2] = items[i+2] + " - " + Globals.AppTouchscreenKeyboardKeysNames[i].replace("_", " ");
for( int i = 6; i < Math.min(12, Globals.AppTouchscreenKeyboardKeysNames.length); i++ )
items[i+4] = items[i+4] + " - " + Globals.AppTouchscreenKeyboardKeysNames[i].replace("_", " ");
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.remap_screenkb));
@@ -442,9 +441,15 @@ class SettingsMenuKeyboard extends SettingsMenu
p.getResources().getString(R.string.remap_screenkb_button) + " 4",
p.getResources().getString(R.string.remap_screenkb_button) + " 5",
p.getResources().getString(R.string.remap_screenkb_button) + " 6",
p.getResources().getString(R.string.remap_screenkb_button) + " 7",
p.getResources().getString(R.string.remap_screenkb_button) + " 8",
p.getResources().getString(R.string.remap_screenkb_button) + " 9",
p.getResources().getString(R.string.remap_screenkb_button) + " 10",
p.getResources().getString(R.string.remap_screenkb_button) + " 11",
p.getResources().getString(R.string.remap_screenkb_button) + " 12",
};
for( int i = 0; i < Math.min(6, Globals.AppTouchscreenKeyboardKeysNames.length); i++ )
for( int i = 0; i < Math.min(12, Globals.AppTouchscreenKeyboardKeysNames.length); i++ )
items[i] = items[i] + " - " + Globals.AppTouchscreenKeyboardKeysNames[i].replace("_", " ");
if( currentButton >= Globals.RemapScreenKbKeycode.length )
@@ -452,7 +457,12 @@ class SettingsMenuKeyboard extends SettingsMenu
goBack(p);
return;
}
if( ! Globals.ScreenKbControlsShown[currentButton + 2] )
if( currentButton < 6 && ! Globals.ScreenKbControlsShown[currentButton + 2] )
{
showRemapScreenKbConfig2(p, currentButton + 1);
return;
}
if( currentButton >= 6 && ! Globals.ScreenKbControlsShown[currentButton + 4] )
{
showRemapScreenKbConfig2(p, currentButton + 1);
return;
@@ -623,13 +633,19 @@ class SettingsMenuKeyboard extends SettingsMenu
void run (final MainActivity p)
{
p.setText(p.getResources().getString(R.string.screenkb_custom_layout_help));
CustomizeScreenKbLayoutTool tool = new CustomizeScreenKbLayoutTool(p);
p.touchListener = tool;
p.keyListener = tool;
Globals.TouchscreenKeyboardSize = Globals.TOUCHSCREEN_KEYBOARD_CUSTOM;
if (Globals.ImmersiveMode)
DimSystemStatusBar.dim(p.getVideoLayout(), p.getWindow());
p.getVideoLayout().getHandler().postDelayed(new Runnable()
{
public void run()
{
CustomizeScreenKbLayoutTool tool = new CustomizeScreenKbLayoutTool(p);
Globals.TouchscreenKeyboardSize = Globals.TOUCHSCREEN_KEYBOARD_CUSTOM;
}
}, 200);
}
static class CustomizeScreenKbLayoutTool implements MainActivity.TouchEventsListener, MainActivity.KeyEventsListener
static class CustomizeScreenKbLayoutTool implements View.OnTouchListener, View.OnKeyListener
{
MainActivity p;
FrameLayout layout = null;
@@ -648,16 +664,33 @@ class SettingsMenuKeyboard extends SettingsMenu
R.drawable.b5,
R.drawable.b6,
R.drawable.dpad,
R.drawable.dpad
R.drawable.dpad,
R.drawable.b1,
R.drawable.b2,
R.drawable.b3,
R.drawable.b4,
R.drawable.b5,
R.drawable.b6,
};
int oldX = 0, oldY = 0;
boolean resizing = false;
public CustomizeScreenKbLayoutTool(MainActivity _p)
{
if( buttons.length != Globals.ScreenKbControlsLayout.length )
{
Log.i("SDL", "Assertion failed: buttons.length != Globals.ScreenKbControlsLayout.length" );
throw new RuntimeException("Assertion failed: buttons.length != Globals.ScreenKbControlsLayout.length");
}
p = _p;
layout = new FrameLayout(p);
p.getVideoLayout().addView(layout);
layout.setFocusable(true);
layout.setFocusableInTouchMode(true);
layout.requestFocus();
layout.setOnTouchListener(this);
layout.setOnKeyListener(this);
boundary = new ImageView(p);
boundary.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
boundary.setScaleType(ImageView.ScaleType.MATRIX);
@@ -665,30 +698,28 @@ class SettingsMenuKeyboard extends SettingsMenu
boundary.setImageBitmap(boundaryBmp);
layout.addView(boundary);
currentButton = -1;
if( Globals.TouchscreenKeyboardTheme == 2 )
{
buttons = new int[] {
R.drawable.sun_dpad,
R.drawable.sun_keyboard,
R.drawable.sun_b1,
R.drawable.sun_b2,
R.drawable.sun_b3,
R.drawable.sun_b4,
R.drawable.sun_b5,
R.drawable.sun_b6,
R.drawable.sun_dpad,
R.drawable.sun_dpad
};
}
int displayX = 800;
int displayY = 480;
try {
DisplayMetrics dm = new DisplayMetrics();
p.getWindowManager().getDefaultDisplay().getMetrics(dm);
displayX = dm.widthPixels;
displayY = dm.heightPixels;
} catch (Exception eeeee) {}
final int displayX = p.getVideoLayout().getWidth();
final int displayY = p.getVideoLayout().getHeight();
if( Globals.TouchscreenKeyboardSize != Globals.TOUCHSCREEN_KEYBOARD_CUSTOM )
{
DemoRenderer.nativeResize(displayX, displayY, 0);
Settings.nativeSetJoystickUsed( Globals.AppUsesThirdJoystick ? 3 : (Globals.AppUsesSecondJoystick ? 2 : (Globals.AppUsesJoystick ? 1 : 0)) );
Settings.nativeSetupScreenKeyboard( Globals.TouchscreenKeyboardSize,
Globals.TouchscreenKeyboardDrawSize,
Globals.TouchscreenKeyboardTheme,
Globals.TouchscreenKeyboardTransparency,
Globals.FloatingScreenJoystick ? 1 : 0,
Globals.AppTouchscreenKeyboardKeysAmount );
for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ )
{
Globals.ScreenKbControlsLayout[i][0] = Settings.nativeGetScreenKeyboardButtonLayout(i, 0);
Globals.ScreenKbControlsLayout[i][1] = Settings.nativeGetScreenKeyboardButtonLayout(i, 1);
Globals.ScreenKbControlsLayout[i][2] = Settings.nativeGetScreenKeyboardButtonLayout(i, 2);
Globals.ScreenKbControlsLayout[i][3] = Settings.nativeGetScreenKeyboardButtonLayout(i, 3);
}
}
for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ )
{
@@ -696,37 +727,7 @@ class SettingsMenuKeyboard extends SettingsMenu
continue;
if( currentButton == -1 )
currentButton = i;
//Log.i("SDL", "Screen kb button " + i + " coords " + Globals.ScreenKbControlsLayout[i][0] + ":" + Globals.ScreenKbControlsLayout[i][1] + ":" + Globals.ScreenKbControlsLayout[i][2] + ":" + Globals.ScreenKbControlsLayout[i][3] );
// Check if the button is off screen edge or shrunk to zero
if( Globals.ScreenKbControlsLayout[i][0] > Globals.ScreenKbControlsLayout[i][2] - displayY/12 )
Globals.ScreenKbControlsLayout[i][0] = Globals.ScreenKbControlsLayout[i][2] - displayY/12;
if( Globals.ScreenKbControlsLayout[i][1] > Globals.ScreenKbControlsLayout[i][3] - displayY/12 )
Globals.ScreenKbControlsLayout[i][1] = Globals.ScreenKbControlsLayout[i][3] - displayY/12;
if( Globals.ScreenKbControlsLayout[i][0] < Globals.ScreenKbControlsLayout[i][2] - displayY*2/3 )
Globals.ScreenKbControlsLayout[i][0] = Globals.ScreenKbControlsLayout[i][2] - displayY*2/3;
if( Globals.ScreenKbControlsLayout[i][1] < Globals.ScreenKbControlsLayout[i][3] - displayY*2/3 )
Globals.ScreenKbControlsLayout[i][1] = Globals.ScreenKbControlsLayout[i][3] - displayY*2/3;
if( Globals.ScreenKbControlsLayout[i][0] < 0 )
{
Globals.ScreenKbControlsLayout[i][2] += -Globals.ScreenKbControlsLayout[i][0];
Globals.ScreenKbControlsLayout[i][0] = 0;
}
if( Globals.ScreenKbControlsLayout[i][2] > displayX )
{
Globals.ScreenKbControlsLayout[i][0] -= Globals.ScreenKbControlsLayout[i][2] - displayX;
Globals.ScreenKbControlsLayout[i][2] = displayX;
}
if( Globals.ScreenKbControlsLayout[i][1] < 0 )
{
Globals.ScreenKbControlsLayout[i][3] += -Globals.ScreenKbControlsLayout[i][1];
Globals.ScreenKbControlsLayout[i][1] = 0;
}
if( Globals.ScreenKbControlsLayout[i][3] > displayY )
{
Globals.ScreenKbControlsLayout[i][1] -= Globals.ScreenKbControlsLayout[i][3] - displayY;
Globals.ScreenKbControlsLayout[i][3] = displayY;
}
//Log.i("SDL", "After bounds check coords " + Globals.ScreenKbControlsLayout[i][0] + ":" + Globals.ScreenKbControlsLayout[i][1] + ":" + Globals.ScreenKbControlsLayout[i][2] + ":" + Globals.ScreenKbControlsLayout[i][3] );
Log.i("SDL", "Screen kb button " + i + " coords " + Globals.ScreenKbControlsLayout[i][0] + ":" + Globals.ScreenKbControlsLayout[i][1] + ":" + Globals.ScreenKbControlsLayout[i][2] + ":" + Globals.ScreenKbControlsLayout[i][3] );
imgs[i] = new ImageView(p);
imgs[i].setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
@@ -744,9 +745,34 @@ class SettingsMenuKeyboard extends SettingsMenu
}
boundary.bringToFront();
if( currentButton == -1 )
onKeyEvent( KeyEvent.KEYCODE_BACK ); // All buttons disabled - do not show anything
onKey( null, KeyEvent.KEYCODE_BACK, null ); // All buttons disabled - do not show anything
else
setupButton(currentButton);
final Button backButton = new Button(p);
backButton.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
backButton.setText(android.R.string.ok);
//backButton.setTop(displayY / 30);
//backButton.setLeft(displayX / 2);
backButton.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
p.getVideoLayout().removeView(layout);
layout = null;
goBack(p);
}
});
layout.addView(backButton, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT,
Gravity.TOP | Gravity.CENTER_HORIZONTAL));
layout.getHandler().postDelayed(new Runnable()
{
public void run()
{
//backButton.setLeft(displayX / 2 - backButton.getWidth() / 2);
//backButton.setLeft(displayX / 2);
}
}, 200);
}
void setupButton(int i)
@@ -774,10 +800,15 @@ class SettingsMenuKeyboard extends SettingsMenu
buttonText = "Joystick 2";
if( i == 9 )
buttonText = "Joystick 3";
if( i >= 10 && i <= 15 )
buttonText = p.getResources().getString(R.string.remap_screenkb_button) + (i - 4);
if( i >= 10 && i - 4 < Globals.AppTouchscreenKeyboardKeysNames.length )
buttonText = Globals.AppTouchscreenKeyboardKeysNames[i - 4].replace("_", " ");
p.setText(p.getResources().getString(R.string.screenkb_custom_layout_help) + "\n" + buttonText);
}
public void onTouchEvent(final MotionEvent ev)
@Override
public boolean onTouch(View v, MotionEvent ev)
{
if( ev.getAction() == MotionEvent.ACTION_DOWN )
{
@@ -842,18 +873,19 @@ class SettingsMenuKeyboard extends SettingsMenu
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
boundary.setImageMatrix(m);
}
return true;
}
public void onKeyEvent(final int keyCode)
@Override
public boolean onKey(View v, int keyCode, KeyEvent event)
{
if( keyCode == KeyEvent.KEYCODE_BACK )
{
p.getVideoLayout().removeView(layout);
layout = null;
p.touchListener = null;
p.keyListener = null;
goBack(p);
}
return true;
}
}
}
@@ -871,7 +903,7 @@ class SettingsMenuKeyboard extends SettingsMenu
p.getResources().getString(R.string.screenkb_floating_joystick),
};
boolean defaults[] = {
boolean defaults[] = {
Globals.FloatingScreenJoystick,
};

View File

@@ -324,6 +324,7 @@ class SettingsMenuMisc extends SettingsMenu
p.getResources().getString(R.string.mouse_keepaspectratio),
p.getResources().getString(R.string.video_smooth),
p.getResources().getString(R.string.video_immersive),
p.getResources().getString(R.string.video_draw_cutout),
p.getResources().getString(R.string.video_orientation_autodetect),
p.getResources().getString(R.string.video_orientation_vertical),
p.getResources().getString(R.string.video_bpp_24),
@@ -333,6 +334,7 @@ class SettingsMenuMisc extends SettingsMenu
Globals.KeepAspectRatio,
Globals.VideoLinearFilter,
Globals.ImmersiveMode,
Globals.DrawInDisplayCutout,
Globals.AutoDetectOrientation,
!Globals.HorizontalOrientation,
Globals.VideoDepthBpp == 24,
@@ -345,6 +347,7 @@ class SettingsMenuMisc extends SettingsMenu
p.getResources().getString(R.string.mouse_keepaspectratio),
p.getResources().getString(R.string.video_smooth),
p.getResources().getString(R.string.video_immersive),
p.getResources().getString(R.string.video_draw_cutout),
p.getResources().getString(R.string.video_orientation_autodetect),
p.getResources().getString(R.string.video_orientation_vertical),
p.getResources().getString(R.string.video_bpp_24),
@@ -355,6 +358,7 @@ class SettingsMenuMisc extends SettingsMenu
Globals.KeepAspectRatio,
Globals.VideoLinearFilter,
Globals.ImmersiveMode,
Globals.DrawInDisplayCutout,
Globals.AutoDetectOrientation,
!Globals.HorizontalOrientation,
Globals.VideoDepthBpp == 24,
@@ -365,7 +369,7 @@ class SettingsMenuMisc extends SettingsMenu
defaults = defaults2;
}
if(Globals.Using_SDL_1_3)
if(Globals.UsingSDL2)
{
CharSequence[] items2 = {
p.getResources().getString(R.string.mouse_keepaspectratio),
@@ -390,14 +394,16 @@ class SettingsMenuMisc extends SettingsMenu
if( item == 2 )
Globals.ImmersiveMode = isChecked;
if( item == 3 )
Globals.AutoDetectOrientation = isChecked;
Globals.DrawInDisplayCutout = isChecked;
if( item == 4 )
Globals.HorizontalOrientation = !isChecked;
Globals.AutoDetectOrientation = isChecked;
if( item == 5 )
Globals.VideoDepthBpp = (isChecked ? 24 : 16);
Globals.HorizontalOrientation = !isChecked;
if( item == 6 )
Globals.TvBorders = isChecked;
Globals.VideoDepthBpp = (isChecked ? 24 : 16);
if( item == 7 )
Globals.TvBorders = isChecked;
if( item == 8 )
Globals.MultiThreadedVideo = isChecked;
}
});
@@ -437,7 +443,7 @@ class SettingsMenuMisc extends SettingsMenu
String readmes[] = Globals.ReadmeText.split("\\^");
String lang = new String(Locale.getDefault().getLanguage()) + ":";
if( p.isRunningOnOUYA() )
lang = "ouya:";
lang = "tv:";
String readme = readmes[0];
String buttonName = "", buttonUrl = "";
for( String r: readmes )
@@ -469,10 +475,14 @@ class SettingsMenuMisc extends SettingsMenu
text.setPadding(0, 5, 0, 20);
text.setTextSize(20.0f);
text.setGravity(Gravity.CENTER);
text.setFocusable(false);
text.setFocusableInTouchMode(false);
AlertDialog.Builder builder = new AlertDialog.Builder(p);
ScrollView scroll = new ScrollView(p);
scroll.setFocusable(false);
scroll.setFocusableInTouchMode(false);
scroll.addView(text, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
Button ok = new Button(p);
final Button ok = new Button(p);
final AlertDialog alertDismiss[] = new AlertDialog[1];
ok.setOnClickListener(new View.OnClickListener()
{
@@ -485,7 +495,6 @@ class SettingsMenuMisc extends SettingsMenu
LinearLayout layout = new LinearLayout(p);
layout.setOrientation(LinearLayout.VERTICAL);
layout.addView(scroll);
//layout.addView(text);
layout.addView(ok);
if( buttonName.length() > 0 )
{
@@ -539,6 +548,42 @@ class SettingsMenuMisc extends SettingsMenu
}
}
public static class StorageAccessConfig extends Menu
{
public static int REQUEST_STORAGE_ID = 42;
public static void onActivityResult(final MainActivity p, final int requestCode, final int resultCode, final Intent resultData)
{
if (requestCode == REQUEST_STORAGE_ID)
{
if (resultCode == Activity.RESULT_OK)
{
Uri treeUri = resultData.getData();
p.getContentResolver().takePersistableUriPermission(treeUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
Log.i("SDL", "Storage write permission granted to path " + treeUri.toString());
}
else
{
Log.i("SDL", "Storage write permission rejected");
}
}
}
String title(final MainActivity p)
{
return p.getResources().getString(R.string.storage_access);
}
void run (final MainActivity p)
{
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP)
{
p.startActivityForResult(new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE), REQUEST_STORAGE_ID);
}
goBack(p);
}
}
static class CommandlineConfig extends Menu
{
String title(final MainActivity p)
@@ -554,12 +599,10 @@ class SettingsMenuMisc extends SettingsMenu
edit.setFocusableInTouchMode(true);
edit.setFocusable(true);
if (Globals.CommandLine.length() == 0)
Globals.CommandLine = "SDL_app";
if (Globals.CommandLine.indexOf(" ") == -1)
Globals.CommandLine += " ";
edit.setText(Globals.CommandLine.substring(Globals.CommandLine.indexOf(" ")).replace(" ", "\n").replace(" ", " "));
Globals.CommandLine = "App";
edit.setText(Globals.CommandLine.replace(" ", "\n").replace(" ", " "));
edit.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
edit.setMinLines(2);
edit.setMinLines(1);
//edit.setMaxLines(100);
builder.setView(edit);
@@ -567,17 +610,22 @@ class SettingsMenuMisc extends SettingsMenu
{
public void onClick(DialogInterface dialog, int item)
{
Globals.CommandLine = "SDL_app";
Globals.CommandLine = "";
String args[] = edit.getText().toString().split("\n");
boolean firstArg = true;
for( String arg: args )
if( args.length == 1 )
{
Globals.CommandLine += " ";
if( firstArg )
Globals.CommandLine += arg;
else
Globals.CommandLine = args[0];
}
else
{
boolean firstArg = true;
for( String arg: args )
{
if( !firstArg )
Globals.CommandLine += " ";
Globals.CommandLine += arg.replace(" ", " ");
firstArg = false;
firstArg = false;
}
}
dialog.dismiss();
goBack(p);

View File

@@ -267,7 +267,7 @@ class SettingsMenuMouse extends SettingsMenu
dialog.dismiss();
Globals.LeftClickMethod = item;
if( item == Mouse.LEFT_CLICK_WITH_KEY )
p.keyListener = new KeyRemapToolMouseClick(p, true);
p.getVideoLayout().setOnKeyListener(new KeyRemapToolMouseClick(p, true));
else if( item == Mouse.LEFT_CLICK_WITH_TIMEOUT || item == Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT )
showLeftClickTimeoutConfig(p);
else
@@ -343,7 +343,7 @@ class SettingsMenuMouse extends SettingsMenu
Globals.RightClickMethod = item;
dialog.dismiss();
if( item == Mouse.RIGHT_CLICK_WITH_KEY )
p.keyListener = new KeyRemapToolMouseClick(p, false);
p.getVideoLayout().setOnKeyListener(new KeyRemapToolMouseClick(p, false));
else if( item == Mouse.RIGHT_CLICK_WITH_TIMEOUT )
showRightClickTimeoutConfig(p);
else
@@ -393,7 +393,7 @@ class SettingsMenuMouse extends SettingsMenu
}
}
public static class KeyRemapToolMouseClick implements MainActivity.KeyEventsListener
public static class KeyRemapToolMouseClick implements View.OnKeyListener
{
MainActivity p;
boolean leftClick;
@@ -404,9 +404,10 @@ class SettingsMenuMouse extends SettingsMenu
this.leftClick = leftClick;
}
public void onKeyEvent(final int keyCode)
@Override
public boolean onKey(View v, int keyCode, KeyEvent event)
{
p.keyListener = null;
p.getVideoLayout().setOnKeyListener(null);
int keyIndex = keyCode;
if( keyIndex < 0 )
keyIndex = 0;
@@ -419,6 +420,7 @@ class SettingsMenuMouse extends SettingsMenu
Globals.RightClickKey = keyIndex;
goBack(p);
return true;
}
}
@@ -686,10 +688,10 @@ class SettingsMenuMouse extends SettingsMenu
void run (final MainActivity p)
{
p.setText(p.getResources().getString(R.string.measurepressure_touchplease));
p.touchListener = new TouchMeasurementTool(p);
p.getVideoLayout().setOnTouchListener(new TouchMeasurementTool(p));
}
public static class TouchMeasurementTool implements MainActivity.TouchEventsListener
public static class TouchMeasurementTool implements View.OnTouchListener
{
MainActivity p;
ArrayList<Integer> force = new ArrayList<Integer>();
@@ -701,7 +703,8 @@ class SettingsMenuMouse extends SettingsMenu
p = _p;
}
public void onTouchEvent(final MotionEvent ev)
@Override
public boolean onTouch(View v, MotionEvent ev)
{
force.add(new Integer((int)(ev.getPressure() * 1000.0)));
radius.add(new Integer((int)(ev.getSize() * 1000.0)));
@@ -712,12 +715,13 @@ class SettingsMenuMouse extends SettingsMenu
if( force.size() >= maxEventAmount )
{
p.touchListener = null;
p.getVideoLayout().setOnTouchListener(null);
Globals.ClickScreenPressure = getAverageForce();
Globals.ClickScreenTouchspotSize = getAverageRadius();
Log.i("SDL", "SDL: measured average force " + Globals.ClickScreenPressure + " radius " + Globals.ClickScreenTouchspotSize);
goBack(p);
}
return true;
}
int getAverageForce()
@@ -756,11 +760,11 @@ class SettingsMenuMouse extends SettingsMenu
Globals.TouchscreenCalibration[2] = 0;
Globals.TouchscreenCalibration[3] = 0;
ScreenEdgesCalibrationTool tool = new ScreenEdgesCalibrationTool(p);
p.touchListener = tool;
p.keyListener = tool;
p.getVideoLayout().setOnTouchListener(tool);
p.getVideoLayout().setOnKeyListener(tool);
}
static class ScreenEdgesCalibrationTool implements MainActivity.TouchEventsListener, MainActivity.KeyEventsListener
static class ScreenEdgesCalibrationTool implements View.OnTouchListener, View.OnKeyListener
{
MainActivity p;
ImageView img;
@@ -783,7 +787,8 @@ class SettingsMenuMouse extends SettingsMenu
p.getVideoLayout().addView(img);
}
public void onTouchEvent(final MotionEvent ev)
@Override
public boolean onTouch(View v, MotionEvent ev)
{
if( Globals.TouchscreenCalibration[0] == Globals.TouchscreenCalibration[1] &&
Globals.TouchscreenCalibration[1] == Globals.TouchscreenCalibration[2] &&
@@ -808,14 +813,17 @@ class SettingsMenuMouse extends SettingsMenu
Globals.TouchscreenCalibration[2], Globals.TouchscreenCalibration[3]);
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
img.setImageMatrix(m);
return true;
}
public void onKeyEvent(final int keyCode)
@Override
public boolean onKey(View v, int keyCode, KeyEvent event)
{
p.touchListener = null;
p.keyListener = null;
p.getVideoLayout().setOnTouchListener(null);
p.getVideoLayout().setOnKeyListener(null);
p.getVideoLayout().removeView(img);
goBack(p);
return true;
}
}
}

View File

@@ -33,11 +33,13 @@ import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.egl.EGLSurface;
import java.io.File;
import java.io.InputStream;
import java.util.concurrent.locks.ReentrantLock;
import java.lang.reflect.Method;
import java.util.LinkedList;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.zip.GZIPInputStream;
import android.os.Bundle;
import android.os.Build;
@@ -65,48 +67,20 @@ import android.view.Display;
import android.net.Uri;
import android.Manifest;
import android.content.pm.PackageManager;
import android.hardware.input.InputManager;
import android.graphics.Rect;
class Mouse
{
public static final int LEFT_CLICK_NORMAL = 0;
public static final int LEFT_CLICK_NEAR_CURSOR = 1;
public static final int LEFT_CLICK_WITH_MULTITOUCH = 2;
public static final int LEFT_CLICK_WITH_PRESSURE = 3;
public static final int LEFT_CLICK_WITH_KEY = 4;
public static final int LEFT_CLICK_WITH_TIMEOUT = 5;
public static final int LEFT_CLICK_WITH_TAP = 6;
public static final int LEFT_CLICK_WITH_TAP_OR_TIMEOUT = 7;
public static final int RIGHT_CLICK_NONE = 0;
public static final int RIGHT_CLICK_WITH_MULTITOUCH = 1;
public static final int RIGHT_CLICK_WITH_PRESSURE = 2;
public static final int RIGHT_CLICK_WITH_KEY = 3;
public static final int RIGHT_CLICK_WITH_TIMEOUT = 4;
public static final int SDL_FINGER_DOWN = 0;
public static final int SDL_FINGER_UP = 1;
public static final int SDL_FINGER_MOVE = 2;
public static final int SDL_FINGER_HOVER = 3;
public static final int ZOOM_NONE = 0;
public static final int ZOOM_MAGNIFIER = 1;
public static final int MOUSE_HW_INPUT_FINGER = 0;
public static final int MOUSE_HW_INPUT_STYLUS = 1;
public static final int MOUSE_HW_INPUT_MOUSE = 2;
public static final int MAX_HOVER_DISTANCE = 1024;
public static final int HOVER_REDRAW_SCREEN = 1024 * 10;
public static final float MAX_PRESSURE = 1024.0f;
}
abstract class DifferentTouchInput
{
public abstract void process(final MotionEvent event);
public abstract void processGenericEvent(final MotionEvent event);
public static int ExternalMouseDetected = Mouse.MOUSE_HW_INPUT_FINGER;
public static int buttonState = 0;
public static float capturedMouseX = 0;
public static float capturedMouseY = 0;
public static DifferentTouchInput touchInput = getInstance();
@@ -318,6 +292,12 @@ abstract class DifferentTouchInput
int hwMouseEvent = ((event.getSource() & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE || Globals.ForceHardwareMouse) ? Mouse.MOUSE_HW_INPUT_MOUSE :
((event.getSource() & InputDevice.SOURCE_STYLUS) == InputDevice.SOURCE_STYLUS) ? Mouse.MOUSE_HW_INPUT_STYLUS :
Mouse.MOUSE_HW_INPUT_FINGER;
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O )
{
if( (event.getSource() & InputDevice.SOURCE_MOUSE_RELATIVE) == InputDevice.SOURCE_MOUSE_RELATIVE )
hwMouseEvent = Mouse.MOUSE_HW_INPUT_MOUSE;
}
if( ExternalMouseDetected != hwMouseEvent )
{
ExternalMouseDetected = hwMouseEvent;
@@ -361,12 +341,10 @@ abstract class DifferentTouchInput
}
private static class IcsTouchInput extends GingerbreadTouchInput
{
float hatX = 0.0f, hatY = 0.0f;
private static class Holder
{
private static final IcsTouchInput sInstance = new IcsTouchInput();
}
private int buttonState = 0;
public void process(final MotionEvent event)
{
//Log.i("SDL", "Got motion event, type " + (int)(event.getAction()) + " X " + (int)event.getX() + " Y " + (int)event.getY() + " buttons " + buttonState + " source " + event.getSource());
@@ -388,37 +366,16 @@ abstract class DifferentTouchInput
}
public void processGenericEvent(final MotionEvent event)
{
// Joysticks are supported since Honeycomb, but I don't care about it, because very little devices have it
// Joysticks are supported since Honeycomb, but I don't care about it, because very few devices have it
if( (event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == InputDevice.SOURCE_CLASS_JOYSTICK )
{
// event.getAxisValue(AXIS_HAT_X) and event.getAxisValue(AXIS_HAT_Y) are joystick arrow keys, on Nvidia Shield and some other joysticks
if( event.getAxisValue(MotionEvent.AXIS_HAT_X) != hatX )
{
hatX = event.getAxisValue(MotionEvent.AXIS_HAT_X);
if( hatX == 0.0f )
{
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_LEFT, 0, 0);
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_RIGHT, 0, 0);
}
else
DemoGLSurfaceView.nativeKey(hatX < 0.0f ? KeyEvent.KEYCODE_DPAD_LEFT : KeyEvent.KEYCODE_DPAD_RIGHT, 1, 0);
}
if( event.getAxisValue(MotionEvent.AXIS_HAT_Y) != hatY )
{
hatY = event.getAxisValue(MotionEvent.AXIS_HAT_Y);
if( hatY == 0.0f )
{
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_UP, 0, 0);
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_DOWN, 0, 0);
}
else
DemoGLSurfaceView.nativeKey(hatY < 0.0f ? KeyEvent.KEYCODE_DPAD_UP : KeyEvent.KEYCODE_DPAD_DOWN, 1, 0);
}
DemoGLSurfaceView.nativeGamepadAnalogJoystickInput(
event.getAxisValue(MotionEvent.AXIS_X), event.getAxisValue(MotionEvent.AXIS_Y),
event.getAxisValue(MotionEvent.AXIS_Z), event.getAxisValue(MotionEvent.AXIS_RZ),
event.getAxisValue(MotionEvent.AXIS_LTRIGGER), event.getAxisValue(MotionEvent.AXIS_RTRIGGER),
(hatX == 0.0f && hatY == 0.0f) ? 0 : 1 );
event.getAxisValue(MotionEvent.AXIS_LTRIGGER), event.getAxisValue(MotionEvent.AXIS_RTRIGGER),
event.getAxisValue(MotionEvent.AXIS_HAT_X), event.getAxisValue(MotionEvent.AXIS_HAT_Y),
processGamepadDeviceId(event.getDevice()) );
return;
}
// Process mousewheel
@@ -573,6 +530,78 @@ abstract class DifferentTouchInput
}
}
}
private static int gamepadIds[] = new int[4]; // Maximum 4 gamepads at the moment
public static int processGamepadDeviceId(InputDevice device)
{
if( device == null )
return 0;
int source = device.getSources();
if( (source & InputDevice.SOURCE_CLASS_JOYSTICK) != InputDevice.SOURCE_CLASS_JOYSTICK &&
(source & InputDevice.SOURCE_GAMEPAD) != InputDevice.SOURCE_GAMEPAD )
{
return 0;
}
int deviceId = device.getId();
for( int i = 0; i < gamepadIds.length; i++ )
{
if (gamepadIds[i] == deviceId)
return i + 1;
}
for( int i = 0; i < gamepadIds.length; i++ )
{
if (gamepadIds[i] == 0)
{
Log.i("SDL", "libSDL: gamepad added: deviceId " + deviceId + " gamepadId " + (i + 1));
gamepadIds[i] = deviceId;
return i + 1;
}
}
return 0;
}
public static void registerInputManagerCallbacks(Context context)
{
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN )
{
JellyBeanInputManager.Holder.sInstance.register(context);
}
}
private static class JellyBeanInputManager
{
private static class Holder
{
private static final JellyBeanInputManager sInstance = new JellyBeanInputManager();
}
private static class Listener implements InputManager.InputDeviceListener
{
public void onInputDeviceAdded(int deviceId)
{
}
public void onInputDeviceChanged(int deviceId)
{
onInputDeviceRemoved(deviceId);
}
public void onInputDeviceRemoved(int deviceId)
{
for( int i = 0; i < gamepadIds.length; i++ )
{
if (gamepadIds[i] == deviceId)
{
Log.i("SDL", "libSDL: gamepad removed: deviceId " + deviceId + " gamepadId "+ (i + 1));
gamepadIds[i] = 0;
}
}
}
}
public void register(Context context)
{
InputManager manager = (InputManager) context.getSystemService(Context.INPUT_SERVICE);
manager.registerInputDeviceListener(new Listener(), null);
}
}
}
class DemoRenderer extends GLSurfaceView_SDL.Renderer
@@ -613,6 +642,9 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
mHeight = h - h % 2;
mGl = gl;
nativeResize(mWidth, mHeight, Globals.KeepAspectRatio ? 1 : 0);
if( Globals.TouchscreenCalibration[2] > Globals.TouchscreenCalibration[0] )
Settings.nativeSetTouchscreenCalibration(Globals.TouchscreenCalibration[0], Globals.TouchscreenCalibration[1],
Globals.TouchscreenCalibration[2], Globals.TouchscreenCalibration[3]);
}
int mLastPendingResize = 0;
@@ -644,30 +676,8 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
if (mWidth != 0 && mHeight != 0 && (mWidth != ww || mHeight != hh))
{
Log.i("SDL", "libSDL: DemoRenderer.onWindowResize(): screen size changed from " + mWidth + "x" + mHeight + " to " + ww + "x" + hh);
if (Globals.SwVideoMode &&
(Math.abs(display.getWidth() - ww) > display.getWidth() / 10 ||
Math.abs(display.getHeight() - hh) > display.getHeight() / 10))
{
Log.i("SDL", "Multiwindow detected - enabling screen orientation autodetection");
Globals.AutoDetectOrientation = true;
context.setScreenOrientation();
DemoRenderer.super.ResetVideoSurface();
DemoRenderer.super.onWindowResize(ww, hh);
}
else
{
Log.i("SDL", "System button bar hidden - re-init video to avoid black bar at the top");
DemoRenderer.super.ResetVideoSurface();
DemoRenderer.super.onWindowResize(ww, hh);
}
}
if (mWidth == 0 && mHeight == 0)
{
if ((ww > hh) != (display.getWidth() > display.getHeight()))
{
Log.i("SDL", "Multiwindow detected - app window size " + ww + "x" + hh + " but display dimensions are " + display.getWidth() + "x" + display.getHeight());
Globals.AutoDetectOrientation = true;
}
DemoRenderer.super.ResetVideoSurface();
DemoRenderer.super.onWindowResize(ww, hh);
}
if (Globals.AutoDetectOrientation && (ww > hh) != (mWidth > mHeight))
Globals.HorizontalOrientation = (ww > hh);
@@ -710,9 +720,16 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
// Tweak video thread priority, if user selected big audio buffer
if( Globals.AudioBufferConfig >= 2 )
Thread.currentThread().setPriority( (Thread.NORM_PRIORITY + Thread.MIN_PRIORITY) / 2 ); // Lower than normal
// Calls main() and never returns, hehe - we'll call eglSwapBuffers() from native code
// Calls main() and never returns, hehe - we'll call eglSwapBuffers() from native code
String commandline = Globals.CommandLine;
if( context.getIntent() != null && context.getIntent().getScheme() != null &&
context.getIntent().getScheme().compareTo(android.content.ContentResolver.SCHEME_FILE) == 0 &&
context.getIntent().getData() != null && context.getIntent().getData().getPath() != null )
{
commandline += " " + context.getIntent().getData().getPath();
}
nativeInit( Globals.DataDir,
Globals.CommandLine,
commandline,
( (Globals.SwVideoMode && Globals.MultiThreadedVideo) || Globals.CompatibilityHacksVideo ) ? 1 : 0,
0 );
System.exit(0); // The main() returns here - I don't bother with deinit stuff, just terminate process
@@ -722,30 +739,16 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
{
if( ! super.SwapBuffers() && Globals.NonBlockingSwapBuffers )
{
if(mRatelimitTouchEvents)
{
synchronized(this)
{
this.notify();
}
}
return 0;
}
if(mGlContextLost) {
mGlContextLost = false;
Settings.SetupTouchscreenKeyboardGraphics(context); // Reload on-screen buttons graphics
DemoGLSurfaceView.SetupTouchscreenKeyboardGraphics(context); // Reload on-screen buttons graphics
super.SwapBuffers();
}
// Unblock event processing thread only after we've finished rendering
if(mRatelimitTouchEvents)
{
synchronized(this)
{
this.notify();
}
}
if( context.isScreenKeyboardShown() && !context.keyboardWithoutTextInputShown )
{
try {
@@ -836,6 +839,12 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
Clipboard.get().set(context, s);
}
public void setCapturedMousePosition(int x, int y) // Called from native code
{
DifferentTouchInput.capturedMouseX = x;
DifferentTouchInput.capturedMouseY = y;
}
public void exitApp()
{
nativeDone();
@@ -936,6 +945,11 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
}
}
public void setSystemMousePointerVisible(int visible)
{
context.setSystemMousePointerVisible(visible);
}
public void restartMyself(String restartParams)
{
Intent intent = new Intent(context, RestartMainActivity.class);
@@ -959,7 +973,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
private native void nativeInitJavaCallbacks();
private native void nativeInit(String CurrentPath, String CommandLine, int multiThreadedVideo, int unused);
private native void nativeResize(int w, int h, int keepAspectRatio);
public static native void nativeResize(int w, int h, int keepAspectRatio);
private native void nativeDone();
private native void nativeGlContextLost();
public native void nativeGlContextRecreated();
@@ -983,32 +997,114 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
public int mWidth = 0;
public int mHeight = 0;
int mOrientationFrameHackyCounter = 0;
public static final boolean mRatelimitTouchEvents = true; //(Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO);
}
class DemoGLSurfaceView extends GLSurfaceView_SDL {
public DemoGLSurfaceView(MainActivity context) {
super(context);
mParent = context;
setEGLConfigChooser(Globals.VideoDepthBpp, Globals.NeedDepthBuffer, Globals.NeedStencilBuffer, Globals.NeedGles2, Globals.NeedGles3);
mRenderer = new DemoRenderer(context);
setRenderer(mRenderer);
DifferentTouchInput.registerInputManagerCallbacks(context);
}
@Override
public boolean onTouchEvent(final MotionEvent event)
public boolean onKeyDown(int keyCode, final KeyEvent event)
{
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH)
//Log.v("SDL", "DemoGLSurfaceView::onKeyDown(): keyCode " + keyCode + " event.getSource() " + event.getSource());
if( keyCode == KeyEvent.KEYCODE_BACK )
{
boolean mouseInput = false;
if( (event.getSource() & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE )
mouseInput = true;
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O )
{
if( (event.getSource() & InputDevice.SOURCE_MOUSE_RELATIVE) == InputDevice.SOURCE_MOUSE_RELATIVE )
mouseInput = true;
}
if( mouseInput )
{
// Stupid Samsung and stupid Acer remaps right mouse button to BACK key
nativeMouseButtonsPressed(2, 1);
return true;
}
else if( mParent.keyboardWithoutTextInputShown )
{
return true;
}
}
if( nativeKey( keyCode, 1, event.getUnicodeChar(), DifferentTouchInput.processGamepadDeviceId(event.getDevice()) ) == 0 )
return super.onKeyDown(keyCode, event);
return true;
}
@Override
public boolean onKeyUp(int keyCode, final KeyEvent event)
{
if( keyCode == KeyEvent.KEYCODE_BACK )
{
boolean mouseInput = false;
if( (event.getSource() & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE )
mouseInput = true;
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O )
{
if( (event.getSource() & InputDevice.SOURCE_MOUSE_RELATIVE) == InputDevice.SOURCE_MOUSE_RELATIVE )
mouseInput = true;
}
if( mouseInput )
{
// Stupid Samsung and stupid Acer remaps right mouse button to BACK key
nativeMouseButtonsPressed(2, 0);
return true;
}
else if( mParent.keyboardWithoutTextInputShown )
{
mParent.showScreenKeyboardWithoutTextInputField(0); // Hide keyboard
return true;
}
}
if( nativeKey( keyCode, 0, event.getUnicodeChar(), DifferentTouchInput.processGamepadDeviceId(event.getDevice()) ) == 0 )
return super.onKeyUp(keyCode, event);
return true;
}
@Override
public boolean onKeyMultiple(int keyCode, int repeatCount, final KeyEvent event)
{
if( event.getCharacters() != null )
{
// Non-English text input
for( int i = 0; i < event.getCharacters().length(); i++ )
{
nativeKey( event.getKeyCode(), 1, event.getCharacters().codePointAt(i), 0 );
nativeKey( event.getKeyCode(), 0, event.getCharacters().codePointAt(i), 0 );
}
}
return true;
}
@Override
public boolean onTouchEvent(final MotionEvent event)
{
if( mParent.keyboardWithoutTextInputShown && mParent._screenKeyboard != null &&
mParent._screenKeyboard.getY() <= event.getY() )
{
event.offsetLocation(-mParent._screenKeyboard.getX(), -mParent._screenKeyboard.getY());
mParent._screenKeyboard.onTouchEvent(event);
return true;
}
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH )
{
if (getX() != 0)
event.offsetLocation(-getX(), -getY());
}
DifferentTouchInput.touchInput.process(event);
if( DemoRenderer.mRatelimitTouchEvents )
{
limitEventRate(event);
}
return true;
};
@@ -1016,33 +1112,47 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
public boolean onGenericMotionEvent (final MotionEvent event)
{
DifferentTouchInput.touchInput.processGenericEvent(event);
if( DemoRenderer.mRatelimitTouchEvents )
{
limitEventRate(event);
}
return true;
}
public void limitEventRate(final MotionEvent event)
@Override
public boolean onCapturedPointerEvent (final MotionEvent event)
{
// Wait a bit, and try to synchronize to app framerate, or event thread will eat all CPU and we'll lose FPS
// With Froyo the rate of touch events seems to be limited by OS, but they are arriving faster then we're redrawing anyway
if((event.getAction() == MotionEvent.ACTION_MOVE ||
event.getAction() == MotionEvent.ACTION_HOVER_MOVE))
{
synchronized(mRenderer)
{
try
{
mRenderer.wait(300L); // And sometimes the app decides not to render at all, so this timeout should not be big.
}
catch (InterruptedException e)
{
Log.v("SDL", "DemoGLSurfaceView::limitEventRate(): Who dared to interrupt my slumber?");
Thread.interrupted();
}
}
}
DifferentTouchInput.capturedMouseX += event.getX();
DifferentTouchInput.capturedMouseY += event.getY();
if (DifferentTouchInput.capturedMouseX < 0)
DifferentTouchInput.capturedMouseX = 0;
if (DifferentTouchInput.capturedMouseY < 0)
DifferentTouchInput.capturedMouseY = 0;
if (DifferentTouchInput.capturedMouseX >= this.getWidth())
DifferentTouchInput.capturedMouseX = this.getWidth() - 1;
if (DifferentTouchInput.capturedMouseY >= this.getHeight())
DifferentTouchInput.capturedMouseY = this.getHeight() - 1;
//Log.v("SDL", "SDL DemoGLSurfaceView::onCapturedPointerEvent(): X " + DifferentTouchInput.capturedMouseX + " Y " + DifferentTouchInput.capturedMouseY +
// " W " + this.getWidth() + " H " + this.getHeight() + " getX " + event.getX() + " getY " + event.getY() +
// " RelX " + event.getAxisValue(MotionEvent.AXIS_RELATIVE_X) + " RelY " + event.getAxisValue(MotionEvent.AXIS_RELATIVE_Y) );
event.setLocation(DifferentTouchInput.capturedMouseX, DifferentTouchInput.capturedMouseY);
event.setAction(MotionEvent.ACTION_HOVER_MOVE);
int scrollX = Math.round(event.getAxisValue(MotionEvent.AXIS_HSCROLL));
int scrollY = Math.round(event.getAxisValue(MotionEvent.AXIS_VSCROLL));
if (scrollX != 0 || scrollY != 0)
DemoGLSurfaceView.nativeMouseWheel(scrollX, scrollY);
//Log.v("SDL", "DemoGLSurfaceView::onCapturedPointerEvent(): XY " + event.getX() + " " + event.getY() + " action " + event.getAction() + " scroll " + scrollX + " " + scrollY);
return this.onTouchEvent(event);
}
@Override
public void onPointerCaptureChange (boolean hasCapture)
{
Log.v("SDL", "DemoGLSurfaceView::onPointerCaptureChange(): " + hasCapture);
super.onPointerCaptureChange(hasCapture);
DifferentTouchInput.capturedMouseX = this.getWidth() / 2;
DifferentTouchInput.capturedMouseY = this.getHeight() / 2;
}
public void exitApp() {
@@ -1076,17 +1186,110 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
mRenderer.nativeGlContextRecreated();
if( mRenderer.accelerometer != null && mRenderer.accelerometer.openedBySDL ) // For some reason it crashes here often - are we getting this event before initialization?
mRenderer.accelerometer.start();
captureMouse(true);
};
public void captureMouse(boolean capture)
{
if( capture )
{
setFocusableInTouchMode(true);
setFocusable(true);
requestFocus();
if( Globals.HideSystemMousePointer && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O )
{
postDelayed( new Runnable()
{
public void run()
{
Log.v("SDL", "captureMouse::requestPointerCapture() delayed");
requestPointerCapture();
}
}, 50 );
}
}
else
{
if( Globals.HideSystemMousePointer && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O )
{
postDelayed( new Runnable()
{
public void run()
{
Log.v("SDL", "captureMouse::releasePointerCapture()");
releasePointerCapture();
}
}, 50 );
}
}
}
static byte [] loadRaw(Activity p, int res)
{
byte [] buf = new byte[65536 * 2];
byte [] a = new byte[1048576 * 5]; // We need 5Mb buffer for Keen theme, and this Java code is inefficient
int written = 0;
try{
InputStream is = new GZIPInputStream(p.getResources().openRawResource(res));
int readed = 0;
while( (readed = is.read(buf)) >= 0 )
{
if( written + readed > a.length )
{
byte [] b = new byte [written + readed];
System.arraycopy(a, 0, b, 0, written);
a = b;
}
System.arraycopy(buf, 0, a, written, readed);
written += readed;
}
} catch(Exception e) {};
byte [] b = new byte [written];
System.arraycopy(a, 0, b, 0, written);
return b;
}
static void SetupTouchscreenKeyboardGraphics(Activity p)
{
if( Globals.UseTouchscreenKeyboard )
{
if(Globals.TouchscreenKeyboardTheme < 0)
Globals.TouchscreenKeyboardTheme = 0;
if(Globals.TouchscreenKeyboardTheme > 9)
Globals.TouchscreenKeyboardTheme = 9;
if( Globals.TouchscreenKeyboardTheme == 0 )
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.ultimatedroid));
if( Globals.TouchscreenKeyboardTheme == 1 )
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.simpletheme));
if( Globals.TouchscreenKeyboardTheme == 2 )
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.sun));
if( Globals.TouchscreenKeyboardTheme == 3 )
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.keen));
if( Globals.TouchscreenKeyboardTheme == 4 )
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.retro));
if( Globals.TouchscreenKeyboardTheme == 5 )
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.gba));
if( Globals.TouchscreenKeyboardTheme == 6 )
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.psx));
if( Globals.TouchscreenKeyboardTheme == 7 )
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.snes));
if( Globals.TouchscreenKeyboardTheme == 8 )
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.dualshock));
if( Globals.TouchscreenKeyboardTheme == 9 )
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.n64));
}
}
DemoRenderer mRenderer;
MainActivity mParent;
public static native void nativeMotionEvent( int x, int y, int action, int pointerId, int pressure, int radius );
public static native int nativeKey( int keyCode, int down, int unicode );
public static native int nativeKey( int keyCode, int down, int unicode, int gamepadId );
public static native void nativeHardwareMouseDetected( int detected );
public static native void nativeMouseButtonsPressed( int buttonId, int pressedState );
public static native void nativeMouseWheel( int scrollX, int scrollY );
public static native void nativeGamepadAnalogJoystickInput( float stick1x, float stick1y, float stick2x, float stick2y, float ltrigger, float rtrigger, int usingHat );
public static native void nativeGamepadAnalogJoystickInput( float stick1x, float stick1y, float stick2x, float stick2y, float ltrigger, float rtrigger, float dpadx, float dpady, int gamepadId );
public static native void nativeScreenVisibleRect( int x, int y, int w, int h );
public static native void nativeScreenKeyboardShown( int shown );
}

View File

@@ -41,6 +41,7 @@ public class CloudSave implements GameHelper.GameHelperListener {
// The game helper object. This class is mainly a wrapper around this object.
protected GameHelper mHelper;
public int REQUEST_CLOUD_SAVE_ID = 38;
MainActivity parent;
@@ -72,6 +73,8 @@ public class CloudSave implements GameHelper.GameHelperListener {
boolean createNewSave = false;
public void onActivityResult(int request, int response, Intent intent)
{
if (request != REQUEST_CLOUD_SAVE_ID)
return;
Log.d("SDL", "CloudSave: onActivityResult() response " + response + " intent " + (intent != null));
try
{
@@ -119,7 +122,7 @@ public class CloudSave implements GameHelper.GameHelperListener {
{
public void run()
{
parent.startActivityForResult(snapshotIntent, 0);
parent.startActivityForResult(snapshotIntent, REQUEST_CLOUD_SAVE_ID);
}
});
semaphore.acquireUninterruptibly();
@@ -192,7 +195,7 @@ public class CloudSave implements GameHelper.GameHelperListener {
{
public void run()
{
parent.startActivityForResult(snapshotIntent, 0);
parent.startActivityForResult(snapshotIntent, REQUEST_CLOUD_SAVE_ID);
}
});
semaphore.acquireUninterruptibly();
@@ -361,10 +364,6 @@ public class CloudSave implements GameHelper.GameHelperListener {
mHelper.enableDebugLog(enabled);
}
public String getInvitationId() {
return mHelper.getInvitationId();
}
public void reconnectClient() {
mHelper.reconnectClient();
}

View File

@@ -37,12 +37,6 @@ import com.google.android.gms.drive.Drive;
import com.google.android.gms.games.Games;
import com.google.android.gms.games.Games.GamesOptions;
import com.google.android.gms.games.GamesActivityResultCodes;
import com.google.android.gms.games.multiplayer.Invitation;
import com.google.android.gms.games.multiplayer.Multiplayer;
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch;
import com.google.android.gms.games.request.GameRequest;
//import com.google.android.gms.plus.Plus;
//import com.google.android.gms.plus.Plus.PlusOptions;
public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener {
@@ -121,11 +115,9 @@ public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
// Client request flags
public final static int CLIENT_NONE = 0x00;
public final static int CLIENT_GAMES = 0x01;
//public final static int CLIENT_PLUS = 0x02;
public final static int CLIENT_APPSTATE = 0x04;
public final static int CLIENT_SNAPSHOT = 0x05;
public final static int CLIENT_ALL = CLIENT_GAMES //| CLIENT_PLUS
| CLIENT_APPSTATE | CLIENT_SNAPSHOT;
public final static int CLIENT_ALL = CLIENT_GAMES | CLIENT_APPSTATE | CLIENT_SNAPSHOT;
// What clients were requested? (bit flags)
int mRequestedClients = CLIENT_NONE;
@@ -157,24 +149,6 @@ public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
Handler mHandler;
/*
* If we got an invitation when we connected to the games client, it's here.
* Otherwise, it's null.
*/
Invitation mInvitation;
/*
* If we got turn-based match when we connected to the games client, it's
* here. Otherwise, it's null.
*/
TurnBasedMatch mTurnBasedMatch;
/*
* If we have incoming requests when we connected to the games client, they
* are here. Otherwise, it's null.
*/
ArrayList<GameRequest> mRequests;
// Listener
GameHelperListener mListener = null;
@@ -414,101 +388,6 @@ public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
mActivity = null;
}
/**
* Returns the invitation ID received through an invitation notification.
* This should be called from your GameHelperListener's
*
* @link{GameHelperListener#onSignInSucceeded method, to check if there's an
* invitation available. In that
* case, accept the invitation.
* @return The id of the invitation, or null if none was received.
*/
public String getInvitationId() {
if (!mGoogleApiClient.isConnected()) {
Log.w(TAG,
"Warning: getInvitationId() should only be called when signed in, "
+ "that is, after getting onSignInSuceeded()");
}
return mInvitation == null ? null : mInvitation.getInvitationId();
}
/**
* Returns the invitation received through an invitation notification. This
* should be called from your GameHelperListener's
*
* @link{GameHelperListener#onSignInSucceeded method, to check if there's an
* invitation available. In that
* case, accept the invitation.
* @return The invitation, or null if none was received.
*/
public Invitation getInvitation() {
if (!mGoogleApiClient.isConnected()) {
Log.w(TAG,
"Warning: getInvitation() should only be called when signed in, "
+ "that is, after getting onSignInSuceeded()");
}
return mInvitation;
}
public boolean hasInvitation() {
return mInvitation != null;
}
public boolean hasTurnBasedMatch() {
return mTurnBasedMatch != null;
}
public boolean hasRequests() {
return mRequests != null;
}
public void clearInvitation() {
mInvitation = null;
}
public void clearTurnBasedMatch() {
mTurnBasedMatch = null;
}
public void clearRequests() {
mRequests = null;
}
/**
* Returns the tbmp match received through an invitation notification. This
* should be called from your GameHelperListener's
*
* @link{GameHelperListener#onSignInSucceeded method, to check if there's a
* match available.
* @return The match, or null if none was received.
*/
public TurnBasedMatch getTurnBasedMatch() {
if (!mGoogleApiClient.isConnected()) {
Log.w(TAG,
"Warning: getTurnBasedMatch() should only be called when signed in, "
+ "that is, after getting onSignInSuceeded()");
}
return mTurnBasedMatch;
}
/**
* Returns the requests received through the onConnected bundle. This should
* be called from your GameHelperListener's
*
* @link{GameHelperListener#onSignInSucceeded method, to check if there are
* incoming requests that must be
* handled.
* @return The requests, or null if none were received.
*/
public ArrayList<GameRequest> getRequests() {
if (!mGoogleApiClient.isConnected()) {
Log.w(TAG, "Warning: getRequests() should only be called "
+ "when signed in, "
+ "that is, after getting onSignInSuceeded()");
}
return mRequests;
}
/** Enables debug logging */
public void enableDebugLog(boolean enabled) {
mDebugLog = enabled;
@@ -686,8 +565,6 @@ public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
}
debugLog("Starting connection.");
mConnecting = true;
mInvitation = null;
mTurnBasedMatch = null;
mGoogleApiClient.connect();
}
@@ -712,27 +589,6 @@ public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
if (connectionHint != null) {
debugLog("onConnected: connection hint provided. Checking for invite.");
Invitation inv = connectionHint
.getParcelable(Multiplayer.EXTRA_INVITATION);
if (inv != null && inv.getInvitationId() != null) {
// retrieve and cache the invitation ID
debugLog("onConnected: connection hint has a room invite!");
mInvitation = inv;
debugLog("Invitation ID: " + mInvitation.getInvitationId());
}
// Do we have any requests pending?
mRequests = Games.Requests
.getGameRequestsFromBundle(connectionHint);
if (!mRequests.isEmpty()) {
// We have requests in onConnected's connectionHint.
debugLog("onConnected: connection hint has " + mRequests.size()
+ " request(s)");
}
debugLog("onConnected: connection hint provided. Checking for TBMP game.");
mTurnBasedMatch = connectionHint
.getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH);
}
// we're good to go

View File

@@ -42,8 +42,6 @@ class GameHelperUtils {
return "RESULT_CANCELED";
case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
return "RESULT_APP_MISCONFIGURED";
case GamesActivityResultCodes.RESULT_LEFT_ROOM:
return "RESULT_LEFT_ROOM";
case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
return "RESULT_LICENSE_FAILED";
case GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED:

View File

@@ -16,6 +16,7 @@
<string name="storage_phone">Внутреннее хранение - %d Мб</string>
<string name="storage_sd">SD карта - %d Мб</string>
<string name="storage_question">Куда сохранять данные приложения</string>
<string name="storage_access">Разрешение на запись на SD карту</string>
<string name="optional_downloads">Дополнительные загрузки</string>
<string name="ok">Продолжить</string>
<string name="controls_arrows">Стрелки / джойстик / Dpad</string>

View File

@@ -16,6 +16,7 @@
<string name="storage_phone">Внутрішнє зберігання - %d Мб</string>
<string name="storage_sd">SD карта - %d Мб</string>
<string name="storage_question">Куди зберігати дані програми</string>
<string name="storage_access">Дозвіл на запис на SD карту</string>
<string name="optional_downloads">Додаткові завантаження</string>
<string name="ok">ОК</string>
<string name="controls_arrows">Стрілки / джойстік / Dpad</string>

View File

@@ -4,7 +4,7 @@
<string name="init">初始化中</string>
<string name="please_wait">正在下载数据,请稍</string>
<string name="please_wait">正在下载数据,请稍</string>
<string name="device_config">设备配置</string>
<string name="device_change_cfg">更改设备配置</string>
@@ -26,7 +26,7 @@
<string name="storage_question">数据文件安装位置</string>
<string name="optional_downloads">下载</string>
<string name="downloads">下载</string>
<string name="ok"></string>
<string name="ok">完成</string>
<string name="cancel">取消</string>
<string name="controls_arrows">箭头 / 操纵杆 / 方向键</string>
@@ -163,6 +163,7 @@
<string name="display_size_mouse">鼠标仿真模式</string>
<string name="display_size">显示仿真鼠标的大小</string>
<string name="display_size_desktop">桌面版,无仿真</string>
<string name="display_size_large">大(适用于平板电脑)</string>
<string name="display_size_small">小,放大镜</string>
<string name="display_size_small_touchpad">小,触摸模式</string>

View File

@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingTranslation">
<string name="app_name">Commander Genius</string>
@@ -24,6 +26,7 @@
<string name="storage_custom">Specify directory</string>
<string name="storage_commandline">Command line parameters, one argument per line</string>
<string name="storage_question">Data installation location</string>
<string name="storage_access">Permission to write to SD card</string>
<string name="optional_downloads">Downloads</string>
<string name="downloads">Downloads</string>
<string name="ok">OK</string>
@@ -157,6 +160,7 @@
<string name="video_orientation_autodetect">Auto-detect screen orientation</string>
<string name="video_bpp_24">24 bpp screen color depth</string>
<string name="video_immersive">Hide system navigation buttons / immersive mode</string>
<string name="video_draw_cutout">Draw in display cutout area</string>
<string name="tv_borders">TV borders</string>
<string name="text_edit_click_here">Tap to start typing, press Back when done</string>

View File

@@ -1,129 +0,0 @@
/*
Simple DirectMedia Layer
Java source code (C) 2009-2012 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package net.sourceforge.clonekeenplus;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.os.Vibrator;
import android.hardware.SensorManager;
import android.hardware.SensorEventListener;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.util.Log;
import android.widget.TextView;
class AccelerometerReader implements SensorEventListener
{
private SensorManager _manager = null;
public boolean openedBySDL = false;
public static final GyroscopeListener gyro = new GyroscopeListener();
public AccelerometerReader(Activity context)
{
_manager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
}
public synchronized void stop()
{
if( _manager != null )
{
Log.i("SDL", "libSDL: stopping accelerometer/gyroscope");
_manager.unregisterListener(this);
_manager.unregisterListener(gyro);
}
}
public synchronized void start()
{
if( (Globals.UseAccelerometerAsArrowKeys || Globals.AppUsesAccelerometer) &&
_manager != null && _manager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER) != null )
{
Log.i("SDL", "libSDL: starting accelerometer");
_manager.registerListener(this, _manager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_GAME);
}
if( Globals.AppUsesGyroscope && _manager != null && _manager.getDefaultSensor(Sensor.TYPE_GYROSCOPE) != null )
{
Log.i("SDL", "libSDL: starting gyroscope");
_manager.registerListener(gyro, _manager.getDefaultSensor(Sensor.TYPE_GYROSCOPE), SensorManager.SENSOR_DELAY_GAME);
}
}
public void onSensorChanged(SensorEvent event)
{
if( Globals.HorizontalOrientation )
nativeAccelerometer(event.values[1], -event.values[0], event.values[2]);
else
nativeAccelerometer(event.values[0], event.values[1], event.values[2]); // TODO: not tested!
}
public void onAccuracyChanged(Sensor s, int a)
{
}
static class GyroscopeListener implements SensorEventListener
{
public float x1, x2, xc, y1, y2, yc, z1, z2, zc;
public GyroscopeListener()
{
}
public void onSensorChanged(SensorEvent event)
{
// TODO: vertical orientation
//if( Globals.HorizontalOrientation )
if( event.values[0] < x1 || event.values[0] > x2 ||
event.values[1] < y1 || event.values[1] > y2 ||
event.values[2] < z1 || event.values[2] > z2 )
nativeGyroscope(event.values[0] - xc, event.values[1] - yc, event.values[2] - zc);
}
public void onAccuracyChanged(Sensor s, int a)
{
}
public boolean available(Activity context)
{
SensorManager manager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
return ( manager != null && manager.getDefaultSensor(Sensor.TYPE_GYROSCOPE) != null );
}
public void registerListener(Activity context, SensorEventListener l)
{
SensorManager manager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
if ( manager == null && manager.getDefaultSensor(Sensor.TYPE_GYROSCOPE) == null )
return;
manager.registerListener(l, manager.getDefaultSensor(Sensor.TYPE_GYROSCOPE), SensorManager.SENSOR_DELAY_GAME);
}
public void unregisterListener(Activity context,SensorEventListener l)
{
SensorManager manager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
if ( manager == null )
return;
manager.unregisterListener(l);
}
}
private static native void nativeAccelerometer(float accX, float accY, float accZ);
private static native void nativeGyroscope(float X, float Y, float Z);
}

View File

@@ -1,50 +0,0 @@
/*
Simple DirectMedia Layer
Java source code (C) 2009-2012 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package net.sourceforge.clonekeenplus;
import android.app.Activity;
import android.content.Context;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import android.view.View;
class Advertisement
{
MainActivity parent;
public Advertisement(MainActivity p)
{
parent = p;
}
public View getView()
{
return null;
}
public void requestNewAd()
{
}
}

View File

@@ -1,307 +0,0 @@
/*
Simple DirectMedia Layer
Java source code (C) 2009-2012 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package net.sourceforge.clonekeenplus;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.media.AudioTrack;
import android.media.AudioManager;
import android.media.AudioFormat;
import android.media.AudioRecord;
import android.media.MediaRecorder.AudioSource;
import java.io.*;
import android.util.Log;
import java.util.concurrent.Semaphore;
class AudioThread
{
private MainActivity mParent;
private AudioTrack mAudio;
private byte[] mAudioBuffer;
private int mVirtualBufSize;
public AudioThread(MainActivity parent)
{
mParent = parent;
mAudio = null;
mAudioBuffer = null;
//nativeAudioInitJavaCallbacks();
}
public int fillBuffer()
{
if( mParent.isPaused() )
{
try{
Thread.sleep(500);
} catch (InterruptedException e) {}
}
else
{
//if( Globals.AudioBufferConfig == 0 ) // Gives too much spam to logcat, makes things worse
// mAudio.flush();
mAudio.write( mAudioBuffer, 0, mVirtualBufSize );
}
return 1;
}
public int initAudio(int rate, int channels, int encoding, int bufSize)
{
if( mAudio == null )
{
channels = ( channels == 1 ) ? AudioFormat.CHANNEL_CONFIGURATION_MONO :
AudioFormat.CHANNEL_CONFIGURATION_STEREO;
encoding = ( encoding == 1 ) ? AudioFormat.ENCODING_PCM_16BIT :
AudioFormat.ENCODING_PCM_8BIT;
mVirtualBufSize = bufSize;
if( AudioTrack.getMinBufferSize( rate, channels, encoding ) > bufSize )
bufSize = AudioTrack.getMinBufferSize( rate, channels, encoding );
if(Globals.AudioBufferConfig != 0) { // application's choice - use minimal buffer
bufSize = (int)((float)bufSize * (((float)(Globals.AudioBufferConfig - 1) * 2.5f) + 1.0f));
mVirtualBufSize = bufSize;
}
mAudioBuffer = new byte[bufSize];
mAudio = new AudioTrack(AudioManager.STREAM_MUSIC,
rate,
channels,
encoding,
bufSize,
AudioTrack.MODE_STREAM );
mAudio.play();
}
return mVirtualBufSize;
}
public byte[] getBuffer()
{
return mAudioBuffer;
}
public int deinitAudio()
{
if( mAudio != null )
{
mAudio.stop();
mAudio.release();
mAudio = null;
}
mAudioBuffer = null;
return 1;
}
public int initAudioThread()
{
// Make audio thread priority higher so audio thread won't get underrun
Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
return 1;
}
public int pauseAudioPlayback()
{
if( mAudio != null )
{
mAudio.pause();
}
if( mRecordThread != null )
{
mRecordThread.pauseRecording();
}
return 1;
}
public int resumeAudioPlayback()
{
if( mAudio != null )
{
mAudio.play();
}
if( mRecordThread != null )
{
mRecordThread.resumeRecording();
}
return 1;
}
private native int nativeAudioInitJavaCallbacks();
// ----- Audio recording -----
private RecordingThread mRecordThread = null;
private AudioRecord mRecorder = null;
private int mRecorderBufferSize = 0;
private byte[] startRecording(int rate, int channels, int encoding, int bufsize)
{
if( mRecordThread == null )
{
mRecordThread = new RecordingThread();
mRecordThread.start();
}
if( !mRecordThread.isStopped() )
{
Log.i("SDL", "SDL: error: application already opened audio recording device");
return null;
}
mRecordThread.init(bufsize);
int channelConfig = ( channels == 1 ) ? AudioFormat.CHANNEL_IN_MONO :
AudioFormat.CHANNEL_IN_STEREO;
int encodingConfig = ( encoding == 1 ) ? AudioFormat.ENCODING_PCM_16BIT :
AudioFormat.ENCODING_PCM_8BIT;
int minBufDevice = AudioRecord.getMinBufferSize(rate, channelConfig, encodingConfig);
int minBufferSize = Math.max(bufsize * 8, minBufDevice + (bufsize - (minBufDevice % bufsize)));
Log.i("SDL", "SDL: app opened recording device, rate " + rate + " channels " + channels + " sample size " + (encoding+1) + " bufsize " + bufsize + " internal bufsize " + minBufferSize);
if( mRecorder == null || mRecorder.getSampleRate() != rate ||
mRecorder.getChannelCount() != channels ||
mRecorder.getAudioFormat() != encodingConfig ||
mRecorderBufferSize != minBufferSize )
{
if( mRecorder != null )
mRecorder.release();
mRecorder = null;
try {
mRecorder = new AudioRecord(AudioSource.DEFAULT, rate, channelConfig, encodingConfig, minBufferSize);
mRecorderBufferSize = minBufferSize;
} catch (IllegalArgumentException e) {
Log.i("SDL", "SDL: error: failed to open recording device!");
return null;
}
}
else
{
Log.i("SDL", "SDL: reusing old recording device");
}
mRecordThread.startRecording();
return mRecordThread.mRecordBuffer;
}
private void stopRecording()
{
if( mRecordThread == null || mRecordThread.isStopped() )
{
Log.i("SDL", "SDL: error: application already closed audio recording device");
return;
}
mRecordThread.stopRecording();
Log.i("SDL", "SDL: app closed recording device");
}
private class RecordingThread extends Thread
{
private boolean stopped = true;
byte[] mRecordBuffer;
private Semaphore waitStarted = new Semaphore(0);
private boolean sleep = false;
RecordingThread()
{
super();
}
void init(int bufsize)
{
if( mRecordBuffer == null || mRecordBuffer.length != bufsize )
mRecordBuffer = new byte[bufsize];
}
public void run()
{
while( true )
{
waitStarted.acquireUninterruptibly();
waitStarted.drainPermits();
stopped = false;
sleep = false;
while( !sleep )
{
int got = mRecorder.read(mRecordBuffer, 0, mRecordBuffer.length);
if( got != mRecordBuffer.length )
{
// Audio is stopped here, sleep a bit.
try{
Thread.sleep(1000);
} catch (InterruptedException e) {}
}
else
{
//Log.i("SDL", "SDL: nativeAudioRecordCallback with len " + mRecordBuffer.length);
nativeAudioRecordCallback();
//Log.i("SDL", "SDL: nativeAudioRecordCallback returned");
}
}
stopped = true;
mRecorder.stop();
}
}
public void startRecording()
{
mRecorder.startRecording();
waitStarted.release();
}
public void stopRecording()
{
sleep = true;
while( !stopped )
{
try{
Thread.sleep(100);
} catch (InterruptedException e) {}
}
}
public void pauseRecording()
{
if( !stopped )
mRecorder.stop();
}
public void resumeRecording()
{
if( !stopped )
mRecorder.startRecording();
}
public boolean isStopped()
{
return stopped;
}
}
private native void nativeAudioRecordCallback();
}

View File

@@ -1,758 +0,0 @@
/*
Simple DirectMedia Layer
Java source code (C) 2009-2012 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package net.sourceforge.clonekeenplus;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.os.Environment;
import android.widget.TextView;
import org.apache.http.client.methods.*;
import org.apache.http.*;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.conn.*;
import org.apache.http.conn.params.*;
import org.apache.http.conn.scheme.*;
import org.apache.http.conn.ssl.*;
import org.apache.http.impl.*;
import org.apache.http.impl.client.*;
import org.apache.http.impl.conn.SingleClientConnManager;
import java.security.cert.*;
import java.security.SecureRandom;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import java.util.zip.*;
import java.io.*;
import android.util.Log;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import android.content.Context;
import android.content.res.Resources;
import java.lang.String;
import android.text.SpannedString;
import android.app.AlertDialog;
import android.content.DialogInterface;
class CountingInputStream extends BufferedInputStream
{
private long bytesReadMark = 0;
private long bytesRead = 0;
public CountingInputStream(InputStream in, int size) {
super(in, size);
}
public CountingInputStream(InputStream in) {
super(in);
}
public long getBytesRead() {
return bytesRead;
}
public synchronized int read() throws IOException {
int read = super.read();
if (read >= 0) {
bytesRead++;
}
return read;
}
public synchronized int read(byte[] b, int off, int len) throws IOException {
int read = super.read(b, off, len);
if (read >= 0) {
bytesRead += read;
}
return read;
}
public synchronized long skip(long n) throws IOException {
long skipped = super.skip(n);
if (skipped >= 0) {
bytesRead += skipped;
}
return skipped;
}
public synchronized void mark(int readlimit) {
super.mark(readlimit);
bytesReadMark = bytesRead;
}
public synchronized void reset() throws IOException {
super.reset();
bytesRead = bytesReadMark;
}
}
class DataDownloader extends Thread
{
public static final String DOWNLOAD_FLAG_FILENAME = "libsdl-DownloadFinished-";
class StatusWriter
{
private TextView Status;
private MainActivity Parent;
private SpannedString oldText = new SpannedString("");
public StatusWriter( TextView _Status, MainActivity _Parent )
{
Status = _Status;
Parent = _Parent;
}
public void setParent( TextView _Status, MainActivity _Parent )
{
synchronized(DataDownloader.this) {
Status = _Status;
Parent = _Parent;
setText( oldText.toString() );
}
}
public void setText(final String str)
{
class Callback implements Runnable
{
public TextView Status;
public SpannedString text;
public void run()
{
Status.setText(text);
}
}
synchronized(DataDownloader.this) {
Callback cb = new Callback();
oldText = new SpannedString(str);
cb.text = new SpannedString(str);
cb.Status = Status;
if( Parent != null && Status != null )
Parent.runOnUiThread(cb);
}
}
}
public DataDownloader( MainActivity _Parent, TextView _Status )
{
Parent = _Parent;
Status = new StatusWriter( _Status, _Parent );
//Status.setText( "Connecting to " + Globals.DataDownloadUrl );
outFilesDir = Globals.DataDir;
DownloadComplete = false;
this.start();
}
public void setStatusField(TextView _Status)
{
synchronized(this) {
Status.setParent( _Status, Parent );
}
}
@Override
public void run()
{
Parent.keyListener = new BackKeyListener(Parent);
String [] downloadFiles = Globals.DataDownloadUrl;
int total = 0;
int count = 0;
for( int i = 0; i < downloadFiles.length; i++ )
{
if( downloadFiles[i].length() > 0 &&
( Globals.OptionalDataDownload.length > i && Globals.OptionalDataDownload[i] ) ||
( Globals.OptionalDataDownload.length <= i && downloadFiles[i].indexOf("!") == 0 ) )
total += 1;
}
for( int i = 0; i < downloadFiles.length; i++ )
{
if( downloadFiles[i].length() > 0 &&
( Globals.OptionalDataDownload.length > i && Globals.OptionalDataDownload[i] ) ||
( Globals.OptionalDataDownload.length <= i && downloadFiles[i].indexOf("!") == 0 ) )
{
if( ! DownloadDataFile(downloadFiles[i], DOWNLOAD_FLAG_FILENAME + String.valueOf(i) + ".flag", count+1, total, i) )
{
DownloadFailed = true;
return;
}
count += 1;
}
}
DownloadComplete = true;
Parent.keyListener = null;
initParent();
}
public boolean DownloadDataFile(final String DataDownloadUrl, final String DownloadFlagFileName, int downloadCount, int downloadTotal, int downloadIndex)
{
DownloadCanBeResumed = false;
Resources res = Parent.getResources();
String [] downloadUrls = DataDownloadUrl.split("[|]");
if( downloadUrls.length < 2 )
{
Log.i("SDL", "Error: download string invalid: '" + DataDownloadUrl + "', your AndroidAppSettigns.cfg is broken");
Status.setText( res.getString(R.string.error_dl_from, DataDownloadUrl) );
return false;
}
boolean forceOverwrite = false;
String path = getOutFilePath(DownloadFlagFileName);
InputStream checkFile = null;
try {
checkFile = new FileInputStream( path );
} catch( FileNotFoundException e ) {
} catch( SecurityException e ) { };
if( checkFile != null )
{
try {
byte b[] = new byte[ Globals.DataDownloadUrl[downloadIndex].getBytes("UTF-8").length + 1 ];
int readed = checkFile.read(b);
String compare = "";
if( readed > 0 )
compare = new String( b, 0, readed, "UTF-8" );
boolean matched = false;
//Log.i("SDL", "Read URL: '" + compare + "'");
for( int i = 1; i < downloadUrls.length; i++ )
{
//Log.i("SDL", "Comparing: '" + downloadUrls[i] + "'");
if( compare.compareTo(downloadUrls[i]) == 0 )
matched = true;
}
//Log.i("SDL", "Matched: " + String.valueOf(matched));
if( ! matched )
throw new IOException();
Status.setText( res.getString(R.string.download_unneeded) );
return true;
} catch ( IOException e ) {
forceOverwrite = true;
new File(path).delete();
}
}
checkFile = null;
// Create output directory (not necessary for phone storage)
Log.i("SDL", "Downloading data to: '" + outFilesDir + "'");
try {
File outDir = new File( outFilesDir );
if( !(outDir.exists() && outDir.isDirectory()) )
outDir.mkdirs();
OutputStream out = new FileOutputStream( getOutFilePath(".nomedia") );
out.flush();
out.close();
}
catch( SecurityException e ) {}
catch( FileNotFoundException e ) {}
catch( IOException e ) {};
HttpResponse response = null, responseError = null;
HttpGet request;
long totalLen = 0;
CountingInputStream stream;
byte[] buf = new byte[16384];
boolean DoNotUnzip = false;
boolean FileInAssets = false;
String url = "";
long partialDownloadLen = 0;
int downloadUrlIndex = 1;
while( downloadUrlIndex < downloadUrls.length )
{
Log.i("SDL", "Processing download " + downloadUrls[downloadUrlIndex]);
url = new String(downloadUrls[downloadUrlIndex]);
DoNotUnzip = false;
if(url.indexOf(":") == 0)
{
path = getOutFilePath(url.substring( 1, url.indexOf(":", 1) ));
url = url.substring( url.indexOf(":", 1) + 1 );
DoNotUnzip = true;
DownloadCanBeResumed = true;
File partialDownload = new File( path );
if( partialDownload.exists() && !partialDownload.isDirectory() && !forceOverwrite )
partialDownloadLen = partialDownload.length();
}
Status.setText( downloadCount + "/" + downloadTotal + ": " + res.getString(R.string.connecting_to, url) );
if( url.indexOf("http://") == -1 && url.indexOf("https://") == -1 ) // File inside assets
{
InputStream stream1 = null;
try {
stream1 = Parent.getAssets().open(url);
stream1.close();
} catch( Exception e ) {
try {
stream1 = Parent.getAssets().open(url + "000");
stream1.close();
} catch( Exception ee ) {
Log.i("SDL", "Failed to open file in assets: " + url);
downloadUrlIndex++;
continue;
}
}
FileInAssets = true;
Log.i("SDL", "Fetching file from assets: " + url);
break;
}
else
{
Log.i("SDL", "Connecting to: " + url);
request = new HttpGet(url);
request.addHeader("Accept", "*/*");
if( partialDownloadLen > 0 ) {
request.addHeader("Range", "bytes=" + partialDownloadLen + "-");
Log.i("SDL", "Trying to resume download at pos " + partialDownloadLen);
}
try {
DefaultHttpClient client = HttpWithDisabledSslCertCheck();
client.getParams().setBooleanParameter("http.protocol.handle-redirects", true);
response = client.execute(request);
} catch (IOException e) {
Log.i("SDL", "Failed to connect to " + url);
downloadUrlIndex++;
};
if( response != null )
{
if( response.getStatusLine().getStatusCode() != 200 && response.getStatusLine().getStatusCode() != 206 )
{
Log.i("SDL", "Failed to connect to " + url + " with error " + response.getStatusLine().getStatusCode() + " " + response.getStatusLine().getReasonPhrase());
responseError = response;
response = null;
downloadUrlIndex++;
}
else
break;
}
}
}
if( FileInAssets )
{
int multipartCounter = 0;
InputStream multipart = null;
while( true )
{
try {
// Make string ".zip000", ".zip001" etc for multipart archives
String url1 = url + String.format("%03d", multipartCounter);
CountingInputStream stream1 = new CountingInputStream(Parent.getAssets().open(url1), 8192);
while( stream1.skip(65536) > 0 ) { };
totalLen += stream1.getBytesRead();
stream1.close();
InputStream s = Parent.getAssets().open(url1);
if( multipart == null )
multipart = s;
else
multipart = new SequenceInputStream(multipart, s);
Log.i("SDL", "Multipart archive found: " + url1);
} catch( IOException e ) {
break;
}
multipartCounter += 1;
}
if( multipart != null )
stream = new CountingInputStream(multipart, 8192);
else
{
try {
stream = new CountingInputStream(Parent.getAssets().open(url), 8192);
while( stream.skip(65536) > 0 ) { };
totalLen += stream.getBytesRead();
stream.close();
stream = new CountingInputStream(Parent.getAssets().open(url), 8192);
} catch( IOException e ) {
Log.i("SDL", "Unpacking from assets '" + url + "' - error: " + e.toString());
Status.setText( res.getString(R.string.error_dl_from, url) );
return false;
}
}
}
else
{
if( response == null )
{
Log.i("SDL", "Error connecting to " + url);
Status.setText( res.getString(R.string.failed_connecting_to, url) + (responseError == null ? "" : ": " + responseError.getStatusLine().getStatusCode() + " " + responseError.getStatusLine().getReasonPhrase()) );
return false;
}
Status.setText( downloadCount + "/" + downloadTotal + ": " + res.getString(R.string.dl_from, url) );
totalLen = response.getEntity().getContentLength();
try {
stream = new CountingInputStream(response.getEntity().getContent(), 8192);
} catch( java.io.IOException e ) {
Status.setText( res.getString(R.string.error_dl_from, url) );
return false;
}
}
long updateStatusTime = 0;
if(DoNotUnzip)
{
Log.i("SDL", "Saving file '" + path + "'");
OutputStream out = null;
try {
try {
File outDir = new File( path.substring(0, path.lastIndexOf("/") ));
if( !(outDir.exists() && outDir.isDirectory()) )
outDir.mkdirs();
} catch( SecurityException e ) { };
if( partialDownloadLen > 0 )
{
try {
Header[] range = response.getHeaders("Content-Range");
if( range.length > 0 && range[0].getValue().indexOf("bytes") == 0 )
{
//Log.i("SDL", "Resuming download of file '" + path + "': Content-Range: " + range[0].getValue());
String[] skippedBytes = range[0].getValue().split("/")[0].split("-")[0].split(" ");
if( skippedBytes.length >= 2 && Long.parseLong(skippedBytes[1]) == partialDownloadLen )
{
out = new FileOutputStream( path, true );
Log.i("SDL", "Resuming download of file '" + path + "' at pos " + partialDownloadLen);
}
}
else
Log.i("SDL", "Server does not support partial downloads. " + (range.length == 0 ? "" : range[0].getValue()));
} catch (Exception e) { }
}
if( out == null )
{
out = new FileOutputStream( path );
partialDownloadLen = 0;
}
} catch( FileNotFoundException e ) {
Log.i("SDL", "Saving file '" + path + "' - error creating output file: " + e.toString());
} catch( SecurityException e ) {
Log.i("SDL", "Saving file '" + path + "' - error creating output file: " + e.toString());
};
if( out == null )
{
Status.setText( res.getString(R.string.error_write, path) );
Log.i("SDL", "Saving file '" + path + "' - error creating output file");
return false;
}
try {
int len = stream.read(buf);
while (len >= 0)
{
if(len > 0)
out.write(buf, 0, len);
len = stream.read(buf);
float percent = 0.0f;
if( totalLen > 0 )
percent = (stream.getBytesRead() + partialDownloadLen) * 100.0f / (totalLen + partialDownloadLen);
if( System.currentTimeMillis() > updateStatusTime + 1000 )
{
updateStatusTime = System.currentTimeMillis();
Status.setText( downloadCount + "/" + downloadTotal + ": " + res.getString(R.string.dl_progress, percent, path) );
}
}
out.flush();
out.close();
out = null;
} catch( java.io.IOException e ) {
Status.setText( res.getString(R.string.error_write, path) + ": " + e.getMessage() );
Log.i("SDL", "Saving file '" + path + "' - error writing: " + e.toString());
return false;
}
Log.i("SDL", "Saving file '" + path + "' done");
}
else
{
Log.i("SDL", "Reading from zip file '" + url + "'");
ZipInputStream zip = new ZipInputStream(stream);
while(true)
{
ZipEntry entry = null;
try {
entry = zip.getNextEntry();
if( entry != null )
Log.i("SDL", "Reading from zip file '" + url + "' entry '" + entry.getName() + "'");
} catch( java.io.IOException e ) {
Status.setText( res.getString(R.string.error_dl_from, url) );
Log.i("SDL", "Error reading from zip file '" + url + "': " + e.toString());
return false;
}
if( entry == null )
{
Log.i("SDL", "Reading from zip file '" + url + "' finished");
break;
}
if( entry.isDirectory() )
{
Log.i("SDL", "Creating dir '" + getOutFilePath(entry.getName()) + "'");
try {
File outDir = new File( getOutFilePath(entry.getName()) );
if( !(outDir.exists() && outDir.isDirectory()) )
outDir.mkdirs();
} catch( SecurityException e ) { };
continue;
}
OutputStream out = null;
path = getOutFilePath(entry.getName());
float percent = 0.0f;
Log.i("SDL", "Saving file '" + path + "'");
try {
File outDir = new File( path.substring(0, path.lastIndexOf("/") ));
if( !(outDir.exists() && outDir.isDirectory()) )
outDir.mkdirs();
} catch( SecurityException e ) { };
try {
CheckedInputStream check = new CheckedInputStream( new FileInputStream(path), new CRC32() );
while( check.read(buf, 0, buf.length) >= 0 ) {};
check.close();
if( check.getChecksum().getValue() != entry.getCrc() )
{
File ff = new File(path);
ff.delete();
throw new Exception();
}
Log.i("SDL", "File '" + path + "' exists and passed CRC check - not overwriting it");
if( totalLen > 0 )
percent = stream.getBytesRead() * 100.0f / totalLen;
if( System.currentTimeMillis() > updateStatusTime + 1000 )
{
updateStatusTime = System.currentTimeMillis();
Status.setText( downloadCount + "/" + downloadTotal + ": " + res.getString(R.string.dl_progress, percent, path) );
}
continue;
} catch( Exception e ) { }
try {
out = new FileOutputStream( path );
} catch( FileNotFoundException e ) {
Log.i("SDL", "Saving file '" + path + "' - cannot create file: " + e.toString());
} catch( SecurityException e ) {
Log.i("SDL", "Saving file '" + path + "' - cannot create file: " + e.toString());
};
if( out == null )
{
Status.setText( res.getString(R.string.error_write, path) );
Log.i("SDL", "Saving file '" + path + "' - cannot create file");
return false;
}
if( totalLen > 0 )
percent = stream.getBytesRead() * 100.0f / totalLen;
if( System.currentTimeMillis() > updateStatusTime + 1000 )
{
updateStatusTime = System.currentTimeMillis();
Status.setText( downloadCount + "/" + downloadTotal + ": " + res.getString(R.string.dl_progress, percent, path) );
}
try {
int len = zip.read(buf);
while (len >= 0)
{
if(len > 0)
out.write(buf, 0, len);
len = zip.read(buf);
percent = 0.0f;
if( totalLen > 0 )
percent = stream.getBytesRead() * 100.0f / totalLen;
if( System.currentTimeMillis() > updateStatusTime + 1000 )
{
updateStatusTime = System.currentTimeMillis();
Status.setText( downloadCount + "/" + downloadTotal + ": " + res.getString(R.string.dl_progress, percent, path) );
}
}
out.flush();
out.close();
out = null;
} catch( java.io.IOException e ) {
Status.setText( res.getString(R.string.error_write, path) + ": " + e.getMessage() );
Log.i("SDL", "Saving file '" + path + "' - error writing or downloading: " + e.toString());
return false;
}
try {
long count = 0, ret = 0;
CheckedInputStream check = new CheckedInputStream( new FileInputStream(path), new CRC32() );
while( ret >= 0 )
{
count += ret;
ret = check.read(buf, 0, buf.length);
}
check.close();
if( check.getChecksum().getValue() != entry.getCrc() || count != entry.getSize() )
{
File ff = new File(path);
ff.delete();
Log.i("SDL", "Saving file '" + path + "' - CRC check failed, ZIP: " +
String.format("%x", entry.getCrc()) + " actual file: " + String.format("%x", check.getChecksum().getValue()) +
" file size in ZIP: " + entry.getSize() + " actual size " + count );
throw new Exception();
}
} catch( Exception e ) {
Status.setText( res.getString(R.string.error_write, path) + ": " + e.getMessage() );
return false;
}
Log.i("SDL", "Saving file '" + path + "' done");
}
};
OutputStream out = null;
path = getOutFilePath(DownloadFlagFileName);
try {
out = new FileOutputStream( path );
out.write(downloadUrls[downloadUrlIndex].getBytes("UTF-8"));
out.flush();
out.close();
} catch( FileNotFoundException e ) {
} catch( SecurityException e ) {
} catch( java.io.IOException e ) {
Status.setText( res.getString(R.string.error_write, path) + ": " + e.getMessage() );
return false;
};
Status.setText( downloadCount + "/" + downloadTotal + ": " + res.getString(R.string.dl_finished) );
try {
stream.close();
} catch( java.io.IOException e ) {
};
return true;
};
private void initParent()
{
class Callback implements Runnable
{
public MainActivity Parent;
public void run()
{
Parent.initSDL();
}
}
Callback cb = new Callback();
synchronized(this) {
cb.Parent = Parent;
if(Parent != null)
Parent.runOnUiThread(cb);
}
}
private String getOutFilePath(final String filename)
{
return outFilesDir + "/" + filename;
};
private static DefaultHttpClient HttpWithDisabledSslCertCheck()
{
return new DefaultHttpClient();
// This code does not work
/*
HostnameVerifier hostnameVerifier = org.apache.http.conn.ssl.SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER;
DefaultHttpClient client = new DefaultHttpClient();
SchemeRegistry registry = new SchemeRegistry();
SSLSocketFactory socketFactory = SSLSocketFactory.getSocketFactory();
socketFactory.setHostnameVerifier((X509HostnameVerifier) hostnameVerifier);
registry.register(new Scheme("https", socketFactory, 443));
SingleClientConnManager mgr = new SingleClientConnManager(client.getParams(), registry);
DefaultHttpClient http = new DefaultHttpClient(mgr, client.getParams());
HttpsURLConnection.setDefaultHostnameVerifier(hostnameVerifier);
return http;
*/
}
public class BackKeyListener implements MainActivity.KeyEventsListener
{
MainActivity p;
public BackKeyListener(MainActivity _p)
{
p = _p;
}
public void onKeyEvent(final int keyCode)
{
if( DownloadFailed )
System.exit(1);
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.cancel_download));
builder.setMessage(p.getResources().getString(R.string.cancel_download) + (DownloadCanBeResumed ? " " + p.getResources().getString(R.string.cancel_download_resume) : ""));
builder.setPositiveButton(p.getResources().getString(R.string.yes), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
System.exit(1);
dialog.dismiss();
}
});
builder.setNegativeButton(p.getResources().getString(R.string.no), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
public StatusWriter Status;
public boolean DownloadComplete = false;
public boolean DownloadFailed = false;
public boolean DownloadCanBeResumed = false;
private MainActivity Parent;
private String outFilesDir = null;
}

View File

@@ -0,0 +1 @@
../java/DataDownloader.java

File diff suppressed because it is too large Load Diff

View File

@@ -1,126 +0,0 @@
/*
Simple DirectMedia Layer
Java source code (C) 2009-2012 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package net.sourceforge.clonekeenplus;
/*import android.app.Activity;
import android.content.Context;
import java.util.Vector;*/
import android.view.KeyEvent;
class Globals
{
// These config options are modified by ChangeAppsettings.sh script - see the detailed descriptions there
public static String ApplicationName = "CommanderGenius";
public static String AppLibraries[] = { "sdl-1.2", };
public static String AppMainLibraries[] = { "application", "sdl_main" };
public static final boolean Using_SDL_1_3 = false;
public static final boolean Using_SDL_2_0 = false;
public static String[] DataDownloadUrl = { "Data files are 2 Mb|https://sourceforge.net/projects/libsdl-android/files/CommanderGenius/commandergenius-data.zip/download", "High-quality GFX and music - 40 Mb|https://sourceforge.net/projects/libsdl-android/files/CommanderGenius/commandergenius-hqp.zip/download" };
public static int VideoDepthBpp = 16;
public static boolean SwVideoMode = false;
public static boolean NeedDepthBuffer = false;
public static boolean NeedStencilBuffer = false;
public static boolean NeedGles2 = false;
public static boolean CompatibilityHacksVideo = false;
public static boolean CompatibilityHacksStaticInit = false;
public static boolean CompatibilityHacksTextInputEmulatesHwKeyboard = false;
public static boolean HorizontalOrientation = true;
public static boolean KeepAspectRatioDefaultSetting = false;
public static boolean InhibitSuspend = false;
public static String ReadmeText = "^You may press \"Home\" now - the data will be downloaded in background".replace("^","\n");
public static String CommandLine = "";
public static boolean AppUsesMouse = false;
public static boolean AppNeedsTwoButtonMouse = false;
public static boolean ForceRelativeMouseMode = false; // If both on-screen keyboard and mouse are needed, this will only set the default setting, user may override it later
public static boolean ShowMouseCursor = false;
public static boolean AppNeedsArrowKeys = true;
public static boolean AppNeedsTextInput = true;
public static boolean AppUsesJoystick = false;
public static boolean AppUsesSecondJoystick = false;
public static boolean AppUsesAccelerometer = false;
public static boolean AppUsesGyroscope = false;
public static boolean AppUsesMultitouch = false;
public static boolean NonBlockingSwapBuffers = false;
public static boolean ResetSdlConfigForThisVersion = false;
public static String DeleteFilesOnUpgrade = "";
public static int AppTouchscreenKeyboardKeysAmount = 4;
public static int AppTouchscreenKeyboardKeysAmountAutoFire = 1;
public static String[] AppTouchscreenKeyboardKeysNames = "Fire Shoot Switch_weapon Jump Run Hide/Seek".split(" ");
public static int StartupMenuButtonTimeout = 3000;
public static int AppMinimumRAM = 0;
public static SettingsMenu.Menu HiddenMenuOptions [] = {}; // If you see error here - update HiddenMenuOptions in your AndroidAppSettings.cfg: change OptionalDownloadConfig to SettingsMenuMisc.OptionalDownloadConfig etc.
public static SettingsMenu.Menu FirstStartMenuOptions [] = { new SettingsMenuMisc.ShowReadme(), (AppUsesMouse && ! ForceRelativeMouseMode ? new SettingsMenuMouse.DisplaySizeConfig() : new SettingsMenu.DummyMenu()), new SettingsMenuMisc.OptionalDownloadConfig(), new SettingsMenuMisc.GyroscopeCalibration() };
public static String AdmobPublisherId = "";
public static String AdmobTestDeviceId = "";
public static String AdmobBannerSize = "";
// Phone-specific config, modified by user in "Change phone config" startup dialog, TODO: move this to settings
public static boolean DownloadToSdcard = true;
public static boolean PhoneHasTrackball = false;
public static boolean PhoneHasArrowKeys = false;
public static boolean UseAccelerometerAsArrowKeys = false;
public static boolean UseTouchscreenKeyboard = true;
public static int TouchscreenKeyboardSize = 1;
public static final int TOUCHSCREEN_KEYBOARD_CUSTOM = 4;
public static int TouchscreenKeyboardDrawSize = 1;
public static int TouchscreenKeyboardTheme = 2;
public static int TouchscreenKeyboardTransparency = 2;
public static int AccelerometerSensitivity = 2;
public static int AccelerometerCenterPos = 2;
public static int TrackballDampening = 0;
public static int AudioBufferConfig = 0;
public static boolean OptionalDataDownload[] = null;
public static int LeftClickMethod = Mouse.LEFT_CLICK_NORMAL;
public static int LeftClickKey = KeyEvent.KEYCODE_DPAD_CENTER;
public static int LeftClickTimeout = 3;
public static int RightClickTimeout = 4;
public static int RightClickMethod = AppNeedsTwoButtonMouse ? Mouse.RIGHT_CLICK_WITH_MULTITOUCH : Mouse.RIGHT_CLICK_NONE;
public static int RightClickKey = KeyEvent.KEYCODE_MENU;
public static boolean MoveMouseWithJoystick = false;
public static int MoveMouseWithJoystickSpeed = 0;
public static int MoveMouseWithJoystickAccel = 0;
public static boolean ClickMouseWithDpad = false;
public static boolean RelativeMouseMovement = ForceRelativeMouseMode; // Laptop touchpad mode
public static int RelativeMouseMovementSpeed = 2;
public static int RelativeMouseMovementAccel = 0;
public static int ShowScreenUnderFinger = Mouse.ZOOM_NONE;
public static boolean KeepAspectRatio = KeepAspectRatioDefaultSetting;
public static int ClickScreenPressure = 0;
public static int ClickScreenTouchspotSize = 0;
public static int RemapHwKeycode[] = new int[SDL_Keys.JAVA_KEYCODE_LAST];
public static int RemapScreenKbKeycode[] = new int[6];
public static int ScreenKbControlsLayout[][] = AppUsesSecondJoystick ? // Values for 800x480 resolution
new int[][] { { 0, 303, 177, 480 }, { 0, 0, 48, 48 }, { 400, 392, 488, 480 }, { 312, 392, 400, 480 }, { 400, 304, 488, 392 }, { 312, 304, 400, 392 }, { 400, 216, 488, 304 }, { 312, 216, 400, 304 }, { 623, 303, 800, 480 } } :
new int[][] { { 0, 303, 177, 480 }, { 0, 0, 48, 48 }, { 712, 392, 800, 480 }, { 624, 392, 712, 480 }, { 712, 304, 800, 392 }, { 624, 304, 712, 392 }, { 712, 216, 800, 304 }, { 624, 216, 712, 304 } };
public static boolean ScreenKbControlsShown[] = new boolean[ScreenKbControlsLayout.length]; // Also joystick and text input button added
public static int RemapMultitouchGestureKeycode[] = new int[4];
public static boolean MultitouchGesturesUsed[] = new boolean[4];
public static int MultitouchGestureSensitivity = 1;
public static int TouchscreenCalibration[] = new int[4];
public static String DataDir = new String("");
public static boolean VideoLinearFilter = true;
public static boolean MultiThreadedVideo = false;
public static boolean BrokenLibCMessageShown = false;
// Gyroscope calibration
public static float gyro_x1, gyro_x2, gyro_xc, gyro_y1, gyro_y2, gyro_yc, gyro_z1, gyro_z2, gyro_zc;
public static boolean OuyaEmulation = false; // For debugging
}

View File

@@ -0,0 +1 @@
../java/Globals.java

View File

@@ -1,592 +0,0 @@
/*
Simple DirectMedia Layer
Java source code (C) 2009-2012 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package net.sourceforge.clonekeenplus;
import java.lang.String;
import java.util.ArrayList;
import java.util.Arrays;
import java.lang.reflect.Field;
// Autogenerated by hand with a command:
// grep 'SDLK_' SDL_keysym.h | sed 's/SDLK_\([a-zA-Z0-9_]\+\).*[=] \([0-9]\+\).*/public static final int SDLK_\1 = \2;/' >> Keycodes.java
class SDL_1_2_Keycodes
{
public static final int SDLK_UNKNOWN = 0;
public static final int SDLK_BACKSPACE = 8;
public static final int SDLK_TAB = 9;
public static final int SDLK_CLEAR = 12;
public static final int SDLK_RETURN = 13;
public static final int SDLK_PAUSE = 19;
public static final int SDLK_ESCAPE = 27;
public static final int SDLK_SPACE = 32;
public static final int SDLK_EXCLAIM = 33;
public static final int SDLK_QUOTEDBL = 34;
public static final int SDLK_HASH = 35;
public static final int SDLK_DOLLAR = 36;
public static final int SDLK_AMPERSAND = 38;
public static final int SDLK_QUOTE = 39;
public static final int SDLK_LEFTPAREN = 40;
public static final int SDLK_RIGHTPAREN = 41;
public static final int SDLK_ASTERISK = 42;
public static final int SDLK_PLUS = 43;
public static final int SDLK_COMMA = 44;
public static final int SDLK_MINUS = 45;
public static final int SDLK_PERIOD = 46;
public static final int SDLK_SLASH = 47;
public static final int SDLK_0 = 48;
public static final int SDLK_1 = 49;
public static final int SDLK_2 = 50;
public static final int SDLK_3 = 51;
public static final int SDLK_4 = 52;
public static final int SDLK_5 = 53;
public static final int SDLK_6 = 54;
public static final int SDLK_7 = 55;
public static final int SDLK_8 = 56;
public static final int SDLK_9 = 57;
public static final int SDLK_COLON = 58;
public static final int SDLK_SEMICOLON = 59;
public static final int SDLK_LESS = 60;
public static final int SDLK_EQUALS = 61;
public static final int SDLK_GREATER = 62;
public static final int SDLK_QUESTION = 63;
public static final int SDLK_AT = 64;
public static final int SDLK_LEFTBRACKET = 91;
public static final int SDLK_BACKSLASH = 92;
public static final int SDLK_RIGHTBRACKET = 93;
public static final int SDLK_CARET = 94;
public static final int SDLK_UNDERSCORE = 95;
public static final int SDLK_BACKQUOTE = 96;
public static final int SDLK_a = 97;
public static final int SDLK_b = 98;
public static final int SDLK_c = 99;
public static final int SDLK_d = 100;
public static final int SDLK_e = 101;
public static final int SDLK_f = 102;
public static final int SDLK_g = 103;
public static final int SDLK_h = 104;
public static final int SDLK_i = 105;
public static final int SDLK_j = 106;
public static final int SDLK_k = 107;
public static final int SDLK_l = 108;
public static final int SDLK_m = 109;
public static final int SDLK_n = 110;
public static final int SDLK_o = 111;
public static final int SDLK_p = 112;
public static final int SDLK_q = 113;
public static final int SDLK_r = 114;
public static final int SDLK_s = 115;
public static final int SDLK_t = 116;
public static final int SDLK_u = 117;
public static final int SDLK_v = 118;
public static final int SDLK_w = 119;
public static final int SDLK_x = 120;
public static final int SDLK_y = 121;
public static final int SDLK_z = 122;
public static final int SDLK_DELETE = 127;
public static final int SDLK_WORLD_0 = 160;
public static final int SDLK_WORLD_1 = 161;
public static final int SDLK_WORLD_2 = 162;
public static final int SDLK_WORLD_3 = 163;
public static final int SDLK_WORLD_4 = 164;
public static final int SDLK_WORLD_5 = 165;
public static final int SDLK_WORLD_6 = 166;
public static final int SDLK_WORLD_7 = 167;
public static final int SDLK_WORLD_8 = 168;
public static final int SDLK_WORLD_9 = 169;
public static final int SDLK_WORLD_10 = 170;
public static final int SDLK_WORLD_11 = 171;
public static final int SDLK_WORLD_12 = 172;
public static final int SDLK_WORLD_13 = 173;
public static final int SDLK_WORLD_14 = 174;
public static final int SDLK_WORLD_15 = 175;
public static final int SDLK_WORLD_16 = 176;
public static final int SDLK_WORLD_17 = 177;
public static final int SDLK_WORLD_18 = 178;
public static final int SDLK_WORLD_19 = 179;
public static final int SDLK_WORLD_20 = 180;
public static final int SDLK_WORLD_21 = 181;
public static final int SDLK_WORLD_22 = 182;
public static final int SDLK_WORLD_23 = 183;
public static final int SDLK_WORLD_24 = 184;
public static final int SDLK_WORLD_25 = 185;
public static final int SDLK_WORLD_26 = 186;
public static final int SDLK_WORLD_27 = 187;
public static final int SDLK_WORLD_28 = 188;
public static final int SDLK_WORLD_29 = 189;
public static final int SDLK_WORLD_30 = 190;
public static final int SDLK_WORLD_31 = 191;
public static final int SDLK_WORLD_32 = 192;
public static final int SDLK_WORLD_33 = 193;
public static final int SDLK_WORLD_34 = 194;
public static final int SDLK_WORLD_35 = 195;
public static final int SDLK_WORLD_36 = 196;
public static final int SDLK_WORLD_37 = 197;
public static final int SDLK_WORLD_38 = 198;
public static final int SDLK_WORLD_39 = 199;
public static final int SDLK_WORLD_40 = 200;
public static final int SDLK_WORLD_41 = 201;
public static final int SDLK_WORLD_42 = 202;
public static final int SDLK_WORLD_43 = 203;
public static final int SDLK_WORLD_44 = 204;
public static final int SDLK_WORLD_45 = 205;
public static final int SDLK_WORLD_46 = 206;
public static final int SDLK_WORLD_47 = 207;
public static final int SDLK_WORLD_48 = 208;
public static final int SDLK_WORLD_49 = 209;
public static final int SDLK_WORLD_50 = 210;
public static final int SDLK_WORLD_51 = 211;
public static final int SDLK_WORLD_52 = 212;
public static final int SDLK_WORLD_53 = 213;
public static final int SDLK_WORLD_54 = 214;
public static final int SDLK_WORLD_55 = 215;
public static final int SDLK_WORLD_56 = 216;
public static final int SDLK_WORLD_57 = 217;
public static final int SDLK_WORLD_58 = 218;
public static final int SDLK_WORLD_59 = 219;
public static final int SDLK_WORLD_60 = 220;
public static final int SDLK_WORLD_61 = 221;
public static final int SDLK_WORLD_62 = 222;
public static final int SDLK_WORLD_63 = 223;
public static final int SDLK_WORLD_64 = 224;
public static final int SDLK_WORLD_65 = 225;
public static final int SDLK_WORLD_66 = 226;
public static final int SDLK_WORLD_67 = 227;
public static final int SDLK_WORLD_68 = 228;
public static final int SDLK_WORLD_69 = 229;
public static final int SDLK_WORLD_70 = 230;
public static final int SDLK_WORLD_71 = 231;
public static final int SDLK_WORLD_72 = 232;
public static final int SDLK_WORLD_73 = 233;
public static final int SDLK_WORLD_74 = 234;
public static final int SDLK_WORLD_75 = 235;
public static final int SDLK_WORLD_76 = 236;
public static final int SDLK_WORLD_77 = 237;
public static final int SDLK_WORLD_78 = 238;
public static final int SDLK_WORLD_79 = 239;
public static final int SDLK_WORLD_80 = 240;
public static final int SDLK_WORLD_81 = 241;
public static final int SDLK_WORLD_82 = 242;
public static final int SDLK_WORLD_83 = 243;
public static final int SDLK_WORLD_84 = 244;
public static final int SDLK_WORLD_85 = 245;
public static final int SDLK_WORLD_86 = 246;
public static final int SDLK_WORLD_87 = 247;
public static final int SDLK_WORLD_88 = 248;
public static final int SDLK_WORLD_89 = 249;
public static final int SDLK_WORLD_90 = 250;
public static final int SDLK_WORLD_91 = 251;
public static final int SDLK_WORLD_92 = 252;
public static final int SDLK_WORLD_93 = 253;
public static final int SDLK_WORLD_94 = 254;
public static final int SDLK_WORLD_95 = 255;
public static final int SDLK_KP0 = 256;
public static final int SDLK_KP1 = 257;
public static final int SDLK_KP2 = 258;
public static final int SDLK_KP3 = 259;
public static final int SDLK_KP4 = 260;
public static final int SDLK_KP5 = 261;
public static final int SDLK_KP6 = 262;
public static final int SDLK_KP7 = 263;
public static final int SDLK_KP8 = 264;
public static final int SDLK_KP9 = 265;
public static final int SDLK_KP_PERIOD = 266;
public static final int SDLK_KP_DIVIDE = 267;
public static final int SDLK_KP_MULTIPLY = 268;
public static final int SDLK_KP_MINUS = 269;
public static final int SDLK_KP_PLUS = 270;
public static final int SDLK_KP_ENTER = 271;
public static final int SDLK_KP_EQUALS = 272;
public static final int SDLK_UP = 273;
public static final int SDLK_DOWN = 274;
public static final int SDLK_RIGHT = 275;
public static final int SDLK_LEFT = 276;
public static final int SDLK_INSERT = 277;
public static final int SDLK_HOME = 278;
public static final int SDLK_END = 279;
public static final int SDLK_PAGEUP = 280;
public static final int SDLK_PAGEDOWN = 281;
public static final int SDLK_F1 = 282;
public static final int SDLK_F2 = 283;
public static final int SDLK_F3 = 284;
public static final int SDLK_F4 = 285;
public static final int SDLK_F5 = 286;
public static final int SDLK_F6 = 287;
public static final int SDLK_F7 = 288;
public static final int SDLK_F8 = 289;
public static final int SDLK_F9 = 290;
public static final int SDLK_F10 = 291;
public static final int SDLK_F11 = 292;
public static final int SDLK_F12 = 293;
public static final int SDLK_F13 = 294;
public static final int SDLK_F14 = 295;
public static final int SDLK_F15 = 296;
public static final int SDLK_NUMLOCK = 300;
public static final int SDLK_CAPSLOCK = 301;
public static final int SDLK_SCROLLOCK = 302;
public static final int SDLK_RSHIFT = 303;
public static final int SDLK_LSHIFT = 304;
public static final int SDLK_RCTRL = 305;
public static final int SDLK_LCTRL = 306;
public static final int SDLK_RALT = 307;
public static final int SDLK_LALT = 308;
public static final int SDLK_RMETA = 309;
public static final int SDLK_LMETA = 310;
public static final int SDLK_LSUPER = 311;
public static final int SDLK_RSUPER = 312;
public static final int SDLK_MODE = 313;
public static final int SDLK_COMPOSE = 314;
public static final int SDLK_HELP = 315;
public static final int SDLK_PRINT = 316;
public static final int SDLK_SYSREQ = 317;
public static final int SDLK_BREAK = 318;
public static final int SDLK_MENU = 319;
public static final int SDLK_POWER = 320;
public static final int SDLK_EURO = 321;
public static final int SDLK_UNDO = 322;
public static final int SDLK_NO_REMAP = 512;
}
// Autogenerated by hand with a command:
// grep 'SDL_SCANCODE_' SDL_scancode.h | sed 's/SDL_SCANCODE_\([a-zA-Z0-9_]\+\).*[=] \([0-9]\+\).*/public static final int SDLK_\1 = \2;/' >> Keycodes.java
class SDL_1_3_Keycodes
{
public static final int SDLK_UNKNOWN = 0;
public static final int SDLK_A = 4;
public static final int SDLK_B = 5;
public static final int SDLK_C = 6;
public static final int SDLK_D = 7;
public static final int SDLK_E = 8;
public static final int SDLK_F = 9;
public static final int SDLK_G = 10;
public static final int SDLK_H = 11;
public static final int SDLK_I = 12;
public static final int SDLK_J = 13;
public static final int SDLK_K = 14;
public static final int SDLK_L = 15;
public static final int SDLK_M = 16;
public static final int SDLK_N = 17;
public static final int SDLK_O = 18;
public static final int SDLK_P = 19;
public static final int SDLK_Q = 20;
public static final int SDLK_R = 21;
public static final int SDLK_S = 22;
public static final int SDLK_T = 23;
public static final int SDLK_U = 24;
public static final int SDLK_V = 25;
public static final int SDLK_W = 26;
public static final int SDLK_X = 27;
public static final int SDLK_Y = 28;
public static final int SDLK_Z = 29;
public static final int SDLK_1 = 30;
public static final int SDLK_2 = 31;
public static final int SDLK_3 = 32;
public static final int SDLK_4 = 33;
public static final int SDLK_5 = 34;
public static final int SDLK_6 = 35;
public static final int SDLK_7 = 36;
public static final int SDLK_8 = 37;
public static final int SDLK_9 = 38;
public static final int SDLK_0 = 39;
public static final int SDLK_RETURN = 40;
public static final int SDLK_ESCAPE = 41;
public static final int SDLK_BACKSPACE = 42;
public static final int SDLK_TAB = 43;
public static final int SDLK_SPACE = 44;
public static final int SDLK_MINUS = 45;
public static final int SDLK_EQUALS = 46;
public static final int SDLK_LEFTBRACKET = 47;
public static final int SDLK_RIGHTBRACKET = 48;
public static final int SDLK_BACKSLASH = 49;
public static final int SDLK_NONUSHASH = 50;
public static final int SDLK_SEMICOLON = 51;
public static final int SDLK_APOSTROPHE = 52;
public static final int SDLK_GRAVE = 53;
public static final int SDLK_COMMA = 54;
public static final int SDLK_PERIOD = 55;
public static final int SDLK_SLASH = 56;
public static final int SDLK_CAPSLOCK = 57;
public static final int SDLK_F1 = 58;
public static final int SDLK_F2 = 59;
public static final int SDLK_F3 = 60;
public static final int SDLK_F4 = 61;
public static final int SDLK_F5 = 62;
public static final int SDLK_F6 = 63;
public static final int SDLK_F7 = 64;
public static final int SDLK_F8 = 65;
public static final int SDLK_F9 = 66;
public static final int SDLK_F10 = 67;
public static final int SDLK_F11 = 68;
public static final int SDLK_F12 = 69;
public static final int SDLK_PRINTSCREEN = 70;
public static final int SDLK_SCROLLLOCK = 71;
public static final int SDLK_PAUSE = 72;
public static final int SDLK_INSERT = 73;
public static final int SDLK_HOME = 74;
public static final int SDLK_PAGEUP = 75;
public static final int SDLK_DELETE = 76;
public static final int SDLK_END = 77;
public static final int SDLK_PAGEDOWN = 78;
public static final int SDLK_RIGHT = 79;
public static final int SDLK_LEFT = 80;
public static final int SDLK_DOWN = 81;
public static final int SDLK_UP = 82;
public static final int SDLK_NUMLOCKCLEAR = 83;
public static final int SDLK_KP_DIVIDE = 84;
public static final int SDLK_KP_MULTIPLY = 85;
public static final int SDLK_KP_MINUS = 86;
public static final int SDLK_KP_PLUS = 87;
public static final int SDLK_KP_ENTER = 88;
public static final int SDLK_KP_1 = 89;
public static final int SDLK_KP_2 = 90;
public static final int SDLK_KP_3 = 91;
public static final int SDLK_KP_4 = 92;
public static final int SDLK_KP_5 = 93;
public static final int SDLK_KP_6 = 94;
public static final int SDLK_KP_7 = 95;
public static final int SDLK_KP_8 = 96;
public static final int SDLK_KP_9 = 97;
public static final int SDLK_KP_0 = 98;
public static final int SDLK_KP_PERIOD = 99;
public static final int SDLK_NONUSBACKSLASH = 100;
public static final int SDLK_APPLICATION = 101;
public static final int SDLK_POWER = 102;
public static final int SDLK_KP_EQUALS = 103;
public static final int SDLK_F13 = 104;
public static final int SDLK_F14 = 105;
public static final int SDLK_F15 = 106;
public static final int SDLK_F16 = 107;
public static final int SDLK_F17 = 108;
public static final int SDLK_F18 = 109;
public static final int SDLK_F19 = 110;
public static final int SDLK_F20 = 111;
public static final int SDLK_F21 = 112;
public static final int SDLK_F22 = 113;
public static final int SDLK_F23 = 114;
public static final int SDLK_F24 = 115;
public static final int SDLK_EXECUTE = 116;
public static final int SDLK_HELP = 117;
public static final int SDLK_MENU = 118;
public static final int SDLK_SELECT = 119;
public static final int SDLK_STOP = 120;
public static final int SDLK_AGAIN = 121;
public static final int SDLK_UNDO = 122;
public static final int SDLK_CUT = 123;
public static final int SDLK_COPY = 124;
public static final int SDLK_PASTE = 125;
public static final int SDLK_FIND = 126;
public static final int SDLK_MUTE = 127;
public static final int SDLK_VOLUMEUP = 128;
public static final int SDLK_VOLUMEDOWN = 129;
public static final int SDLK_KP_COMMA = 133;
public static final int SDLK_KP_EQUALSAS400 = 134;
public static final int SDLK_INTERNATIONAL1 = 135;
public static final int SDLK_INTERNATIONAL2 = 136;
public static final int SDLK_INTERNATIONAL3 = 137;
public static final int SDLK_INTERNATIONAL4 = 138;
public static final int SDLK_INTERNATIONAL5 = 139;
public static final int SDLK_INTERNATIONAL6 = 140;
public static final int SDLK_INTERNATIONAL7 = 141;
public static final int SDLK_INTERNATIONAL8 = 142;
public static final int SDLK_INTERNATIONAL9 = 143;
public static final int SDLK_LANG1 = 144;
public static final int SDLK_LANG2 = 145;
public static final int SDLK_LANG3 = 146;
public static final int SDLK_LANG4 = 147;
public static final int SDLK_LANG5 = 148;
public static final int SDLK_LANG6 = 149;
public static final int SDLK_LANG7 = 150;
public static final int SDLK_LANG8 = 151;
public static final int SDLK_LANG9 = 152;
public static final int SDLK_ALTERASE = 153;
public static final int SDLK_SYSREQ = 154;
public static final int SDLK_CANCEL = 155;
public static final int SDLK_CLEAR = 156;
public static final int SDLK_PRIOR = 157;
public static final int SDLK_RETURN2 = 158;
public static final int SDLK_SEPARATOR = 159;
public static final int SDLK_OUT = 160;
public static final int SDLK_OPER = 161;
public static final int SDLK_CLEARAGAIN = 162;
public static final int SDLK_CRSEL = 163;
public static final int SDLK_EXSEL = 164;
public static final int SDLK_KP_00 = 176;
public static final int SDLK_KP_000 = 177;
public static final int SDLK_THOUSANDSSEPARATOR = 178;
public static final int SDLK_DECIMALSEPARATOR = 179;
public static final int SDLK_CURRENCYUNIT = 180;
public static final int SDLK_CURRENCYSUBUNIT = 181;
public static final int SDLK_KP_LEFTPAREN = 182;
public static final int SDLK_KP_RIGHTPAREN = 183;
public static final int SDLK_KP_LEFTBRACE = 184;
public static final int SDLK_KP_RIGHTBRACE = 185;
public static final int SDLK_KP_TAB = 186;
public static final int SDLK_KP_BACKSPACE = 187;
public static final int SDLK_KP_A = 188;
public static final int SDLK_KP_B = 189;
public static final int SDLK_KP_C = 190;
public static final int SDLK_KP_D = 191;
public static final int SDLK_KP_E = 192;
public static final int SDLK_KP_F = 193;
public static final int SDLK_KP_XOR = 194;
public static final int SDLK_KP_POWER = 195;
public static final int SDLK_KP_PERCENT = 196;
public static final int SDLK_KP_LESS = 197;
public static final int SDLK_KP_GREATER = 198;
public static final int SDLK_KP_AMPERSAND = 199;
public static final int SDLK_KP_DBLAMPERSAND = 200;
public static final int SDLK_KP_VERTICALBAR = 201;
public static final int SDLK_KP_DBLVERTICALBAR = 202;
public static final int SDLK_KP_COLON = 203;
public static final int SDLK_KP_HASH = 204;
public static final int SDLK_KP_SPACE = 205;
public static final int SDLK_KP_AT = 206;
public static final int SDLK_KP_EXCLAM = 207;
public static final int SDLK_KP_MEMSTORE = 208;
public static final int SDLK_KP_MEMRECALL = 209;
public static final int SDLK_KP_MEMCLEAR = 210;
public static final int SDLK_KP_MEMADD = 211;
public static final int SDLK_KP_MEMSUBTRACT = 212;
public static final int SDLK_KP_MEMMULTIPLY = 213;
public static final int SDLK_KP_MEMDIVIDE = 214;
public static final int SDLK_KP_PLUSMINUS = 215;
public static final int SDLK_KP_CLEAR = 216;
public static final int SDLK_KP_CLEARENTRY = 217;
public static final int SDLK_KP_BINARY = 218;
public static final int SDLK_KP_OCTAL = 219;
public static final int SDLK_KP_DECIMAL = 220;
public static final int SDLK_KP_HEXADECIMAL = 221;
public static final int SDLK_LCTRL = 224;
public static final int SDLK_LSHIFT = 225;
public static final int SDLK_LALT = 226;
public static final int SDLK_LGUI = 227;
public static final int SDLK_RCTRL = 228;
public static final int SDLK_RSHIFT = 229;
public static final int SDLK_RALT = 230;
public static final int SDLK_RGUI = 231;
public static final int SDLK_MODE = 257;
public static final int SDLK_AUDIONEXT = 258;
public static final int SDLK_AUDIOPREV = 259;
public static final int SDLK_AUDIOSTOP = 260;
public static final int SDLK_AUDIOPLAY = 261;
public static final int SDLK_AUDIOMUTE = 262;
public static final int SDLK_MEDIASELECT = 263;
public static final int SDLK_WWW = 264;
public static final int SDLK_MAIL = 265;
public static final int SDLK_CALCULATOR = 266;
public static final int SDLK_COMPUTER = 267;
public static final int SDLK_AC_SEARCH = 268;
public static final int SDLK_AC_HOME = 269;
public static final int SDLK_AC_BACK = 270;
public static final int SDLK_AC_FORWARD = 271;
public static final int SDLK_AC_STOP = 272;
public static final int SDLK_AC_REFRESH = 273;
public static final int SDLK_AC_BOOKMARKS = 274;
public static final int SDLK_BRIGHTNESSDOWN = 275;
public static final int SDLK_BRIGHTNESSUP = 276;
public static final int SDLK_DISPLAYSWITCH = 277;
public static final int SDLK_KBDILLUMTOGGLE = 278;
public static final int SDLK_KBDILLUMDOWN = 279;
public static final int SDLK_KBDILLUMUP = 280;
public static final int SDLK_EJECT = 281;
public static final int SDLK_SLEEP = 282;
public static final int SDLK_NO_REMAP = 512;
}
class SDL_Keys
{
public static String [] names = null;
public static Integer [] values = null;
public static String [] namesSorted = null;
public static Integer [] namesSortedIdx = null;
public static Integer [] namesSortedBackIdx = null;
static final int JAVA_KEYCODE_LAST = 255; // Android 2.3 added several new gaming keys, Android 3.1 added even more - keep in sync with javakeycodes.h
static String getName(int v)
{
for( int f = 0; f < values.length; f++ )
{
if( values[f] == v )
return names[f];
}
return names[0];
}
static
{
ArrayList<String> Names = new ArrayList<String> ();
ArrayList<Integer> Values = new ArrayList<Integer> ();
Field [] fields = SDL_1_2_Keycodes.class.getDeclaredFields();
if( Globals.Using_SDL_1_3 )
{
fields = SDL_1_3_Keycodes.class.getDeclaredFields();
}
try {
for(Field f: fields)
{
Values.add(f.getInt(null));
Names.add(f.getName().substring(5).toUpperCase());
}
} catch(IllegalAccessException e) {};
// Sort by value
for( int i = 0; i < Values.size(); i++ )
{
for( int j = i; j < Values.size(); j++ )
{
if( Values.get(i) > Values.get(j) )
{
int x = Values.get(i);
Values.set(i, Values.get(j));
Values.set(j, x);
String s = Names.get(i);
Names.set(i, Names.get(j));
Names.set(j, s);
}
}
}
names = Names.toArray(new String[0]);
values = Values.toArray(new Integer[0]);
namesSorted = Names.toArray(new String[0]);
namesSortedIdx = new Integer[values.length];
namesSortedBackIdx = new Integer[values.length];
Arrays.sort(namesSorted);
for( int i = 0; i < namesSorted.length; i++ )
{
for( int j = 0; j < namesSorted.length; j++ )
{
if( namesSorted[i].equals( names[j] ) )
{
namesSortedIdx[i] = j;
namesSortedBackIdx[j] = i;
break;
}
}
}
}
}

File diff suppressed because it is too large Load Diff

1
project/javaSDL2/Mouse.java Symbolic link
View File

@@ -0,0 +1 @@
../java/Mouse.java

View File

@@ -0,0 +1 @@
../java/SDL_Keys.java

View File

@@ -1,782 +0,0 @@
/*
Simple DirectMedia Layer
Java source code (C) 2009-2012 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package net.sourceforge.clonekeenplus;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import android.util.Log;
import java.io.*;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Environment;
import android.os.StatFs;
import java.util.Locale;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.zip.GZIPInputStream;
import java.util.Collections;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import java.lang.String;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.FrameLayout;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.BitmapFactory;
import android.graphics.Bitmap;
import android.widget.TextView;
import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.Button;
import android.view.View;
import android.widget.LinearLayout;
import android.text.Editable;
import android.text.SpannedString;
import android.content.Intent;
import android.app.PendingIntent;
import android.app.AlarmManager;
import android.util.DisplayMetrics;
import android.net.Uri;
import java.util.concurrent.Semaphore;
import java.util.Arrays;
import android.graphics.Color;
import android.hardware.SensorEventListener;
import android.hardware.SensorEvent;
import android.hardware.Sensor;
import android.widget.Toast;
// TODO: too much code here, split into multiple files, possibly auto-generated menus?
class Settings
{
static String SettingsFileName = "libsdl-settings.cfg";
static boolean settingsLoaded = false;
static boolean settingsChanged = false;
static final int SETTINGS_FILE_VERSION = 5;
static void Save(final MainActivity p)
{
try {
ObjectOutputStream out = new ObjectOutputStream(p.openFileOutput( SettingsFileName, p.MODE_WORLD_READABLE ));
out.writeInt(SETTINGS_FILE_VERSION);
out.writeBoolean(Globals.DownloadToSdcard);
out.writeBoolean(Globals.PhoneHasArrowKeys);
out.writeBoolean(Globals.PhoneHasTrackball);
out.writeBoolean(Globals.UseAccelerometerAsArrowKeys);
out.writeBoolean(Globals.UseTouchscreenKeyboard);
out.writeInt(Globals.TouchscreenKeyboardSize);
out.writeInt(Globals.AccelerometerSensitivity);
out.writeInt(Globals.AccelerometerCenterPos);
out.writeInt(Globals.TrackballDampening);
out.writeInt(Globals.AudioBufferConfig);
out.writeInt(Globals.TouchscreenKeyboardTheme);
out.writeInt(Globals.RightClickMethod);
out.writeInt(Globals.ShowScreenUnderFinger);
out.writeInt(Globals.LeftClickMethod);
out.writeBoolean(Globals.MoveMouseWithJoystick);
out.writeBoolean(Globals.ClickMouseWithDpad);
out.writeInt(Globals.ClickScreenPressure);
out.writeInt(Globals.ClickScreenTouchspotSize);
out.writeBoolean(Globals.KeepAspectRatio);
out.writeInt(Globals.MoveMouseWithJoystickSpeed);
out.writeInt(Globals.MoveMouseWithJoystickAccel);
out.writeInt(SDL_Keys.JAVA_KEYCODE_LAST);
for( int i = 0; i < SDL_Keys.JAVA_KEYCODE_LAST; i++ )
{
out.writeInt(Globals.RemapHwKeycode[i]);
}
out.writeInt(Globals.RemapScreenKbKeycode.length);
for( int i = 0; i < Globals.RemapScreenKbKeycode.length; i++ )
{
out.writeInt(Globals.RemapScreenKbKeycode[i]);
}
out.writeInt(Globals.ScreenKbControlsShown.length);
for( int i = 0; i < Globals.ScreenKbControlsShown.length; i++ )
{
out.writeBoolean(Globals.ScreenKbControlsShown[i]);
}
out.writeInt(Globals.TouchscreenKeyboardTransparency);
out.writeInt(Globals.RemapMultitouchGestureKeycode.length);
for( int i = 0; i < Globals.RemapMultitouchGestureKeycode.length; i++ )
{
out.writeInt(Globals.RemapMultitouchGestureKeycode[i]);
out.writeBoolean(Globals.MultitouchGesturesUsed[i]);
}
out.writeInt(Globals.MultitouchGestureSensitivity);
for( int i = 0; i < Globals.TouchscreenCalibration.length; i++ )
out.writeInt(Globals.TouchscreenCalibration[i]);
out.writeInt(Globals.DataDir.length());
for( int i = 0; i < Globals.DataDir.length(); i++ )
out.writeChar(Globals.DataDir.charAt(i));
out.writeInt(Globals.CommandLine.length());
for( int i = 0; i < Globals.CommandLine.length(); i++ )
out.writeChar(Globals.CommandLine.charAt(i));
out.writeInt(Globals.ScreenKbControlsLayout.length);
for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ )
for( int ii = 0; ii < 4; ii++ )
out.writeInt(Globals.ScreenKbControlsLayout[i][ii]);
out.writeInt(Globals.LeftClickKey);
out.writeInt(Globals.RightClickKey);
out.writeBoolean(Globals.VideoLinearFilter);
out.writeInt(Globals.LeftClickTimeout);
out.writeInt(Globals.RightClickTimeout);
out.writeBoolean(Globals.RelativeMouseMovement);
out.writeInt(Globals.RelativeMouseMovementSpeed);
out.writeInt(Globals.RelativeMouseMovementAccel);
out.writeBoolean(Globals.MultiThreadedVideo);
out.writeInt(Globals.OptionalDataDownload.length);
for(int i = 0; i < Globals.OptionalDataDownload.length; i++)
out.writeBoolean(Globals.OptionalDataDownload[i]);
out.writeBoolean(Globals.BrokenLibCMessageShown);
out.writeInt(Globals.TouchscreenKeyboardDrawSize);
out.writeInt(p.getApplicationVersion());
out.writeFloat(Globals.gyro_x1);
out.writeFloat(Globals.gyro_x2);
out.writeFloat(Globals.gyro_xc);
out.writeFloat(Globals.gyro_y1);
out.writeFloat(Globals.gyro_y2);
out.writeFloat(Globals.gyro_yc);
out.writeFloat(Globals.gyro_z1);
out.writeFloat(Globals.gyro_z2);
out.writeFloat(Globals.gyro_zc);
out.writeBoolean(Globals.OuyaEmulation);
out.close();
settingsLoaded = true;
} catch( FileNotFoundException e ) {
} catch( SecurityException e ) {
} catch ( IOException e ) {};
}
static void Load( final MainActivity p )
{
if(settingsLoaded) // Prevent starting twice
{
return;
}
Log.i("SDL", "libSDL: Settings.Load(): enter");
/*nativeInitKeymap(); // TODO: Disabled in SDL2
if( p.isRunningOnOUYA() )
nativeSetKeymapKey(KeyEvent.KEYCODE_MENU, nativeGetKeymapKey(KeyEvent.KEYCODE_BACK)); // Ouya does not have Back key, only Menu, so remap Back keycode to Menu
for( int i = 0; i < SDL_Keys.JAVA_KEYCODE_LAST; i++ )
{
int sdlKey = nativeGetKeymapKey(i);
int idx = 0;
for(int ii = 0; ii < SDL_Keys.values.length; ii++)
if(SDL_Keys.values[ii] == sdlKey)
idx = ii;
Globals.RemapHwKeycode[i] = idx;
}
for( int i = 0; i < Globals.RemapScreenKbKeycode.length; i++ )
{
int sdlKey = nativeGetKeymapKeyScreenKb(i);
int idx = 0;
for(int ii = 0; ii < SDL_Keys.values.length; ii++)
if(SDL_Keys.values[ii] == sdlKey)
idx = ii;
Globals.RemapScreenKbKeycode[i] = idx;
}*/
Globals.ScreenKbControlsShown[0] = (Globals.AppNeedsArrowKeys || Globals.AppUsesJoystick);
Globals.ScreenKbControlsShown[1] = Globals.AppNeedsTextInput;
for( int i = 2; i < Globals.ScreenKbControlsShown.length; i++ )
Globals.ScreenKbControlsShown[i] = ( i - 2 < Globals.AppTouchscreenKeyboardKeysAmount );
if( Globals.AppUsesSecondJoystick )
Globals.ScreenKbControlsShown[8] = true;
/*for( int i = 0; i < Globals.RemapMultitouchGestureKeycode.length; i++ )
{
int sdlKey = nativeGetKeymapKeyMultitouchGesture(i);
int idx = 0;
for(int ii = 0; ii < SDL_Keys.values.length; ii++)
if(SDL_Keys.values[ii] == sdlKey)
idx = ii;
Globals.RemapMultitouchGestureKeycode[i] = idx;
}*/
for( int i = 0; i < Globals.MultitouchGesturesUsed.length; i++ )
Globals.MultitouchGesturesUsed[i] = true;
// Adjust coordinates of on-screen buttons from 800x480
int displayX = 800;
int displayY = 480;
try {
DisplayMetrics dm = new DisplayMetrics();
p.getWindowManager().getDefaultDisplay().getMetrics(dm);
displayX = dm.widthPixels;
displayY = dm.heightPixels;
} catch (Exception eeeee) {}
for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ )
{
Globals.ScreenKbControlsLayout[i][0] *= (float)displayX / 800.0f;
Globals.ScreenKbControlsLayout[i][2] *= (float)displayX / 800.0f;
Globals.ScreenKbControlsLayout[i][1] *= (float)displayY / 480.0f;
Globals.ScreenKbControlsLayout[i][3] *= (float)displayY / 480.0f;
// Make them square
int wh = Math.min( Globals.ScreenKbControlsLayout[i][2] - Globals.ScreenKbControlsLayout[i][0], Globals.ScreenKbControlsLayout[i][3] - Globals.ScreenKbControlsLayout[i][1] );
Globals.ScreenKbControlsLayout[i][2] = Globals.ScreenKbControlsLayout[i][0] + wh;
Globals.ScreenKbControlsLayout[i][3] = Globals.ScreenKbControlsLayout[i][1] + wh;
}
Log.i("SDL", "android.os.Build.MODEL: " + android.os.Build.MODEL);
if( (android.os.Build.MODEL.equals("GT-N7000") || android.os.Build.MODEL.equals("SGH-I717"))
&& android.os.Build.VERSION.SDK_INT <= android.os.Build.VERSION_CODES.GINGERBREAD_MR1 )
{
// Samsung Galaxy Note generates a keypress when you hover a stylus over the screen, and that messes up OpenTTD dialogs
// ICS update sends events in a proper way
Globals.RemapHwKeycode[112] = SDL_1_2_Keycodes.SDLK_UNKNOWN;
}
try {
ObjectInputStream settingsFile = new ObjectInputStream(new FileInputStream( p.getFilesDir().getAbsolutePath() + "/" + SettingsFileName ));
if( settingsFile.readInt() != SETTINGS_FILE_VERSION )
throw new IOException();
Globals.DownloadToSdcard = settingsFile.readBoolean();
Globals.PhoneHasArrowKeys = settingsFile.readBoolean();
Globals.PhoneHasTrackball = settingsFile.readBoolean();
Globals.UseAccelerometerAsArrowKeys = settingsFile.readBoolean();
Globals.UseTouchscreenKeyboard = settingsFile.readBoolean();
Globals.TouchscreenKeyboardSize = settingsFile.readInt();
Globals.AccelerometerSensitivity = settingsFile.readInt();
Globals.AccelerometerCenterPos = settingsFile.readInt();
Globals.TrackballDampening = settingsFile.readInt();
Globals.AudioBufferConfig = settingsFile.readInt();
Globals.TouchscreenKeyboardTheme = settingsFile.readInt();
Globals.RightClickMethod = settingsFile.readInt();
Globals.ShowScreenUnderFinger = settingsFile.readInt();
Globals.LeftClickMethod = settingsFile.readInt();
Globals.MoveMouseWithJoystick = settingsFile.readBoolean();
Globals.ClickMouseWithDpad = settingsFile.readBoolean();
Globals.ClickScreenPressure = settingsFile.readInt();
Globals.ClickScreenTouchspotSize = settingsFile.readInt();
Globals.KeepAspectRatio = settingsFile.readBoolean();
Globals.MoveMouseWithJoystickSpeed = settingsFile.readInt();
Globals.MoveMouseWithJoystickAccel = settingsFile.readInt();
int readKeys = settingsFile.readInt();
for( int i = 0; i < readKeys; i++ )
{
Globals.RemapHwKeycode[i] = settingsFile.readInt();
}
if( settingsFile.readInt() != Globals.RemapScreenKbKeycode.length )
throw new IOException();
for( int i = 0; i < Globals.RemapScreenKbKeycode.length; i++ )
{
Globals.RemapScreenKbKeycode[i] = settingsFile.readInt();
}
if( settingsFile.readInt() != Globals.ScreenKbControlsShown.length )
throw new IOException();
for( int i = 0; i < Globals.ScreenKbControlsShown.length; i++ )
{
Globals.ScreenKbControlsShown[i] = settingsFile.readBoolean();
}
Globals.TouchscreenKeyboardTransparency = settingsFile.readInt();
if( settingsFile.readInt() != Globals.RemapMultitouchGestureKeycode.length )
throw new IOException();
for( int i = 0; i < Globals.RemapMultitouchGestureKeycode.length; i++ )
{
Globals.RemapMultitouchGestureKeycode[i] = settingsFile.readInt();
Globals.MultitouchGesturesUsed[i] = settingsFile.readBoolean();
}
Globals.MultitouchGestureSensitivity = settingsFile.readInt();
for( int i = 0; i < Globals.TouchscreenCalibration.length; i++ )
Globals.TouchscreenCalibration[i] = settingsFile.readInt();
StringBuilder b = new StringBuilder();
int len = settingsFile.readInt();
for( int i = 0; i < len; i++ )
b.append( settingsFile.readChar() );
Globals.DataDir = b.toString();
b = new StringBuilder();
len = settingsFile.readInt();
for( int i = 0; i < len; i++ )
b.append( settingsFile.readChar() );
Globals.CommandLine = b.toString();
if( settingsFile.readInt() != Globals.ScreenKbControlsLayout.length )
throw new IOException();
for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ )
for( int ii = 0; ii < 4; ii++ )
Globals.ScreenKbControlsLayout[i][ii] = settingsFile.readInt();
Globals.LeftClickKey = settingsFile.readInt();
Globals.RightClickKey = settingsFile.readInt();
Globals.VideoLinearFilter = settingsFile.readBoolean();
Globals.LeftClickTimeout = settingsFile.readInt();
Globals.RightClickTimeout = settingsFile.readInt();
Globals.RelativeMouseMovement = settingsFile.readBoolean();
Globals.RelativeMouseMovementSpeed = settingsFile.readInt();
Globals.RelativeMouseMovementAccel = settingsFile.readInt();
Globals.MultiThreadedVideo = settingsFile.readBoolean();
Globals.OptionalDataDownload = new boolean[settingsFile.readInt()];
for(int i = 0; i < Globals.OptionalDataDownload.length; i++)
Globals.OptionalDataDownload[i] = settingsFile.readBoolean();
Globals.BrokenLibCMessageShown = settingsFile.readBoolean();
Globals.TouchscreenKeyboardDrawSize = settingsFile.readInt();
int cfgVersion = settingsFile.readInt();
Globals.gyro_x1 = settingsFile.readFloat();
Globals.gyro_x2 = settingsFile.readFloat();
Globals.gyro_xc = settingsFile.readFloat();
Globals.gyro_y1 = settingsFile.readFloat();
Globals.gyro_y2 = settingsFile.readFloat();
Globals.gyro_yc = settingsFile.readFloat();
Globals.gyro_z1 = settingsFile.readFloat();
Globals.gyro_z2 = settingsFile.readFloat();
Globals.gyro_zc = settingsFile.readFloat();
Globals.OuyaEmulation = settingsFile.readBoolean();
settingsLoaded = true;
Log.i("SDL", "libSDL: Settings.Load(): loaded settings successfully");
settingsFile.close();
Log.i("SDL", "libSDL: old cfg version " + cfgVersion + ", our version " + p.getApplicationVersion());
if( cfgVersion != p.getApplicationVersion() )
{
DeleteFilesOnUpgrade(p);
if( Globals.ResetSdlConfigForThisVersion )
{
Log.i("SDL", "libSDL: old cfg version " + cfgVersion + ", our version " + p.getApplicationVersion() + " and we need to clean up config file");
// Delete settings file, and restart the application
DeleteSdlConfigOnUpgradeAndRestart(p);
}
Save(p);
}
return;
} catch( FileNotFoundException e ) {
} catch( SecurityException e ) {
} catch ( IOException e ) {
DeleteFilesOnUpgrade(p);
if( Globals.ResetSdlConfigForThisVersion )
{
Log.i("SDL", "libSDL: old cfg version unknown or too old, our version " + p.getApplicationVersion() + " and we need to clean up config file");
DeleteSdlConfigOnUpgradeAndRestart(p);
}
};
if( Globals.DataDir.length() == 0 )
{
if( !Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED) )
{
Log.i("SDL", "libSDL: SD card or external storage is not mounted (state " + Environment.getExternalStorageState() + "), switching to the internal storage.");
Globals.DownloadToSdcard = false;
}
Globals.DataDir = Globals.DownloadToSdcard ?
SdcardAppPath.getPath(p) :
p.getFilesDir().getAbsolutePath();
if( Globals.DownloadToSdcard )
{
// Check if data already installed into deprecated location at /sdcard/app-data/<package-name>
String[] fileList = new File(SdcardAppPath.deprecatedPath(p)).list();
if( fileList != null )
for( String s: fileList )
if( s.toUpperCase().startsWith(DataDownloader.DOWNLOAD_FLAG_FILENAME.toUpperCase()) )
Globals.DataDir = SdcardAppPath.deprecatedPath(p);
}
}
Log.i("SDL", "libSDL: Settings.Load(): loading settings failed, running config dialog");
p.setUpStatusLabel();
if( checkRamSize(p) )
SettingsMenu.showConfig(p, true);
}
// ===============================================================================================
public static boolean deleteRecursively(File dir)
{
if (dir.isDirectory()) {
String[] children = dir.list();
for (int i=0; i<children.length; i++)
{
boolean success = deleteRecursively(new File(dir, children[i]));
if (!success)
return false;
}
}
return dir.delete();
}
public static boolean deleteRecursivelyAndLog(File dir)
{
Log.v("SDL", "Deleting old file: " + dir.getAbsolutePath() + " exists " + dir.exists());
if (dir.isDirectory()) {
String[] children = dir.list();
for (int i=0; i<children.length; i++)
{
boolean success = deleteRecursively(new File(dir, children[i]));
if (!success)
return false;
}
}
return dir.delete();
}
public static void DeleteFilesOnUpgrade(final MainActivity p)
{
String [] files = Globals.DeleteFilesOnUpgrade.split(" ");
for(String path: files)
{
if( path.equals("") )
continue;
deleteRecursivelyAndLog(new File( SdcardAppPath.getPath(p) + "/" + path ));
deleteRecursivelyAndLog(new File( p.getFilesDir().getAbsolutePath() + "/" + path ));
deleteRecursivelyAndLog(new File( SdcardAppPath.deprecatedPath(p) + "/" + path ));
}
}
public static void DeleteSdlConfigOnUpgradeAndRestart(final MainActivity p)
{
try {
ObjectOutputStream out = new ObjectOutputStream(p.openFileOutput( SettingsFileName, p.MODE_WORLD_READABLE ));
out.writeInt(-1);
out.close();
} catch( FileNotFoundException e ) {
} catch ( IOException e ) { }
new File( p.getFilesDir() + "/" + SettingsFileName ).delete();
PendingIntent intent = PendingIntent.getActivity(p, 0, new Intent(p.getIntent()), p.getIntent().getFlags());
AlarmManager mgr = (AlarmManager) p.getSystemService(Context.ALARM_SERVICE);
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 1000, intent);
System.exit(0);
}
// ===============================================================================================
static void Apply(MainActivity p)
{
/*nativeSetVideoDepth(Globals.VideoDepthBpp, Globals.NeedGles2 ? 1 : 0);
if(Globals.VideoLinearFilter)
nativeSetVideoLinearFilter();
if( Globals.CompatibilityHacksVideo )
{
Globals.MultiThreadedVideo = true;
Globals.SwVideoMode = true;
nativeSetCompatibilityHacks();
}
if( Globals.SwVideoMode )
nativeSetVideoForceSoftwareMode();
if( Globals.SwVideoMode && Globals.MultiThreadedVideo )
nativeSetVideoMultithreaded();
if( Globals.PhoneHasTrackball )
nativeSetTrackballUsed();
if( Globals.AppUsesMouse )
nativeSetMouseUsed( Globals.RightClickMethod,
Globals.ShowScreenUnderFinger,
Globals.LeftClickMethod,
Globals.MoveMouseWithJoystick ? 1 : 0,
Globals.ClickMouseWithDpad ? 1 : 0,
Globals.ClickScreenPressure,
Globals.ClickScreenTouchspotSize,
Globals.MoveMouseWithJoystickSpeed,
Globals.MoveMouseWithJoystickAccel,
Globals.LeftClickKey,
Globals.RightClickKey,
Globals.LeftClickTimeout,
Globals.RightClickTimeout,
Globals.RelativeMouseMovement ? 1 : 0,
Globals.RelativeMouseMovementSpeed,
Globals.RelativeMouseMovementAccel,
Globals.ShowMouseCursor ? 1 : 0 );
nativeSetJoystickUsed(Globals.AppUsesJoystick ? 1 : 0, Globals.AppUsesSecondJoystick ? 1 : 0);
if( Globals.AppUsesAccelerometer )
nativeSetAccelerometerUsed();
if( Globals.AppUsesMultitouch )
nativeSetMultitouchUsed();
nativeSetAccelerometerSettings(Globals.AccelerometerSensitivity, Globals.AccelerometerCenterPos);
nativeSetTrackballDampening(Globals.TrackballDampening);
if( Globals.UseTouchscreenKeyboard )
{
boolean screenKbReallyUsed = false;
for( int i = 0; i < Globals.ScreenKbControlsShown.length; i++ )
if( Globals.ScreenKbControlsShown[i] )
screenKbReallyUsed = true;
if( p.isRunningOnOUYA() )
screenKbReallyUsed = false;
if( screenKbReallyUsed )
{
nativeSetTouchscreenKeyboardUsed();
nativeSetupScreenKeyboard( Globals.TouchscreenKeyboardSize,
Globals.TouchscreenKeyboardDrawSize,
Globals.TouchscreenKeyboardTheme,
Globals.AppTouchscreenKeyboardKeysAmountAutoFire,
Globals.TouchscreenKeyboardTransparency );
SetupTouchscreenKeyboardGraphics(p);
for( int i = 0; i < Globals.RemapScreenKbKeycode.length; i++ )
nativeSetKeymapKeyScreenKb(i, SDL_Keys.values[Globals.RemapScreenKbKeycode[i]]);
if( Globals.TouchscreenKeyboardSize == Globals.TOUCHSCREEN_KEYBOARD_CUSTOM )
{
for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ )
if( Globals.ScreenKbControlsLayout[i][0] < Globals.ScreenKbControlsLayout[i][2] )
nativeSetScreenKbKeyLayout( i, Globals.ScreenKbControlsLayout[i][0], Globals.ScreenKbControlsLayout[i][1],
Globals.ScreenKbControlsLayout[i][2], Globals.ScreenKbControlsLayout[i][3]);
}
for( int i = 0; i < Globals.ScreenKbControlsShown.length; i++ )
nativeSetScreenKbKeyUsed(i, Globals.ScreenKbControlsShown[i] ? 1 : 0);
}
else
Globals.UseTouchscreenKeyboard = false;
}
for( int i = 0; i < SDL_Keys.JAVA_KEYCODE_LAST; i++ )
nativeSetKeymapKey(i, SDL_Keys.values[Globals.RemapHwKeycode[i]]);
for( int i = 0; i < Globals.RemapMultitouchGestureKeycode.length; i++ )
nativeSetKeymapKeyMultitouchGesture(i, Globals.MultitouchGesturesUsed[i] ? SDL_Keys.values[Globals.RemapMultitouchGestureKeycode[i]] : 0);
nativeSetMultitouchGestureSensitivity(Globals.MultitouchGestureSensitivity);
if( Globals.TouchscreenCalibration[2] > Globals.TouchscreenCalibration[0] )
nativeSetTouchscreenCalibration(Globals.TouchscreenCalibration[0], Globals.TouchscreenCalibration[1],
Globals.TouchscreenCalibration[2], Globals.TouchscreenCalibration[3]);*/
String lang = new String(Locale.getDefault().getLanguage());
if( Locale.getDefault().getCountry().length() > 0 )
lang = lang + "_" + Locale.getDefault().getCountry();
Log.i("SDL", "libSDL: setting envvar LANGUAGE to '" + lang + "'");
nativeSetEnv( "LANG", lang );
nativeSetEnv( "LANGUAGE", lang );
// TODO: get current user name and set envvar USER, the API is not availalbe on Android 1.6 so I don't bother with this
nativeSetEnv( "APPDIR", p.getFilesDir().getAbsolutePath() );
nativeSetEnv( "SECURE_STORAGE_DIR", p.getFilesDir().getAbsolutePath() );
nativeSetEnv( "DATADIR", Globals.DataDir );
nativeSetEnv( "UNSECURE_STORAGE_DIR", Globals.DataDir );
nativeSetEnv( "HOME", Globals.DataDir );
nativeSetEnv( "ANDROID_VERSION", String.valueOf(android.os.Build.VERSION.SDK_INT) );
Log.d("SDL", "libSDL: Is running on OUYA: " + p.isRunningOnOUYA());
if( p.isRunningOnOUYA() )
nativeSetEnv( "OUYA", "1" );
try {
DisplayMetrics dm = new DisplayMetrics();
p.getWindowManager().getDefaultDisplay().getMetrics(dm);
float xx = dm.widthPixels/dm.xdpi;
float yy = dm.heightPixels/dm.ydpi;
float x = Math.max(xx, yy);
float y = Math.min(xx, yy);
float displayInches = (float)Math.sqrt( x*x + y*y );
nativeSetEnv( "DISPLAY_SIZE", String.valueOf(displayInches) );
nativeSetEnv( "DISPLAY_SIZE_MM", String.valueOf((int)(displayInches*25.4f)) );
nativeSetEnv( "DISPLAY_WIDTH", String.valueOf(x) );
nativeSetEnv( "DISPLAY_HEIGHT", String.valueOf(y) );
nativeSetEnv( "DISPLAY_WIDTH_MM", String.valueOf((int)(x*25.4f)) );
nativeSetEnv( "DISPLAY_HEIGHT_MM", String.valueOf((int)(y*25.4f)) );
nativeSetEnv( "DISPLAY_RESOLUTION_WIDTH", String.valueOf(Math.max(dm.widthPixels, dm.heightPixels)) );
nativeSetEnv( "DISPLAY_RESOLUTION_HEIGHT", String.valueOf(Math.min(dm.widthPixels, dm.heightPixels)) );
} catch (Exception eeeee) {}
}
static byte [] loadRaw(Activity p, int res)
{
byte [] buf = new byte[65536 * 2];
byte [] a = new byte[65536 * 4 * 10]; // We need 2363516 bytes for the Sun theme
int written = 0;
try{
InputStream is = new GZIPInputStream(p.getResources().openRawResource(res));
int readed = 0;
while( (readed = is.read(buf)) >= 0 )
{
if( written + readed > a.length )
{
byte [] b = new byte [written + readed];
System.arraycopy(a, 0, b, 0, written);
a = b;
}
System.arraycopy(buf, 0, a, written, readed);
written += readed;
}
} catch(Exception e) {};
byte [] b = new byte [written];
System.arraycopy(a, 0, b, 0, written);
return b;
}
static void SetupTouchscreenKeyboardGraphics(Activity p)
{
if( Globals.UseTouchscreenKeyboard )
{
if(Globals.TouchscreenKeyboardTheme < 0)
Globals.TouchscreenKeyboardTheme = 0;
if(Globals.TouchscreenKeyboardTheme > 3)
Globals.TouchscreenKeyboardTheme = 3;
if( Globals.TouchscreenKeyboardTheme == 0 )
{
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.ultimatedroid));
}
if( Globals.TouchscreenKeyboardTheme == 1 )
{
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.simpletheme));
}
if( Globals.TouchscreenKeyboardTheme == 2 )
{
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.sun));
}
if( Globals.TouchscreenKeyboardTheme == 3 )
{
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.keen));
}
}
}
abstract static class SdcardAppPath
{
private static SdcardAppPath get()
{
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.FROYO)
return Froyo.Holder.sInstance;
else
return Dummy.Holder.sInstance;
}
public abstract String path(final Context p);
public static String deprecatedPath(final Context p)
{
return Environment.getExternalStorageDirectory().getAbsolutePath() + "/app-data/" + p.getPackageName();
}
public static String getPath(final Context p)
{
try {
return get().path(p);
} catch(Exception e) { }
return Dummy.Holder.sInstance.path(p);
}
private static class Froyo extends SdcardAppPath
{
private static class Holder
{
private static final Froyo sInstance = new Froyo();
}
public String path(final Context p)
{
return p.getExternalFilesDir(null).getAbsolutePath();
}
}
private static class Dummy extends SdcardAppPath
{
private static class Holder
{
private static final Dummy sInstance = new Dummy();
}
public String path(final Context p)
{
return Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/" + p.getPackageName() + "/files";
}
}
}
static boolean checkRamSize(final MainActivity p)
{
try {
BufferedReader reader = new BufferedReader(new FileReader("/proc/meminfo"));
String line = null;
while( ( line = reader.readLine() ) != null )
{
if( line.indexOf("MemTotal:") == 0 )
{
String[] fields = line.split("[ \t]+");
Long size = Long.parseLong(fields[1]);
Log.i("SDL", "Device RAM size: " + size / 1024 + " Mb, required minimum RAM: " + Globals.AppMinimumRAM + " Mb" );
if( size / 1024 < Globals.AppMinimumRAM )
{
settingsChanged = true;
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.not_enough_ram);
builder.setMessage(p.getResources().getString( R.string.not_enough_ram_size, Globals.AppMinimumRAM, (int)(size / 1024)) );
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
p.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + p.getPackageName())));
System.exit(0);
}
});
builder.setNegativeButton(p.getResources().getString(R.string.ignore), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
SettingsMenu.showConfig(p, true);
return;
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
p.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + p.getPackageName())));
System.exit(0);
}
});
final AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
return false;
}
}
}
} catch ( Exception e ) {
Log.i("SDL", "Error: cannot parse /proc/meminfo: " + e.toString());
}
return true;
}
private static native void nativeSetTrackballUsed();
private static native void nativeSetTrackballDampening(int value);
private static native void nativeSetAccelerometerSettings(int sensitivity, int centerPos);
private static native void nativeSetMouseUsed(int RightClickMethod, int ShowScreenUnderFinger, int LeftClickMethod,
int MoveMouseWithJoystick, int ClickMouseWithDpad, int MaxForce, int MaxRadius,
int MoveMouseWithJoystickSpeed, int MoveMouseWithJoystickAccel,
int leftClickKeycode, int rightClickKeycode,
int leftClickTimeout, int rightClickTimeout,
int relativeMovement, int relativeMovementSpeed,
int relativeMovementAccel, int showMouseCursor);
private static native void nativeSetJoystickUsed(int firstJoystickUsed, int secondJoystickUsed);
private static native void nativeSetAccelerometerUsed();
private static native void nativeSetMultitouchUsed();
private static native void nativeSetTouchscreenKeyboardUsed();
private static native void nativeSetVideoLinearFilter();
private static native void nativeSetVideoDepth(int bpp, int gles2);
private static native void nativeSetCompatibilityHacks();
private static native void nativeSetVideoMultithreaded();
private static native void nativeSetVideoForceSoftwareMode();
private static native void nativeSetupScreenKeyboard(int size, int drawsize, int theme, int nbuttonsAutoFire, int transparency);
private static native void nativeSetupScreenKeyboardButtons(byte[] img);
private static native void nativeInitKeymap();
private static native int nativeGetKeymapKey(int key);
private static native void nativeSetKeymapKey(int javakey, int key);
private static native int nativeGetKeymapKeyScreenKb(int keynum);
private static native void nativeSetKeymapKeyScreenKb(int keynum, int key);
private static native void nativeSetScreenKbKeyUsed(int keynum, int used);
private static native void nativeSetScreenKbKeyLayout(int keynum, int x1, int y1, int x2, int y2);
private static native int nativeGetKeymapKeyMultitouchGesture(int keynum);
private static native void nativeSetKeymapKeyMultitouchGesture(int keynum, int key);
private static native void nativeSetMultitouchGestureSensitivity(int sensitivity);
private static native void nativeSetTouchscreenCalibration(int x1, int y1, int x2, int y2);
public static native void nativeSetEnv(final String name, final String value);
public static native int nativeChmod(final String name, int mode);
public static native void nativeChdir(final String dir);
}

View File

@@ -0,0 +1 @@
../java/Settings.java

View File

@@ -1,257 +0,0 @@
/*
Simple DirectMedia Layer
Java source code (C) 2009-2012 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package net.sourceforge.clonekeenplus;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import android.util.Log;
import java.io.*;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Environment;
import android.os.StatFs;
import java.util.Locale;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.zip.GZIPInputStream;
import java.util.Collections;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import java.lang.String;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.FrameLayout;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.BitmapFactory;
import android.graphics.Bitmap;
import android.widget.TextView;
import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.Button;
import android.view.View;
import android.widget.LinearLayout;
import android.text.Editable;
import android.text.SpannedString;
import android.content.Intent;
import android.app.PendingIntent;
import android.app.AlarmManager;
import android.util.DisplayMetrics;
import android.net.Uri;
import java.util.concurrent.Semaphore;
import java.util.Arrays;
import android.graphics.Color;
import android.hardware.SensorEventListener;
import android.hardware.SensorEvent;
import android.hardware.Sensor;
import android.widget.Toast;
class SettingsMenu
{
public static abstract class Menu
{
// Should be overridden by children
abstract void run(final MainActivity p);
abstract String title(final MainActivity p);
boolean enabled()
{
return true;
}
// Should not be overridden
boolean enabledOrHidden()
{
for( Menu m: Globals.HiddenMenuOptions )
{
if( m.getClass().getName().equals( this.getClass().getName() ) )
return false;
}
return enabled();
}
void showMenuOptionsList(final MainActivity p, final Menu[] list)
{
menuStack.add(this);
ArrayList<CharSequence> items = new ArrayList<CharSequence> ();
for( Menu m: list )
{
if(m.enabledOrHidden())
items.add(m.title(p));
}
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(title(p));
builder.setItems(items.toArray(new CharSequence[0]), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
int selected = 0;
for( Menu m: list )
{
if(m.enabledOrHidden())
{
if( selected == item )
{
m.run(p);
return;
}
selected ++;
}
}
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBackOuterMenu(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static ArrayList<Menu> menuStack = new ArrayList<Menu> ();
public static void showConfig(final MainActivity p, final boolean firstStart)
{
Settings.settingsChanged = true;
if( Globals.OptionalDataDownload == null )
{
String downloads[] = Globals.DataDownloadUrl;
Globals.OptionalDataDownload = new boolean[downloads.length];
boolean oldFormat = true;
for( int i = 0; i < downloads.length; i++ )
{
if( downloads[i].indexOf("!") == 0 )
{
Globals.OptionalDataDownload[i] = true;
oldFormat = false;
}
}
if( oldFormat )
Globals.OptionalDataDownload[0] = true;
}
if(!firstStart)
new MainMenu().run(p);
else
{
if( Globals.StartupMenuButtonTimeout > 0 ) // If we did not disable startup menu altogether
{
for( Menu m: Globals.FirstStartMenuOptions )
{
boolean hidden = false;
for( Menu m1: Globals.HiddenMenuOptions )
{
if( m1.getClass().getName().equals( m.getClass().getName() ) )
hidden = true;
}
if( ! hidden )
menuStack.add(0, m);
}
}
goBack(p);
}
}
static void goBack(final MainActivity p)
{
if(menuStack.isEmpty())
{
Settings.Save(p);
p.startDownloader();
}
else
{
Menu c = menuStack.remove(menuStack.size() - 1);
c.run(p);
}
}
static void goBackOuterMenu(final MainActivity p)
{
if(!menuStack.isEmpty())
menuStack.remove(menuStack.size() - 1);
goBack(p);
}
static class OkButton extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.ok);
}
void run (final MainActivity p)
{
goBackOuterMenu(p);
}
}
static class DummyMenu extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.ok);
}
void run (final MainActivity p)
{
goBack(p);
}
}
static class MainMenu extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.device_config);
}
void run (final MainActivity p)
{
Menu options[] =
{
new SettingsMenuMisc.DownloadConfig(),
new SettingsMenuMisc.OptionalDownloadConfig(false),
new SettingsMenuKeyboard.KeyboardConfigMainMenu(),
new SettingsMenuMouse.MouseConfigMainMenu(),
new SettingsMenuMisc.GyroscopeCalibration(),
new SettingsMenuMisc.AudioConfig(),
new SettingsMenuKeyboard.RemapHwKeysConfig(),
new SettingsMenuKeyboard.ScreenGesturesConfig(),
new SettingsMenuMisc.VideoSettingsConfig(),
new SettingsMenuMisc.ResetToDefaultsConfig(),
new OkButton(),
};
showMenuOptionsList(p, options);
}
}
}

View File

@@ -1,843 +0,0 @@
/*
Simple DirectMedia Layer
Java source code (C) 2009-2012 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package net.sourceforge.clonekeenplus;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import android.util.Log;
import java.io.*;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Environment;
import android.os.StatFs;
import java.util.Locale;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.zip.GZIPInputStream;
import java.util.Collections;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import java.lang.String;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.FrameLayout;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.BitmapFactory;
import android.graphics.Bitmap;
import android.widget.TextView;
import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.Button;
import android.view.View;
import android.widget.LinearLayout;
import android.text.Editable;
import android.text.SpannedString;
import android.content.Intent;
import android.app.PendingIntent;
import android.app.AlarmManager;
import android.util.DisplayMetrics;
import android.net.Uri;
import java.util.concurrent.Semaphore;
import java.util.Arrays;
import android.graphics.Color;
import android.hardware.SensorEventListener;
import android.hardware.SensorEvent;
import android.hardware.Sensor;
import android.widget.Toast;
class SettingsMenuKeyboard extends SettingsMenu
{
static class KeyboardConfigMainMenu extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.controls_screenkb);
}
boolean enabled()
{
return Globals.UseTouchscreenKeyboard;
}
void run (final MainActivity p)
{
Menu options[] =
{
new ScreenKeyboardThemeConfig(),
new ScreenKeyboardSizeConfig(),
new ScreenKeyboardDrawSizeConfig(),
new ScreenKeyboardTransparencyConfig(),
new RemapScreenKbConfig(),
new CustomizeScreenKbLayout(),
new OkButton(),
};
showMenuOptionsList(p, options);
}
}
static class ScreenKeyboardSizeConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.controls_screenkb_size);
}
void run (final MainActivity p)
{
final CharSequence[] items = { p.getResources().getString(R.string.controls_screenkb_large),
p.getResources().getString(R.string.controls_screenkb_medium),
p.getResources().getString(R.string.controls_screenkb_small),
p.getResources().getString(R.string.controls_screenkb_tiny),
p.getResources().getString(R.string.controls_screenkb_custom) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.controls_screenkb_size));
builder.setSingleChoiceItems(items, Globals.TouchscreenKeyboardSize, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.TouchscreenKeyboardSize = item;
dialog.dismiss();
if( Globals.TouchscreenKeyboardSize == Globals.TOUCHSCREEN_KEYBOARD_CUSTOM )
new CustomizeScreenKbLayout().run(p);
else
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class ScreenKeyboardDrawSizeConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.controls_screenkb_drawsize);
}
void run (final MainActivity p)
{
final CharSequence[] items = { p.getResources().getString(R.string.controls_screenkb_large),
p.getResources().getString(R.string.controls_screenkb_medium),
p.getResources().getString(R.string.controls_screenkb_small),
p.getResources().getString(R.string.controls_screenkb_tiny) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.controls_screenkb_drawsize));
builder.setSingleChoiceItems(items, Globals.TouchscreenKeyboardDrawSize, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.TouchscreenKeyboardDrawSize = item;
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class ScreenKeyboardThemeConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.controls_screenkb_theme);
}
void run (final MainActivity p)
{
final CharSequence[] items = {
p.getResources().getString(R.string.controls_screenkb_by, "Ultimate Droid", "Sean Stieber"),
p.getResources().getString(R.string.controls_screenkb_by, "Simple Theme", "Beholder"),
p.getResources().getString(R.string.controls_screenkb_by, "Sun", "Sirea"),
p.getResources().getString(R.string.controls_screenkb_by, "Keen", "Gerstrong")
};
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.controls_screenkb_theme));
builder.setSingleChoiceItems(items, Globals.TouchscreenKeyboardTheme, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.TouchscreenKeyboardTheme = item;
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class ScreenKeyboardTransparencyConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.controls_screenkb_transparency);
}
void run (final MainActivity p)
{
final CharSequence[] items = { p.getResources().getString(R.string.controls_screenkb_trans_0),
p.getResources().getString(R.string.controls_screenkb_trans_1),
p.getResources().getString(R.string.controls_screenkb_trans_2),
p.getResources().getString(R.string.controls_screenkb_trans_3),
p.getResources().getString(R.string.controls_screenkb_trans_4) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.controls_screenkb_transparency));
builder.setSingleChoiceItems(items, Globals.TouchscreenKeyboardTransparency, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.TouchscreenKeyboardTransparency = item;
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class RemapHwKeysConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.remap_hwkeys);
}
void run (final MainActivity p)
{
p.setText(p.getResources().getString(R.string.remap_hwkeys_press));
p.keyListener = new KeyRemapTool(p);
}
public static class KeyRemapTool implements MainActivity.KeyEventsListener
{
MainActivity p;
public KeyRemapTool(MainActivity _p)
{
p = _p;
}
public void onKeyEvent(final int keyCode)
{
p.keyListener = null;
int keyIndex = keyCode;
if( keyIndex < 0 )
keyIndex = 0;
if( keyIndex > SDL_Keys.JAVA_KEYCODE_LAST )
keyIndex = 0;
final int KeyIndexFinal = keyIndex;
CharSequence[] items = {
SDL_Keys.names[Globals.RemapScreenKbKeycode[0]],
SDL_Keys.names[Globals.RemapScreenKbKeycode[1]],
SDL_Keys.names[Globals.RemapScreenKbKeycode[2]],
SDL_Keys.names[Globals.RemapScreenKbKeycode[3]],
SDL_Keys.names[Globals.RemapScreenKbKeycode[4]],
SDL_Keys.names[Globals.RemapScreenKbKeycode[5]],
p.getResources().getString(R.string.remap_hwkeys_select_more_keys),
};
for( int i = 0; i < Math.min(6, Globals.AppTouchscreenKeyboardKeysNames.length); i++ )
items[i] = Globals.AppTouchscreenKeyboardKeysNames[i].replace("_", " ");
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.remap_hwkeys_select_simple);
builder.setItems(items, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
if( item >= 6 )
ShowAllKeys(KeyIndexFinal);
else
{
Globals.RemapHwKeycode[KeyIndexFinal] = Globals.RemapScreenKbKeycode[item];
goBack(p);
}
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
public void ShowAllKeys(final int KeyIndex)
{
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.remap_hwkeys_select);
builder.setSingleChoiceItems(SDL_Keys.namesSorted, SDL_Keys.namesSortedBackIdx[Globals.RemapHwKeycode[KeyIndex]], new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.RemapHwKeycode[KeyIndex] = SDL_Keys.namesSortedIdx[item];
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
}
static class RemapScreenKbConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.remap_screenkb);
}
//boolean enabled() { return true; };
void run (final MainActivity p)
{
CharSequence[] items = {
p.getResources().getString(R.string.remap_screenkb_joystick),
p.getResources().getString(R.string.remap_screenkb_button_text),
p.getResources().getString(R.string.remap_screenkb_button) + " 1",
p.getResources().getString(R.string.remap_screenkb_button) + " 2",
p.getResources().getString(R.string.remap_screenkb_button) + " 3",
p.getResources().getString(R.string.remap_screenkb_button) + " 4",
p.getResources().getString(R.string.remap_screenkb_button) + " 5",
p.getResources().getString(R.string.remap_screenkb_button) + " 6",
};
boolean defaults[] = Arrays.copyOf(Globals.ScreenKbControlsShown, Globals.ScreenKbControlsShown.length);
if( Globals.AppUsesSecondJoystick )
{
items = Arrays.copyOf(items, items.length + 1);
items[items.length - 1] = p.getResources().getString(R.string.remap_screenkb_joystick) + " 2";
defaults = Arrays.copyOf(defaults, defaults.length + 1);
defaults[defaults.length - 1] = true;
}
for( int i = 0; i < Math.min(6, Globals.AppTouchscreenKeyboardKeysNames.length); i++ )
items[i+2] = items[i+2] + " - " + Globals.AppTouchscreenKeyboardKeysNames[i].replace("_", " ");
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.remap_screenkb));
builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener()
{
public void onClick(DialogInterface dialog, int item, boolean isChecked)
{
Globals.ScreenKbControlsShown[item] = isChecked;
}
});
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
showRemapScreenKbConfig2(p, 0);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
static void showRemapScreenKbConfig2(final MainActivity p, final int currentButton)
{
CharSequence[] items = {
p.getResources().getString(R.string.remap_screenkb_button) + " 1",
p.getResources().getString(R.string.remap_screenkb_button) + " 2",
p.getResources().getString(R.string.remap_screenkb_button) + " 3",
p.getResources().getString(R.string.remap_screenkb_button) + " 4",
p.getResources().getString(R.string.remap_screenkb_button) + " 5",
p.getResources().getString(R.string.remap_screenkb_button) + " 6",
};
for( int i = 0; i < Math.min(6, Globals.AppTouchscreenKeyboardKeysNames.length); i++ )
items[i] = items[i] + " - " + Globals.AppTouchscreenKeyboardKeysNames[i].replace("_", " ");
if( currentButton >= Globals.RemapScreenKbKeycode.length )
{
goBack(p);
return;
}
if( ! Globals.ScreenKbControlsShown[currentButton + 2] )
{
showRemapScreenKbConfig2(p, currentButton + 1);
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(items[currentButton]);
builder.setSingleChoiceItems(SDL_Keys.namesSorted, SDL_Keys.namesSortedBackIdx[Globals.RemapScreenKbKeycode[currentButton]], new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.RemapScreenKbKeycode[currentButton] = SDL_Keys.namesSortedIdx[item];
dialog.dismiss();
showRemapScreenKbConfig2(p, currentButton + 1);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class ScreenGesturesConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.remap_screenkb_button_gestures);
}
//boolean enabled() { return true; };
void run (final MainActivity p)
{
CharSequence[] items = {
p.getResources().getString(R.string.remap_screenkb_button_zoomin),
p.getResources().getString(R.string.remap_screenkb_button_zoomout),
p.getResources().getString(R.string.remap_screenkb_button_rotateleft),
p.getResources().getString(R.string.remap_screenkb_button_rotateright),
};
boolean defaults[] = {
Globals.MultitouchGesturesUsed[0],
Globals.MultitouchGesturesUsed[1],
Globals.MultitouchGesturesUsed[2],
Globals.MultitouchGesturesUsed[3],
};
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.remap_screenkb_button_gestures));
builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener()
{
public void onClick(DialogInterface dialog, int item, boolean isChecked)
{
Globals.MultitouchGesturesUsed[item] = isChecked;
}
});
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
showScreenGesturesConfig2(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
static void showScreenGesturesConfig2(final MainActivity p)
{
final CharSequence[] items = {
p.getResources().getString(R.string.accel_slow),
p.getResources().getString(R.string.accel_medium),
p.getResources().getString(R.string.accel_fast),
p.getResources().getString(R.string.accel_veryfast)
};
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.remap_screenkb_button_gestures_sensitivity);
builder.setSingleChoiceItems(items, Globals.MultitouchGestureSensitivity, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.MultitouchGestureSensitivity = item;
dialog.dismiss();
showScreenGesturesConfig3(p, 0);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
static void showScreenGesturesConfig3(final MainActivity p, final int currentButton)
{
CharSequence[] items = {
p.getResources().getString(R.string.remap_screenkb_button_zoomin),
p.getResources().getString(R.string.remap_screenkb_button_zoomout),
p.getResources().getString(R.string.remap_screenkb_button_rotateleft),
p.getResources().getString(R.string.remap_screenkb_button_rotateright),
};
if( currentButton >= Globals.RemapMultitouchGestureKeycode.length )
{
goBack(p);
return;
}
if( ! Globals.MultitouchGesturesUsed[currentButton] )
{
showScreenGesturesConfig3(p, currentButton + 1);
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(items[currentButton]);
builder.setSingleChoiceItems(SDL_Keys.namesSorted, SDL_Keys.namesSortedBackIdx[Globals.RemapMultitouchGestureKeycode[currentButton]], new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.RemapMultitouchGestureKeycode[currentButton] = SDL_Keys.namesSortedIdx[item];
dialog.dismiss();
showScreenGesturesConfig3(p, currentButton + 1);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class CustomizeScreenKbLayout extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.screenkb_custom_layout);
}
//boolean enabled() { return true; };
void run (final MainActivity p)
{
p.setText(p.getResources().getString(R.string.screenkb_custom_layout_help));
CustomizeScreenKbLayoutTool tool = new CustomizeScreenKbLayoutTool(p);
p.touchListener = tool;
p.keyListener = tool;
Globals.TouchscreenKeyboardSize = Globals.TOUCHSCREEN_KEYBOARD_CUSTOM;
}
static class CustomizeScreenKbLayoutTool implements MainActivity.TouchEventsListener, MainActivity.KeyEventsListener
{
MainActivity p;
FrameLayout layout = null;
ImageView imgs[] = new ImageView[Globals.ScreenKbControlsLayout.length];
Bitmap bmps[] = new Bitmap[Globals.ScreenKbControlsLayout.length];
ImageView boundary = null;
Bitmap boundaryBmp = null;
int currentButton = 0;
int buttons[] = {
R.drawable.dpad,
R.drawable.keyboard,
R.drawable.b1,
R.drawable.b2,
R.drawable.b3,
R.drawable.b4,
R.drawable.b5,
R.drawable.b6,
R.drawable.dpad
};
int oldX = 0, oldY = 0;
boolean resizing = false;
public CustomizeScreenKbLayoutTool(MainActivity _p)
{
p = _p;
layout = new FrameLayout(p);
p.getVideoLayout().addView(layout);
boundary = new ImageView(p);
boundary.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
boundary.setScaleType(ImageView.ScaleType.MATRIX);
boundaryBmp = BitmapFactory.decodeResource( p.getResources(), R.drawable.rectangle );
boundary.setImageBitmap(boundaryBmp);
layout.addView(boundary);
currentButton = -1;
if( Globals.TouchscreenKeyboardTheme == 2 )
{
buttons = new int[] {
R.drawable.sun_dpad,
R.drawable.sun_keyboard,
R.drawable.sun_b1,
R.drawable.sun_b2,
R.drawable.sun_b3,
R.drawable.sun_b4,
R.drawable.sun_b5,
R.drawable.sun_b6,
R.drawable.sun_dpad
};
}
int displayX = 800;
int displayY = 480;
try {
DisplayMetrics dm = new DisplayMetrics();
p.getWindowManager().getDefaultDisplay().getMetrics(dm);
displayX = dm.widthPixels;
displayY = dm.heightPixels;
} catch (Exception eeeee) {}
for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ )
{
if( ! Globals.ScreenKbControlsShown[i] )
continue;
if( currentButton == -1 )
currentButton = i;
//Log.i("SDL", "Screen kb button " + i + " coords " + Globals.ScreenKbControlsLayout[i][0] + ":" + Globals.ScreenKbControlsLayout[i][1] + ":" + Globals.ScreenKbControlsLayout[i][2] + ":" + Globals.ScreenKbControlsLayout[i][3] );
// Check if the button is off screen edge or shrunk to zero
if( Globals.ScreenKbControlsLayout[i][0] > Globals.ScreenKbControlsLayout[i][2] - displayY/12 )
Globals.ScreenKbControlsLayout[i][0] = Globals.ScreenKbControlsLayout[i][2] - displayY/12;
if( Globals.ScreenKbControlsLayout[i][1] > Globals.ScreenKbControlsLayout[i][3] - displayY/12 )
Globals.ScreenKbControlsLayout[i][1] = Globals.ScreenKbControlsLayout[i][3] - displayY/12;
if( Globals.ScreenKbControlsLayout[i][0] < Globals.ScreenKbControlsLayout[i][2] - displayY*2/3 )
Globals.ScreenKbControlsLayout[i][0] = Globals.ScreenKbControlsLayout[i][2] - displayY*2/3;
if( Globals.ScreenKbControlsLayout[i][1] < Globals.ScreenKbControlsLayout[i][3] - displayY*2/3 )
Globals.ScreenKbControlsLayout[i][1] = Globals.ScreenKbControlsLayout[i][3] - displayY*2/3;
if( Globals.ScreenKbControlsLayout[i][0] < 0 )
{
Globals.ScreenKbControlsLayout[i][2] += -Globals.ScreenKbControlsLayout[i][0];
Globals.ScreenKbControlsLayout[i][0] = 0;
}
if( Globals.ScreenKbControlsLayout[i][2] > displayX )
{
Globals.ScreenKbControlsLayout[i][0] -= Globals.ScreenKbControlsLayout[i][2] - displayX;
Globals.ScreenKbControlsLayout[i][2] = displayX;
}
if( Globals.ScreenKbControlsLayout[i][1] < 0 )
{
Globals.ScreenKbControlsLayout[i][3] += -Globals.ScreenKbControlsLayout[i][1];
Globals.ScreenKbControlsLayout[i][1] = 0;
}
if( Globals.ScreenKbControlsLayout[i][3] > displayY )
{
Globals.ScreenKbControlsLayout[i][1] -= Globals.ScreenKbControlsLayout[i][3] - displayY;
Globals.ScreenKbControlsLayout[i][3] = displayY;
}
//Log.i("SDL", "After bounds check coords " + Globals.ScreenKbControlsLayout[i][0] + ":" + Globals.ScreenKbControlsLayout[i][1] + ":" + Globals.ScreenKbControlsLayout[i][2] + ":" + Globals.ScreenKbControlsLayout[i][3] );
imgs[i] = new ImageView(p);
imgs[i].setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
imgs[i].setScaleType(ImageView.ScaleType.MATRIX);
bmps[i] = BitmapFactory.decodeResource( p.getResources(), buttons[i] );
imgs[i].setImageBitmap(bmps[i]);
imgs[i].setAlpha(128);
layout.addView(imgs[i]);
Matrix m = new Matrix();
RectF src = new RectF(0, 0, bmps[i].getWidth(), bmps[i].getHeight());
RectF dst = new RectF(Globals.ScreenKbControlsLayout[i][0], Globals.ScreenKbControlsLayout[i][1],
Globals.ScreenKbControlsLayout[i][2], Globals.ScreenKbControlsLayout[i][3]);
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
imgs[i].setImageMatrix(m);
}
boundary.bringToFront();
if( currentButton == -1 )
onKeyEvent( KeyEvent.KEYCODE_BACK ); // All buttons disabled - do not show anything
else
setupButton(currentButton);
}
void setupButton(int i)
{
Matrix m = new Matrix();
RectF src = new RectF(0, 0, bmps[i].getWidth(), bmps[i].getHeight());
RectF dst = new RectF(Globals.ScreenKbControlsLayout[i][0], Globals.ScreenKbControlsLayout[i][1],
Globals.ScreenKbControlsLayout[i][2], Globals.ScreenKbControlsLayout[i][3]);
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
imgs[i].setImageMatrix(m);
m = new Matrix();
src = new RectF(0, 0, boundaryBmp.getWidth(), boundaryBmp.getHeight());
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
boundary.setImageMatrix(m);
String buttonText = "";
if( i >= 2 && i <= 7 )
buttonText = p.getResources().getString(R.string.remap_screenkb_button) + (i - 2);
if( i >= 2 && i - 2 < Globals.AppTouchscreenKeyboardKeysNames.length )
buttonText = Globals.AppTouchscreenKeyboardKeysNames[i - 2].replace("_", " ");
if( i == 0 )
buttonText = "Joystick";
if( i == 1 )
buttonText = "Text input";
if( i == 8 )
buttonText = "Joystick 2";
p.setText(p.getResources().getString(R.string.screenkb_custom_layout_help) + "\n" + buttonText);
}
public void onTouchEvent(final MotionEvent ev)
{
if( ev.getAction() == MotionEvent.ACTION_DOWN )
{
oldX = (int)ev.getX();
oldY = (int)ev.getY();
resizing = true;
for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ )
{
if( ! Globals.ScreenKbControlsShown[i] )
continue;
if( Globals.ScreenKbControlsLayout[i][0] <= oldX &&
Globals.ScreenKbControlsLayout[i][2] >= oldX &&
Globals.ScreenKbControlsLayout[i][1] <= oldY &&
Globals.ScreenKbControlsLayout[i][3] >= oldY )
{
currentButton = i;
setupButton(currentButton);
resizing = false;
break;
}
}
}
if( ev.getAction() == MotionEvent.ACTION_MOVE )
{
int dx = (int)ev.getX() - oldX;
int dy = (int)ev.getY() - oldY;
if( resizing )
{
// Resize slowly, with 1/3 of movement speed
dx /= 6;
dy /= 6;
if( Globals.ScreenKbControlsLayout[currentButton][0] <= Globals.ScreenKbControlsLayout[currentButton][2] + dx*2 )
{
Globals.ScreenKbControlsLayout[currentButton][0] -= dx;
Globals.ScreenKbControlsLayout[currentButton][2] += dx;
}
if( Globals.ScreenKbControlsLayout[currentButton][1] <= Globals.ScreenKbControlsLayout[currentButton][3] + dy*2 )
{
Globals.ScreenKbControlsLayout[currentButton][1] += dy;
Globals.ScreenKbControlsLayout[currentButton][3] -= dy;
}
dx *= 6;
dy *= 6;
}
else
{
Globals.ScreenKbControlsLayout[currentButton][0] += dx;
Globals.ScreenKbControlsLayout[currentButton][2] += dx;
Globals.ScreenKbControlsLayout[currentButton][1] += dy;
Globals.ScreenKbControlsLayout[currentButton][3] += dy;
}
oldX += dx;
oldY += dy;
Matrix m = new Matrix();
RectF src = new RectF(0, 0, bmps[currentButton].getWidth(), bmps[currentButton].getHeight());
RectF dst = new RectF(Globals.ScreenKbControlsLayout[currentButton][0], Globals.ScreenKbControlsLayout[currentButton][1],
Globals.ScreenKbControlsLayout[currentButton][2], Globals.ScreenKbControlsLayout[currentButton][3]);
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
imgs[currentButton].setImageMatrix(m);
m = new Matrix();
src = new RectF(0, 0, boundaryBmp.getWidth(), boundaryBmp.getHeight());
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
boundary.setImageMatrix(m);
}
}
public void onKeyEvent(final int keyCode)
{
if( keyCode == KeyEvent.KEYCODE_BACK )
{
p.getVideoLayout().removeView(layout);
layout = null;
p.touchListener = null;
p.keyListener = null;
goBack(p);
}
}
}
}
}

View File

@@ -1,755 +0,0 @@
/*
Simple DirectMedia Layer
Java source code (C) 2009-2012 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package net.sourceforge.clonekeenplus;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import android.util.Log;
import java.io.*;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Environment;
import android.os.StatFs;
import java.util.Locale;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.zip.GZIPInputStream;
import java.util.Collections;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import java.lang.String;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.FrameLayout;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.BitmapFactory;
import android.graphics.Bitmap;
import android.widget.TextView;
import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.Button;
import android.widget.Scroller;
import android.view.View;
import android.view.Gravity;
import android.widget.LinearLayout;
import android.text.Editable;
import android.text.SpannedString;
import android.content.Intent;
import android.app.PendingIntent;
import android.app.AlarmManager;
import android.util.DisplayMetrics;
import android.net.Uri;
import java.util.concurrent.Semaphore;
import java.util.Arrays;
import android.graphics.Color;
import android.hardware.SensorEventListener;
import android.hardware.SensorEvent;
import android.hardware.Sensor;
import android.widget.Toast;
class SettingsMenuMisc extends SettingsMenu
{
static class DownloadConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.storage_question);
}
void run (final MainActivity p)
{
long freeSdcard = 0;
long freePhone = 0;
try
{
StatFs sdcard = new StatFs(Environment.getExternalStorageDirectory().getPath());
StatFs phone = new StatFs(Environment.getDataDirectory().getPath());
freeSdcard = (long)sdcard.getAvailableBlocks() * sdcard.getBlockSize() / 1024 / 1024;
freePhone = (long)phone.getAvailableBlocks() * phone.getBlockSize() / 1024 / 1024;
}
catch(Exception e) {}
final CharSequence[] items = { p.getResources().getString(R.string.storage_phone, freePhone),
p.getResources().getString(R.string.storage_sd, freeSdcard),
p.getResources().getString(R.string.storage_custom) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.storage_question));
builder.setSingleChoiceItems(items, Globals.DownloadToSdcard ? 1 : 0, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
if( item == 2 )
showCustomDownloadDirConfig(p);
else
{
Globals.DownloadToSdcard = (item != 0);
Globals.DataDir = Globals.DownloadToSdcard ?
Settings.SdcardAppPath.getPath(p) :
p.getFilesDir().getAbsolutePath();
goBack(p);
}
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
static void showCustomDownloadDirConfig(final MainActivity p)
{
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.storage_custom));
final EditText edit = new EditText(p);
edit.setFocusableInTouchMode(true);
edit.setFocusable(true);
edit.setText(Globals.DataDir);
builder.setView(edit);
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.DataDir = edit.getText().toString();
dialog.dismiss();
showCommandLineConfig(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
static void showCommandLineConfig(final MainActivity p)
{
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.storage_commandline));
final EditText edit = new EditText(p);
edit.setFocusableInTouchMode(true);
edit.setFocusable(true);
edit.setText(Globals.CommandLine);
builder.setView(edit);
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.CommandLine = edit.getText().toString();
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class OptionalDownloadConfig extends Menu
{
boolean firstStart = false;
OptionalDownloadConfig()
{
firstStart = true;
}
OptionalDownloadConfig(boolean firstStart)
{
this.firstStart = firstStart;
}
String title(final MainActivity p)
{
return p.getResources().getString(R.string.downloads);
}
void run (final MainActivity p)
{
String [] downloadFiles = Globals.DataDownloadUrl;
final boolean [] mandatory = new boolean[downloadFiles.length];
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.downloads));
CharSequence[] items = new CharSequence[downloadFiles.length];
for(int i = 0; i < downloadFiles.length; i++ )
{
items[i] = new String(downloadFiles[i].split("[|]")[0]);
if( items[i].toString().indexOf("!") == 0 )
items[i] = items[i].toString().substring(1);
if( items[i].toString().indexOf("!") == 0 )
{
items[i] = items[i].toString().substring(1);
mandatory[i] = true;
}
}
if( Globals.OptionalDataDownload == null || Globals.OptionalDataDownload.length != items.length )
{
Globals.OptionalDataDownload = new boolean[downloadFiles.length];
boolean oldFormat = true;
for( int i = 0; i < downloadFiles.length; i++ )
{
if( downloadFiles[i].indexOf("!") == 0 )
{
Globals.OptionalDataDownload[i] = true;
oldFormat = false;
}
}
if( oldFormat )
{
Globals.OptionalDataDownload[0] = true;
mandatory[0] = true;
}
}
builder.setMultiChoiceItems(items, Globals.OptionalDataDownload, new DialogInterface.OnMultiChoiceClickListener()
{
public void onClick(DialogInterface dialog, int item, boolean isChecked)
{
Globals.OptionalDataDownload[item] = isChecked;
if( mandatory[item] && !isChecked )
{
Globals.OptionalDataDownload[item] = true;
((AlertDialog)dialog).getListView().setItemChecked(item, true);
}
}
});
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
goBack(p);
}
});
if( firstStart )
{
builder.setNegativeButton(p.getResources().getString(R.string.show_more_options), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
menuStack.clear();
new MainMenu().run(p);
}
});
}
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class AudioConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.audiobuf_question);
}
void run (final MainActivity p)
{
final CharSequence[] items = { p.getResources().getString(R.string.audiobuf_verysmall),
p.getResources().getString(R.string.audiobuf_small),
p.getResources().getString(R.string.audiobuf_medium),
p.getResources().getString(R.string.audiobuf_large) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.audiobuf_question);
builder.setSingleChoiceItems(items, Globals.AudioBufferConfig, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.AudioBufferConfig = item;
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class VideoSettingsConfig extends Menu
{
static int debugMenuShowCount = 0;
String title(final MainActivity p)
{
return p.getResources().getString(R.string.video);
}
//boolean enabled() { return true; };
void run (final MainActivity p)
{
debugMenuShowCount++;
CharSequence[] items = {
p.getResources().getString(R.string.pointandclick_keepaspectratio),
p.getResources().getString(R.string.video_smooth)
};
boolean defaults[] = {
Globals.KeepAspectRatio,
Globals.VideoLinearFilter
};
if(Globals.SwVideoMode && !Globals.CompatibilityHacksVideo)
{
CharSequence[] items2 = {
p.getResources().getString(R.string.pointandclick_keepaspectratio),
p.getResources().getString(R.string.video_smooth),
p.getResources().getString(R.string.video_separatethread),
};
boolean defaults2[] = {
Globals.KeepAspectRatio,
Globals.VideoLinearFilter,
Globals.MultiThreadedVideo
};
items = items2;
defaults = defaults2;
}
if(Globals.Using_SDL_1_3)
{
CharSequence[] items2 = {
p.getResources().getString(R.string.pointandclick_keepaspectratio),
};
boolean defaults2[] = {
Globals.KeepAspectRatio,
};
items = items2;
defaults = defaults2;
}
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.video));
builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener()
{
public void onClick(DialogInterface dialog, int item, boolean isChecked)
{
if( item == 0 )
Globals.KeepAspectRatio = isChecked;
if( item == 1 )
Globals.VideoLinearFilter = isChecked;
if( item == 2 )
Globals.MultiThreadedVideo = isChecked;
}
});
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
if( debugMenuShowCount > 5 || Globals.OuyaEmulation )
showDebugMenu(p);
else
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
void showDebugMenu (final MainActivity p)
{
CharSequence[] items = {
"OUYA emulation"
};
boolean defaults[] = {
Globals.OuyaEmulation,
};
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle("Debug settings");
builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener()
{
public void onClick(DialogInterface dialog, int item, boolean isChecked)
{
if( item == 0 )
Globals.OuyaEmulation = isChecked;
}
});
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class ShowReadme extends Menu
{
String title(final MainActivity p)
{
return "Readme";
}
boolean enabled()
{
return true;
}
void run (final MainActivity p)
{
String readmes[] = Globals.ReadmeText.split("\\^");
String lang = new String(Locale.getDefault().getLanguage()) + ":";
if( p.isRunningOnOUYA() )
lang = "ouya:";
String readme = readmes[0];
String buttonName = "", buttonUrl = "";
for( String r: readmes )
{
if( r.startsWith(lang) )
readme = r.substring(lang.length());
if( r.startsWith("button:") )
{
buttonName = r.substring("button:".length());
if( buttonName.indexOf(":") != -1 )
{
buttonUrl = buttonName.substring(buttonName.indexOf(":") + 1);
buttonName = buttonName.substring(0, buttonName.indexOf(":"));
}
}
}
readme = readme.trim();
if( readme.length() <= 2 )
{
goBack(p);
return;
}
TextView text = new TextView(p);
text.setMaxLines(100);
//text.setScroller(new Scroller(p));
//text.setVerticalScrollBarEnabled(true);
text.setText(readme);
text.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
text.setPadding(0, 5, 0, 20);
text.setTextSize(20.0f);
text.setGravity(Gravity.CENTER);
AlertDialog.Builder builder = new AlertDialog.Builder(p);
ScrollView scroll = new ScrollView(p);
scroll.addView(text, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
Button ok = new Button(p);
final AlertDialog alertDismiss[] = new AlertDialog[1];
ok.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
alertDismiss[0].cancel();
}
});
ok.setText(R.string.ok);
LinearLayout layout = new LinearLayout(p);
layout.setOrientation(LinearLayout.VERTICAL);
layout.addView(scroll);
//layout.addView(text);
layout.addView(ok);
if( buttonName.length() > 0 )
{
Button cancel = new Button(p);
cancel.setText(buttonName);
final String url = buttonUrl;
cancel.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
if( url.length() > 0 )
{
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
p.startActivity(i);
}
alertDismiss[0].cancel();
System.exit(0);
}
});
layout.addView(cancel);
}
builder.setView(layout);
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alertDismiss[0] = alert;
alert.setOwnerActivity(p);
alert.show();
}
}
static class GyroscopeCalibration extends Menu implements SensorEventListener
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.calibrate_gyroscope);
}
boolean enabled()
{
return Globals.AppUsesGyroscope;
}
void run (final MainActivity p)
{
if( !Globals.AppUsesGyroscope || !AccelerometerReader.gyro.available(p) )
{
if( Globals.AppUsesGyroscope )
{
Toast toast = Toast.makeText(p, p.getResources().getString(R.string.calibrate_gyroscope_not_supported), Toast.LENGTH_LONG);
toast.show();
}
goBack(p);
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.calibrate_gyroscope));
builder.setMessage(p.getResources().getString(R.string.calibrate_gyroscope_text));
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
startCalibration(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
ImageView img;
Bitmap bmp;
int numEvents;
MainActivity p;
void startCalibration(final MainActivity _p)
{
p = _p;
img = new ImageView(p);
img.setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
img.setScaleType(ImageView.ScaleType.MATRIX);
bmp = BitmapFactory.decodeResource( p.getResources(), R.drawable.calibrate );
img.setImageBitmap(bmp);
Matrix m = new Matrix();
RectF src = new RectF(0, 0, bmp.getWidth(), bmp.getHeight());
RectF dst = new RectF( p.getVideoLayout().getWidth()/2 - 50, p.getVideoLayout().getHeight()/2 - 50,
p.getVideoLayout().getWidth()/2 + 50, p.getVideoLayout().getHeight()/2 + 50);
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
img.setImageMatrix(m);
p.getVideoLayout().addView(img);
numEvents = 0;
AccelerometerReader.gyro.x1 = 100;
AccelerometerReader.gyro.x2 = -100;
AccelerometerReader.gyro.xc = 0;
AccelerometerReader.gyro.y1 = 100;
AccelerometerReader.gyro.y2 = -100;
AccelerometerReader.gyro.yc = 0;
AccelerometerReader.gyro.z1 = 100;
AccelerometerReader.gyro.z2 = -100;
AccelerometerReader.gyro.zc = 0;
AccelerometerReader.gyro.registerListener(p, this);
(new Thread(new Runnable()
{
public void run()
{
for(int count = 1; count < 10; count++)
{
p.setText("" + count + "0% ...");
try {
Thread.sleep(500);
} catch( Exception e ) {}
}
finishCalibration(p);
}
}
)).start();
}
public void onSensorChanged(SensorEvent event)
{
gyroscopeEvent(event.values[0], event.values[1], event.values[2]);
}
public void onAccuracyChanged(Sensor s, int a)
{
}
void gyroscopeEvent(float x, float y, float z)
{
numEvents++;
AccelerometerReader.gyro.xc += x;
AccelerometerReader.gyro.yc += y;
AccelerometerReader.gyro.zc += z;
AccelerometerReader.gyro.x1 = Math.min(AccelerometerReader.gyro.x1, x * 1.1f); // Small safety bound coefficient
AccelerometerReader.gyro.x2 = Math.max(AccelerometerReader.gyro.x2, x * 1.1f);
AccelerometerReader.gyro.y1 = Math.min(AccelerometerReader.gyro.y1, y * 1.1f);
AccelerometerReader.gyro.y2 = Math.max(AccelerometerReader.gyro.y2, y * 1.1f);
AccelerometerReader.gyro.z1 = Math.min(AccelerometerReader.gyro.z1, z * 1.1f);
AccelerometerReader.gyro.z2 = Math.max(AccelerometerReader.gyro.z2, z * 1.1f);
final Matrix m = new Matrix();
RectF src = new RectF(0, 0, bmp.getWidth(), bmp.getHeight());
RectF dst = new RectF( x * 5000 + p.getVideoLayout().getWidth()/2 - 50, y * 5000 + p.getVideoLayout().getHeight()/2 - 50,
x * 5000 + p.getVideoLayout().getWidth()/2 + 50, y * 5000 + p.getVideoLayout().getHeight()/2 + 50);
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
p.runOnUiThread(new Runnable()
{
public void run()
{
img.setImageMatrix(m);
}
});
}
void finishCalibration(final MainActivity p)
{
AccelerometerReader.gyro.unregisterListener(p, this);
try {
Thread.sleep(200); // Just in case we have pending events
} catch( Exception e ) {}
if( numEvents > 5 )
{
AccelerometerReader.gyro.xc /= (float)numEvents;
AccelerometerReader.gyro.yc /= (float)numEvents;
AccelerometerReader.gyro.zc /= (float)numEvents;
}
p.runOnUiThread(new Runnable()
{
public void run()
{
p.getVideoLayout().removeView(img);
goBack(p);
}
});
}
}
static class ResetToDefaultsConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.reset_config);
}
boolean enabled()
{
return true;
}
void run (final MainActivity p)
{
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.reset_config_ask));
builder.setMessage(p.getResources().getString(R.string.reset_config_ask));
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Settings.DeleteSdlConfigOnUpgradeAndRestart(p); // Never returns
dialog.dismiss();
goBack(p);
}
});
builder.setNegativeButton(p.getResources().getString(R.string.cancel), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
}

View File

@@ -1,771 +0,0 @@
/*
Simple DirectMedia Layer
Java source code (C) 2009-2012 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package net.sourceforge.clonekeenplus;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import android.util.Log;
import java.io.*;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Environment;
import android.os.StatFs;
import java.util.Locale;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.zip.GZIPInputStream;
import java.util.Collections;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import java.lang.String;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.FrameLayout;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.BitmapFactory;
import android.graphics.Bitmap;
import android.widget.TextView;
import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.Button;
import android.view.View;
import android.widget.LinearLayout;
import android.text.Editable;
import android.text.SpannedString;
import android.content.Intent;
import android.app.PendingIntent;
import android.app.AlarmManager;
import android.util.DisplayMetrics;
import android.net.Uri;
import java.util.concurrent.Semaphore;
import java.util.Arrays;
import android.graphics.Color;
import android.hardware.SensorEventListener;
import android.hardware.SensorEvent;
import android.hardware.Sensor;
import android.widget.Toast;
class SettingsMenuMouse extends SettingsMenu
{
static class MouseConfigMainMenu extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.mouse_emulation);
}
boolean enabled()
{
return Globals.AppUsesMouse;
}
void run (final MainActivity p)
{
Menu options[] =
{
new DisplaySizeConfig(false),
new LeftClickConfig(),
new RightClickConfig(),
new AdditionalMouseConfig(),
new JoystickMouseConfig(),
new TouchPressureMeasurementTool(),
new CalibrateTouchscreenMenu(),
new OkButton(),
};
showMenuOptionsList(p, options);
}
}
static class DisplaySizeConfig extends Menu
{
boolean firstStart = false;
DisplaySizeConfig()
{
this.firstStart = true;
}
DisplaySizeConfig(boolean firstStart)
{
this.firstStart = firstStart;
}
String title(final MainActivity p)
{
return p.getResources().getString(R.string.display_size_mouse);
}
void run (final MainActivity p)
{
CharSequence[] items = {
p.getResources().getString(R.string.display_size_tiny_touchpad),
p.getResources().getString(R.string.display_size_tiny),
p.getResources().getString(R.string.display_size_small),
p.getResources().getString(R.string.display_size_small_touchpad),
p.getResources().getString(R.string.display_size_large),
};
int _size_tiny_touchpad = 0;
int _size_tiny = 1;
int _size_small = 2;
int _size_small_touchpad = 3;
int _size_large = 4;
int _more_options = 5;
if( ! Globals.SwVideoMode )
{
CharSequence[] items2 = {
p.getResources().getString(R.string.display_size_small_touchpad),
p.getResources().getString(R.string.display_size_large),
};
items = items2;
_size_small_touchpad = 0;
_size_large = 1;
_size_tiny_touchpad = _size_tiny = _size_small = 1000;
}
if( firstStart )
{
CharSequence[] items2 = {
p.getResources().getString(R.string.display_size_tiny_touchpad),
p.getResources().getString(R.string.display_size_tiny),
p.getResources().getString(R.string.display_size_small),
p.getResources().getString(R.string.display_size_small_touchpad),
p.getResources().getString(R.string.display_size_large),
p.getResources().getString(R.string.show_more_options),
};
items = items2;
if( ! Globals.SwVideoMode )
{
CharSequence[] items3 = {
p.getResources().getString(R.string.display_size_small_touchpad),
p.getResources().getString(R.string.display_size_large),
p.getResources().getString(R.string.show_more_options),
};
items = items3;
_more_options = 3;
}
}
// Java is so damn worse than C++11
final int size_tiny_touchpad = _size_tiny_touchpad;
final int size_tiny = _size_tiny;
final int size_small = _size_small;
final int size_small_touchpad = _size_small_touchpad;
final int size_large = _size_large;
final int more_options = _more_options;
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.display_size);
class ClickListener implements DialogInterface.OnClickListener
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
if( item == size_large )
{
Globals.LeftClickMethod = Mouse.LEFT_CLICK_NORMAL;
Globals.RelativeMouseMovement = false;
Globals.ShowScreenUnderFinger = Mouse.ZOOM_NONE;
}
if( item == size_small )
{
Globals.LeftClickMethod = Mouse.LEFT_CLICK_NEAR_CURSOR;
Globals.RelativeMouseMovement = false;
Globals.ShowScreenUnderFinger = Mouse.ZOOM_MAGNIFIER;
}
if( item == size_small_touchpad )
{
Globals.LeftClickMethod = Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT;
Globals.RelativeMouseMovement = true;
Globals.ShowScreenUnderFinger = Mouse.ZOOM_NONE;
}
if( item == size_tiny )
{
Globals.LeftClickMethod = Mouse.LEFT_CLICK_NEAR_CURSOR;
Globals.RelativeMouseMovement = false;
Globals.ShowScreenUnderFinger = Mouse.ZOOM_SCREEN_TRANSFORM;
}
if( item == size_tiny_touchpad )
{
Globals.LeftClickMethod = Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT;
Globals.RelativeMouseMovement = true;
Globals.ShowScreenUnderFinger = Mouse.ZOOM_FULLSCREEN_MAGNIFIER;
}
if( item == more_options )
{
menuStack.clear();
new MainMenu().run(p);
return;
}
goBack(p);
}
}
builder.setItems(items, new ClickListener());
/*
else
builder.setSingleChoiceItems(items,
Globals.ShowScreenUnderFinger == Mouse.ZOOM_NONE ?
( Globals.RelativeMouseMovement ? Globals.SwVideoMode ? 2 : 1 : 0 ) :
( Globals.ShowScreenUnderFinger == Mouse.ZOOM_MAGNIFIER && Globals.SwVideoMode ) ? 1 :
Globals.ShowScreenUnderFinger + 1,
new ClickListener());
*/
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class LeftClickConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.leftclick_question);
}
void run (final MainActivity p)
{
final CharSequence[] items = { p.getResources().getString(R.string.leftclick_normal),
p.getResources().getString(R.string.leftclick_near_cursor),
p.getResources().getString(R.string.leftclick_multitouch),
p.getResources().getString(R.string.leftclick_pressure),
p.getResources().getString(R.string.rightclick_key),
p.getResources().getString(R.string.leftclick_timeout),
p.getResources().getString(R.string.leftclick_tap),
p.getResources().getString(R.string.leftclick_tap_or_timeout) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.leftclick_question);
builder.setSingleChoiceItems(items, Globals.LeftClickMethod, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
Globals.LeftClickMethod = item;
if( item == Mouse.LEFT_CLICK_WITH_KEY )
p.keyListener = new KeyRemapToolMouseClick(p, true);
else if( item == Mouse.LEFT_CLICK_WITH_TIMEOUT || item == Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT )
showLeftClickTimeoutConfig(p);
else
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
static void showLeftClickTimeoutConfig(final MainActivity p) {
final CharSequence[] items = { p.getResources().getString(R.string.leftclick_timeout_time_0),
p.getResources().getString(R.string.leftclick_timeout_time_1),
p.getResources().getString(R.string.leftclick_timeout_time_2),
p.getResources().getString(R.string.leftclick_timeout_time_3),
p.getResources().getString(R.string.leftclick_timeout_time_4) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.leftclick_timeout_time);
builder.setSingleChoiceItems(items, Globals.LeftClickTimeout, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.LeftClickTimeout = item;
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class RightClickConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.rightclick_question);
}
boolean enabled()
{
return Globals.AppNeedsTwoButtonMouse;
}
void run (final MainActivity p)
{
final CharSequence[] items = { p.getResources().getString(R.string.rightclick_none),
p.getResources().getString(R.string.rightclick_multitouch),
p.getResources().getString(R.string.rightclick_pressure),
p.getResources().getString(R.string.rightclick_key),
p.getResources().getString(R.string.leftclick_timeout) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.rightclick_question);
builder.setSingleChoiceItems(items, Globals.RightClickMethod, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.RightClickMethod = item;
dialog.dismiss();
if( item == Mouse.RIGHT_CLICK_WITH_KEY )
p.keyListener = new KeyRemapToolMouseClick(p, false);
else if( item == Mouse.RIGHT_CLICK_WITH_TIMEOUT )
showRightClickTimeoutConfig(p);
else
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
static void showRightClickTimeoutConfig(final MainActivity p) {
final CharSequence[] items = { p.getResources().getString(R.string.leftclick_timeout_time_0),
p.getResources().getString(R.string.leftclick_timeout_time_1),
p.getResources().getString(R.string.leftclick_timeout_time_2),
p.getResources().getString(R.string.leftclick_timeout_time_3),
p.getResources().getString(R.string.leftclick_timeout_time_4) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.leftclick_timeout_time);
builder.setSingleChoiceItems(items, Globals.RightClickTimeout, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.RightClickTimeout = item;
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
public static class KeyRemapToolMouseClick implements MainActivity.KeyEventsListener
{
MainActivity p;
boolean leftClick;
public KeyRemapToolMouseClick(MainActivity _p, boolean leftClick)
{
p = _p;
p.setText(p.getResources().getString(R.string.remap_hwkeys_press));
this.leftClick = leftClick;
}
public void onKeyEvent(final int keyCode)
{
p.keyListener = null;
int keyIndex = keyCode;
if( keyIndex < 0 )
keyIndex = 0;
if( keyIndex > SDL_Keys.JAVA_KEYCODE_LAST )
keyIndex = 0;
if( leftClick )
Globals.LeftClickKey = keyIndex;
else
Globals.RightClickKey = keyIndex;
goBack(p);
}
}
static class AdditionalMouseConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.pointandclick_question);
}
void run (final MainActivity p)
{
CharSequence[] items = {
p.getResources().getString(R.string.pointandclick_joystickmouse),
p.getResources().getString(R.string.click_with_dpadcenter),
p.getResources().getString(R.string.pointandclick_relative)
};
boolean defaults[] = {
Globals.MoveMouseWithJoystick,
Globals.ClickMouseWithDpad,
Globals.RelativeMouseMovement
};
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.pointandclick_question));
builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener()
{
public void onClick(DialogInterface dialog, int item, boolean isChecked)
{
if( item == 0 )
Globals.MoveMouseWithJoystick = isChecked;
if( item == 1 )
Globals.ClickMouseWithDpad = isChecked;
if( item == 2 )
Globals.RelativeMouseMovement = isChecked;
}
});
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
if( Globals.RelativeMouseMovement )
showRelativeMouseMovementConfig(p);
else
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
static void showRelativeMouseMovementConfig(final MainActivity p)
{
final CharSequence[] items = { p.getResources().getString(R.string.accel_veryslow),
p.getResources().getString(R.string.accel_slow),
p.getResources().getString(R.string.accel_medium),
p.getResources().getString(R.string.accel_fast),
p.getResources().getString(R.string.accel_veryfast) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.pointandclick_relative_speed);
builder.setSingleChoiceItems(items, Globals.RelativeMouseMovementSpeed, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.RelativeMouseMovementSpeed = item;
dialog.dismiss();
showRelativeMouseMovementConfig1(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
static void showRelativeMouseMovementConfig1(final MainActivity p)
{
final CharSequence[] items = { p.getResources().getString(R.string.none),
p.getResources().getString(R.string.accel_slow),
p.getResources().getString(R.string.accel_medium),
p.getResources().getString(R.string.accel_fast) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.pointandclick_relative_accel);
builder.setSingleChoiceItems(items, Globals.RelativeMouseMovementAccel, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.RelativeMouseMovementAccel = item;
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class JoystickMouseConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.pointandclick_joystickmousespeed);
}
boolean enabled()
{
return Globals.MoveMouseWithJoystick;
};
void run (final MainActivity p)
{
final CharSequence[] items = { p.getResources().getString(R.string.accel_slow),
p.getResources().getString(R.string.accel_medium),
p.getResources().getString(R.string.accel_fast) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.pointandclick_joystickmousespeed);
builder.setSingleChoiceItems(items, Globals.MoveMouseWithJoystickSpeed, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.MoveMouseWithJoystickSpeed = item;
dialog.dismiss();
showJoystickMouseAccelConfig(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
static void showJoystickMouseAccelConfig(final MainActivity p)
{
final CharSequence[] items = { p.getResources().getString(R.string.none),
p.getResources().getString(R.string.accel_slow),
p.getResources().getString(R.string.accel_medium),
p.getResources().getString(R.string.accel_fast) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.pointandclick_joystickmouseaccel);
builder.setSingleChoiceItems(items, Globals.MoveMouseWithJoystickAccel, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.MoveMouseWithJoystickAccel = item;
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class TouchPressureMeasurementTool extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.measurepressure);
}
boolean enabled()
{
return Globals.RightClickMethod == Mouse.RIGHT_CLICK_WITH_PRESSURE ||
Globals.LeftClickMethod == Mouse.LEFT_CLICK_WITH_PRESSURE;
};
void run (final MainActivity p)
{
p.setText(p.getResources().getString(R.string.measurepressure_touchplease));
p.touchListener = new TouchMeasurementTool(p);
}
public static class TouchMeasurementTool implements MainActivity.TouchEventsListener
{
MainActivity p;
ArrayList<Integer> force = new ArrayList<Integer>();
ArrayList<Integer> radius = new ArrayList<Integer>();
static final int maxEventAmount = 100;
public TouchMeasurementTool(MainActivity _p)
{
p = _p;
}
public void onTouchEvent(final MotionEvent ev)
{
force.add(new Integer((int)(ev.getPressure() * 1000.0)));
radius.add(new Integer((int)(ev.getSize() * 1000.0)));
p.setText(p.getResources().getString(R.string.measurepressure_response, force.get(force.size()-1), radius.get(radius.size()-1)));
try {
Thread.sleep(10L);
} catch (InterruptedException e) { }
if( force.size() >= maxEventAmount )
{
p.touchListener = null;
Globals.ClickScreenPressure = getAverageForce();
Globals.ClickScreenTouchspotSize = getAverageRadius();
Log.i("SDL", "SDL: measured average force " + Globals.ClickScreenPressure + " radius " + Globals.ClickScreenTouchspotSize);
goBack(p);
}
}
int getAverageForce()
{
int avg = 0;
for(Integer f: force)
{
avg += f;
}
return avg / force.size();
}
int getAverageRadius()
{
int avg = 0;
for(Integer r: radius)
{
avg += r;
}
return avg / radius.size();
}
}
}
static class CalibrateTouchscreenMenu extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.calibrate_touchscreen);
}
//boolean enabled() { return true; };
void run (final MainActivity p)
{
p.setText(p.getResources().getString(R.string.calibrate_touchscreen_touch));
Globals.TouchscreenCalibration[0] = 0;
Globals.TouchscreenCalibration[1] = 0;
Globals.TouchscreenCalibration[2] = 0;
Globals.TouchscreenCalibration[3] = 0;
ScreenEdgesCalibrationTool tool = new ScreenEdgesCalibrationTool(p);
p.touchListener = tool;
p.keyListener = tool;
}
static class ScreenEdgesCalibrationTool implements MainActivity.TouchEventsListener, MainActivity.KeyEventsListener
{
MainActivity p;
ImageView img;
Bitmap bmp;
public ScreenEdgesCalibrationTool(MainActivity _p)
{
p = _p;
img = new ImageView(p);
img.setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
img.setScaleType(ImageView.ScaleType.MATRIX);
bmp = BitmapFactory.decodeResource( p.getResources(), R.drawable.calibrate );
img.setImageBitmap(bmp);
Matrix m = new Matrix();
RectF src = new RectF(0, 0, bmp.getWidth(), bmp.getHeight());
RectF dst = new RectF(Globals.TouchscreenCalibration[0], Globals.TouchscreenCalibration[1],
Globals.TouchscreenCalibration[2], Globals.TouchscreenCalibration[3]);
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
img.setImageMatrix(m);
p.getVideoLayout().addView(img);
}
public void onTouchEvent(final MotionEvent ev)
{
if( Globals.TouchscreenCalibration[0] == Globals.TouchscreenCalibration[1] &&
Globals.TouchscreenCalibration[1] == Globals.TouchscreenCalibration[2] &&
Globals.TouchscreenCalibration[2] == Globals.TouchscreenCalibration[3] )
{
Globals.TouchscreenCalibration[0] = (int)ev.getX();
Globals.TouchscreenCalibration[1] = (int)ev.getY();
Globals.TouchscreenCalibration[2] = (int)ev.getX();
Globals.TouchscreenCalibration[3] = (int)ev.getY();
}
if( ev.getX() < Globals.TouchscreenCalibration[0] )
Globals.TouchscreenCalibration[0] = (int)ev.getX();
if( ev.getY() < Globals.TouchscreenCalibration[1] )
Globals.TouchscreenCalibration[1] = (int)ev.getY();
if( ev.getX() > Globals.TouchscreenCalibration[2] )
Globals.TouchscreenCalibration[2] = (int)ev.getX();
if( ev.getY() > Globals.TouchscreenCalibration[3] )
Globals.TouchscreenCalibration[3] = (int)ev.getY();
Matrix m = new Matrix();
RectF src = new RectF(0, 0, bmp.getWidth(), bmp.getHeight());
RectF dst = new RectF(Globals.TouchscreenCalibration[0], Globals.TouchscreenCalibration[1],
Globals.TouchscreenCalibration[2], Globals.TouchscreenCalibration[3]);
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
img.setImageMatrix(m);
}
public void onKeyEvent(final int keyCode)
{
p.touchListener = null;
p.keyListener = null;
p.getVideoLayout().removeView(img);
goBack(p);
}
}
}
}

View File

@@ -0,0 +1,48 @@
/*
Simple DirectMedia Layer
Java source code (C) 2009-2014 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package net.sourceforge.clonekeenplus;
import android.app.Activity;
import android.os.Bundle;
// Stubs for compatibility with SDL 1.2 code
class SettingsMenu {
public static void showConfig(final MainActivity p, final boolean firstStart) {
}
}
class RestartMainActivity extends Activity {
// For compatibility with SDL 1.2 code
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
public static final String ACTIVITY_AUTODETECT_SCREEN_ORIENTATION = "libsdl.org.ACTIVITY_AUTODETECT_SCREEN_ORIENTATION";
public static final String SDL_RESTART_PARAMS = "SDL_RESTART_PARAMS";
}
class DemoGLSurfaceView {
static void SetupTouchscreenKeyboardGraphics(Activity p) {
}
}

View File

@@ -1,846 +0,0 @@
/*
Simple DirectMedia Layer
Java source code (C) 2009-2012 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package net.sourceforge.clonekeenplus;
import javax.microedition.khronos.opengles.GL10;
import javax.microedition.khronos.opengles.GL11;
import javax.microedition.khronos.opengles.GL11Ext;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGL11;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.egl.EGLSurface;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.InputDevice;
import android.view.Window;
import android.view.WindowManager;
import android.os.Environment;
import java.io.File;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.content.res.Resources;
import android.content.res.AssetManager;
import android.widget.Toast;
import android.util.Log;
import android.widget.TextView;
import java.lang.Thread;
import java.util.concurrent.locks.ReentrantLock;
import android.os.Build;
import java.lang.reflect.Method;
import java.util.LinkedList;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
class Mouse
{
public static final int LEFT_CLICK_NORMAL = 0;
public static final int LEFT_CLICK_NEAR_CURSOR = 1;
public static final int LEFT_CLICK_WITH_MULTITOUCH = 2;
public static final int LEFT_CLICK_WITH_PRESSURE = 3;
public static final int LEFT_CLICK_WITH_KEY = 4;
public static final int LEFT_CLICK_WITH_TIMEOUT = 5;
public static final int LEFT_CLICK_WITH_TAP = 6;
public static final int LEFT_CLICK_WITH_TAP_OR_TIMEOUT = 7;
public static final int RIGHT_CLICK_NONE = 0;
public static final int RIGHT_CLICK_WITH_MULTITOUCH = 1;
public static final int RIGHT_CLICK_WITH_PRESSURE = 2;
public static final int RIGHT_CLICK_WITH_KEY = 3;
public static final int RIGHT_CLICK_WITH_TIMEOUT = 4;
public static final int SDL_FINGER_DOWN = 0;
public static final int SDL_FINGER_UP = 1;
public static final int SDL_FINGER_MOVE = 2;
public static final int SDL_FINGER_HOVER = 3;
public static final int ZOOM_NONE = 0;
public static final int ZOOM_MAGNIFIER = 1;
public static final int ZOOM_SCREEN_TRANSFORM = 2;
public static final int ZOOM_FULLSCREEN_MAGNIFIER = 3;
}
abstract class DifferentTouchInput
{
public abstract void process(final MotionEvent event);
public abstract void processGenericEvent(final MotionEvent event);
public static boolean ExternalMouseDetected = false;
public static DifferentTouchInput getInstance()
{
boolean multiTouchAvailable1 = false;
boolean multiTouchAvailable2 = false;
// Not checking for getX(int), getY(int) etc 'cause I'm lazy
Method methods [] = MotionEvent.class.getDeclaredMethods();
for(Method m: methods)
{
if( m.getName().equals("getPointerCount") )
multiTouchAvailable1 = true;
if( m.getName().equals("getPointerId") )
multiTouchAvailable2 = true;
}
try {
Log.i("SDL", "Device model: " + android.os.Build.MODEL);
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH )
{
if( DetectCrappyDragonRiseDatexGamepad() )
return CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad.Holder.sInstance;
return IcsTouchInput.Holder.sInstance;
}
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD )
return GingerbreadTouchInput.Holder.sInstance;
if (multiTouchAvailable1 && multiTouchAvailable2)
return MultiTouchInput.Holder.sInstance;
else
return SingleTouchInput.Holder.sInstance;
} catch( Exception e ) {
try {
if (multiTouchAvailable1 && multiTouchAvailable2)
return MultiTouchInput.Holder.sInstance;
else
return SingleTouchInput.Holder.sInstance;
} catch( Exception ee ) {
return SingleTouchInput.Holder.sInstance;
}
}
}
private static boolean DetectCrappyDragonRiseDatexGamepad()
{
if( CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad.Holder.sInstance == null )
return false;
return CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad.Holder.sInstance.detect();
}
private static class SingleTouchInput extends DifferentTouchInput
{
private static class Holder
{
private static final SingleTouchInput sInstance = new SingleTouchInput();
}
@Override
public void processGenericEvent(final MotionEvent event)
{
process(event);
}
public void process(final MotionEvent event)
{
int action = -1;
if( event.getAction() == MotionEvent.ACTION_DOWN )
action = Mouse.SDL_FINGER_DOWN;
if( event.getAction() == MotionEvent.ACTION_UP )
action = Mouse.SDL_FINGER_UP;
if( event.getAction() == MotionEvent.ACTION_MOVE )
action = Mouse.SDL_FINGER_MOVE;
if ( action >= 0 )
DemoGLSurfaceView.nativeMotionEvent( (int)event.getX(), (int)event.getY(), action, 0,
(int)(event.getPressure() * 1000.0),
(int)(event.getSize() * 1000.0) );
}
}
private static class MultiTouchInput extends DifferentTouchInput
{
public static final int TOUCH_EVENTS_MAX = 16; // Max multitouch pointers
private class touchEvent
{
public boolean down = false;
public int x = 0;
public int y = 0;
public int pressure = 0;
public int size = 0;
}
protected touchEvent touchEvents[];
MultiTouchInput()
{
touchEvents = new touchEvent[TOUCH_EVENTS_MAX];
for( int i = 0; i < TOUCH_EVENTS_MAX; i++ )
touchEvents[i] = new touchEvent();
}
private static class Holder
{
private static final MultiTouchInput sInstance = new MultiTouchInput();
}
public void processGenericEvent(final MotionEvent event)
{
process(event);
}
public void process(final MotionEvent event)
{
int action = -1;
//Log.i("SDL", "Got motion event, type " + (int)(event.getAction()) + " X " + (int)event.getX() + " Y " + (int)event.getY());
if( (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_UP ||
(event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_CANCEL )
{
action = Mouse.SDL_FINGER_UP;
for( int i = 0; i < TOUCH_EVENTS_MAX; i++ )
{
if( touchEvents[i].down )
{
touchEvents[i].down = false;
DemoGLSurfaceView.nativeMotionEvent( touchEvents[i].x, touchEvents[i].y, action, i, touchEvents[i].pressure, touchEvents[i].size );
}
}
}
if( (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_DOWN )
{
action = Mouse.SDL_FINGER_DOWN;
for( int i = 0; i < event.getPointerCount(); i++ )
{
int id = event.getPointerId(i);
if( id >= TOUCH_EVENTS_MAX )
id = TOUCH_EVENTS_MAX - 1;
touchEvents[id].down = true;
touchEvents[id].x = (int)event.getX(i);
touchEvents[id].y = (int)event.getY(i);
touchEvents[id].pressure = (int)(event.getPressure(i) * 1000.0);
touchEvents[id].size = (int)(event.getSize(i) * 1000.0);
DemoGLSurfaceView.nativeMotionEvent( touchEvents[id].x, touchEvents[id].y, action, id, touchEvents[id].pressure, touchEvents[id].size );
}
}
if( (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_MOVE ||
(event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_DOWN ||
(event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_UP )
{
/*
String s = "MOVE: ptrs " + event.getPointerCount();
for( int i = 0 ; i < event.getPointerCount(); i++ )
{
s += " p" + event.getPointerId(i) + "=" + (int)event.getX(i) + ":" + (int)event.getY(i);
}
Log.i("SDL", s);
*/
int pointerReleased = -1;
if( (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_UP )
pointerReleased = (event.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;
for( int id = 0; id < TOUCH_EVENTS_MAX; id++ )
{
int ii;
for( ii = 0; ii < event.getPointerCount(); ii++ )
{
if( id == event.getPointerId(ii) )
break;
}
if( ii >= event.getPointerCount() )
{
// Up event
if( touchEvents[id].down )
{
action = Mouse.SDL_FINGER_UP;
touchEvents[id].down = false;
DemoGLSurfaceView.nativeMotionEvent( touchEvents[id].x, touchEvents[id].y, action, id, touchEvents[id].pressure, touchEvents[id].size );
}
}
else
{
if( pointerReleased == id && touchEvents[pointerReleased].down )
{
action = Mouse.SDL_FINGER_UP;
touchEvents[id].down = false;
}
else if( touchEvents[id].down )
{
action = Mouse.SDL_FINGER_MOVE;
}
else
{
action = Mouse.SDL_FINGER_DOWN;
touchEvents[id].down = true;
}
touchEvents[id].x = (int)event.getX(ii);
touchEvents[id].y = (int)event.getY(ii);
touchEvents[id].pressure = (int)(event.getPressure(ii) * 1000.0);
touchEvents[id].size = (int)(event.getSize(ii) * 1000.0);
DemoGLSurfaceView.nativeMotionEvent( touchEvents[id].x, touchEvents[id].y, action, id, touchEvents[id].pressure, touchEvents[id].size );
}
}
}
if( (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_HOVER_MOVE ) // Support bluetooth/USB mouse - available since Android 3.1
{
// TODO: it is possible that multiple pointers return that event, but we're handling only pointer #0
if( touchEvents[0].down )
action = Mouse.SDL_FINGER_UP;
else
action = Mouse.SDL_FINGER_HOVER;
touchEvents[0].down = false;
touchEvents[0].x = (int)event.getX();
touchEvents[0].y = (int)event.getY();
touchEvents[0].pressure = 0;
touchEvents[0].size = 0;
DemoGLSurfaceView.nativeMotionEvent( touchEvents[0].x, touchEvents[0].y, action, 0, touchEvents[0].pressure, touchEvents[0].size );
}
}
}
private static class GingerbreadTouchInput extends MultiTouchInput
{
private static class Holder
{
private static final GingerbreadTouchInput sInstance = new GingerbreadTouchInput();
}
GingerbreadTouchInput()
{
super();
}
public void process(final MotionEvent event)
{
boolean hwMouseEvent = ( (event.getSource() & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE ||
(event.getSource() & InputDevice.SOURCE_STYLUS) == InputDevice.SOURCE_STYLUS ||
(event.getMetaState() & KeyEvent.FLAG_TRACKING) != 0 ); // Hack to recognize Galaxy Note Gingerbread stylus
if( ExternalMouseDetected != hwMouseEvent )
{
ExternalMouseDetected = hwMouseEvent;
DemoGLSurfaceView.nativeHardwareMouseDetected(hwMouseEvent ? 1 : 0);
}
super.process(event);
}
public void processGenericEvent(final MotionEvent event)
{
process(event);
}
}
private static class IcsTouchInput extends GingerbreadTouchInput
{
private static class Holder
{
private static final IcsTouchInput sInstance = new IcsTouchInput();
}
private int buttonState = 0;
public void process(final MotionEvent event)
{
//Log.i("SDL", "Got motion event, type " + (int)(event.getAction()) + " X " + (int)event.getX() + " Y " + (int)event.getY() + " buttons " + buttonState + " source " + event.getSource());
int buttonStateNew = event.getButtonState();
if( buttonStateNew != buttonState )
{
for( int i = 1; i <= MotionEvent.BUTTON_FORWARD; i *= 2 )
{
if( (buttonStateNew & i) != (buttonState & i) )
DemoGLSurfaceView.nativeMouseButtonsPressed(i, ((buttonStateNew & i) == 0) ? 0 : 1);
}
buttonState = buttonStateNew;
}
super.process(event); // Push mouse coordinate first
}
public void processGenericEvent(final MotionEvent event)
{
// Joysticks are supported since Honeycomb, but I don't care about it, because very little devices have it
if( (event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == InputDevice.SOURCE_CLASS_JOYSTICK )
{
DemoGLSurfaceView.nativeGamepadAnalogJoystickInput(
event.getAxisValue(MotionEvent.AXIS_X), event.getAxisValue(MotionEvent.AXIS_Y),
event.getAxisValue(MotionEvent.AXIS_Z), event.getAxisValue(MotionEvent.AXIS_RZ),
event.getAxisValue(MotionEvent.AXIS_RTRIGGER), event.getAxisValue(MotionEvent.AXIS_LTRIGGER) );
return;
}
// Process mousewheel
if( event.getAction() == MotionEvent.ACTION_SCROLL )
{
int scrollX = Math.round(event.getAxisValue(MotionEvent.AXIS_HSCROLL));
int scrollY = Math.round(event.getAxisValue(MotionEvent.AXIS_VSCROLL));
DemoGLSurfaceView.nativeMouseWheel(scrollX, scrollY);
return;
}
super.processGenericEvent(event);
}
}
private static class CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad extends IcsTouchInput
{
private static class Holder
{
private static final CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad sInstance = new CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad();
}
float hatX = 0.0f, hatY = 0.0f;
public void processGenericEvent(final MotionEvent event)
{
// Joysticks are supported since Honeycomb, but I don't care about it, because very little devices have it
if( (event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == InputDevice.SOURCE_CLASS_JOYSTICK )
{
// event.getAxisValue(AXIS_HAT_X) and event.getAxisValue(AXIS_HAT_Y) are joystick arrow keys, they also send keyboard events
DemoGLSurfaceView.nativeGamepadAnalogJoystickInput(
event.getAxisValue(MotionEvent.AXIS_X), event.getAxisValue(MotionEvent.AXIS_Y),
event.getAxisValue(MotionEvent.AXIS_RX), event.getAxisValue(MotionEvent.AXIS_RZ),
0, 0);
if( event.getAxisValue(MotionEvent.AXIS_HAT_X) != hatX )
{
hatX = event.getAxisValue(MotionEvent.AXIS_HAT_X);
if( hatX == 0.0f )
{
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_LEFT, 0);
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_RIGHT, 0);
}
else
DemoGLSurfaceView.nativeKey(hatX < 0.0f ? KeyEvent.KEYCODE_DPAD_LEFT : KeyEvent.KEYCODE_DPAD_RIGHT, 1);
}
if( event.getAxisValue(MotionEvent.AXIS_HAT_Y) != hatY )
{
hatY = event.getAxisValue(MotionEvent.AXIS_HAT_Y);
if( hatY == 0.0f )
{
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_UP, 0);
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_DOWN, 0);
}
else
DemoGLSurfaceView.nativeKey(hatY < 0.0f ? KeyEvent.KEYCODE_DPAD_UP : KeyEvent.KEYCODE_DPAD_DOWN, 1);
}
return;
}
super.processGenericEvent(event);
}
public boolean detect()
{
int[] devIds = InputDevice.getDeviceIds();
for( int id : devIds )
{
InputDevice device = InputDevice.getDevice(id);
if( device == null )
continue;
System.out.println("libSDL: input device ID " + id + " type " + device.getSources() + " name " + device.getName() );
if( (device.getSources() & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD &&
(device.getSources() & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK &&
device.getName().indexOf("DragonRise Inc") == 0 )
{
System.out.println("libSDL: Detected crappy DragonRise gamepad, enabling special hack for it. Please press button labeled 'Analog', otherwise it won't work, because it's cheap and crappy");
return true;
}
}
return false;
}
}
}
class DemoRenderer extends GLSurfaceView_SDL.Renderer
{
public DemoRenderer(MainActivity _context)
{
context = _context;
}
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
Log.i("SDL", "libSDL: DemoRenderer.onSurfaceCreated(): paused " + mPaused + " mFirstTimeStart " + mFirstTimeStart );
mGlSurfaceCreated = true;
mGl = gl;
/*if( ! mPaused && ! mFirstTimeStart )
nativeGlContextRecreated();*/
mFirstTimeStart = false;
}
public void onSurfaceChanged(GL10 gl, int w, int h) {
Log.i("SDL", "libSDL: DemoRenderer.onSurfaceChanged(): paused " + mPaused + " mFirstTimeStart " + mFirstTimeStart + " w " + w + " h " + h);
if( w < h && Globals.HorizontalOrientation )
{
// Sometimes when Android awakes from lockscreen, portrait orientation is kept
int x = w;
w = h;
h = x;
}
mWidth = w;
mHeight = h;
mGl = gl;
//nativeResize(w, h, Globals.KeepAspectRatio ? 1 : 0);
}
public void onSurfaceDestroyed() {
Log.i("SDL", "libSDL: DemoRenderer.onSurfaceDestroyed(): paused " + mPaused + " mFirstTimeStart " + mFirstTimeStart );
mGlSurfaceCreated = false;
mGlContextLost = true;
//nativeGlContextLost();
};
public void onDrawFrame(GL10 gl) {
mGl = gl;
DrawLogo(mGl);
SwapBuffers();
//nativeInitJavaCallbacks();
// Make main thread priority lower so audio thread won't get underrun
// Thread.currentThread().setPriority((Thread.currentThread().getPriority() + Thread.MIN_PRIORITY)/2);
mGlContextLost = false;
if(Globals.CompatibilityHacksStaticInit)
MainActivity.LoadApplicationLibrary(context);
Settings.Apply(context);
accelerometer = new AccelerometerReader(context);
// Tweak video thread priority, if user selected big audio buffer
if(Globals.AudioBufferConfig >= 2)
Thread.currentThread().setPriority( (Thread.NORM_PRIORITY + Thread.MIN_PRIORITY) / 2 ); // Lower than normal
// Calls main() and never returns, hehe - we'll call eglSwapBuffers() from native code
/*nativeInit( Globals.DataDir,
Globals.CommandLine,
( (Globals.SwVideoMode && Globals.MultiThreadedVideo) || Globals.CompatibilityHacksVideo ) ? 1 : 0,
android.os.Debug.isDebuggerConnected() ? 1 : 0 );*/
//System.exit(0); // The main() returns here - I don't bother with deinit stuff, just terminate process
}
public int swapBuffers() // Called from native code
{
if( ! super.SwapBuffers() && Globals.NonBlockingSwapBuffers )
{
if(mRatelimitTouchEvents)
{
synchronized(this)
{
this.notify();
}
}
return 0;
}
if(mGlContextLost) {
mGlContextLost = false;
Settings.SetupTouchscreenKeyboardGraphics(context); // Reload on-screen buttons graphics
DrawLogo(mGl);
super.SwapBuffers();
}
// Unblock event processing thread only after we've finished rendering
if(mRatelimitTouchEvents)
{
synchronized(this)
{
this.notify();
}
}
/*if( context.isScreenKeyboardShown() )
{
try {
Thread.sleep(50); // Give some time to the keyboard input thread
} catch(Exception e) { };
}*/
return 1;
}
public void showScreenKeyboardWithoutTextInputField() // Called from native code
{
class Callback implements Runnable
{
public MainActivity parent;
public void run()
{
parent.showScreenKeyboardWithoutTextInputField();
}
}
Callback cb = new Callback();
cb.parent = context;
context.runOnUiThread(cb);
}
public void showScreenKeyboard(final String oldText, int sendBackspace) // Called from native code
{
class Callback implements Runnable
{
public MainActivity parent;
public String oldText;
public boolean sendBackspace;
public void run()
{
parent.showScreenKeyboard(oldText, sendBackspace);
}
}
Callback cb = new Callback();
cb.parent = context;
cb.oldText = oldText;
cb.sendBackspace = (sendBackspace != 0);
context.runOnUiThread(cb);
}
public void hideScreenKeyboard() // Called from native code
{
class Callback implements Runnable
{
public MainActivity parent;
public void run()
{
//parent.hideScreenKeyboard();
}
}
Callback cb = new Callback();
cb.parent = context;
context.runOnUiThread(cb);
}
public int isScreenKeyboardShown() // Called from native code
{
//return context.isScreenKeyboardShown() ? 1 : 0;
return 0;
}
public void setScreenKeyboardHintMessage(String s)
{
//context.setScreenKeyboardHintMessage(s);
}
public void startAccelerometerGyroscope(int started)
{
accelerometer.openedBySDL = (started != 0);
if( accelerometer.openedBySDL && !mPaused )
accelerometer.start();
else
accelerometer.stop();
}
public void exitApp()
{
//nativeDone();
}
public void getAdvertisementParams(int params[])
{
//context.getAdvertisementParams(params);
}
public void setAdvertisementVisible(int visible)
{
//context.setAdvertisementVisible(visible);
}
public void setAdvertisementPosition(int left, int top)
{
//context.setAdvertisementPosition(left, top);
}
public void requestNewAdvertisement()
{
//context.requestNewAdvertisement();
}
private int PowerOf2(int i)
{
int value = 1;
while (value < i)
value <<= 1;
return value;
}
public void DrawLogo(GL10 gl)
{
/*
// TODO: this not quite works, as it seems
BitmapDrawable bmp = null;
try
{
bmp = new BitmapDrawable(context.getAssets().open("logo.png"));
}
catch(Exception e)
{
bmp = new BitmapDrawable(context.getResources().openRawResource(R.drawable.publisherlogo));
}
int width = bmp.getBitmap().getWidth();
int height = bmp.getBitmap().getHeight();
ByteBuffer byteBuffer = ByteBuffer.allocateDirect(4 * width * height);
//byteBuffer.order(ByteOrder.BIG_ENDIAN);
bmp.getBitmap().copyPixelsToBuffer(byteBuffer);
byteBuffer.position(0);
gl.glViewport(0, 0, mWidth, mHeight);
gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT);
gl.glColor4x(0x10000, 0x10000, 0x10000, 0x10000);
gl.glPixelStorei(gl.GL_UNPACK_ALIGNMENT, 1);
gl.glEnable(GL10.GL_TEXTURE_2D);
int textureName = -1;
int mTextureNameWorkspace[] = new int[1];
int mCropWorkspace[] = new int[4];
gl.glGenTextures(1, mTextureNameWorkspace, 0);
textureName = mTextureNameWorkspace[0];
gl.glBindTexture(GL10.GL_TEXTURE_2D, textureName);
gl.glActiveTexture(textureName);
gl.glClientActiveTexture(textureName);
gl.glTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGBA,
PowerOf2(width), PowerOf2(height), 0,
GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, null);
gl.glTexSubImage2D(GL10.GL_TEXTURE_2D, 0, 0, 0,
width, height,
GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, byteBuffer);
mCropWorkspace[0] = 0; // u
mCropWorkspace[1] = height; // v
mCropWorkspace[2] = width;
mCropWorkspace[3] = -height;
((GL11) gl).glTexParameteriv(GL10.GL_TEXTURE_2D,
GL11Ext.GL_TEXTURE_CROP_RECT_OES, mCropWorkspace, 0);
((GL11Ext) gl).glDrawTexiOES(0, -mHeight, 0, mWidth, mHeight);
gl.glActiveTexture(0);
gl.glClientActiveTexture(0);
gl.glBindTexture(GL10.GL_TEXTURE_2D, 0);
gl.glDeleteTextures(1, mTextureNameWorkspace, 0);
gl.glFlush();
*/
}
//private native void nativeInitJavaCallbacks();
//private native void nativeInit(String CurrentPath, String CommandLine, int multiThreadedVideo, int isDebuggerConnected);
//private native void nativeResize(int w, int h, int keepAspectRatio);
//private native void nativeDone();
//private native void nativeGlContextLost();
//public native void nativeGlContextRecreated();
//public native void nativeGlContextLostAsyncEvent();
//public static native void nativeTextInput( int ascii, int unicode );
//public static native void nativeTextInputFinished();
private MainActivity context = null;
public AccelerometerReader accelerometer = null;
private GL10 mGl = null;
private EGL10 mEgl = null;
private EGLDisplay mEglDisplay = null;
private EGLSurface mEglSurface = null;
//private EGLContext mEglContext = null;
private boolean mGlContextLost = false;
public boolean mGlSurfaceCreated = false;
public boolean mPaused = false;
private boolean mFirstTimeStart = true;
public int mWidth = 0;
public int mHeight = 0;
public static final boolean mRatelimitTouchEvents = true; //(Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO);
}
class DemoGLSurfaceView extends GLSurfaceView_SDL {
public DemoGLSurfaceView(MainActivity context) {
super(context);
mParent = context;
touchInput = DifferentTouchInput.getInstance();
setEGLConfigChooser(Globals.VideoDepthBpp, Globals.NeedDepthBuffer, Globals.NeedStencilBuffer, Globals.NeedGles2);
mRenderer = new DemoRenderer(context);
setRenderer(mRenderer);
}
@Override
public boolean onTouchEvent(final MotionEvent event)
{
touchInput.process(event);
if( DemoRenderer.mRatelimitTouchEvents )
{
limitEventRate(event);
}
return true;
};
@Override
public boolean onGenericMotionEvent (final MotionEvent event)
{
touchInput.processGenericEvent(event);
if( DemoRenderer.mRatelimitTouchEvents )
{
limitEventRate(event);
}
return true;
}
public void limitEventRate(final MotionEvent event)
{
// Wait a bit, and try to synchronize to app framerate, or event thread will eat all CPU and we'll lose FPS
// With Froyo the rate of touch events seems to be limited by OS, but they are arriving faster then we're redrawing anyway
if((event.getAction() == MotionEvent.ACTION_MOVE ||
event.getAction() == MotionEvent.ACTION_HOVER_MOVE))
{
synchronized(mRenderer)
{
try
{
mRenderer.wait(300L); // And sometimes the app decides not to render at all, so this timeout should not be big.
} catch (InterruptedException e) { }
}
}
}
public void exitApp() {
mRenderer.exitApp();
};
@Override
public void onPause() {
if(mRenderer.mPaused)
return;
mRenderer.mPaused = true;
//mRenderer.nativeGlContextLostAsyncEvent();
if( mRenderer.accelerometer != null ) // For some reason it crashes here often - are we getting this event before initialization?
mRenderer.accelerometer.stop();
super.onPause();
};
public boolean isPaused() {
return mRenderer.mPaused;
}
@Override
public void onResume() {
if(!mRenderer.mPaused)
return;
mRenderer.mPaused = false;
super.onResume();
Log.i("SDL", "libSDL: DemoGLSurfaceView.onResume(): mRenderer.mGlSurfaceCreated " + mRenderer.mGlSurfaceCreated + " mRenderer.mPaused " + mRenderer.mPaused);
/*if( mRenderer.mGlSurfaceCreated && ! mRenderer.mPaused || Globals.NonBlockingSwapBuffers )
mRenderer.nativeGlContextRecreated();*/
if( mRenderer.accelerometer != null && mRenderer.accelerometer.openedBySDL ) // For some reason it crashes here often - are we getting this event before initialization?
mRenderer.accelerometer.start();
};
// This seems like redundant code - it handled in MainActivity.java
@Override
public boolean onKeyDown(int keyCode, final KeyEvent event) {
//Log.i("SDL", "Got key down event, id " + keyCode + " meta " + event.getMetaState() + " event " + event.toString());
if( nativeKey( keyCode, 1 ) == 0 )
return super.onKeyDown(keyCode, event);
return true;
}
@Override
public boolean onKeyUp(int keyCode, final KeyEvent event) {
//Log.i("SDL", "Got key up event, id " + keyCode + " meta " + event.getMetaState());
if( nativeKey( keyCode, 0 ) == 0 )
return super.onKeyUp(keyCode, event);
return true;
}
DemoRenderer mRenderer;
MainActivity mParent;
DifferentTouchInput touchInput = null;
public static native void nativeMotionEvent( int x, int y, int action, int pointerId, int pressure, int radius );
public static native int nativeKey( int keyCode, int down );
public static native void nativeTouchpad( int x, int y, int down, int multitouch );
public static native void initJavaCallbacks();
public static native void nativeHardwareMouseDetected( int detected );
public static native void nativeMouseButtonsPressed( int buttonId, int pressedState );
public static native void nativeMouseWheel( int scrollX, int scrollY );
public static native void nativeGamepadAnalogJoystickInput( float stick1x, float stick1y, float stick2x, float stick2y, float rtrigger, float ltrigger );
}

View File

@@ -0,0 +1 @@
../java/XZInputStream.java

View File

@@ -1,75 +0,0 @@
/*
Simple DirectMedia Layer
Java source code (C) 2009-2012 Sergii Pylypenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
package net.sourceforge.clonekeenplus;
import android.app.Activity;
import android.content.Context;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import android.view.View;
import com.google.ads.*; // Copy GoogleAdMobAdsSdk.jar to the directory project/libs
class Advertisement
{
private AdView ad;
MainActivity parent;
public Advertisement(MainActivity p)
{
parent = p;
AdSize adSize = AdSize.BANNER;
if( Globals.AdmobBannerSize.equals("BANNER") )
adSize = AdSize.BANNER;
else if( Globals.AdmobBannerSize.equals("IAB_BANNER") )
adSize = AdSize.IAB_BANNER;
else if( Globals.AdmobBannerSize.equals("IAB_LEADERBOARD") )
adSize = AdSize.IAB_LEADERBOARD;
else if( Globals.AdmobBannerSize.equals("IAB_MRECT") )
adSize = AdSize.IAB_MRECT;
else if( Globals.AdmobBannerSize.equals("IAB_WIDE_SKYSCRAPER") )
adSize = AdSize.IAB_WIDE_SKYSCRAPER;
else if( Globals.AdmobBannerSize.equals("SMART_BANNER") )
adSize = AdSize.SMART_BANNER;
ad = new AdView(parent, adSize, Globals.AdmobPublisherId);
AdRequest adRequest = new AdRequest();
adRequest.addTestDevice(AdRequest.TEST_EMULATOR); // Copy GoogleAdMobAdsSdk.jar to the directory project/libs
adRequest.addTestDevice(Globals.AdmobTestDeviceId);
ad.loadAd(adRequest);
}
public View getView()
{
return ad;
}
public void requestNewAd()
{
AdRequest adRequest = new AdRequest();
adRequest.addTestDevice(AdRequest.TEST_EMULATOR); // Copy GoogleAdMobAdsSdk.jar to the directory project/libs
adRequest.addTestDevice(Globals.AdmobTestDeviceId);
ad.loadAd(adRequest);
}
}

View File

@@ -0,0 +1 @@
../java/translations

View File

@@ -1,31 +0,0 @@
#!/bin/sh
grep '<string name=' values/strings.xml | while read str; do
var=`echo $str | sed 's/<string name=["]\([^"]*\).*/\1/'`
text=`echo $str | sed 's/<string name=["][^"]*["]>\([^<]*\).*/\1/'`
if [ "$var" = "app_name" ]; then
continue
fi
PRINTEN=true
echo
for dir in values-*; do
lang=`echo $dir | sed 's/[^-]*-\(..\).*/\1/'`
trans=`grep "<string name=\"$var\">" $dir/strings.xml`
transtext=`echo $trans | sed 's/<string name=["][^"]*["]>\([^<]*\).*/\1/'`
if [ -z "$transtext" ] ; then
#transtext=`./translate.py en $lang "$text"`
#echo "$transtext" | grep 'Suspected Terms of Service Abuse' > /dev/null && transtext="$text"
transtext="$text"
grep -v "^[<]/resources[>]\$" $dir/strings.xml > $dir/strings.1.xml
echo "<string name=\"$var\">$transtext</string>" >> $dir/strings.1.xml
echo "</resources>" >> $dir/strings.1.xml
mv -f $dir/strings.1.xml $dir/strings.xml
if $PRINTEN ; then
echo en: $var: $text
PRINTEN=false
fi
echo $lang: $var: $transtext
fi
done
done

View File

@@ -1,24 +0,0 @@
#!/usr/bin/env python
from urllib2 import urlopen
from urllib import urlencode
import sys
# The google translate API can be found here:
# http://code.google.com/apis/ajaxlanguage/documentation/#Examples
lang1=sys.argv[1]
lang2=sys.argv[2]
langpair='%s|%s'%(lang1,lang2)
text=' '.join(sys.argv[3:])
base_url='http://ajax.googleapis.com/ajax/services/language/translate?'
params=urlencode( (('v',1.0),
('q',text),
('langpair',langpair),) )
url=base_url+params
content=urlopen(url).read()
start_idx=content.find('"translatedText":"')+18
translation=content[start_idx:]
end_idx=translation.find('"}, "')
translation=translation[:end_idx]
print translation

View File

@@ -1,3 +0,0 @@
I''ve tired of using Google Translate to create random gibberish in the languages I don't know,
so from now on the only supported languages are English, Russian, Ukrainian, and French with some community support,
If you wish to maintain a translation - contact me, but I will want a continuous support, not just one-time translation.

View File

@@ -1,137 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="init">Initialisiere</string>
<string name="please_wait">Bitte warte, während die Dateien heruntergeladen werden.</string>
<string name="device_config">Gerätekonfiguration</string>
<string name="device_change_cfg">Gerätekonfiguration bearbeiten</string>
<string name="download_unneeded">Download nicht nötig</string>
<string name="connecting_to">Verbinde mit %s</string>
<string name="failed_connecting_to">Verbindung mit %s fehlgeschlagen</string>
<string name="error_connecting_to">Fehler beim Verbinden mit %s</string>
<string name="dl_from">Lade Daten von %s</string>
<string name="error_dl_from">Fehler beim Download von %s</string>
<string name="error_write">Fehler beim schreiben auf %s</string>
<string name="dl_progress">Zu %1$.0f%% abgeschlossen: Datei %2$s</string>
<string name="dl_finished">Abgeschlossen</string>
<string name="storage_phone">Interner Speicher: %d MiB frei</string>
<string name="storage_sd">SD Karte: %d MiB frei</string>
<string name="storage_question">Wohin sollen die Dateien gespeichert werden</string>
<string name="controls_arrows">Pfeiltasten / Joystick / dpad</string>
<string name="controls_trackball">Trackball</string>
<string name="controls_accel">Accelerometer</string>
<string name="controls_question">Welche Arten von Navigationstasten hat das Gerät?</string>
<string name="trackball_no_dampening">Keine Dämpfung</string>
<string name="trackball_fast">Schnell</string>
<string name="trackball_medium">Mittel</string>
<string name="trackball_slow">Langsam</string>
<string name="trackball_question">Dämpfung des Trackball</string>
<string name="accel_fast">Schnell</string>
<string name="accel_medium">Mittel</string>
<string name="accel_slow">Langsam</string>
<string name="accel_question">Empfindlichkeit des Accelerometers</string>
<string name="audiobuf_small">Klein (für schnelle Geräte)</string>
<string name="audiobuf_medium">Mittel</string>
<string name="audiobuf_large">Groß (Wenn Ton "hängt")</string>
<string name="audiobuf_question">Größe des Audiopuffers</string>
<string name="optional_downloads">Optional Downloads</string>
<string name="ok">OK</string>
<string name="controls_touch">Touchscreen nur</string>
<string name="controls_additional">Zusätzliche Kontrollen zu verwenden</string>
<string name="controls_screenkb">On-Screen-Tastatur</string>
<string name="controls_accelnav">Beschleunigungsmesser</string>
<string name="controls_screenkb_size">On-Screen-Tastatur Größe</string>
<string name="controls_screenkb_large">Große</string>
<string name="controls_screenkb_medium">Medium</string>
<string name="controls_screenkb_small">Kleine</string>
<string name="controls_screenkb_tiny">Winzig</string>
<string name="controls_screenkb_theme">On-Screen-Tastatur Thema</string>
<string name="controls_screenkb_by">%1$s von %2$s</string>
<string name="accel_floating">Schwimmend</string>
<string name="accel_fixed_start">Feste, wenn die Anwendung startet</string>
<string name="accel_fixed_horiz">Fixiert auf Tisch Schreibtisch Orientierung</string>
<string name="accel_question_center">Beschleunigungsmesser Mittelstellung</string>
<string name="audiobuf_verysmall">Sehr kleine (schnelle Geräte, weniger Verzögerung)</string>
<string name="rightclick_question">Rechter Mausklick ausgelöst durch</string>
<string name="rightclick_menu">Menütaste</string>
<string name="rightclick_multitouch">Touch-Screen mit dem zweiten Finger</string>
<string name="rightclick_pressure">Touchscreen mit Kraft</string>
<string name="pointandclick_question">Erweiterte Funktionen</string>
<string name="pointandclick_keepaspectratio">Halten 4:3-Bildschirm Seitenverhältnis</string>
<string name="pointandclick_showcreenunderfinger">Show-Bildschirm unter dem Finger in einem separaten Fenster</string>
<string name="measurepressure_touchplease">Bitte schieben Sie den Finger über den Bildschirm für zwei Sekunden</string>
<string name="rightclick_none">Deaktivieren der rechten Maustaste</string>
<string name="leftclick_question">Linke Maustaste</string>
<string name="leftclick_normal">Normal</string>
<string name="leftclick_near_cursor">Tippen Sie auf nahe Mauszeiger</string>
<string name="leftclick_multitouch">Touch-Screen mit dem zweiten Finger</string>
<string name="leftclick_pressure">Touchscreen mit Kraft</string>
<string name="leftclick_dpadcenter">Trackball klicken Select-Taste</string>
<string name="pointandclick_joystickmouse">Bewegen Sie die Maus mit Joystick oder Trackball</string>
<string name="measurepressure_response">Pressure %1$03d Radius %2$03d</string>
<string name="click_with_dpadcenter">Linker Mausklick mit Trackball / Joystick Zentrum</string>
<string name="pointandclick_joystickmousespeed">Bewegen Sie die Maus mit Joystick-Geschwindigkeit</string>
<string name="pointandclick_joystickmouseaccel">Bewegen Sie die Maus mit Joystick-Beschleunigung</string>
<string name="none">Keine</string>
<string name="controls_screenkb_transparency">On-Screen-Tastatur Transparenz</string>
<string name="controls_screenkb_trans_0">Nicht sichtbar</string>
<string name="controls_screenkb_trans_1">Fast unsichtbar</string>
<string name="controls_screenkb_trans_2">Transparente</string>
<string name="controls_screenkb_trans_3">Semi-transparent</string>
<string name="controls_screenkb_trans_4">Non-transparent</string>
<string name="mouse_emulation">Maus-Emulation</string>
<string name="measurepressure">Kalibrieren Touchscreen Druck</string>
<string name="remap_hwkeys">Remap physischen Tasten</string>
<string name="remap_hwkeys_press">Drücken Sie eine beliebige Taste außer HOME und POWER, können Sie Lautstärke-Tasten</string>
<string name="remap_hwkeys_select">Wählen Sie SDL Schlüsselcode</string>
<string name="remap_screenkb">Remap On-Screen-Steuerung</string>
<string name="remap_screenkb_joystick">On-Screen-Joystick</string>
<string name="remap_screenkb_button">On-Screen-Taste</string>
<string name="remap_screenkb_button_text">On-Screen-Texteingabe-Taste</string>
<string name="remap_screenkb_button_zoomin">Zoom in Zwei-Finger-Geste</string>
<string name="remap_screenkb_button_zoomout">Verkleinern Zwei-Finger-Geste</string>
<string name="remap_screenkb_button_rotateleft">Nach links drehen Zwei-Finger-Geste</string>
<string name="remap_screenkb_button_rotateright">Nach rechts drehen Zwei-Finger-Geste</string>
<string name="remap_screenkb_button_gestures">Zwei-Finger-Gesten</string>
<string name="accel_veryfast">Sehr schnell</string>
<string name="remap_screenkb_button_gestures_sensitivity">Zwei-Finger-Gesten Bildschirm Empfindlichkeit</string>
<string name="storage_custom">Geben Sie direkt</string>
<string name="storage_commandline">Geben Kommandozeilenparameter</string>
<string name="calibrate_touchscreen">Kalibrieren Touchscreen</string>
<string name="calibrate_touchscreen_touch">Touch allen vier Rändern des Bildschirms, drücken Sie Menü, wenn Sie fertig</string>
<string name="screenkb_custom_layout">Passen Sie auf dem Bildschirm Tastatur-Layout</string>
<string name="screenkb_custom_layout_help">Slide-Bildschirm hinzufügen Taste, drücken Sie Menü zum letzten Knopf rückgängig machen</string>
<string name="rightclick_key">Physikalische Schlüssel</string>
<string name="pointandclick_showcreenunderfinger2">On-Screen-Lupe</string>
<string name="video">Video-Einstellungen</string>
<string name="video_smooth">Glatte Video</string>
<string name="accel_veryslow">Sehr langsam</string>
<string name="leftclick_timeout">Halten Sie an der gleichen Stelle</string>
<string name="leftclick_tap">Tippen Sie auf</string>
<string name="leftclick_tap_or_timeout">Tippen Sie auf oder halten</string>
<string name="leftclick_timeout_time">Holding-Timeout</string>
<string name="leftclick_timeout_time_0">0,3 Sek.</string>
<string name="leftclick_timeout_time_1">0,5 Sek.</string>
<string name="leftclick_timeout_time_2">0,7 Sek.</string>
<string name="leftclick_timeout_time_3">1 Sek.</string>
<string name="leftclick_timeout_time_4">1,5 Sek.</string>
<string name="pointandclick_relative">Relative Bewegung der Maus (Laptop-Modus)</string>
<string name="pointandclick_relative_speed">Relative Maus Bewegungsgeschwindigkeit</string>
<string name="pointandclick_relative_accel">Relative Bewegung der Maus Beschleunigung</string>
<string name="downloads">Downloads</string>
<string name="video_separatethread">Separaten Thread für Video, FPS bei einigen Geräten zu erhöhen</string>
<string name="text_edit_click_here">Tippen Sie auf der Eingabe beginnen, drücken Sie Zurück, wenn Sie fertig</string>
<string name="display_size_mouse">Konfigurieren der Maus je nach Display-Größe</string>
<string name="display_size">Wählen Sie Ihre Display-Größe</string>
<string name="display_size_large">Groß (Tablette)</string>
<string name="display_size_small">Klein (Telefon)</string>
<string name="display_size_tiny">Uberklein (Xperia Mini)</string>
<string name="show_more_options">Weitere Optionen</string>
<string name="controls_screenkb_drawsize">Größe der Schaltfläche Bilder</string>
</resources>

View File

@@ -1,137 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="init">Käynnistetään</string>
<string name="please_wait">Odota kun tietoja ladataan</string>
<string name="device_config">Laiteasetukset</string>
<string name="device_change_cfg">Muuta laiteasetuksia</string>
<string name="download_unneeded">Ei tarvitse ladata</string>
<string name="connecting_to">Yhdistetään %s</string>
<string name="failed_connecting_to">Yhdistäminen epäonnistui %s</string>
<string name="error_connecting_to">Virhe yhdistettäessä %s</string>
<string name="dl_from">Ladataan kohteesta %s</string>
<string name="error_dl_from">Virhe ladattaessa kohteesta %s</string>
<string name="error_write">Virhe kirjoittaessa %s</string>
<string name="dl_progress">%1$.0f%% valmis: tiedosto %2$s</string>
<string name="dl_finished">Valmis</string>
<string name="storage_phone">Sisäinen muisti - %d Mt vapaana</string>
<string name="storage_sd">SD kortti - %d Mt vapaana</string>
<string name="storage_question">Minne sovelluksen data ladataan</string>
<string name="controls_arrows">Nuolinapit / joystick / dpad</string>
<string name="controls_trackball">Pallohiiri</string>
<string name="controls_accel">Kiihtyvyysanturi</string>
<string name="controls_question">Millaiset navigointinapit laittessasi on?</string>
<string name="trackball_no_dampening">Ei vaimennusta</string>
<string name="trackball_fast">Nopea</string>
<string name="trackball_medium">Kohtalainen</string>
<string name="trackball_slow">Hidas</string>
<string name="trackball_question">Pallohiiren vaimennus</string>
<string name="accel_fast">Nopea</string>
<string name="accel_medium">Kohtalainen</string>
<string name="accel_slow">Hidas</string>
<string name="accel_question">Kiihtyvyysanturin herkkyys</string>
<string name="audiobuf_small">Pieni (nopeat laitteet)</string>
<string name="audiobuf_medium">Keskisuuri</string>
<string name="audiobuf_large">Suuri (jos ääni pätkii)</string>
<string name="audiobuf_question">Äänipuskurin koko</string>
<string name="optional_downloads">Vapaaehtoinen lataukset</string>
<string name="ok">OK</string>
<string name="controls_touch">Kosketusnäyttö vain</string>
<string name="controls_additional">Muita ohjausobjekteja käyttää</string>
<string name="controls_screenkb">Näyttönäppäimistöllä</string>
<string name="controls_accelnav">Kiihtyvyysmittari</string>
<string name="controls_screenkb_size">Näyttönäppäimistöllä koko</string>
<string name="controls_screenkb_large">Suuri</string>
<string name="controls_screenkb_medium">Medium</string>
<string name="controls_screenkb_small">Pienet</string>
<string name="controls_screenkb_tiny">Tiny</string>
<string name="controls_screenkb_theme">Näyttönäppäimistöllä teema</string>
<string name="controls_screenkb_by">%1$s %2$s</string>
<string name="accel_floating">Kelluva</string>
<string name="accel_fixed_start">Kiinteät kun sovellus käynnistyy</string>
<string name="accel_fixed_horiz">Korjattu taulukko työpöytä suuntautumiseen</string>
<string name="accel_question_center">Kiihtyvyysmittari keskiasentoon</string>
<string name="audiobuf_verysmall">Hyvin pieni (nopea laitteita, vähemmän lag)</string>
<string name="rightclick_question">Napsauta hiiren kakkospainikkeella alkunsa</string>
<string name="rightclick_menu">Valikkonäppäin</string>
<string name="rightclick_multitouch">Kosketusnäyttö on toinen sormi</string>
<string name="rightclick_pressure">Kosketusnäyttö voimalla</string>
<string name="pointandclick_question">Lisäominaisuudet</string>
<string name="pointandclick_keepaspectratio">Pidä 04:03 kuvasuhde</string>
<string name="pointandclick_showcreenunderfinger">Näytä näytön alle sormi erillisessä ikkunassa</string>
<string name="measurepressure_touchplease">Ole hyvä ja liu\u0026#39;uttamalla sormea näytöllä kaksi sekuntia</string>
<string name="rightclick_none">Poista oikealla hiiren klikkauksella</string>
<string name="leftclick_question">Vasen hiiren nappi</string>
<string name="leftclick_normal">Normaali</string>
<string name="leftclick_near_cursor">Touch lähellä hiiren kursori</string>
<string name="leftclick_multitouch">Kosketusnäyttö on toinen sormi</string>
<string name="leftclick_pressure">Kosketusnäyttö voimalla</string>
<string name="leftclick_dpadcenter">Trackball Valitse / Select-näppäintä</string>
<string name="pointandclick_joystickmouse">Siirrä hiiren ohjaimella tai trackball</string>
<string name="measurepressure_response">Paine %1$03d säde %2$03d</string>
<string name="click_with_dpadcenter">Vasen hiiren klikkaus trackball-ohjaimella keskusta</string>
<string name="pointandclick_joystickmousespeed">Siirrä hiiri ohjainta nopeasti</string>
<string name="pointandclick_joystickmouseaccel">Siirrä hiiri ohjainta kiihtyvyys</string>
<string name="none">Ei</string>
<string name="controls_screenkb_transparency">Näyttönäppäimistöllä avoimuutta</string>
<string name="controls_screenkb_trans_0">Näkymätön</string>
<string name="controls_screenkb_trans_1">Lähes näkymätön</string>
<string name="controls_screenkb_trans_2">Läpinäkyvä</string>
<string name="controls_screenkb_trans_3">Semi-avoimet</string>
<string name="controls_screenkb_trans_4">Ei-läpinäkyvä</string>
<string name="mouse_emulation">Hiiren emulointi</string>
<string name="measurepressure">Kalibroi kosketusnäyttö paine</string>
<string name="remap_hwkeys">Remap fyysiset näppäimet</string>
<string name="remap_hwkeys_press">Paina mitä tahansa näppäintä paitsi koti-ja POWER, voit käyttää äänenvoimakkuusnäppäimiä</string>
<string name="remap_hwkeys_select">Valitse SDL näppäinkoodien</string>
<string name="remap_screenkb">Remap näytön valvonnan</string>
<string name="remap_screenkb_joystick">Näytöllä ohjainta</string>
<string name="remap_screenkb_button">Ruutunäyttöpainike</string>
<string name="remap_screenkb_button_text">Näytön tekstin tulopainiketta</string>
<string name="remap_screenkb_button_zoomin">Suurenna kahden sormen elettä</string>
<string name="remap_screenkb_button_zoomout">Pienennä kahden sormen elettä</string>
<string name="remap_screenkb_button_rotateleft">Kierrä vasemmalle kahden sormen elettä</string>
<string name="remap_screenkb_button_rotateright">Kierrä oikealle kahden sormen elettä</string>
<string name="remap_screenkb_button_gestures">Kahden sormen eleitä</string>
<string name="accel_veryfast">Erittäin nopea</string>
<string name="remap_screenkb_button_gestures_sensitivity">Kahden sormen näytön eleet herkkyys</string>
<string name="storage_custom">Määritä hakemisto</string>
<string name="storage_commandline">Määritä komentoriviparametrit</string>
<string name="calibrate_touchscreen">Kalibroi kosketusnäyttö</string>
<string name="calibrate_touchscreen_touch">Touch kaikki neljä reunaa näytön, paina Valikko, kun olet valmis</string>
<string name="screenkb_custom_layout">Mukauta-ruudun näppäimistö</string>
<string name="screenkb_custom_layout_help">Työnnä näytön lisätä painikkeen, paina Menu kumota viimeksi painike</string>
<string name="rightclick_key">Fyysinen avain</string>
<string name="pointandclick_showcreenunderfinger2">Näytöllä suurennuslasi</string>
<string name="video">Videon asetukset</string>
<string name="video_smooth">Tasainen video</string>
<string name="accel_veryslow">Erittäin hidas</string>
<string name="leftclick_timeout">Pidä samalla paikalla</string>
<string name="leftclick_tap">Hana</string>
<string name="leftclick_tap_or_timeout">Napauta tai pidä</string>
<string name="leftclick_timeout_time">Holding aikakatkaisu</string>
<string name="leftclick_timeout_time_0">0,3 sekuntia</string>
<string name="leftclick_timeout_time_1">0,5 sekuntia</string>
<string name="leftclick_timeout_time_2">0,7 sekuntia</string>
<string name="leftclick_timeout_time_3">1 sek</string>
<string name="leftclick_timeout_time_4">1,5 sek</string>
<string name="pointandclick_relative">Suhteellinen hiiren liikkeet (kannettavan tietokoneen tilassa)</string>
<string name="pointandclick_relative_speed">Suhteellinen hiiren liikkeen nopeus</string>
<string name="pointandclick_relative_accel">Suhteellinen hiiren liikkeen kiihtyvyys</string>
<string name="downloads">Downloads</string>
<string name="video_separatethread">Erillisessä säikeessä video, kasvaa FPS joissakin laitteissa</string>
<string name="text_edit_click_here">Napauta aloittaa kirjoittamisen, paina Takaisin, kun olet valmis</string>
<string name="display_size_mouse">Määritä hiiren riippuen näytön koosta</string>
<string name="display_size">Valitse näytön koko</string>
<string name="display_size_large">Suuri (tabletti)</string>
<string name="display_size_small">Pieni (puhelin)</string>
<string name="display_size_tiny">Tiny (Xperia Mini)</string>
<string name="show_more_options">Näytä enemmän vaihtoehtoja</string>
<string name="controls_screenkb_drawsize">Koko painike kuvia</string>
</resources>

View File

@@ -1,176 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="init">Démarrage</string>
<string name="please_wait">Veuillez patienter pendant que les données sont téléchargées</string>
<string name="device_config">Configuration de l\'appareil</string>
<string name="device_change_cfg">Changer la configuration</string>
<string name="download_unneeded">Téléchargement non nécessaire</string>
<string name="connecting_to">Connexion à %s</string>
<string name="failed_connecting_to">Echec de la connexion à %s</string>
<string name="error_connecting_to">Erreur durant la connexion à %s</string>
<string name="dl_from">Téléchargement à partir de %s</string>
<string name="error_dl_from">Erreur lors du téléchargement à partir de %s</string>
<string name="error_write">Erreur d\'écriture dans %s</string>
<string name="dl_progress">%1$.0f%% fait : fichier %2$s</string>
<string name="dl_finished">Fini</string>
<string name="storage_phone">Stockage interne - %d Mo de libre</string>
<string name="storage_sd">Carte SD - %d Mo de libre</string>
<string name="storage_custom">Choisir le répertoire</string>
<string name="storage_commandline">Choisir les paramètres de la ligne de commande</string>
<string name="storage_question">Où télécharger les données</string>
<string name="optional_downloads">Téléchargements</string>
<string name="downloads">Téléchargements</string>
<string name="ok">OK</string>
<string name="controls_arrows">Flèches / joystick / dpad</string>
<string name="controls_trackball">Trackball</string>
<string name="controls_accel">Accéléromètre</string>
<string name="controls_touch">Ecran tactile seul</string>
<string name="controls_question">Quel type de touches votre appareil a-t-il?</string>
<string name="controls_additional">Contrôles supplémentaires</string>
<string name="controls_screenkb">Clavier à l\'écran</string>
<string name="controls_accelnav">Accéléromètre</string>
<string name="controls_screenkb_size">Taille du clavier à l\'écran</string>
<string name="controls_screenkb_drawsize">Taille des images des boutons</string>
<string name="controls_screenkb_large">Grande</string>
<string name="controls_screenkb_medium">Moyenne</string>
<string name="controls_screenkb_small">Petite</string>
<string name="controls_screenkb_tiny">Minuscule</string>
<string name="controls_screenkb_theme">Thème du clavier à l\'écran</string>
<string name="controls_screenkb_by">%1$s par %2$s</string>
<string name="controls_screenkb_transparency">Transparence du clavier</string>
<string name="controls_screenkb_trans_0">Invisible</string>
<string name="controls_screenkb_trans_1">Presque invisible</string>
<string name="controls_screenkb_trans_2">Transparent</string>
<string name="controls_screenkb_trans_3">Semi-transparent</string>
<string name="controls_screenkb_trans_4">Non-transparent</string>
<string name="trackball_no_dampening">Sans limite</string>
<string name="trackball_fast">Rapide</string>
<string name="trackball_medium">Moyenne</string>
<string name="trackball_slow">Lente</string>
<string name="trackball_question">Limitation du trackball</string>
<string name="accel_veryfast">Très rapide</string>
<string name="accel_fast">Rapide</string>
<string name="accel_medium">Moyenne</string>
<string name="accel_slow">Lente</string>
<string name="accel_veryslow">Très lente</string>
<string name="accel_question">Sensibilité de l\'accéléromètre</string>
<string name="accel_floating">Flottante</string>
<string name="accel_fixed_start">Déterminée au démarrage de l\'application</string>
<string name="accel_fixed_horiz">Orientaton de la table</string>
<string name="accel_question_center">Position du centre de l\'accéléromètre</string>
<string name="mouse_emulation">Emulation de la souris</string>
<string name="rightclick_question">Clic droit de la souris</string>
<string name="rightclick_menu">Touche Menu</string>
<string name="rightclick_key">Touche Physique</string>
<string name="rightclick_multitouch">Ecran tactile avec le deuxième doigt</string>
<string name="rightclick_pressure">Ecran tactile avec force</string>
<string name="rightclick_none">Désactiver le clic droit de la souris</string>
<string name="leftclick_question">Clic gauche de la souris</string>
<string name="leftclick_normal">Normal</string>
<string name="leftclick_near_cursor">Curseur de la souris près Touch</string>
<string name="leftclick_multitouch">Ecran tactile avec le deuxième doigt</string>
<string name="leftclick_pressure">Ecran tactile avec force</string>
<string name="leftclick_dpadcenter">Trackball clic / Joystick au centre</string>
<string name="leftclick_timeout">Tenir au même endroit</string>
<string name="leftclick_tap">Appuyez sur</string>
<string name="leftclick_tap_or_timeout">Appuyez sur, ou maintenez</string>
<string name="leftclick_timeout_time">timeout Holding</string>
<string name="leftclick_timeout_time_0">0,3 s</string>
<string name="leftclick_timeout_time_1">0,5 sec</string>
<string name="leftclick_timeout_time_2">0,7 sec</string>
<string name="leftclick_timeout_time_3">1 sec</string>
<string name="leftclick_timeout_time_4">1,5 sec</string>
<string name="click_with_dpadcenter">Cliquez gauche de la souris avec le Trackball / centre du joystick </string>
<string name="pointandclick_question">Fonctionnalités avancées</string>
<string name="pointandclick_keepaspectratio">Gardez le format 4:3 écran</string>
<string name="pointandclick_showcreenunderfinger">Afficher l\'écran sous le doigt dans une fenêtre séparée</string>
<string name="pointandclick_showcreenunderfinger2">Loupe à l\'écran</string>
<string name="pointandclick_joystickmouse">Déplacez la souris avec un trackball ou le joystick</string>
<string name="pointandclick_joystickmousespeed">Déplacez la souris avec la vitesse du joystick</string>
<string name="pointandclick_joystickmouseaccel">Déplacez la souris avec l\'accélération du joystick</string>
<string name="pointandclick_relative">Mouvement relatif de la souris (mode portable)</string>
<string name="pointandclick_relative_speed">Vitesse relative de la souris</string>
<string name="pointandclick_relative_accel">Accélération relative de la souris</string>
<string name="none">Aucun</string>
<string name="measurepressure">Calibrer la pression de l\'écran tactile</string>
<string name="measurepressure_touchplease">Glisser les doigts sur l\'écran pendant deux secondes</string>
<string name="measurepressure_response">Pression %1$03d rayon %2$03d</string>
<string name="audiobuf_verysmall">Très petite (appareils rapides, plus de réactivité)</string>
<string name="audiobuf_small">Petite (appareils rapides)</string>
<string name="audiobuf_medium">Moyenne</string>
<string name="audiobuf_large">Grande (appareils anciens, si le son est saccadé)</string>
<string name="audiobuf_question">Taille du tampon audio</string>
<string name="remap_hwkeys">Reconfigurer les touches physiques</string>
<string name="remap_hwkeys_press">Appuyez sur n\'importe quelle touche sauf HOME et POWER, vous pouvez utiliser les touches de volume</string>
<string name="remap_hwkeys_select">Sélectionnez le keycode SDL</string>
<string name="remap_screenkb">Reconfigurer les contrôles via l\'écran</string>
<string name="remap_screenkb_joystick">Joystick à l\'écran</string>
<string name="remap_screenkb_button">Bouton à l\'écran</string>
<string name="remap_screenkb_button_text">Saisie de texte à l\'écran</string>
<string name="remap_screenkb_button_gestures">Gestes avec deux doigts</string>
<string name="remap_screenkb_button_gestures_sensitivity">Sensibilité des gestes</string>
<string name="remap_screenkb_button_zoomin">Geste de +Zoom avec deux doigts</string>
<string name="remap_screenkb_button_zoomout">Geste de -Zoom avec deux doigts</string>
<string name="remap_screenkb_button_rotateleft">Geste de rotation à gauche avec deux doigts</string>
<string name="remap_screenkb_button_rotateright">Geste de rotation à droite avec deux doigts</string>
<string name="screenkb_custom_layout">Personnalisation de la présentation du clavier à l\'écran</string>
<string name="calibrate_touchscreen">Calibrer l\'écran tactile</string>
<string name="calibrate_touchscreen_touch">Touchez les bords de l\'écran, appuyez sur Retour/BACK lorsque vous avez terminé</string>
<string name="video">Paramètres vidéo</string>
<string name="video_smooth">Fluidité de la vidéo</string>
<string name="video_separatethread">Thread séparé pour la vidéo : permet paroifs d\'augmenter FPS</string>
<string name="text_edit_click_here">Appuyez pour commencer à taper, appuyez sur Retour/BACK lorsque vous avez terminé</string>
<string name="display_size_mouse">Mode d\'émulation de la souris</string>
<string name="display_size">Sélectionnez votre taille d\'affichage</string>
<string name="display_size_large">Large (tablet)</string>
<string name="display_size_small">Petit (téléphone)</string>
<string name="display_size_small_touchpad">Petit, mode touchpad</string>
<string name="display_size_tiny">Très petit</string>
<string name="display_size_tiny_touchpad">Très petit, mode touchpad</string>
<string name="show_more_options">Afficher plus d\'options</string>
<string name="hardware_mouse_detected">Hardware mouse detected, disabling mouse emulation</string>
<string name="not_enough_ram">Not enough RAM</string>
<string name="not_enough_ram_size">This app needs %1$d Mb RAM, your device has %2$d Mb</string>
<string name="ignore">Ignore</string>
<string name="calibrate_gyroscope">Calibrate gyroscope</string>
<string name="calibrate_gyroscope_text">Put your phone on a flat surface</string>
<string name="reset_config">Reset config to defaults</string>
<string name="cancel">Cancel</string>
<string name="calibrate_gyroscope_not_supported">Your device does not have gyroscope</string>
<string name="reset_config_ask">Reset all options to default values?</string>
<string name="cancel_download">Cancel data downloading?</string>
<string name="cancel_download_resume">You can resume it later, the data will not be downloaded twice.</string>
<string name="yes">Yes</string>
<string name="no">No</string>
<string name="screenkb_custom_layout_help">Press BACK when done. Resize buttons by sliding on empty space.</string>
<string name="controls_screenkb_custom">Custom</string>
</resources>

View File

@@ -1,149 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="init">Инициализация</string>
<string name="please_wait">Пожалуйста, подождите, пока данные загружаются</string>
<string name="device_config">Конфигурация устройства</string>
<string name="device_change_cfg">Изменение конфигурации устройства</string>
<string name="download_unneeded">Нет необходимости скачивать</string>
<string name="connecting_to">Подключение к %s</string>
<string name="failed_connecting_to">Ошибка подключения к %s</string>
<string name="error_connecting_to">Ошибка подключения к %s</string>
<string name="dl_from">Загрузка данных с %s</string>
<string name="error_dl_from">Ошибка при загрузке данных с %s</string>
<string name="error_write">Ошибка записи в %s</string>
<string name="dl_progress">%1$.0f%% готово: файл %2$s</string>
<string name="dl_finished">Завершенный</string>
<string name="storage_phone">Внутреннее хранение - %d Мб</string>
<string name="storage_sd">SD карта - %d Мб</string>
<string name="storage_question">Куда сохранять данные приложения</string>
<string name="optional_downloads">Дополнительные загрузки</string>
<string name="ok">Продолжить</string>
<string name="controls_arrows">Стрелки / джойстик / Dpad</string>
<string name="controls_trackball">Трекбол</string>
<string name="controls_accel">Акселерометр</string>
<string name="controls_touch">Только сенсорный экран</string>
<string name="controls_question">Какие на телефоне клавиши навигации?</string>
<string name="controls_additional">Дополнительные элементы управления</string>
<string name="controls_screenkb">Экранная клавиатура</string>
<string name="controls_accelnav">Акселерометр</string>
<string name="controls_screenkb_size">Размер экранной клавиатуры</string>
<string name="controls_screenkb_large">Большой</string>
<string name="controls_screenkb_medium">Средний</string>
<string name="controls_screenkb_small">Маленький</string>
<string name="controls_screenkb_tiny">Крошечный</string>
<string name="controls_screenkb_theme">Тема клавиатуры</string>
<string name="controls_screenkb_by">%1$s от %2$s</string>
<string name="trackball_no_dampening">Нет</string>
<string name="trackball_fast">Быстрое</string>
<string name="trackball_medium">Среднее</string>
<string name="trackball_slow">Медленное</string>
<string name="trackball_question">Замедление трекбола</string>
<string name="accel_fast">Быстрая</string>
<string name="accel_medium">Средний</string>
<string name="accel_slow">Медленно</string>
<string name="accel_question">Чувствительность акселерометра</string>
<string name="rightclick_question">Правая кнопка мыши</string>
<string name="rightclick_menu">Клавиша меню</string>
<string name="rightclick_multitouch">Касание экрана вторым пальцем</string>
<string name="rightclick_pressure">Нажатие на экран с силой</string>
<string name="pointandclick_question">Расширенные функции</string>
<string name="pointandclick_keepaspectratio">Сохранять соотношение сторон 4:3 на экране</string>
<string name="pointandclick_showcreenunderfinger">Экранная лупа</string>
<string name="measurepressure_touchplease">Пожалуйста, проведите пальцем по экрану в течение двух секунд</string>
<string name="measurepressure_response">Давление %1$03d радиус %2$03d </string>
<string name="audiobuf_verysmall">Очень мало (быстрые устройства)</string>
<string name="audiobuf_small">Малый</string>
<string name="audiobuf_medium">Средний</string>
<string name="audiobuf_large">Большой (для старых устройств, если звук прерывается)</string>
<string name="audiobuf_question">Размер буфера аудио</string>
<string name="accel_floating">Плавающее</string>
<string name="accel_fixed_start">Фиксировано при запуске приложения</string>
<string name="accel_fixed_horiz">Фиксировано на горизонт</string>
<string name="accel_question_center">Центральное положение акселерометра</string>
<string name="rightclick_none">Правая кнопка мыши отключена</string>
<string name="leftclick_question">Левая кнопка мыши</string>
<string name="leftclick_normal">Нормальный</string>
<string name="leftclick_near_cursor">Касание возле курсора мыши</string>
<string name="leftclick_multitouch">Касание двумя пальцами</string>
<string name="leftclick_pressure">Нажатие с силой</string>
<string name="leftclick_dpadcenter">Нажатие на трекбол / центр джойстика</string>
<string name="pointandclick_joystickmouse">Перемещение мыши при помощи джойстика или трекбола</string>
<string name="click_with_dpadcenter">Левый клик мыши при помощи трекбола / центра джойстика</string>
<string name="pointandclick_joystickmousespeed">Перемещение мыши джойстиком - скорость</string>
<string name="pointandclick_joystickmouseaccel">Перемещение мыши джойстиком - ускорение</string>
<string name="none">Нет</string>
<string name="controls_screenkb_transparency">Прозрачность клавиатуры</string>
<string name="controls_screenkb_trans_0">Невидимый</string>
<string name="controls_screenkb_trans_1">Почти невидимый</string>
<string name="controls_screenkb_trans_2">Прозрачный</string>
<string name="controls_screenkb_trans_3">Полупрозрачные</string>
<string name="controls_screenkb_trans_4">Непрозрачные</string>
<string name="mouse_emulation">Эмуляции мыши</string>
<string name="measurepressure">Калибровка сенсорного давления</string>
<string name="remap_hwkeys">Переназначение физических клавиш</string>
<string name="remap_hwkeys_press">Нажмите любую клавишу, кроме HOME и POWER, вы можете использовать клавиши регулировки громкости</string>
<string name="remap_hwkeys_select">Выберите код кнопки SDL</string>
<string name="remap_screenkb">Переназначение экранных кнопок</string>
<string name="remap_screenkb_joystick">Экранный джойстик</string>
<string name="remap_screenkb_button">Экранные кнопки</string>
<string name="remap_screenkb_button_text">Экранная кнопка ввода текста</string>
<string name="remap_screenkb_button_zoomin">Увеличить двумя пальцами</string>
<string name="remap_screenkb_button_zoomout">Уменьшить двумя пальцами</string>
<string name="remap_screenkb_button_rotateleft">Повернуть налево двумя пальцами</string>
<string name="remap_screenkb_button_rotateright">Повернуть вправо двумя пальцами</string>
<string name="remap_screenkb_button_gestures">Жест двумя пальцами по экрану</string>
<string name="accel_veryfast">Очень быстро</string>
<string name="remap_screenkb_button_gestures_sensitivity">Чувствительность жеста двумя пальцами по экрану</string>
<string name="storage_custom">Укажите каталог</string>
<string name="storage_commandline">Укажите параметры командной строки</string>
<string name="calibrate_touchscreen">Калибровка сенсорного экрана</string>
<string name="calibrate_touchscreen_touch">Дотроньтесь до всех краев экрана, потом нажмите Назад/BACK</string>
<string name="screenkb_custom_layout">Настройка расположения кнопок</string>
<string name="screenkb_custom_layout_help">Нажмите клавишу Назад/BACK для завершения. Проведите по пустому месту, чтобы изменить размер кнопки</string>
<string name="rightclick_key">Физическая кнопка</string>
<string name="pointandclick_showcreenunderfinger2">Наэкранная лупа</string>
<string name="video">Настройки видео</string>
<string name="video_smooth">Линейное сглаживание видео</string>
<string name="accel_veryslow">Очень медленно</string>
<string name="leftclick_timeout">Нажатие с задержкой</string>
<string name="leftclick_tap">Быстрое нажатие</string>
<string name="leftclick_tap_or_timeout">Быстрое нажатие либо с задержкой</string>
<string name="leftclick_timeout_time">Время нажатия</string>
<string name="leftclick_timeout_time_0">0,3 сек</string>
<string name="leftclick_timeout_time_1">0,5 сек</string>
<string name="leftclick_timeout_time_2">0,7 сек</string>
<string name="leftclick_timeout_time_3">1 сек</string>
<string name="leftclick_timeout_time_4">1,5 сек</string>
<string name="pointandclick_relative">Относительное движение мыши (режим ноутбука)</string>
<string name="pointandclick_relative_speed">Скорость движения мыши</string>
<string name="pointandclick_relative_accel">Ускорение движения мыши</string>
<string name="downloads">Загрузки</string>
<string name="video_separatethread">Отдельный поток для видео, увеличит FPS на некоторых устройствах</string>
<string name="text_edit_click_here">Нажмите, чтобы ввести текст, нажмите Назад, когда закончите</string>
<string name="display_size_mouse">Настройка размера дисплея</string>
<string name="display_size">Размер дисплея</string>
<string name="display_size_large">Большой (таблетка)</string>
<string name="display_size_small">Маленький (телефон)</string>
<string name="display_size_tiny">Крохотный</string>
<string name="show_more_options">Показать больше параметров</string>
<string name="controls_screenkb_drawsize">Размер изображения кнопок</string>
<string name="display_size_small_touchpad">Маленький, режим тачпада</string>
<string name="display_size_tiny_touchpad">Крохотный, режим тачпада</string>
<string name="hardware_mouse_detected">Обнаружена внешняя мышь, эмуляция мыши выключена</string>
<string name="not_enough_ram">Недостаточно оперативной памяти</string>
<string name="not_enough_ram_size">Для запуска приложения нужно %1$d Мб оперативной памяти, на этом устройстве есть %2$d Мб</string>
<string name="ignore">Игнорировать</string>
<string name="calibrate_gyroscope">Калибровать гироскоп</string>
<string name="calibrate_gyroscope_text">Положите устройство на ровную поверхность</string>
<string name="reset_config">Сбросить все настройки</string>
<string name="cancel">Отменить</string>
<string name="calibrate_gyroscope_not_supported">Гироскоп отсутствует</string>
<string name="reset_config_ask">Сбросить все настройки в значения по умолчанию?</string>
<string name="cancel_download">Остановить загрузку?</string>
<string name="cancel_download_resume">Загрузка может быть продолжена позднее.</string>
<string name="yes">Да</string>
<string name="no">Нет</string>
<string name="controls_screenkb_custom">Пользовательские настройки</string>
</resources>

View File

@@ -1,148 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="init">Ініціалізація</string>
<string name="please_wait">Будь-ласка, зачекайте, поки завантажуться дані</string>
<string name="device_config">Конфігурація пристрою</string>
<string name="device_change_cfg">Зміна конфігурації пристрою</string>
<string name="download_unneeded">Немає необхідності викачувати</string>
<string name="connecting_to">Підключенння до %s</string>
<string name="failed_connecting_to">Помилка підключення до %s</string>
<string name="error_connecting_to">помилка підключення до %s</string>
<string name="dl_from">Завантаження даних з %s</string>
<string name="error_dl_from">Помилка при завантаженні даних з %s</string>
<string name="error_write">Помилка запису в %s</string>
<string name="dl_progress">%1$.0f%% готово: файл %2$s</string>
<string name="dl_finished">Завершений</string>
<string name="storage_phone">Внутрішнє зберігання - %d Мб</string>
<string name="storage_sd">SD карта - %d Мб</string>
<string name="storage_question">Куди зберігати дані програми</string>
<string name="optional_downloads">Додаткові завантаження</string>
<string name="ok">ОК</string>
<string name="controls_arrows">Стрілки / джойстік / Dpad</string>
<string name="controls_trackball">Трекбол</string>
<string name="controls_accel">Акселерометр</string>
<string name="controls_touch">Тільки сенсорний екран</string>
<string name="controls_question">Які на телефоні кнопки навігації?</string>
<string name="controls_additional">Додаткові элементи керування</string>
<string name="controls_screenkb">Наекранні кнопки</string>
<string name="controls_accelnav">Акселерометр</string>
<string name="controls_screenkb_size">Розмір наекранних кнопок</string>
<string name="controls_screenkb_large">Великий</string>
<string name="controls_screenkb_medium">Середній</string>
<string name="controls_screenkb_small">Малий</string>
<string name="controls_screenkb_tiny">Дрібний</string>
<string name="controls_screenkb_theme">Тема кнопок</string>
<string name="controls_screenkb_by">%1$s від %2$s</string>
<string name="trackball_no_dampening">Немає</string>
<string name="trackball_fast">Швидке</string>
<string name="trackball_medium">Середнє</string>
<string name="trackball_slow">Повільне</string>
<string name="trackball_question">Сповільнення трекболу</string>
<string name="accel_fast">Швидко</string>
<string name="accel_medium">середньо</string>
<string name="accel_slow">повільно</string>
<string name="accel_question">Чутливість акселерометру</string>
<string name="rightclick_question">Права кнопка миші</string>
<string name="rightclick_menu">Кнопка меню</string>
<string name="rightclick_multitouch">Торкання екрана другим пальцем</string>
<string name="rightclick_pressure">Натиск на екран силою</string>
<string name="pointandclick_question">Розширені функції</string>
<string name="pointandclick_keepaspectratio">Зберігати співвідношення сторін 4:3 на екрані</string>
<string name="pointandclick_showcreenunderfinger">Наекранна лупа</string>
<string name="measurepressure_touchplease">Будь-ласка, проведіть пальцем по екрану на протязі двох секунд</string>
<string name="measurepressure_response">Тиск %1$03d радіус %2$03d </string>
<string name="audiobuf_verysmall">Дуже мало (швидкі пристрої)</string>
<string name="audiobuf_small">Малий</string>
<string name="audiobuf_medium">Середній</string>
<string name="audiobuf_large">Великий (для старих пристроїв, якщо звук переривається)</string>
<string name="audiobuf_question">Розмір буферу аудіо</string>
<string name="accel_floating">Плаваюче</string>
<string name="accel_fixed_start">Фiксоване під час запуску програми</string>
<string name="accel_fixed_horiz">Фiксоване до горизонту</string>
<string name="accel_question_center">Центральне положення акселерометра</string>
<string name="rightclick_none">Вiдключена</string>
<string name="leftclick_question">Ліва кнопка миші</string>
<string name="leftclick_normal">Нормальна</string>
<string name="leftclick_near_cursor">Дотик біля курсору миші</string>
<string name="leftclick_multitouch">Натиск на екран другим пальцем</string>
<string name="leftclick_pressure">>Натиск на екран з силою</string>
<string name="leftclick_dpadcenter">Натиск на трекбол / центр джойстику</string>
<string name="pointandclick_joystickmouse">Переміщення миші за допомогою джойстика або трекбола</string>
<string name="click_with_dpadcenter">Лівий клік миші за допомогою трекбола / центра джойстика</string>
<string name="pointandclick_joystickmousespeed">Переміщення миші джойстиком - швидкiсть</string>
<string name="pointandclick_joystickmouseaccel">Переміщення миші джойстиком - прискорення</string>
<string name="none">Немає</string>
<string name="controls_screenkb_transparency">Прозорість клавіатури</string>
<string name="controls_screenkb_trans_0">Невидимий</string>
<string name="controls_screenkb_trans_1">Майже невидимий</string>
<string name="controls_screenkb_trans_2">Прозорий</string>
<string name="controls_screenkb_trans_3">Напівпрозорі</string>
<string name="controls_screenkb_trans_4">Непрозорі</string>
<string name="mouse_emulation">Емуляція миші</string>
<string name="measurepressure">Калібрування сенсорного натискання</string>
<string name="remap_hwkeys">Перепризначення фізичних кнопок</string>
<string name="remap_hwkeys_press">Натисніть будь-яку клавішу, крім HOME і POWER, ви можете використовувати клавіші регулювання гучності</string>
<string name="remap_hwkeys_select">Виберіть код кнопки SDL</string>
<string name="remap_screenkb">Перепризначення наекранних кнопок</string>
<string name="remap_screenkb_joystick">Наекранний джойстік</string>
<string name="remap_screenkb_button">Наекранні кнопки</string>
<string name="remap_screenkb_button_text">Наекранна кнопка вводу тексту</string>
<string name="remap_screenkb_button_zoomin">Збільшити двома пальцями</string>
<string name="remap_screenkb_button_zoomout">Зменшити двома пальцями</string>
<string name="remap_screenkb_button_rotateleft">Повернути наліво двома пальцями</string>
<string name="remap_screenkb_button_rotateright">Повернути праворуч двома пальцями</string>
<string name="remap_screenkb_button_gestures">Жест двома пальцями по екрану</string>
<string name="accel_veryfast">Дуже швидко</string>
<string name="remap_screenkb_button_gestures_sensitivity">Чутливість жесту двома пальцями по екрану</string>
<string name="storage_custom">Вкажіть каталог</string>
<string name="storage_commandline">Вкажіть параметри командного рядка</string>
<string name="calibrate_touchscreen">Калібрування сенсорного екрану</string>
<string name="calibrate_touchscreen_touch">Доторкнiться до всіх країв екрану, потiм натисніть Назад/BACK</string>
<string name="screenkb_custom_layout">Налаштування положення кнопок</string>
<string name="screenkb_custom_layout_help">Натисніть Назад/BACK для завершення. Проведiть по екрану, щоб змінити розмір кнопки</string>
<string name="rightclick_key">Фізична кнопка</string>
<string name="pointandclick_showcreenunderfinger2">Наекранна лупа</string>
<string name="video">Налаштування відео</string>
<string name="video_smooth">Лінійне сглажування відео</string>
<string name="accel_veryslow">Дуже повільно</string>
<string name="leftclick_timeout">Натискання з затримкою</string>
<string name="leftclick_tap">Швидке натискання</string>
<string name="leftclick_tap_or_timeout">Швидке натискання або з затримкою</string>
<string name="leftclick_timeout_time">Час натискання</string>
<string name="leftclick_timeout_time_0">0,3 сек</string>
<string name="leftclick_timeout_time_1">0,5 сек</string>
<string name="leftclick_timeout_time_2">0,7 секунд</string>
<string name="leftclick_timeout_time_3">1 сек</string>
<string name="leftclick_timeout_time_4">1,5 сек</string>
<string name="pointandclick_relative">Відносний рух миші (режим ноутбука)</string>
<string name="pointandclick_relative_speed">Швидкість руху миші</string>
<string name="pointandclick_relative_accel">Прискорення руху миші</string>
<string name="downloads">Завантаження</string>
<string name="video_separatethread">Окремий потік для відео, збільшить FPS на деяких пристроях</string>
<string name="text_edit_click_here">Натисніть, щоб ввести текст, натисніть Назад, коли закiнчете</string>
<string name="display_size_mouse">Налаштування розміру дисплея</string>
<string name="display_size">Виберіть розмір дисплея</string>
<string name="display_size_large">Великий (таблетка)</string>
<string name="display_size_small">Маленький</string>
<string name="display_size_tiny">Крихiтний</string>
<string name="show_more_options">Показати більше параметрів</string>
<string name="controls_screenkb_drawsize">Розмір зображення кнопок</string>
<string name="display_size_small_touchpad">Маленький, режим тачпаду</string>
<string name="display_size_tiny_touchpad">Крихiтний, режим тачпаду</string>
<string name="hardware_mouse_detected">Виявлена зовнiшня миша, емуляція миші вимкнена</string>
<string name="not_enough_ram">Недостатньо пам’яті</string>
<string name="not_enough_ram_size">Потрібно %1$d Mb пам’яті, доступно лише %2$d Mb</string>
<string name="ignore">Ігнорувати</string>
<string name="calibrate_gyroscope">Калібрувати гіроскоп</string>
<string name="calibrate_gyroscope_text">Покладіть телефон на рівну поверхню</string>
<string name="reset_config">Скинути всі налаштування</string>
<string name="cancel">Відмінити</string>
<string name="calibrate_gyroscope_not_supported">Гіроскоп відсутній</string>
<string name="reset_config_ask">Скинути всі налаштування у значення за замовчуванням?</string>
<string name="cancel_download">Припинити завантаження?</string>
<string name="cancel_download_resume">Завантаження може бути відновлено пізніше.</string>
<string name="yes">Так</string>
<string name="no">Ні</string>
<string name="controls_screenkb_custom">Налаштування користувача</string>
</resources>

View File

@@ -1,181 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Commander Genius</string>
<string name="init">Initializing</string>
<string name="please_wait">Please wait while data is being downloaded</string>
<string name="device_config">Device configuration</string>
<string name="device_change_cfg">Change device configuration</string>
<string name="download_unneeded">No need to download</string>
<string name="connecting_to">Connecting to %s</string>
<string name="failed_connecting_to">Failed connecting to %s</string>
<string name="error_connecting_to">Error connecting to %s</string>
<string name="dl_from">Downloading data from %s</string>
<string name="error_dl_from">Error downloading data from %s</string>
<string name="error_write">Error writing to %s</string>
<string name="dl_progress">%1$.0f%% done: file %2$s</string>
<string name="dl_finished">Finished</string>
<string name="storage_phone">Internal storage - %d MB free</string>
<string name="storage_sd">SD card storage - %d MB free</string>
<string name="storage_custom">Specify directory</string>
<string name="storage_commandline">Specify command line parameters</string>
<string name="storage_question">Data installation location</string>
<string name="optional_downloads">Downloads</string>
<string name="downloads">Downloads</string>
<string name="ok">OK</string>
<string name="cancel">Cancel</string>
<string name="controls_arrows">Arrows / joystick / dpad</string>
<string name="controls_trackball">Trackball</string>
<string name="controls_accel">Accelerometer</string>
<string name="controls_touch">Touchscreen only</string>
<string name="controls_question">What kind of navigation keys does your device have?</string>
<string name="controls_additional">Additional controls</string>
<string name="controls_screenkb">On-screen keyboard</string>
<string name="controls_accelnav">Accelerometer</string>
<string name="controls_screenkb_size">On-screen keyboard size</string>
<string name="controls_screenkb_drawsize">Size of button images</string>
<string name="controls_screenkb_large">Large</string>
<string name="controls_screenkb_medium">Medium</string>
<string name="controls_screenkb_small">Small</string>
<string name="controls_screenkb_tiny">Tiny</string>
<string name="controls_screenkb_custom">Custom</string>
<string name="controls_screenkb_theme">On-screen keyboard theme</string>
<string name="controls_screenkb_by">%1$s by %2$s</string>
<string name="controls_screenkb_transparency">On-screen keyboard transparency</string>
<string name="controls_screenkb_trans_0">Invisible</string>
<string name="controls_screenkb_trans_1">Almost invisible</string>
<string name="controls_screenkb_trans_2">Transparent</string>
<string name="controls_screenkb_trans_3">Semi-transparent</string>
<string name="controls_screenkb_trans_4">Non-transparent</string>
<string name="trackball_no_dampening">No dampening</string>
<string name="trackball_fast">Fast</string>
<string name="trackball_medium">Medium</string>
<string name="trackball_slow">Slow</string>
<string name="trackball_question">Trackball dampening</string>
<string name="accel_veryfast">Very fast</string>
<string name="accel_fast">Fast</string>
<string name="accel_medium">Medium</string>
<string name="accel_slow">Slow</string>
<string name="accel_veryslow">Very slow</string>
<string name="accel_question">Accelerometer sensitivity</string>
<string name="accel_floating">Floating</string>
<string name="accel_fixed_start">Fixed when application starts</string>
<string name="accel_fixed_horiz">Fixed to table desk orientation</string>
<string name="accel_question_center">Accelerometer center position</string>
<string name="mouse_emulation">Mouse emulation</string>
<string name="rightclick_question">Right mouse click</string>
<string name="rightclick_menu">Menu key</string>
<string name="rightclick_key">Physical key</string>
<string name="rightclick_multitouch">Touch screen with second finger</string>
<string name="rightclick_pressure">Touch screen with force</string>
<string name="rightclick_none">Disable right mouse click</string>
<string name="leftclick_question">Left mouse click</string>
<string name="leftclick_normal">Normal</string>
<string name="leftclick_near_cursor">Touch near mouse cursor</string>
<string name="leftclick_multitouch">Touch screen with second finger</string>
<string name="leftclick_pressure">Touch screen with force</string>
<string name="leftclick_dpadcenter">Trackball click / joystick center</string>
<string name="leftclick_timeout">Hold at the same spot</string>
<string name="leftclick_tap">Tap</string>
<string name="leftclick_tap_or_timeout">Tap or hold</string>
<string name="leftclick_timeout_time">Holding timeout</string>
<string name="leftclick_timeout_time_0">0.3 sec</string>
<string name="leftclick_timeout_time_1">0.5 sec</string>
<string name="leftclick_timeout_time_2">0.7 sec</string>
<string name="leftclick_timeout_time_3">1 sec</string>
<string name="leftclick_timeout_time_4">1.5 sec</string>
<string name="click_with_dpadcenter">Left mouse click with trackball / joystick center</string>
<string name="pointandclick_question">Advanced features</string>
<string name="pointandclick_keepaspectratio">Keep 4:3 screen aspect ratio</string>
<string name="pointandclick_showcreenunderfinger">Show screen under finger in separate window</string>
<string name="pointandclick_showcreenunderfinger2">On-screen magnifying glass</string>
<string name="pointandclick_joystickmouse">Move mouse with joystick or trackball</string>
<string name="pointandclick_joystickmousespeed">Move mouse with joystick speed</string>
<string name="pointandclick_joystickmouseaccel">Move mouse with joystick acceleration</string>
<string name="pointandclick_relative">Relative mouse movement (laptop mode)</string>
<string name="pointandclick_relative_speed">Relative mouse movement speed</string>
<string name="pointandclick_relative_accel">Relative mouse movement acceleration</string>
<string name="none">None</string>
<string name="measurepressure">Calibrate touchscreen pressure</string>
<string name="measurepressure_touchplease">Please slide finger across the screen for two seconds</string>
<string name="measurepressure_response">Pressure %1$03d radius %2$03d</string>
<string name="audiobuf_verysmall">Very small (fast devices, less lag)</string>
<string name="audiobuf_small">Small</string>
<string name="audiobuf_medium">Medium</string>
<string name="audiobuf_large">Large (older devices, if sound is choppy)</string>
<string name="audiobuf_question">Size of audio buffer</string>
<string name="remap_hwkeys">Remap physical keys</string>
<string name="remap_hwkeys_press">Press any key except HOME and POWER, you may use volume keys</string>
<string name="remap_hwkeys_select">Select SDL keycode</string>
<string name="remap_hwkeys_select_simple">Select action</string>
<string name="remap_hwkeys_select_more_keys">Show all keycodes</string>
<string name="remap_screenkb">Remap on-screen controls</string>
<string name="remap_screenkb_joystick">Joystick</string>
<string name="remap_screenkb_button">Button</string>
<string name="remap_screenkb_button_text">Text input button</string>
<string name="remap_screenkb_button_gestures">Two-finger screen gestures</string>
<string name="remap_screenkb_button_gestures_sensitivity">Two-finger screen gestures sensitivity</string>
<string name="remap_screenkb_button_zoomin">Zoom in two-finger gesture</string>
<string name="remap_screenkb_button_zoomout">Zoom out two-finger gesture</string>
<string name="remap_screenkb_button_rotateleft">Rotate left two-finger gesture</string>
<string name="remap_screenkb_button_rotateright">Rotate right two-finger gesture</string>
<string name="screenkb_custom_layout">Customize on-screen keyboard layout</string>
<string name="screenkb_custom_layout_help">Press BACK when done. Resize buttons by sliding on empty space.</string>
<string name="calibrate_touchscreen">Calibrate touchscreen</string>
<string name="calibrate_touchscreen_touch">Touch all edges of the screen, press BACK when done</string>
<string name="video">Video settings</string>
<string name="video_smooth">Linear video filtering</string>
<string name="video_separatethread">Separate thread for video, will increase FPS on some devices</string>
<string name="text_edit_click_here">Tap to start typing, press Back when done</string>
<string name="display_size_mouse">Mouse emulation mode</string>
<string name="display_size">Display size for mouse emulation</string>
<string name="display_size_large">Large (tablets)</string>
<string name="display_size_small">Small, magnifying glass</string>
<string name="display_size_small_touchpad">Small, touchpad mode</string>
<string name="display_size_tiny">Tiny</string>
<string name="display_size_tiny_touchpad">Tiny, touchpad mode</string>
<string name="show_more_options">Show more options</string>
<string name="hardware_mouse_detected">Hardware mouse detected, disabling mouse emulation</string>
<string name="not_enough_ram">Not enough RAM</string>
<string name="not_enough_ram_size">This app needs %1$d Mb RAM, your device has %2$d Mb</string>
<string name="ignore">Ignore</string>
<string name="calibrate_gyroscope">Calibrate gyroscope</string>
<string name="calibrate_gyroscope_text">Put your device on a flat surface</string>
<string name="calibrate_gyroscope_not_supported">Your device does not have gyroscope</string>
<string name="reset_config">Reset config to defaults</string>
<string name="reset_config_ask">Reset all options to default values?</string>
<string name="cancel_download">Cancel data downloading?</string>
<string name="cancel_download_resume">You can resume it later, the data will not be downloaded twice.</string>
<string name="yes">Yes</string>
<string name="no">No</string>
</resources>

View File

@@ -4,12 +4,19 @@ ifneq ($(strip $(filter mad, $(COMPILED_LIBRARIES))),)
SDL_MIXER_USE_LIBMAD := 1
endif
# Disable timidity library inside sdl2_mixer, we have our own version of timidity used by OpenTTD
SUPPORT_MID_TIMIDITY := 0
NDK_VERSION := $(strip $(patsubst android-ndk-%,%,$(filter android-ndk-%, $(subst /, ,$(dir $(TARGET_CC))))))
#$(info NDK version $(NDK_VERSION)) # This warning puzzles ndk-gdb
ifneq ($(filter r1 r2 r3 r4 r5 r6 r7 r8,$(NDK_VERSION)),)
$(error Your NDK $(NDK_VERSION) is too old, please download NDK r4b, r5c or r6 from http://developer.android.com)
$(error Your NDK $(NDK_VERSION) is too old, please download NDK from http://developer.android.com)
endif
ifdef ANDROID_NDK_HOME
NDK_PATH := $(ANDROID_NDK_HOME)
else
NDK_PATH := $(shell dirname $(shell which ndk-build))
endif
include $(call all-subdir-makefiles)

View File

@@ -2,6 +2,16 @@ APP_PROJECT_PATH := $(call my-dir)/..
include jni/Settings.mk
APP_STL := $(if $(filter clang%, $(NDK_TOOLCHAIN_VERSION)), c++_static, gnustl_static)
APP_CFLAGS := -O3 -DNDEBUG -g # arm-linux-androideabi-4.4.3 crashes in -O0 mode on SDL sources
ifneq ($(filter c++_shared, $(APP_MODULES)),)
APP_STL := c++_shared
else
APP_STL := none
endif
APP_CFLAGS := -g
ifneq ($(NDK_DEBUG),1)
APP_CFLAGS += -Oz -DNDEBUG # -Oz works best with clang
endif
APP_PIE := true # This feature makes executables incompatible to Android API 15 or lower, but executables without PIE will not run on Android 5.0 and newer
SDL_EXCLUDE_LIBGCC := -Wl,--exclude-libs,libgcc.a
SDL_EXCLUDE_LIBUNWIND := -Wl,--exclude-libs,libunwind.a
APP_LDFLAGS = $(if $(filter clang%, $(NDK_TOOLCHAIN_VERSION)), $(SDL_EXCLUDE_LIBGCC) $(if $(filter armeabi%, $(APP_ABI)), $(SDL_EXCLUDE_LIBUNWIND)))

View File

@@ -1,34 +1,119 @@
# Makefile to build precompiled libraries, which cannot be built using standard NDK makefiles
# TODO: libboost, libffmpeg, libpython (used only in GemRB)
# TODO: libffmpeg, libpython (used only in GemRB)
ARCHES32 := armeabi armeabi-v7a x86 mips
ARCHES64 := arm64-v8a
ARCH_LIST ?= arm64-v8a x86_64 armeabi-v7a x86
ifeq ($(strip $(ARCH_LIST)),all)
ARCH_LIST := arm64-v8a x86_64 armeabi-v7a x86
endif
ICONV := $(foreach ARCH, $(ARCHES32), iconv/lib/$(ARCH)/libiconv.so iconv/lib/$(ARCH)/libcharset.so)
ICONV := $(foreach ARCH, $(ARCH_LIST), iconv/lib/$(ARCH)/libiconv.so iconv/lib/$(ARCH)/libcharset.so)
ICU_LIBS := data i18n io le lx test tu uc
ICU := $(foreach ARCH, $(ARCHES32), $(foreach NAME, $(ICU_LIBS), icuuc/lib/$(ARCH)/libicu$(NAME).a))
ICU_LIBS := icudata icui18n icuio icutest icutu icuuc iculx icu-le-hb
ICU := $(foreach ARCH, $(ARCH_LIST), $(foreach NAME, $(ICU_LIBS), icuuc/lib/$(ARCH)/lib$(NAME).a))
OPENSSL := $(foreach ARCH, $(ARCHES32) $(ARCHES64), openssl/lib-$(ARCH)/libcrypto.so.sdl.1.so openssl/lib-$(ARCH)/libssl.so.sdl.1.so)
OPENSSL := $(foreach ARCH, $(ARCH_LIST), openssl/lib/$(ARCH)/libcrypto.so.sdl.1.so openssl/lib/$(ARCH)/libssl.so.sdl.1.so)
LIBS := $(ICONV) $(ICU) $(OPENSSL)
BOOST_LIBS := \
atomic \
chrono \
container \
context \
contract \
coroutine \
date_time \
exception \
filesystem \
graph \
iostreams \
json \
locale \
log \
log_setup \
math_c99 \
math_c99f \
math_c99l \
math_tr1 \
math_tr1f \
math_tr1l \
nowide \
prg_exec_monitor \
program_options \
random \
regex \
serialization \
system \
test_exec_monitor \
thread \
timer \
type_erasure \
unit_test_framework \
wave \
wserialization \
prebuilt-libraries: $(LIBS)
.NOTPARALLEL: $(LIBS)
BOOST := $(foreach ARCH, $(ARCH_LIST), $(foreach NAME, $(strip $(BOOST_LIBS)), boost/lib/$(ARCH)/libboost_$(NAME).a))
$(ICONV) $(ICU):
cd iconv/src && \
./build.sh && \
for ARCH in $(ARCHES32); do \
mkdir -p ../lib/$$ARCH ; \
.PHONY: all boost icu openssl
all: $(ICONV) $(ICU) $(OPENSSL) $(BOOST)
boost: $(BOOST) $(foreach NAME, $(strip $(BOOST_LIBS)), boost_$(NAME))
icu: $(ICONV) $(ICU)
openssl: $(OPENSSL)
$(ICONV) $(ICU): iconv/src/build.sh
cd iconv/src && \
for ARCH in $(ARCH_LIST); do \
$(shell echo "#=Compiling iconv for $$ARCH") \
env ARCHS=$$ARCH PATH=$(PATH):${ANDROID_NDK_HOME} ./build.sh && \
mkdir -p ../lib/$$ARCH ../include ; \
cp -f $$ARCH/libiconv.so $$ARCH/libcharset.so ../lib/$$ARCH/ ; \
cp -f $$ARCH/include/*.h ../include/ ; \
mkdir -p ../../icuuc/lib/$$ARCH ../../icuuc/include/layout ../../icuuc/include/unicode ; \
mkdir -p ../../icuuc/lib/$$ARCH ../../icuuc/include/unicode ../../icuuc/include/layout ; \
cp -f $$ARCH/libicu*.a ../../icuuc/lib/$$ARCH/ ; \
cp -f $$ARCH/include/layout/*.h ../../icuuc/include/layout/ ; \
cp -f $$ARCH/include/unicode/*.h ../../icuuc/include/unicode/ ; \
cp -f $$ARCH/include/layout/*.h ../../icuuc/include/layout/ ; \
cp -f $$ARCH/include/icu-le-hb/layout/*.h ../../icuuc/include/layout/ ; \
done
$(OPENSSL):
cd openssl && ./compile.sh
$(OPENSSL): openssl/compile.sh
cd openssl && env ARCH_LIST="$(ARCH_LIST)" ./compile.sh
$(BOOST): boost/src/build-android.sh
rm -rf boost/include boost/lib ; \
cd boost/src && \
./build-android.sh --boost=1.78.0 --with-iconv --target-version=16 --arch=$(shell echo $(foreach ARCH, $(ARCH_LIST),$(ARCH),) | tr -d ' ') && \
for ARCH in $(ARCH_LIST); do \
mkdir -p ../lib/$$ARCH ../include ; \
$(foreach NAME, $(strip $(BOOST_LIBS)), cp -f build/out/$$ARCH/lib/libboost_$(NAME)-clang-mt-*.a ../lib/$$ARCH/libboost_$(NAME).a || exit 1 ;) \
cp -r -f build/out/$$ARCH/include/boost-*/* ../include/ || exit 1 ; \
done || exit 1
$(foreach NAME, $(strip $(BOOST_LIBS)), boost_$(NAME)):
ln -sf boost $@
iconv/src/build.sh boost/src/build-android.sh:
git submodule update --init --recursive
# Dependencies for CustomBuildScript.mk
define COPY_TO_OBJ =
ARCH := $(1)
SRCDIR := $(2)
FILENAME := $(3)
../obj/local/$$(ARCH)/$$(FILENAME) $$(abspath ../obj/local/$$(ARCH)/$$(FILENAME)): $$(SRCDIR)/$$(FILENAME)
cp -f $$< $$@
#$$(warning === ARCH = $(1) SRCDIR = $(2) FILENAME = $(3) ../obj/local/$$(ARCH)/$$(FILENAME) $$(abspath ../obj/local/$$(ARCH)/$$(FILENAME)): $$(SRCDIR)/$$(FILENAME))
endef # COPY_TO_OBJ
$(foreach ARCH, $(ARCH_LIST), $(foreach NAME, libiconv.so libcharset.so, $(eval $(call COPY_TO_OBJ,$(ARCH),iconv/lib/$(ARCH),$(NAME)))))
$(foreach ARCH, $(ARCH_LIST), $(foreach NAME, $(ICU_LIBS), $(eval $(call COPY_TO_OBJ,$(ARCH),icuuc/lib/$(ARCH),lib$(NAME).a))))
$(foreach ARCH, $(ARCH_LIST), $(foreach NAME, libcrypto.so.sdl.1.so libssl.so.sdl.1.so, $(eval $(call COPY_TO_OBJ,$(ARCH),openssl/lib/$(ARCH),$(NAME)))))

1
project/jni/SDL2/include Symbolic link
View File

@@ -0,0 +1 @@
../sdl2/include

View File

@@ -0,0 +1 @@
../sdl2_image

View File

@@ -0,0 +1 @@
../sdl2_mixer/include

View File

@@ -0,0 +1 @@
../sdl2_ttf

Some files were not shown because too many files have changed in this diff Show More