Compare commits
776 Commits
python3_te
...
sdl_androi
| Author | SHA1 | Date | |
|---|---|---|---|
| 557d36c11f | |||
| d40d02fc69 | |||
| 4604ab965f | |||
| 832d647e1e | |||
| 39c71f8db5 | |||
| f78755e303 | |||
| 78b470bc4f | |||
| f86b75c1d0 | |||
| 5afec88058 | |||
| eadbd04f81 | |||
| c9ce3ced58 | |||
| 86aa68b95a | |||
| 07e2a663ba | |||
| d2748a5c1a | |||
| a3cf17d96e | |||
|
|
474099d226 | ||
|
|
d90957f51f | ||
|
|
bfb68c161b | ||
|
|
ed13ef776c | ||
| 24205dc948 | |||
| 13c29b3ed2 | |||
|
|
cdfb2dea96 | ||
|
|
c6ec8da264 | ||
|
|
1852b09c9b | ||
|
|
4c0ee01285 | ||
|
|
9eb294a4d5 | ||
|
|
10b199e707 | ||
|
|
f14a9db4b0 | ||
|
|
cf4e7deba7 | ||
|
|
902259cad7 | ||
|
|
0b93255121 | ||
|
|
d87f0fc47c | ||
|
|
67efe70542 | ||
|
|
d75428ec05 | ||
|
|
9aa360df04 | ||
|
|
b0124577c1 | ||
|
|
a7401cfaf7 | ||
|
|
5f53581671 | ||
|
|
6c5703bf22 | ||
|
|
e5d8d9d3a4 | ||
|
|
3b286cc24c | ||
|
|
9a1f5ca352 | ||
|
|
66d66011ce | ||
|
|
c869ac6a8a | ||
|
|
c6e9cf6274 | ||
|
|
6cc124b1df | ||
|
|
ac2fe0ffa1 | ||
|
|
1def252c9b | ||
|
|
73210a9428 | ||
|
|
c9a563e627 | ||
|
|
c3aabf9f7c | ||
|
|
6932189f21 | ||
|
|
601d40b414 | ||
|
|
242bad58b8 | ||
|
|
52e6f828dd | ||
|
|
543df95d62 | ||
|
|
a288880b4a | ||
|
|
fb4a4c7497 | ||
|
|
c1e3582042 | ||
|
|
1f301e2d7c | ||
|
|
e17bf11a15 | ||
|
|
940b04c8ce | ||
|
|
8073d82624 | ||
|
|
5824a4cfce | ||
|
|
42ec5d69c2 | ||
|
|
f17ebbea79 | ||
|
|
17cf60d021 | ||
|
|
bce8691e45 | ||
|
|
a8927c121a | ||
|
|
a8e98dd68b | ||
|
|
956660cd30 | ||
|
|
ba816271e4 | ||
|
|
b6c922f135 | ||
| 7f98205bcc | |||
| 2a82f63627 | |||
| 891b1dfdd9 | |||
| 5bc1e861c5 | |||
| a82486d0c7 | |||
| 2dd2503044 | |||
| 9249dd3ffc | |||
|
|
2e0cc86345 | ||
|
|
ec163bba3b | ||
|
|
b0415e5629 | ||
|
|
f04a74421d | ||
|
|
8d7a7cdf84 | ||
|
|
4b73aece3c | ||
|
|
0baa3f3eee | ||
|
|
8473363012 | ||
|
|
a92f6cf9b8 | ||
|
|
adbe81a060 | ||
|
|
6e8c289854 | ||
|
|
895977f0c8 | ||
|
|
921e814669 | ||
|
|
2e44deacdf | ||
| b8337a5253 | |||
| 70e2889675 | |||
|
|
42b6d73fbf | ||
|
|
3fcfacdf58 | ||
|
|
370435341a | ||
|
|
cb8fe0ee00 | ||
|
|
fab45c98f6 | ||
|
|
ab50f67695 | ||
|
|
ee0df4f895 | ||
| f5d3dec88d | |||
| 767969b04d | |||
| b84940de47 | |||
| a26ff60b8f | |||
| 9439ee7927 | |||
| eeb1b54cd5 | |||
| bcdfccc28e | |||
| 6a67ec9197 | |||
|
|
c6fdfc4cbe | ||
|
|
881d81cc50 | ||
|
|
d40a4b599e | ||
|
|
62611e60f4 | ||
|
|
e4939e3f3f | ||
|
|
8c03645bce | ||
|
|
38f8308926 | ||
|
|
32c747f580 | ||
|
|
fbc7ee1d2b | ||
|
|
899a3b3630 | ||
|
|
84a08cad8e | ||
|
|
e058499e89 | ||
|
|
c87e13d96f | ||
|
|
e080e70bda | ||
|
|
71411d22d5 | ||
| ca643807d2 | |||
| 1c488fe457 | |||
|
|
c9e4d8685a | ||
|
|
86452912a0 | ||
|
|
8d02011e82 | ||
|
|
e2a3938297 | ||
|
|
798fd0f5e1 | ||
|
|
6916b2cce9 | ||
|
|
d3d938c27d | ||
|
|
37c77c100f | ||
|
|
bc0f10c2bf | ||
|
|
f793806d7e | ||
|
|
1c9ff9d98e | ||
|
|
55303806d9 | ||
|
|
8d10d1ff0f | ||
|
|
bbaa42c1ec | ||
|
|
10c751afc3 | ||
|
|
532acc9192 | ||
|
|
20ffa0a809 | ||
|
|
999cefb359 | ||
|
|
ad753cbdd8 | ||
|
|
a961c62043 | ||
|
|
d30371b546 | ||
|
|
37769ef1e1 | ||
|
|
5073ac8df9 | ||
|
|
c130231878 | ||
|
|
8a72407d0e | ||
|
|
8aecf92fee | ||
|
|
00873a5014 | ||
|
|
dece0f3418 | ||
|
|
d3860a6bb4 | ||
|
|
c37381b20f | ||
|
|
3d7782a0db | ||
|
|
6dce6d6690 | ||
|
|
3512b70469 | ||
|
|
2b96250b11 | ||
|
|
27bb3eb642 | ||
|
|
c7a57c155b | ||
|
|
5793ce78fb | ||
|
|
bc710aa7b6 | ||
|
|
45a8f1868e | ||
|
|
4fa235395f | ||
|
|
26c565e2ba | ||
|
|
03b1fde421 | ||
|
|
44047831b3 | ||
|
|
e549b41333 | ||
|
|
c22deddf28 | ||
|
|
20cc7839e5 | ||
|
|
da41bde2a0 | ||
|
|
b1f3d180b3 | ||
|
|
021ebb853e | ||
|
|
1d0efd062b | ||
|
|
d7ef921317 | ||
|
|
04316911e9 | ||
|
|
8edb321123 | ||
|
|
292775eb07 | ||
|
|
fc054fc4f0 | ||
|
|
7dae18fa7d | ||
|
|
47e6527a6f | ||
|
|
bdb958b7d4 | ||
|
|
2f2a2b4fa4 | ||
|
|
8d50979447 | ||
|
|
272fea83c2 | ||
|
|
8f8ea18517 | ||
|
|
32339a9610 | ||
|
|
821196ab38 | ||
|
|
91e6c9f28e | ||
|
|
7babb91d22 | ||
|
|
79c0dc8b96 | ||
|
|
1f88f05321 | ||
|
|
2d98c49a21 | ||
|
|
8f3d943292 | ||
|
|
dcfb99b8e7 | ||
|
|
3093207884 | ||
|
|
9dda18bc61 | ||
|
|
11bd50e1f5 | ||
|
|
964f88c9f7 | ||
|
|
77a2647367 | ||
|
|
24f0179cab | ||
|
|
00b4f92348 | ||
|
|
f8868bf7a0 | ||
|
|
901aecadc0 | ||
|
|
094d04a4c2 | ||
|
|
ef8b1d2c7d | ||
|
|
4cdad6573b | ||
|
|
c8c1cac242 | ||
|
|
466c97d06f | ||
|
|
dd57a9afbd | ||
|
|
624c560aef | ||
|
|
4c8936706a | ||
|
|
d84eac20a4 | ||
|
|
04fc1e2dbb | ||
|
|
919bf9a378 | ||
|
|
a235249f57 | ||
|
|
aa0fe18bf6 | ||
|
|
2195d19f25 | ||
|
|
1cc02b548c | ||
|
|
71f1a35b44 | ||
|
|
51e23ec3ec | ||
|
|
7efe1a42a3 | ||
|
|
33ceea2f40 | ||
|
|
40d637742e | ||
|
|
7e90cf5cd5 | ||
|
|
f8125547e5 | ||
|
|
02bed5f5f0 | ||
|
|
bd33a3a38b | ||
|
|
87fb5d176d | ||
|
|
caaac4cbd9 | ||
|
|
b63e1c0ed8 | ||
|
|
dd1d2c1be6 | ||
|
|
eb0114a628 | ||
|
|
bfa4bbe20a | ||
|
|
87b27b3418 | ||
|
|
f7be0781d9 | ||
|
|
3ac05002f0 | ||
|
|
22e2154d7e | ||
|
|
c2689dc7a5 | ||
|
|
c470f348c4 | ||
|
|
077acc6880 | ||
|
|
211ab6b8be | ||
|
|
50df6e53d0 | ||
|
|
05615e643d | ||
|
|
b325c826e4 | ||
|
|
22ea75c91f | ||
|
|
fc47eac67f | ||
|
|
5e27a1f850 | ||
|
|
cc6cebb094 | ||
|
|
4cf9c797ce | ||
|
|
206ee15e1f | ||
|
|
ed8df2e026 | ||
|
|
3906994ec4 | ||
|
|
21adbe6a1e | ||
|
|
c5d8e8b3c7 | ||
|
|
134b5c6bb6 | ||
|
|
d18f028de7 | ||
|
|
f1ca4e520d | ||
|
|
11c23767fb | ||
|
|
b9dfad3516 | ||
|
|
326ebb7607 | ||
|
|
c728df6a80 | ||
|
|
a692b244eb | ||
|
|
c08e0e6db3 | ||
|
|
1215590f90 | ||
|
|
d863f8f2fe | ||
|
|
09672ef3ee | ||
|
|
76f5ae99ab | ||
|
|
222e626ff2 | ||
|
|
8d9c8259af | ||
|
|
522bef87f9 | ||
|
|
dfe6f6b1c1 | ||
|
|
09ad04bf1a | ||
|
|
0605f7e6d8 | ||
|
|
a5a0daffa2 | ||
|
|
c6a7d713d1 | ||
|
|
e451732de7 | ||
|
|
5c2dd33dff | ||
|
|
a3d5595519 | ||
|
|
a8207ceeae | ||
|
|
c77c68b9f6 | ||
|
|
3dfadf7da1 | ||
|
|
f84b9c5406 | ||
|
|
3ceb3c73ff | ||
|
|
597b140a6c | ||
|
|
cbc8ec5944 | ||
|
|
047bf70ef8 | ||
|
|
23e010f203 | ||
|
|
55026dec85 | ||
|
|
46826b2d17 | ||
|
|
138cd60d30 | ||
|
|
bb3c954a59 | ||
|
|
14c94d5deb | ||
|
|
4d4f33ed90 | ||
|
|
d502c0acb1 | ||
|
|
ae8b343156 | ||
|
|
170f7d680e | ||
|
|
3a3269901a | ||
|
|
636559b5af | ||
|
|
2b45093c2c | ||
|
|
4a5c9ea8c5 | ||
|
|
c4cb02f731 | ||
|
|
c928f762f9 | ||
|
|
67f32a7cc8 | ||
|
|
12993efb3a | ||
|
|
c1890b2a4d | ||
|
|
c476167ea1 | ||
|
|
2aa6ae455c | ||
|
|
eae038b006 | ||
|
|
82c4111733 | ||
|
|
8746ad9623 | ||
|
|
03dca0c4ed | ||
|
|
7a548f6259 | ||
|
|
0502bd9416 | ||
|
|
c937f769c6 | ||
|
|
c6950836a0 | ||
|
|
39f7b7d6ef | ||
|
|
702329a932 | ||
|
|
abb3f4196b | ||
|
|
5936ff80b5 | ||
|
|
4fab6dc422 | ||
|
|
e6823997de | ||
|
|
068d7dba9e | ||
|
|
21e930fb6b | ||
|
|
a1516f415e | ||
|
|
7c23b880c7 | ||
|
|
29a26e824d | ||
|
|
1d6b705ff3 | ||
|
|
3a57177042 | ||
|
|
e00fcf1afe | ||
|
|
2bce9d6854 | ||
|
|
29fcb570f8 | ||
|
|
07952badae | ||
|
|
e02d772173 | ||
|
|
b7607f9618 | ||
|
|
807ad3113c | ||
|
|
13f410df61 | ||
|
|
b30a5bdf47 | ||
|
|
602ceec9ed | ||
|
|
4717519311 | ||
|
|
7203affdc7 | ||
|
|
9440f2227d | ||
|
|
a617b46dec | ||
|
|
72cba7bfd5 | ||
|
|
9731a00c15 | ||
|
|
5544e91d05 | ||
|
|
8e53731b2a | ||
|
|
6ffc00e13b | ||
|
|
9c2adfdcc8 | ||
|
|
fd6e3a02cd | ||
|
|
6b7505dc1f | ||
|
|
70f933c12a | ||
|
|
b60e0a1956 | ||
|
|
58b42e93aa | ||
|
|
af2fc34eb5 | ||
|
|
b0c05e67da | ||
|
|
517eb7572c | ||
|
|
409b173e25 | ||
|
|
6282c041cf | ||
|
|
83c8c657d4 | ||
|
|
4ea94c197d | ||
|
|
71d79c3703 | ||
|
|
2a58d4a24b | ||
|
|
d809f372a8 | ||
|
|
bb09438e1b | ||
|
|
610e43e388 | ||
|
|
ee825d7cee | ||
|
|
ddd9b70af3 | ||
|
|
2133b4bdbf | ||
|
|
1610fbf5b2 | ||
|
|
d49291b64e | ||
|
|
b340f77972 | ||
|
|
bc8d652517 | ||
|
|
2b0d961f8b | ||
|
|
bb387b5f07 | ||
|
|
a64f771e39 | ||
|
|
954676633e | ||
|
|
14692c5794 | ||
|
|
690ab0fdc4 | ||
|
|
9e879a3758 | ||
|
|
4081383cd4 | ||
|
|
4a13c9b8d1 | ||
|
|
7207c9cbaa | ||
|
|
341ea4820e | ||
|
|
de0a2aa094 | ||
|
|
12ee2980ed | ||
|
|
f3490e5a97 | ||
|
|
6d8fc056b7 | ||
|
|
a1f3b803f3 | ||
|
|
74283b9a01 | ||
|
|
3b33a27350 | ||
|
|
f1b5cb5eef | ||
|
|
30ca76a91b | ||
|
|
cd7d7f23b1 | ||
|
|
1aaf5fecb8 | ||
|
|
ae4e375c8e | ||
|
|
12a164f19c | ||
|
|
7d1d1dcce3 | ||
|
|
d00a448056 | ||
|
|
84c3b8f4d9 | ||
|
|
e34e808c15 | ||
|
|
24dbe40bd9 | ||
|
|
d25053ce9f | ||
|
|
720c08d15a | ||
|
|
97c152e6a6 | ||
|
|
428f6b89d7 | ||
|
|
99882fa19e | ||
|
|
8b8597fbc3 | ||
|
|
c2d67139f7 | ||
|
|
11acddec22 | ||
|
|
c4ae2ef53c | ||
|
|
924a106e01 | ||
|
|
3926496d5f | ||
|
|
249f602165 | ||
|
|
d30158b7dd | ||
|
|
769a99cbd8 | ||
|
|
ae4f496106 | ||
|
|
34f00a6c54 | ||
|
|
e32502ed64 | ||
|
|
117074777f | ||
|
|
32442641dc | ||
|
|
b5012d86ad | ||
|
|
5b2b990b29 | ||
|
|
b3e81dfab1 | ||
|
|
9bbfbd2131 | ||
|
|
6d3990058b | ||
|
|
5458d5ffe3 | ||
|
|
7c88857742 | ||
|
|
01dc04fe17 | ||
|
|
5e9c45f330 | ||
|
|
91bfe0b6c4 | ||
|
|
a967016781 | ||
|
|
1e71441946 | ||
|
|
5413bfb6f3 | ||
|
|
63f9c475c1 | ||
|
|
ce74e0fee3 | ||
|
|
b7084f90e1 | ||
|
|
a46c43f459 | ||
|
|
4e8bf7a5ae | ||
|
|
1157101b4b | ||
|
|
43810f8585 | ||
|
|
a07c617cbf | ||
|
|
747e660578 | ||
|
|
3f8e0ea9a9 | ||
|
|
f2074457a4 | ||
|
|
8cc60c9d4b | ||
|
|
4527f9f619 | ||
|
|
d2495a80ce | ||
|
|
7c74e86010 | ||
|
|
0dd74132ab | ||
|
|
959a7a8c66 | ||
|
|
697ba47bf8 | ||
|
|
31f306976f | ||
|
|
cde94796a7 | ||
|
|
dcdcaa2c1a | ||
|
|
f89164b152 | ||
|
|
dd184b184e | ||
|
|
ff8594202d | ||
|
|
63e5356a5b | ||
|
|
89ecc43d8f | ||
|
|
8c34faa475 | ||
|
|
65fe44f66a | ||
|
|
f0ff49906c | ||
|
|
2ff9d7cb2c | ||
|
|
d0f0e4cfea | ||
|
|
7662f2acae | ||
|
|
3bed7f054e | ||
|
|
f78c911f0a | ||
|
|
90f5ab5684 | ||
|
|
20d59c5920 | ||
|
|
b5a391b0dd | ||
|
|
20eef1b149 | ||
|
|
f0425aa9af | ||
|
|
d9ce299843 | ||
|
|
9c3259a969 | ||
|
|
bb46839637 | ||
|
|
22a34468d2 | ||
|
|
ab3e3aa1a7 | ||
|
|
56ae8d528e | ||
|
|
15ee9faf9b | ||
|
|
4d6a8dcd88 | ||
|
|
639a2e7e69 | ||
|
|
054ac50e0a | ||
|
|
9397c0079c | ||
|
|
e887896edf | ||
|
|
8be8471285 | ||
|
|
2f49dd6e30 | ||
|
|
657ab95852 | ||
|
|
3425c4b372 | ||
|
|
5ba2b00a1e | ||
|
|
d431337433 | ||
|
|
1f32270a80 | ||
|
|
0186aa0786 | ||
|
|
8c632cd6e0 | ||
|
|
b5fec3dd68 | ||
|
|
6b1bd79e2f | ||
|
|
da55d86723 | ||
|
|
63178dd22b | ||
|
|
f3ee09e047 | ||
|
|
5b778604b5 | ||
|
|
264f7aa43f | ||
|
|
eec2e53f0f | ||
|
|
bf0eb74ea8 | ||
|
|
969d785ec1 | ||
|
|
76d93ca1fa | ||
|
|
61c5b7352b | ||
|
|
68d6923357 | ||
|
|
fd5babab77 | ||
|
|
71a72389e3 | ||
|
|
2b18728ed5 | ||
|
|
4be95b0d36 | ||
|
|
d1554371a5 | ||
|
|
51790527e9 | ||
|
|
de301f6c59 | ||
|
|
37ad3763ab | ||
|
|
f9a91856ec | ||
|
|
f0a8e491e9 | ||
|
|
b0f344098f | ||
|
|
9087c622ae | ||
|
|
16d326c1c5 | ||
|
|
8333b99596 | ||
|
|
c3f89273e3 | ||
|
|
0c172d10fb | ||
|
|
bef5f545c5 | ||
|
|
aa7919811f | ||
|
|
d169cf6d89 | ||
|
|
b66d0f6af0 | ||
|
|
286b105fc5 | ||
|
|
2f0fa55d2e | ||
|
|
35400851ca | ||
|
|
0299387ea8 | ||
|
|
40b87eb9ac | ||
|
|
e61973a837 | ||
|
|
61a08630ed | ||
|
|
1fe8654d71 | ||
|
|
2c182128c6 | ||
|
|
98062856c6 | ||
|
|
0dd82bd0f7 | ||
|
|
a5a7fea8a7 | ||
|
|
659bf32161 | ||
|
|
1950b85d8b | ||
|
|
4527235f0e | ||
|
|
11090a082e | ||
|
|
9b9768ed8d | ||
|
|
372a73207b | ||
|
|
7f4b9162ba | ||
|
|
d4afed131a | ||
|
|
52cda7c82f | ||
|
|
d74fcef25b | ||
|
|
fc7e6e63b2 | ||
|
|
d98d33b244 | ||
|
|
e700d64cfb | ||
|
|
d9d6289924 | ||
|
|
ed9446c4a3 | ||
|
|
8c64964f4b | ||
|
|
98a442e80d | ||
|
|
f391b0b3ca | ||
|
|
a328e741aa | ||
|
|
c475fbf816 | ||
|
|
65520b847e | ||
|
|
88ab438ba1 | ||
|
|
9865a6dcfe | ||
|
|
cff1d6b9b9 | ||
|
|
853e3f3307 | ||
|
|
b0b78fbf0b | ||
|
|
19ad345143 | ||
|
|
3988790916 | ||
|
|
114f1541c3 | ||
|
|
4a0abd4561 | ||
|
|
059c60acc2 | ||
|
|
49664669ab | ||
|
|
83690c7843 | ||
|
|
836173c6bd | ||
|
|
54daeba17c | ||
|
|
ab388c164b | ||
|
|
451189dd41 | ||
|
|
5857572dc9 | ||
|
|
d7a074409e | ||
|
|
93c3984615 | ||
|
|
16f944d3c6 | ||
|
|
781877ebb6 | ||
|
|
5e0cf567cb | ||
|
|
5452ff026f | ||
|
|
0c407de81c | ||
|
|
d705fee605 | ||
|
|
e4d00b6202 | ||
|
|
73d25fe6cc | ||
|
|
c12c63c66d | ||
|
|
e9843f8a61 | ||
|
|
da45b67d94 | ||
|
|
816ce71085 | ||
|
|
fb816c7a6a | ||
|
|
5d05a7cff2 | ||
|
|
4503bcbc56 | ||
|
|
d359e80b9b | ||
|
|
4b3a2136c7 | ||
|
|
f7b1b69008 | ||
|
|
2face2a79a | ||
|
|
30b7f93467 | ||
|
|
671d537df9 | ||
|
|
38663832d2 | ||
|
|
91735433b1 | ||
|
|
c22928a018 | ||
|
|
eab9c26fa3 | ||
|
|
e000bf3ea4 | ||
|
|
fba592f1c5 | ||
|
|
a5c932a0fa | ||
|
|
ad4a0bc52c | ||
|
|
fd8735fe6f | ||
|
|
334e7114d8 | ||
|
|
49c47093c0 | ||
|
|
fc1bedf1ca | ||
|
|
4c73f4c220 | ||
|
|
1d3e4fce94 | ||
|
|
c582c7e40e | ||
|
|
3116b316bb | ||
|
|
eadd178cfc | ||
|
|
76053bb69f | ||
|
|
6459e79ea9 | ||
|
|
dcad4c156c | ||
|
|
da05e8dfc6 | ||
|
|
3af69bf25c | ||
|
|
f31a9b10cb | ||
|
|
a67e53fe48 | ||
|
|
fd79ad08d2 | ||
|
|
3556067039 | ||
|
|
cdf1c7347d | ||
|
|
1cf8c094a3 | ||
|
|
4799ff9e9f | ||
|
|
96b9a2e36d | ||
|
|
3b65df4624 | ||
|
|
3165576211 | ||
|
|
b176328777 | ||
|
|
6a76b40436 | ||
|
|
b9538af7c3 | ||
|
|
d0f7f72bd7 | ||
|
|
144f485758 | ||
|
|
9a2e67c05d | ||
|
|
bc94fe76d6 | ||
|
|
e15c2ff3d6 | ||
|
|
7301ae0c62 | ||
|
|
d416f94ce4 | ||
|
|
374dbd86b3 | ||
|
|
66f7cc1cfd | ||
|
|
e0d9c99a7c | ||
|
|
4c182a5370 | ||
|
|
7aa2cd0726 | ||
|
|
df9ffa1c2b | ||
|
|
e618b3a2d0 | ||
|
|
0fd27781c6 | ||
|
|
9f5414c407 | ||
|
|
f02e93636f | ||
|
|
9f486346f1 | ||
|
|
49fb9a98e8 | ||
|
|
7d7b6e7997 | ||
|
|
169a2bf551 | ||
|
|
b12fc6e402 | ||
|
|
b742ebaf72 | ||
|
|
9c86e109dd | ||
|
|
f5570a7dae | ||
|
|
2a60bdec8a | ||
|
|
b3b9730c19 | ||
|
|
212e761d33 | ||
|
|
25a86103ec | ||
|
|
54c1b4b0b8 | ||
|
|
95ebb73426 | ||
|
|
d378ee692f | ||
|
|
70b37b6565 | ||
|
|
637eb27e07 | ||
|
|
bb08c6ab43 | ||
|
|
0aba1e43d7 | ||
|
|
5cda8aa8be | ||
|
|
6fe05d83e3 | ||
|
|
ef3c4cf714 | ||
|
|
7babe228b6 | ||
|
|
6356415030 | ||
|
|
af61cce12a | ||
|
|
173d4f193b | ||
|
|
c66e3d5ae1 | ||
|
|
4b47ea502c | ||
|
|
8d9f655db9 | ||
|
|
1ae4bbbfc8 | ||
|
|
a6f20b699b | ||
|
|
a209bee64f | ||
|
|
1db6fb623c | ||
|
|
4336c5e9b8 | ||
|
|
18837e9b8c | ||
|
|
d8b6a2d088 | ||
|
|
bc9842ee59 | ||
|
|
5af764f5ff | ||
|
|
fb9d42b6f5 | ||
|
|
3a9b31a41f | ||
|
|
b8c5dd1d70 | ||
|
|
209a16fd9f | ||
|
|
bd36a07c7b | ||
|
|
4701548e01 | ||
|
|
5223f423d8 | ||
|
|
7953493704 | ||
|
|
5d82a28be3 | ||
|
|
468791d212 | ||
|
|
34824e3300 | ||
|
|
0d524669d0 | ||
|
|
457c6c32af | ||
|
|
91d27beb04 | ||
|
|
3b7eed55a5 | ||
|
|
32488523e1 | ||
|
|
efbdcb1a71 | ||
|
|
2cc2d7bca5 | ||
|
|
6850c719d4 | ||
|
|
bc5f26d089 | ||
|
|
a322e85cd7 | ||
|
|
75eddb701a | ||
|
|
8e87817255 | ||
|
|
90b8790fc0 | ||
|
|
2920b61519 | ||
|
|
d738bd6f53 | ||
|
|
181532e165 | ||
|
|
630d0fb234 | ||
|
|
ca601438d7 | ||
|
|
8fbefc99de | ||
|
|
c985b70f59 | ||
|
|
a6db262f17 | ||
|
|
eafba393be | ||
|
|
b224a4d100 | ||
|
|
5132ae8020 | ||
|
|
35e838c20d | ||
|
|
d89960517c | ||
|
|
2efd15f6b5 | ||
|
|
a361998ee2 | ||
|
|
55194b43e3 | ||
|
|
cdb6e76177 | ||
|
|
132988b141 | ||
|
|
5ab39a579a | ||
|
|
d179d4d2c7 | ||
|
|
39b5b5efb5 | ||
|
|
b42a8623df | ||
|
|
8f54771340 | ||
|
|
d94bfa11f7 | ||
|
|
360fc0b112 | ||
|
|
9e2035c21d | ||
|
|
0eaf0356fc | ||
|
|
74c2b15e22 | ||
|
|
a26e52ca94 | ||
|
|
4fcb4fce72 | ||
|
|
2b0ad6e7d3 | ||
|
|
c398280513 | ||
|
|
f432fb316b | ||
|
|
46e4118ba8 | ||
|
|
78d3c8ca27 | ||
|
|
5497773f96 | ||
|
|
28015f4cca | ||
|
|
f37cf67a7e | ||
|
|
ecb29827af | ||
|
|
d4897280f0 | ||
|
|
485d66ea25 | ||
|
|
09f8a53a22 | ||
|
|
d7ea0a43fb | ||
|
|
bf211679e1 | ||
|
|
32f1ca882e | ||
|
|
4e9dad66bb | ||
|
|
2b64c864f0 | ||
|
|
58beecc25a | ||
|
|
69137dfa78 | ||
|
|
4ab58838d1 | ||
|
|
5edfb74432 | ||
|
|
2d9acc5aee | ||
|
|
7629e64762 | ||
|
|
c67f348338 | ||
|
|
f4727eb466 | ||
|
|
9aa0a1ae36 | ||
|
|
27fea957aa | ||
|
|
f472f15963 |
7
.editorconfig
Normal file
7
.editorconfig
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
indent_style = tab
|
||||||
|
charset = utf-8
|
||||||
142
.github/workflows/ballfield.yml
vendored
Normal file
142
.github/workflows/ballfield.yml
vendored
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
# 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
|
||||||
|
ANDROID_BUILD_TOOLS: 33.0.2
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: 'read'
|
||||||
|
id-token: 'write'
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Java 17
|
||||||
|
uses: actions/setup-java@v2
|
||||||
|
with:
|
||||||
|
java-version: 17
|
||||||
|
distribution: temurin
|
||||||
|
|
||||||
|
- name: Check out the repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
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: 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/$ANDROID_BUILD_TOOLS:$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/$ANDROID_BUILD_TOOLS:$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
|
||||||
|
|
||||||
|
- uses: r0adkll/upload-google-play@v1
|
||||||
|
continue-on-error: true
|
||||||
|
with:
|
||||||
|
serviceAccountJsonPlainText: ${{secrets.SERVICE_ACCOUNT_JSON}}
|
||||||
|
packageName: net.olofson.ballfield
|
||||||
|
releaseFiles: upload/*.aab
|
||||||
|
#track: beta
|
||||||
|
track: production
|
||||||
|
status: completed
|
||||||
|
# inAppUpdatePriority: 2
|
||||||
|
# userFraction: 1
|
||||||
|
# whatsNewDirectory: distribution/whatsnew
|
||||||
|
# mappingFile: app/build/outputs/mapping/release/mapping.txt
|
||||||
|
# debugSymbols: app/intermediates/merged_native_libs/release/out/lib
|
||||||
160
.github/workflows/openttd.yml
vendored
Normal file
160
.github/workflows/openttd.yml
vendored
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
# 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: openttd
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '*'
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
pull_request: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
env:
|
||||||
|
APP_NAME: openttd
|
||||||
|
# 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
|
||||||
|
ANDROID_BUILD_TOOLS: 33.0.2
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Java 17
|
||||||
|
uses: actions/setup-java@v2
|
||||||
|
with:
|
||||||
|
java-version: 17
|
||||||
|
distribution: temurin
|
||||||
|
|
||||||
|
- name: Check out the repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
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/application/${APP_NAME}
|
||||||
|
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 ICU revision
|
||||||
|
id: icu-rev
|
||||||
|
run: echo "ICU_REV=`git -C project/jni/iconv/src rev-parse HEAD`::`echo ${ARCH_LIST} | sed 's/ /:/g'`" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Copy ICU libraries from cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
id: cache-icu
|
||||||
|
with:
|
||||||
|
# The same SDL revision will produce the same libraries
|
||||||
|
key: ${{env.ICU_REV}}
|
||||||
|
path: |
|
||||||
|
project/jni/iconv/include
|
||||||
|
project/jni/iconv/lib
|
||||||
|
project/jni/icuuc/include
|
||||||
|
project/jni/icuuc/lib
|
||||||
|
project/jni/icuuc/share/icu
|
||||||
|
|
||||||
|
- name: Touch cached ICU timestamps
|
||||||
|
if: steps.cache-icu.outputs.cache-hit == 'true'
|
||||||
|
run: touch project/jni/iconv/lib/*/* project/jni/icuuc/lib/*/* project/jni/icuuc/share/icu/*/* || 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/$ANDROID_BUILD_TOOLS:$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/$ANDROID_BUILD_TOOLS:$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
|
||||||
|
|
||||||
|
- uses: r0adkll/upload-google-play@v1
|
||||||
|
continue-on-error: true
|
||||||
|
with:
|
||||||
|
serviceAccountJsonPlainText: ${{secrets.SERVICE_ACCOUNT_JSON}}
|
||||||
|
packageName: org.openttd.sdl
|
||||||
|
releaseFiles: upload/*.aab
|
||||||
|
track: beta
|
||||||
|
#track: production
|
||||||
|
status: completed
|
||||||
|
# inAppUpdatePriority: 2
|
||||||
|
# userFraction: 1
|
||||||
|
# whatsNewDirectory: distribution/whatsnew
|
||||||
|
# mappingFile: app/build/outputs/mapping/release/mapping.txt
|
||||||
|
# debugSymbols: app/intermediates/merged_native_libs/release/out/lib
|
||||||
123
.github/workflows/sdl2-demo.yml
vendored
Normal file
123
.github/workflows/sdl2-demo.yml
vendored
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
# 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
|
||||||
|
ANDROID_BUILD_TOOLS: 33.0.2
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Java 17
|
||||||
|
uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
java-version: 17
|
||||||
|
distribution: temurin
|
||||||
|
|
||||||
|
- 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: 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/$ANDROID_BUILD_TOOLS:$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/$ANDROID_BUILD_TOOLS:$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
5
.gitignore
vendored
@@ -11,6 +11,7 @@
|
|||||||
/project/jni/Settings.mk
|
/project/jni/Settings.mk
|
||||||
/project/jni/application/*/libapplication*.so
|
/project/jni/application/*/libapplication*.so
|
||||||
/project/jni/application/src
|
/project/jni/application/src
|
||||||
|
/project/jni/boost_*
|
||||||
/project/res/drawable-xhdpi/ouya_icon.png
|
/project/res/drawable-xhdpi/ouya_icon.png
|
||||||
/project/res/drawable/app_icon.png
|
/project/res/drawable/app_icon.png
|
||||||
/project/proguard-project.txt
|
/project/proguard-project.txt
|
||||||
@@ -19,3 +20,7 @@
|
|||||||
/project/jni/android-support
|
/project/jni/android-support
|
||||||
/project/res/drawable/banner.png
|
/project/res/drawable/banner.png
|
||||||
/project/res/drawable-xhdpi/ouya_icon.png
|
/project/res/drawable-xhdpi/ouya_icon.png
|
||||||
|
/project/app/build.gradle
|
||||||
|
/project/app/.gradle
|
||||||
|
/project/app/build
|
||||||
|
/project/assetpack/build
|
||||||
|
|||||||
96
.gitmodules
vendored
96
.gitmodules
vendored
@@ -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"]
|
[submodule "project/jni/iconv/src"]
|
||||||
path = project/jni/iconv/src
|
path = project/jni/iconv/src
|
||||||
url = git@github.com:pelya/libiconv-libicu-android.git
|
url = https://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
|
|
||||||
branch = master
|
branch = master
|
||||||
update = merge
|
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 = 14
|
||||||
|
[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
|
||||||
|
|||||||
107
aar2jar.py
107
aar2jar.py
@@ -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
1
app-release.apk
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
project/app/build/outputs/apk/release/app-release.apk
|
||||||
35
app2sd.sh
35
app2sd.sh
@@ -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
|
|
||||||
4
bugs.txt
4
bugs.txt
@@ -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: Shift and Ctrl keys on USB keyboard do not work for text input.
|
||||||
|
|
||||||
- OpenArena: When entering with USB keyboard into chatbox, first 't' disappears.
|
- 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
299
build.sh
@@ -1,34 +1,50 @@
|
|||||||
#!/bin/sh
|
#!/usr/bin/env bash
|
||||||
#set -eu # Bashism, does not work with default shell on Ubuntu 12.04
|
|
||||||
|
|
||||||
|
# Handle any error or die
|
||||||
|
set -e
|
||||||
|
|
||||||
|
THIS_BUILD_DIR=$(dirname "$0")
|
||||||
install_apk=false
|
install_apk=false
|
||||||
run_apk=false
|
run_apk=false
|
||||||
sign_apk=false
|
sign_apk=false
|
||||||
|
sign_bundle=false
|
||||||
build_release=true
|
build_release=true
|
||||||
quick_rebuild=false
|
do_zipalign=true
|
||||||
QUICK_REBUILD_ARGS=
|
named_variant=""
|
||||||
|
base_app_name=""
|
||||||
|
|
||||||
if [ "$#" -gt 0 -a "$1" = "-s" ]; then
|
# Fix Gradle compilation error
|
||||||
shift
|
if [ -z "$ANDROID_NDK_HOME" ]; then
|
||||||
sign_apk=true
|
export ANDROID_NDK_HOME="$(which ndk-build | sed 's@/ndk-build@@')"
|
||||||
fi
|
fi
|
||||||
|
[ -z "$ANDROID_SDK_ROOT" ] && ANDROID_SDK_ROOT="$ANDROID_HOME"
|
||||||
|
|
||||||
if [ "$#" -gt 0 -a "$1" = "-i" ]; then
|
while getopts "sirqbhzv:" OPT
|
||||||
shift
|
do
|
||||||
install_apk=true
|
case $OPT in
|
||||||
fi
|
s) sign_apk=true;;
|
||||||
|
i) install_apk=true;;
|
||||||
if [ "$#" -gt 0 -a "$1" = "-r" ]; then
|
r) install_apk=true ; run_apk=true;;
|
||||||
shift
|
q) echo "Quick rebuild does not work anymore with Gradle!";;
|
||||||
install_apk=true
|
b) sign_bundle=true;;
|
||||||
run_apk=true
|
z) do_zipalign=false;;
|
||||||
fi
|
v) named_variant=${OPTARG};;
|
||||||
|
h)
|
||||||
if [ "$#" -gt 0 -a "$1" = "-q" ]; then
|
echo "Usage: $0 [-s] [-i] [-r] [-q] [debug|release] [app-name]"
|
||||||
shift
|
echo " -s: sign .apk file after building"
|
||||||
quick_rebuild=true
|
echo " -b: sign .aab app bundle file after building"
|
||||||
QUICK_REBUILD_ARGS=APP_ABI=armeabi-v7a
|
echo " -i: install APK file to device after building"
|
||||||
fi
|
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
|
if [ "$#" -gt 0 -a "$1" = "release" ]; then
|
||||||
shift
|
shift
|
||||||
@@ -41,7 +57,7 @@ if [ "$#" -gt 0 -a "$1" = "debug" ]; then
|
|||||||
export NDK_DEBUG=1
|
export NDK_DEBUG=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$#" -gt 0 -a "$1" '!=' "-h" ]; then
|
if [ "$#" -gt 0 ]; then
|
||||||
echo "Switching build target to $1"
|
echo "Switching build target to $1"
|
||||||
if [ -e project/jni/application/$1 ]; then
|
if [ -e project/jni/application/$1 ]; then
|
||||||
rm -f project/jni/application/src
|
rm -f project/jni/application/src
|
||||||
@@ -49,60 +65,56 @@ if [ "$#" -gt 0 -a "$1" '!=' "-h" ]; then
|
|||||||
else
|
else
|
||||||
echo "Error: no app $1 under project/jni/application"
|
echo "Error: no app $1 under project/jni/application"
|
||||||
echo "Available applications:"
|
echo "Available applications:"
|
||||||
cd project/jni/application
|
pushd project/jni/application
|
||||||
for f in *; do
|
for f in *; do
|
||||||
if [ -e "$f/AndroidAppSettings.cfg" ]; then
|
if [ -e "$f/AndroidAppSettings.cfg" ]; then
|
||||||
echo "$f"
|
echo "$f"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
popd
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$#" -gt 0 -a "$1" = "-h" ]; then
|
base_app_name=$(grep -Po 'AppFullName\=\K[[:alnum:].]+\.(?=[[:alnum:]]+)' AndroidAppSettings.cfg)
|
||||||
echo "Usage: $0 [-s] [-i] [-r] [-q] [debug|release] [app-name]"
|
[ -z "${named_variant}" ] && named_variant=$(grep -Po 'AppFullName\=\K[[:alnum:].]+' AndroidAppSettings.cfg | grep -Po '[[:alnum:]]+$')
|
||||||
echo " -s: sign APK file after building"
|
|
||||||
echo " -i: install APK file to device after building"
|
function project_needs_setup {
|
||||||
echo " -r: run APK file on device after building"
|
local app_name=$(grep -Po 'AppFullName\=\K[.[:alnum:]]+' AndroidAppSettings.cfg)
|
||||||
echo " -q: quick-rebuild C code, without rebuilding Java files"
|
|
||||||
echo " debug: build debug package"
|
if [ -z "${base_app_name}" ]; then
|
||||||
echo " release: build release package (default)"
|
echo "Could not determine App base name";
|
||||||
echo " app-name: directory under project/jni/application to be compiled"
|
exit 2
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
NDK_TOOLCHAIN_VERSION=$GCCVER
|
[ ! -e project/local.properties ] || \
|
||||||
[ -z "$NDK_TOOLCHAIN_VERSION" ] && NDK_TOOLCHAIN_VERSION=4.9
|
! 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 \
|
||||||
|
)" \
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
# Set here your own NDK path if needed
|
if project_needs_setup;
|
||||||
# export PATH=$PATH:~/src/endless_space/android-ndk-r7
|
then
|
||||||
NDKBUILDPATH=$PATH
|
APP_FULL_NAME="${base_app_name}${named_variant}" ./changeAppSettings.sh -a
|
||||||
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
|
|
||||||
sleep 1
|
sleep 1
|
||||||
touch project/src/Globals.java
|
touch project/src/Globals.java
|
||||||
fi
|
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
|
MYARCH=linux-x86_64
|
||||||
if [ -z "$NCPU" ]; then
|
if [ -z "$NCPU" ]; then
|
||||||
NCPU=4
|
NCPU=8
|
||||||
if uname -s | grep -i "linux" > /dev/null ; then
|
if uname -s | grep -i "linux" > /dev/null ; then
|
||||||
MYARCH=linux-x86_64
|
MYARCH=linux-x86_64
|
||||||
NCPU=`cat /proc/cpuinfo | grep -c -i processor`
|
NCPU=$(cat /proc/cpuinfo | grep -c -i processor)
|
||||||
fi
|
fi
|
||||||
if uname -s | grep -i "darwin" > /dev/null ; then
|
if uname -s | grep -i "darwin" > /dev/null ; then
|
||||||
MYARCH=darwin-x86_64
|
MYARCH=darwin-x86_64
|
||||||
@@ -111,100 +123,85 @@ if [ -z "$NCPU" ]; then
|
|||||||
MYARCH=windows-x86_64
|
MYARCH=windows-x86_64
|
||||||
fi
|
fi
|
||||||
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() {
|
if [ -x project/jni/application/src/AndroidPreBuild.sh ]; then
|
||||||
grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
|
pushd project/jni/application/src
|
||||||
echo Stripping libapplication-armeabi.so by hand && \
|
./AndroidPreBuild.sh
|
||||||
rm obj/local/armeabi/libapplication.so && \
|
popd
|
||||||
cp jni/application/src/libapplication-armeabi.so obj/local/armeabi/libapplication.so && \
|
fi
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU nice -n19 ndk-build -j$NCPU V=1 $QUICK_REBUILD_ARGS && \
|
if grep -q 'CustomBuildScript=y' ./AndroidAppSettings.cfg; then
|
||||||
strip_libs && \
|
NDK_LOG=1 ${ANDROID_NDK_HOME}/ndk-build -C project -j$NCPU V=1 CUSTOM_BUILD_SCRIPT_FIRST_PASS=1 NDK_APP_STRIP_MODE=none
|
||||||
cd .. && ./copyAssets.sh && cd project && \
|
make -C project/jni/application -f CustomBuildScript.mk
|
||||||
{ if $build_release ; then \
|
fi
|
||||||
$quick_rebuild && { \
|
|
||||||
ln -s -f libs lib ; \
|
${ANDROID_NDK_HOME}/ndk-build -C project -j$NCPU V=1 NDK_APP_STRIP_MODE=none
|
||||||
zip -u -r bin/MainActivity-release-unsigned.apk lib assets || exit 1 ; \
|
./copyAssets.sh
|
||||||
} || ant release || exit 1 ; \
|
pushd project
|
||||||
[ '!' -x jni/application/src/AndroidPostBuild.sh ] || {
|
if $build_release ; then
|
||||||
cd jni/application/src ; \
|
if [ -x ./gradlew ]; then
|
||||||
./AndroidPostBuild.sh `pwd`/../../../bin/MainActivity-release-unsigned.apk || exit 1 ; \
|
./gradlew assembleRelease
|
||||||
cd ../../.. ; \
|
else
|
||||||
} || exit 1 ; \
|
gradle assembleRelease
|
||||||
jarsigner -verbose -keystore ~/.android/debug.keystore -storepass android -sigalg MD5withRSA -digestalg SHA1 bin/MainActivity-release-unsigned.apk androiddebugkey || exit 1 ; \
|
fi
|
||||||
rm -f bin/MainActivity-debug.apk ; \
|
if [ -x jni/application/src/AndroidPostBuild.sh ]; then
|
||||||
zipalign 4 bin/MainActivity-release-unsigned.apk bin/MainActivity-debug.apk || exit 1 ; \
|
pushd jni/application/src
|
||||||
else \
|
./AndroidPostBuild.sh ${THIS_BUILD_DIR}/project/app/build/outputs/apk/release/app-release-unsigned.apk
|
||||||
$quick_rebuild && { \
|
popd
|
||||||
ln -s -f libs lib ; \
|
fi
|
||||||
zip -u -r bin/MainActivity-debug-unaligned.apk lib assets || exit 1 ; \
|
../copyAssets.sh pack-binaries app/build/outputs/apk/release/app-release-unsigned.apk
|
||||||
jarsigner -verbose -keystore ~/.android/debug.keystore -storepass android -sigalg MD5withRSA -digestalg SHA1 bin/MainActivity-debug-unaligned.apk androiddebugkey || exit 1 ; \
|
rm -f app/build/outputs/apk/release/app-release.apk
|
||||||
rm -f bin/MainActivity-debug.apk ; \
|
if $do_zipalign; then
|
||||||
zipalign 4 bin/MainActivity-debug-unaligned.apk bin/MainActivity-debug.apk || exit 1 ; \
|
zipalign -p 4 app/build/outputs/apk/release/app-release-unsigned.apk app/build/outputs/apk/release/app-release.apk
|
||||||
} || ant debug || exit 1 ; \
|
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 cd .. && ./sign.sh && cd project ; else true ; fi ; } && \
|
else
|
||||||
{ $install_apk && [ -n "`adb devices | tail -n +2`" ] && \
|
if [ -x ./gradlew ]; then
|
||||||
{ cd bin && adb install -r MainActivity-debug.apk | grep 'Failure' && \
|
./gradlew assembleDebug
|
||||||
adb uninstall `grep AppFullName ../../AndroidAppSettings.cfg | sed 's/.*=//'` && adb install -r MainActivity-debug.apk ; } ; \
|
else
|
||||||
true ; } && \
|
gradle assembleDebug
|
||||||
{ $run_apk && { \
|
fi
|
||||||
ActivityName="`grep AppFullName ../../AndroidAppSettings.cfg | sed 's/.*=//'`/.MainActivity" ; \
|
if [ -x jni/application/src/AndroidPostBuild.sh ]; then
|
||||||
RUN_APK="adb shell am start -n $ActivityName" ; \
|
pushd jni/application/src
|
||||||
echo "Running $ActivityName on the USB-connected device:" ; \
|
./AndroidPostBuild.sh ${THIS_BUILD_DIR}/project/app/build/outputs/apk/debug/app-debug.apk
|
||||||
echo "$RUN_APK" ; \
|
popd
|
||||||
eval $RUN_APK ; } ; \
|
fi
|
||||||
true ; } || exit 1
|
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
|
||||||
|
|||||||
1320
build/envsetup.sh
1320
build/envsetup.sh
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,16 +1,40 @@
|
|||||||
#!/bin/sh
|
#!/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"
|
echo "Copying app data files from project/jni/application/src/AndroidData to project/assets"
|
||||||
mkdir -p project/assets
|
mkdir -p project/assets
|
||||||
rm -f -r project/assets/*
|
rm -f -r project/assets/*
|
||||||
if [ -d "project/jni/application/src/AndroidData" ] ; then
|
if [ -d "project/jni/application/src/AndroidData" ] ; then
|
||||||
cp -L -r project/jni/application/src/AndroidData/* project/assets/
|
for F in project/jni/application/src/AndroidData/*; do
|
||||||
exit 0 # Do not split assets, this was needed only for Andorid 2.3 with it's stupid limitations
|
[ "$F" = "project/jni/application/src/AndroidData/lib" ] && continue
|
||||||
for F in project/assets/*; do
|
[ "$F" = "project/jni/application/src/AndroidData/assetpack" ] && continue
|
||||||
if [ `cat $F | wc -c` -gt 1000000 ] ; then
|
cp -L -r "$F" project/assets/
|
||||||
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
|
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -5,16 +5,19 @@ APPVER=`grep AppVersionName AndroidAppSettings.cfg | sed 's/.*=//' | tr -d '"' |
|
|||||||
|
|
||||||
ARCHIVER=gzip
|
ARCHIVER=gzip
|
||||||
EXT=gz
|
EXT=gz
|
||||||
which xz > /dev/null && ARCHIVER="xz -z" && EXT=xz
|
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 isntall pxz"
|
#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
|
# 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"
|
# --exclude="*.a" --exclude="*.so"
|
||||||
tar -c --exclude-vcs --exclude="*.o" --exclude="*.d" --exclude="*.dep" \
|
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/.*'` \
|
`git ls-files --exclude-standard | grep -v '^project/jni/application/.*'` \
|
||||||
`find project/jni/application -maxdepth 1 -type f -o -type l` \
|
`find project/jni/application -maxdepth 1 -type f -o -type l` \
|
||||||
project/jni/application/src \
|
project/jni/application/src \
|
||||||
project/jni/application/`readlink project/jni/application/src` \
|
project/jni/application/`readlink project/jni/application/src` \
|
||||||
project/AndroidManifest.xml project/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
|
"$@" | $ARCHIVER > $APPNAME-$APPVER-src.tar.$EXT
|
||||||
|
|||||||
1
metadata/en-US/changelogs/1220111.txt
Normal file
1
metadata/en-US/changelogs/1220111.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Initial F-Droid release
|
||||||
11
metadata/en-US/full_description.txt
Normal file
11
metadata/en-US/full_description.txt
Normal 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.
|
||||||
BIN
metadata/en-US/images/icon.png
Normal file
BIN
metadata/en-US/images/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 88 KiB |
BIN
metadata/en-US/images/phoneScreenshots/01.jpg
Normal file
BIN
metadata/en-US/images/phoneScreenshots/01.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 345 KiB |
BIN
metadata/en-US/images/phoneScreenshots/02.jpg
Normal file
BIN
metadata/en-US/images/phoneScreenshots/02.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 224 KiB |
BIN
metadata/en-US/images/phoneScreenshots/03.jpg
Normal file
BIN
metadata/en-US/images/phoneScreenshots/03.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 246 KiB |
BIN
metadata/en-US/images/phoneScreenshots/04.jpg
Normal file
BIN
metadata/en-US/images/phoneScreenshots/04.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 452 KiB |
BIN
metadata/en-US/images/phoneScreenshots/05.jpg
Normal file
BIN
metadata/en-US/images/phoneScreenshots/05.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 315 KiB |
1
metadata/en-US/short_description.txt
Normal file
1
metadata/en-US/short_description.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
A simulation game based on the popular game "Transport Tycoon Deluxe"
|
||||||
3
project/.gitignore
vendored
Normal file
3
project/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
/.gradle
|
||||||
|
/build
|
||||||
|
|
||||||
@@ -1,23 +1,26 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.package.name"
|
|
||||||
android:versionCode="100"
|
android:versionCode="100"
|
||||||
android:versionName="1.0.0"
|
android:versionName="1.0.0"
|
||||||
android:installLocation="auto"
|
android:installLocation="auto"
|
||||||
>
|
>
|
||||||
<application android:label="@string/app_name"
|
<application android:label="@string/app_name"
|
||||||
android:icon="@drawable/icon"
|
android:icon="@drawable/icon"
|
||||||
android:debuggable="true"
|
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:banner="@drawable/banner"
|
android:banner="@drawable/banner"
|
||||||
android:isGame="true"
|
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:label="@string/app_name"
|
||||||
android:alwaysRetainTaskState="true"
|
android:alwaysRetainTaskState="true"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection"
|
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection"
|
||||||
android:windowSoftInputMode="stateUnspecified"
|
android:windowSoftInputMode="stateUnspecified"
|
||||||
|
android:theme="@style/AppTheme"
|
||||||
|
android:exported="true"
|
||||||
>
|
>
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
@@ -27,20 +30,33 @@
|
|||||||
<category android:name="android.intent.category.LEANBACK_LAUNCHER" /> <!-- Android TV requires this -->
|
<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 -->
|
<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>
|
</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>
|
</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== --> <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.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.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"/>
|
<!-- ==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 -->
|
<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:label="@string/app_name"
|
||||||
android:alwaysRetainTaskState="true"
|
android:alwaysRetainTaskState="true"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection"
|
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection"
|
||||||
android:windowSoftInputMode="stateUnspecified"
|
android:windowSoftInputMode="stateUnspecified"
|
||||||
android:process=":RestartMainActivity"
|
android:process=":RestartMainActivity"
|
||||||
|
android:exported="true"
|
||||||
/>
|
/>
|
||||||
<service android:name=".DummyService"
|
<service android:name=".DummyService"
|
||||||
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection"
|
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection"
|
||||||
@@ -48,20 +64,29 @@
|
|||||||
/>
|
/>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="25"/>
|
|
||||||
<!-- ==INTERNET== --> <uses-permission android:name="android.permission.INTERNET" />
|
<!-- ==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.WRITE_EXTERNAL_STORAGE" />
|
||||||
<!-- ==EXTERNAL_STORAGE== --> <uses-permission android:name="android.permission.READ_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" />
|
<!-- ==RECORD_AUDIO== --> <uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||||
<!-- ==ADMOB== --> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<!-- ==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-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.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.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.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.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-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-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" />
|
<!-- ==SCREEN-SIZE-LARGE== --> <supports-screens android:smallScreens="false" android:normalScreens="false" android:largeScreens="true" android:xlargeScreens="true" />
|
||||||
|
|||||||
41
project/app/build-template.gradle
Normal file
41
project/app/build-template.gradle
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
plugins {
|
||||||
|
id 'com.android.application'
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace 'net.olofson.ballfield'
|
||||||
|
compileSdk 33
|
||||||
|
ndkVersion "25.2.9519653"
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "net.olofson.ballfield"
|
||||||
|
minSdk 24
|
||||||
|
targetSdk 33
|
||||||
|
}
|
||||||
|
|
||||||
|
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("androidx.constraintlayout:constraintlayout:2.1.4")
|
||||||
|
implementation 'com.google.android.gms:play-services-games:23.1.0' // ==GOOGLEPLAYGAMESERVICES==
|
||||||
|
}
|
||||||
1
project/app/src/main/AndroidManifest.xml
Symbolic link
1
project/app/src/main/AndroidManifest.xml
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../../AndroidManifest.xml
|
||||||
1
project/app/src/main/assets
Symbolic link
1
project/app/src/main/assets
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../../assets
|
||||||
1
project/app/src/main/java
Symbolic link
1
project/app/src/main/java
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../../src/
|
||||||
1
project/app/src/main/jniLibs
Symbolic link
1
project/app/src/main/jniLibs
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../../libs/
|
||||||
1
project/app/src/main/res
Symbolic link
1
project/app/src/main/res
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../../res
|
||||||
8
project/assetpack/build.gradle
Normal file
8
project/assetpack/build.gradle
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
apply plugin: 'com.android.asset-pack'
|
||||||
|
|
||||||
|
assetPack {
|
||||||
|
packName = "assetpack"
|
||||||
|
dynamicDelivery {
|
||||||
|
deliveryType = "install-time"
|
||||||
|
}
|
||||||
|
}
|
||||||
1
project/assetpack/src/main/assets
Symbolic link
1
project/assetpack/src/main/assets
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../../jni/application/src/AndroidData/assetpack
|
||||||
5
project/build.gradle
Normal file
5
project/build.gradle
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
plugins {
|
||||||
|
id 'com.android.application' version '8.0.1' apply false
|
||||||
|
id 'com.android.library' version '8.0.1' apply false
|
||||||
|
}
|
||||||
@@ -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>
|
|
||||||
21
project/gradle.properties
Normal file
21
project/gradle.properties
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# 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
|
||||||
|
# Enables namespacing of each library's R class so that its R class includes only the
|
||||||
|
# resources declared in the library itself and none from the library's dependencies,
|
||||||
|
# thereby reducing the size of the R class for that library
|
||||||
|
android.nonTransitiveRClass=true
|
||||||
BIN
project/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
project/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
project/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
project/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#Wed May 17 18:24:03 EEST 2023
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
248
project/gradlew
vendored
Executable file
248
project/gradlew
vendored
Executable file
@@ -0,0 +1,248 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original 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 POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# 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 ;; #(
|
||||||
|
MSYS* | 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
|
||||||
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC3045
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC3045
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# 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"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command;
|
||||||
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
# double quotes to make sure that they get re-expanded; and
|
||||||
|
# * put everything else in single quotes, so that it's not re-expanded.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
92
project/gradlew.bat
vendored
Normal file
92
project/gradlew.bat
vendored
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
@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=.
|
||||||
|
@rem This is normally unused
|
||||||
|
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% equ 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% equ 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!
|
||||||
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
@@ -29,6 +29,7 @@ import android.view.KeyEvent;
|
|||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
@@ -52,10 +53,16 @@ import java.util.Arrays;
|
|||||||
import android.text.SpannedString;
|
import android.text.SpannedString;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.content.pm.PackageManager;
|
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
|
class CountingInputStream extends BufferedInputStream
|
||||||
{
|
{
|
||||||
@@ -170,7 +177,6 @@ class DataDownloader extends Thread
|
|||||||
{
|
{
|
||||||
Parent = _Parent;
|
Parent = _Parent;
|
||||||
Status = new StatusWriter( _Status, _Parent );
|
Status = new StatusWriter( _Status, _Parent );
|
||||||
//Status.setText( "Connecting to " + Globals.DataDownloadUrl );
|
|
||||||
outFilesDir = Globals.DataDir;
|
outFilesDir = Globals.DataDir;
|
||||||
DownloadComplete = false;
|
DownloadComplete = false;
|
||||||
this.start();
|
this.start();
|
||||||
@@ -186,7 +192,6 @@ class DataDownloader extends Thread
|
|||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
Parent.keyListener = new BackKeyListener(Parent);
|
|
||||||
String [] downloadFiles = Globals.DataDownloadUrl;
|
String [] downloadFiles = Globals.DataDownloadUrl;
|
||||||
int total = 0;
|
int total = 0;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -209,7 +214,16 @@ class DataDownloader extends Thread
|
|||||||
downloadFiles[i].contains("<ARCH>") &&
|
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) ) )
|
! 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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -217,7 +231,6 @@ class DataDownloader extends Thread
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
DownloadComplete = true;
|
DownloadComplete = true;
|
||||||
Parent.keyListener = null;
|
|
||||||
initParent();
|
initParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,20 +274,6 @@ class DataDownloader extends Thread
|
|||||||
if( ! matched )
|
if( ! matched )
|
||||||
throw new IOException();
|
throw new IOException();
|
||||||
Status.setText( res.getString(R.string.download_unneeded) );
|
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;
|
return true;
|
||||||
} catch ( IOException e ) {
|
} catch ( IOException e ) {
|
||||||
forceOverwrite = true;
|
forceOverwrite = true;
|
||||||
@@ -287,7 +286,7 @@ class DataDownloader extends Thread
|
|||||||
Log.i("SDL", "Downloading data to: '" + outFilesDir + "'");
|
Log.i("SDL", "Downloading data to: '" + outFilesDir + "'");
|
||||||
try {
|
try {
|
||||||
File outDir = new File( outFilesDir );
|
File outDir = new File( outFilesDir );
|
||||||
if( !(outDir.exists() && outDir.isDirectory()) )
|
if( !outDir.exists() )
|
||||||
outDir.mkdirs();
|
outDir.mkdirs();
|
||||||
OutputStream out = new FileOutputStream( getOutFilePath(".nomedia") );
|
OutputStream out = new FileOutputStream( getOutFilePath(".nomedia") );
|
||||||
out.flush();
|
out.flush();
|
||||||
@@ -304,6 +303,9 @@ class DataDownloader extends Thread
|
|||||||
boolean DoNotUnzip = false;
|
boolean DoNotUnzip = false;
|
||||||
boolean FileInAssets = false;
|
boolean FileInAssets = false;
|
||||||
boolean FileInExpansion = false;
|
boolean FileInExpansion = false;
|
||||||
|
boolean MountObb = false;
|
||||||
|
final boolean[] ObbMounted = new boolean[] { false };
|
||||||
|
final boolean[] ObbMountedError = new boolean[] { false };
|
||||||
String url = "";
|
String url = "";
|
||||||
|
|
||||||
int downloadUrlIndex = 1;
|
int downloadUrlIndex = 1;
|
||||||
@@ -329,31 +331,61 @@ class DataDownloader extends Thread
|
|||||||
partialDownloadLen = partialDownload.length();
|
partialDownloadLen = partialDownload.length();
|
||||||
}
|
}
|
||||||
Status.setText( downloadCount + "/" + downloadTotal + ": " + res.getString(R.string.connecting_to, url) );
|
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);
|
Log.i("SDL", "Found asset pack: " + Parent.assetPackPath);
|
||||||
if (permissionCheck != PackageManager.PERMISSION_GRANTED && !Parent.writeExternalStoragePermissionDialogAnswered)
|
return true;
|
||||||
{
|
|
||||||
Parent.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
|
|
||||||
while( !Parent.writeExternalStoragePermissionDialogAnswered )
|
|
||||||
{
|
|
||||||
try{ Thread.sleep(300); } catch (InterruptedException e) {}
|
|
||||||
}
|
}
|
||||||
|
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);
|
url = getObbFilePath(url);
|
||||||
InputStream stream1 = null;
|
InputStream stream1 = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
stream1 = new FileInputStream(url);
|
stream1 = new FileInputStream(url);
|
||||||
stream1.read();
|
stream1.read();
|
||||||
stream1.close();
|
stream1.close();
|
||||||
Log.i("SDL", "Fetching file from expansion: " + url);
|
Log.i("SDL", "Fetching file from expansion: " + url);
|
||||||
FileInExpansion = true;
|
FileInExpansion = true;
|
||||||
|
MountObb = tmpMountObb;
|
||||||
break;
|
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);
|
Log.i("SDL", "Failed to open file: " + url);
|
||||||
downloadUrlIndex++;
|
downloadUrlIndex++;
|
||||||
continue;
|
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 )
|
if( FileInExpansion )
|
||||||
{
|
{
|
||||||
Log.i("SDL", "Count file size: '" + url);
|
Log.i("SDL", "Count file size: '" + url);
|
||||||
@@ -513,15 +590,7 @@ class DataDownloader extends Thread
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
stream.close();
|
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 ) {
|
} catch( java.io.IOException e ) {
|
||||||
Log.i("SDL", "Error truncating file from expansion: " + url);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -781,7 +850,7 @@ class DataDownloader extends Thread
|
|||||||
public MainActivity Parent;
|
public MainActivity Parent;
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
Parent.initSDL();
|
Parent.downloadFinishedInitSDL();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Callback cb = new Callback();
|
Callback cb = new Callback();
|
||||||
@@ -799,57 +868,13 @@ class DataDownloader extends Thread
|
|||||||
|
|
||||||
private String getObbFilePath(final String url)
|
private String getObbFilePath(final String url)
|
||||||
{
|
{
|
||||||
|
// "obb:" or "mnt:" - same length
|
||||||
return Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/obb/" +
|
return Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/obb/" +
|
||||||
Parent.getPackageName() + "/" + url.substring("obb:".length()) + "." + Parent.getPackageName() + ".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 StatusWriter Status;
|
||||||
public boolean DownloadComplete = false;
|
public boolean DownloadComplete = false;
|
||||||
public boolean DownloadFailed = false;
|
|
||||||
public boolean DownloadCanBeResumed = false;
|
public boolean DownloadCanBeResumed = false;
|
||||||
private MainActivity Parent;
|
private MainActivity Parent;
|
||||||
private String outFilesDir = null;
|
private String outFilesDir = null;
|
||||||
|
|||||||
@@ -92,6 +92,8 @@ import android.inputmethodservice.Keyboard;
|
|||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.widget.RemoteViews;
|
import android.widget.RemoteViews;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.app.NotificationChannel;
|
||||||
|
|
||||||
public class DummyService extends Service
|
public class DummyService extends Service
|
||||||
{
|
{
|
||||||
@@ -110,13 +112,29 @@ public class DummyService extends Service
|
|||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
Log.v("SDL", "Starting dummy service - displaying notification");
|
Log.v("SDL", "Starting dummy service - displaying notification");
|
||||||
Notification ntf = new Notification();
|
Notification.Builder builder;
|
||||||
ntf.icon = R.drawable.icon;
|
if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.O )
|
||||||
ntf.flags |= Notification.FLAG_NO_CLEAR;
|
{
|
||||||
|
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 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);
|
PendingIntent showIntent = PendingIntent.getActivity(this, 0, new Intent("", null, this, MainActivity.class), PendingIntent.FLAG_CANCEL_CURRENT);
|
||||||
ntf.deleteIntent = killIntent;
|
ntf.deleteIntent = killIntent;
|
||||||
ntf.tickerText = getString(getApplicationInfo().labelRes);
|
|
||||||
RemoteViews view = new RemoteViews(getPackageName(), R.layout.notification);
|
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.setCharSequence(R.id.notificationText, "setText", getString(R.string.notification_app_is_running, getString(getApplicationInfo().labelRes)));
|
||||||
view.setOnClickPendingIntent(R.id.notificationText, showIntent);
|
view.setOnClickPendingIntent(R.id.notificationText, showIntent);
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import android.util.Log;
|
|||||||
import android.view.SurfaceHolder;
|
import android.view.SurfaceHolder;
|
||||||
import android.view.SurfaceView;
|
import android.view.SurfaceView;
|
||||||
import android.app.KeyguardManager;
|
import android.app.KeyguardManager;
|
||||||
|
import android.graphics.Rect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An implementation of SurfaceView that uses the dedicated surface for
|
* 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;
|
mRenderMode = RENDERMODE_CONTINUOUSLY;
|
||||||
mRenderer = renderer;
|
mRenderer = renderer;
|
||||||
mRenderer.setSwapBuffersCallback(this);
|
mRenderer.setSwapBuffersCallback(this);
|
||||||
setName("GLThread");
|
setName("SDLVideoThread");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -32,9 +32,14 @@ class Globals
|
|||||||
public static String ApplicationName = "CommanderGenius";
|
public static String ApplicationName = "CommanderGenius";
|
||||||
public static String AppLibraries[] = { "sdl-1.2", };
|
public static String AppLibraries[] = { "sdl-1.2", };
|
||||||
public static String AppMainLibraries[] = { "application", "sdl_main" };
|
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 String LibraryNamesMap[][] = {
|
||||||
public static final boolean Using_SDL_1_3 = false;
|
{ "crypto", "crypto.so.sdl.1" },
|
||||||
public static final boolean Using_SDL_2_0 = false;
|
{ "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 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 SwVideoMode = false;
|
||||||
public static boolean NeedDepthBuffer = false;
|
public static boolean NeedDepthBuffer = false;
|
||||||
@@ -42,7 +47,7 @@ class Globals
|
|||||||
public static boolean NeedGles2 = false;
|
public static boolean NeedGles2 = false;
|
||||||
public static boolean NeedGles3 = false;
|
public static boolean NeedGles3 = false;
|
||||||
public static boolean CompatibilityHacksVideo = false;
|
public static boolean CompatibilityHacksVideo = false;
|
||||||
public static boolean CompatibilityHacksForceScreenUpdateMouseClick = true;
|
public static boolean CompatibilityHacksForceScreenUpdateMouseClick = false;
|
||||||
public static boolean CompatibilityHacksStaticInit = false;
|
public static boolean CompatibilityHacksStaticInit = false;
|
||||||
public static boolean CompatibilityHacksTextInputEmulatesHwKeyboard = false;
|
public static boolean CompatibilityHacksTextInputEmulatesHwKeyboard = false;
|
||||||
public static int TextInputKeyboard = 0;
|
public static int TextInputKeyboard = 0;
|
||||||
@@ -85,13 +90,15 @@ class Globals
|
|||||||
public static boolean HorizontalOrientation = true;
|
public static boolean HorizontalOrientation = true;
|
||||||
public static boolean AutoDetectOrientation = false;
|
public static boolean AutoDetectOrientation = false;
|
||||||
public static boolean ImmersiveMode = true;
|
public static boolean ImmersiveMode = true;
|
||||||
|
public static boolean DrawInDisplayCutout = false;
|
||||||
|
public static boolean HideSystemMousePointer = false;
|
||||||
public static boolean DownloadToSdcard = true;
|
public static boolean DownloadToSdcard = true;
|
||||||
public static boolean PhoneHasArrowKeys = false;
|
public static boolean PhoneHasArrowKeys = false;
|
||||||
public static boolean UseAccelerometerAsArrowKeys = false;
|
public static boolean UseAccelerometerAsArrowKeys = false;
|
||||||
public static boolean UseTouchscreenKeyboard = true;
|
public static boolean UseTouchscreenKeyboard = true;
|
||||||
public static int TouchscreenKeyboardSize = 1;
|
public static int TouchscreenKeyboardSize = 1;
|
||||||
public static final int TOUCHSCREEN_KEYBOARD_CUSTOM = 4;
|
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 TouchscreenKeyboardTheme = 2;
|
||||||
public static int TouchscreenKeyboardTransparency = 2;
|
public static int TouchscreenKeyboardTransparency = 2;
|
||||||
public static boolean FloatingScreenJoystick = false;
|
public static boolean FloatingScreenJoystick = false;
|
||||||
@@ -124,12 +131,66 @@ class Globals
|
|||||||
public static boolean KeepAspectRatio = KeepAspectRatioDefaultSetting;
|
public static boolean KeepAspectRatio = KeepAspectRatioDefaultSetting;
|
||||||
public static boolean TvBorders = true;
|
public static boolean TvBorders = true;
|
||||||
public static int RemapHwKeycode[] = new int[SDL_Keys.JAVA_KEYCODE_LAST];
|
public static int RemapHwKeycode[] = new int[SDL_Keys.JAVA_KEYCODE_LAST];
|
||||||
public static int RemapScreenKbKeycode[] = new int[6];
|
public static int RemapScreenKbKeycode[] = new int[12];
|
||||||
public static int ScreenKbControlsLayout[][] = AppUsesThirdJoystick ? // Values for 800x480 resolution
|
// 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 } } :
|
public static int ScreenKbControlsLayout[][] =
|
||||||
AppUsesSecondJoystick ?
|
AppUsesThirdJoystick ? new int[][]
|
||||||
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 } };
|
{ 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 boolean ScreenKbControlsShown[] = new boolean[ScreenKbControlsLayout.length]; /* Also joystick and text input button added */
|
||||||
public static int RemapMultitouchGestureKeycode[] = new int[4];
|
public static int RemapMultitouchGestureKeycode[] = new int[4];
|
||||||
public static boolean MultitouchGesturesUsed[] = new boolean[4];
|
public static boolean MultitouchGesturesUsed[] = new boolean[4];
|
||||||
|
|||||||
@@ -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
56
project/java/Mouse.java
Normal 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
618
project/java/SDL_Keys.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -75,6 +75,7 @@ import android.widget.Toast;
|
|||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
|
|
||||||
|
|
||||||
// TODO: too much code here, split into multiple files, possibly auto-generated menus?
|
// 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 settingsLoaded = false;
|
||||||
static boolean settingsChanged = false;
|
static boolean settingsChanged = false;
|
||||||
static final int SETTINGS_FILE_VERSION = 5;
|
static final int SETTINGS_FILE_VERSION = 5;
|
||||||
|
static boolean convertButtonSizeFromOldSdlVersion = false;
|
||||||
|
static int settingsAppVersion = 0;
|
||||||
|
|
||||||
static void Save(final MainActivity p)
|
static void Save(final MainActivity p)
|
||||||
{
|
{
|
||||||
@@ -187,6 +190,9 @@ public class Settings
|
|||||||
out.writeBoolean(Globals.AutoDetectOrientation);
|
out.writeBoolean(Globals.AutoDetectOrientation);
|
||||||
out.writeBoolean(Globals.TvBorders);
|
out.writeBoolean(Globals.TvBorders);
|
||||||
out.writeBoolean(Globals.ForceHardwareMouse);
|
out.writeBoolean(Globals.ForceHardwareMouse);
|
||||||
|
convertButtonSizeFromOldSdlVersion = false;
|
||||||
|
out.writeBoolean(convertButtonSizeFromOldSdlVersion);
|
||||||
|
out.writeBoolean(Globals.DrawInDisplayCutout);
|
||||||
|
|
||||||
out.close();
|
out.close();
|
||||||
settingsLoaded = true;
|
settingsLoaded = true;
|
||||||
@@ -196,13 +202,157 @@ public class Settings
|
|||||||
} catch ( IOException e ) {};
|
} catch ( IOException e ) {};
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Load( final MainActivity p )
|
static boolean LoadConfig( final MainActivity p )
|
||||||
|
{
|
||||||
|
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
|
if( settingsLoaded ) // Prevent starting twice
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Log.i("SDL", "libSDL: Settings.Load(): enter");
|
Log.i("SDL", "libSDL: Settings.ProcessConfig(): enter");
|
||||||
nativeInitKeymap();
|
nativeInitKeymap();
|
||||||
for( int i = 0; i < SDL_Keys.JAVA_KEYCODE_LAST; i++ )
|
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[0] = (Globals.AppNeedsArrowKeys || Globals.AppUsesJoystick);
|
||||||
Globals.ScreenKbControlsShown[1] = Globals.AppNeedsTextInput;
|
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 );
|
Globals.ScreenKbControlsShown[i] = ( i - 2 < Globals.AppTouchscreenKeyboardKeysAmount );
|
||||||
if( Globals.AppUsesSecondJoystick )
|
if( Globals.AppUsesSecondJoystick )
|
||||||
Globals.ScreenKbControlsShown[8] = true;
|
Globals.ScreenKbControlsShown[8] = true;
|
||||||
if( Globals.AppUsesThirdJoystick )
|
if( Globals.AppUsesThirdJoystick )
|
||||||
Globals.ScreenKbControlsShown[9] = true;
|
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++ )
|
for( int i = 0; i < Globals.RemapMultitouchGestureKeycode.length; i++ )
|
||||||
{
|
{
|
||||||
int sdlKey = nativeGetKeymapKeyMultitouchGesture(i);
|
int sdlKey = nativeGetKeymapKeyMultitouchGesture(i);
|
||||||
@@ -270,130 +422,20 @@ public class Settings
|
|||||||
// ICS update sends events in a proper way
|
// ICS update sends events in a proper way
|
||||||
Globals.RemapHwKeycode[112] = SDL_1_2_Keycodes.SDLK_UNKNOWN;
|
Globals.RemapHwKeycode[112] = SDL_1_2_Keycodes.SDLK_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
convertButtonSizeFromOldSdlVersion = false;
|
||||||
|
|
||||||
try {
|
settingsLoaded = LoadConfig(p);
|
||||||
ObjectInputStream settingsFile = new ObjectInputStream(new FileInputStream( p.getFilesDir().getAbsolutePath() + "/" + SettingsFileName ));
|
|
||||||
if( settingsFile.readInt() != SETTINGS_FILE_VERSION )
|
if (settingsLoaded)
|
||||||
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();
|
Log.i("SDL", "libSDL: Settings.ProcessConfig(): loaded settings successfully");
|
||||||
}
|
Log.i("SDL", "libSDL: old app version " + settingsAppVersion + ", new app version " + p.getApplicationVersion());
|
||||||
if( settingsFile.readInt() != Globals.RemapScreenKbKeycode.length )
|
if( settingsAppVersion != p.getApplicationVersion() )
|
||||||
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();
|
|
||||||
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() )
|
|
||||||
{
|
{
|
||||||
DeleteFilesOnUpgrade(p);
|
DeleteFilesOnUpgrade(p);
|
||||||
if( Globals.ResetSdlConfigForThisVersion )
|
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
|
// Delete settings file, and restart the application
|
||||||
DeleteSdlConfigOnUpgradeAndRestart(p);
|
DeleteSdlConfigOnUpgradeAndRestart(p);
|
||||||
}
|
}
|
||||||
@@ -401,20 +443,21 @@ public class Settings
|
|||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
} catch( FileNotFoundException e ) {
|
Log.i("SDL", "libSDL: settings cannot be loaded");
|
||||||
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);
|
DeleteFilesOnUpgrade(p);
|
||||||
if( Globals.ResetSdlConfigForThisVersion )
|
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");
|
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);
|
DeleteSdlConfigOnUpgradeAndRestart(p);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
if( Globals.DataDir.length() == 0 )
|
if( Globals.DataDir.length() == 0 )
|
||||||
{
|
{
|
||||||
@@ -593,8 +636,9 @@ public class Settings
|
|||||||
Globals.TouchscreenKeyboardDrawSize,
|
Globals.TouchscreenKeyboardDrawSize,
|
||||||
Globals.TouchscreenKeyboardTheme,
|
Globals.TouchscreenKeyboardTheme,
|
||||||
Globals.TouchscreenKeyboardTransparency,
|
Globals.TouchscreenKeyboardTransparency,
|
||||||
Globals.FloatingScreenJoystick ? 1 : 0 );
|
Globals.FloatingScreenJoystick ? 1 : 0,
|
||||||
SetupTouchscreenKeyboardGraphics(p);
|
Globals.AppTouchscreenKeyboardKeysAmount );
|
||||||
|
DemoGLSurfaceView.SetupTouchscreenKeyboardGraphics(p);
|
||||||
for( int i = 0; i < Globals.RemapScreenKbKeycode.length; i++ )
|
for( int i = 0; i < Globals.RemapScreenKbKeycode.length; i++ )
|
||||||
nativeSetKeymapKeyScreenKb(i, SDL_Keys.values[Globals.RemapScreenKbKeycode[i]]);
|
nativeSetKeymapKeyScreenKb(i, SDL_Keys.values[Globals.RemapScreenKbKeycode[i]]);
|
||||||
if( Globals.TouchscreenKeyboardSize == Globals.TOUCHSCREEN_KEYBOARD_CUSTOM )
|
if( Globals.TouchscreenKeyboardSize == Globals.TOUCHSCREEN_KEYBOARD_CUSTOM )
|
||||||
@@ -629,9 +673,10 @@ public class Settings
|
|||||||
Log.i("SDL", "libSDL: setting envvar LANGUAGE to '" + lang + "'");
|
Log.i("SDL", "libSDL: setting envvar LANGUAGE to '" + lang + "'");
|
||||||
nativeSetEnv( "LANG", lang );
|
nativeSetEnv( "LANG", lang );
|
||||||
nativeSetEnv( "LANGUAGE", 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( "APPDIR", p.getFilesDir().getAbsolutePath() );
|
||||||
nativeSetEnv( "SECURE_STORAGE_DIR", p.getFilesDir().getAbsolutePath() );
|
nativeSetEnv( "SECURE_STORAGE_DIR", p.getFilesDir().getAbsolutePath() );
|
||||||
|
nativeSetEnv( "LIBDIR", p.getApplicationInfo().nativeLibraryDir );
|
||||||
nativeSetEnv( "DATADIR", Globals.DataDir );
|
nativeSetEnv( "DATADIR", Globals.DataDir );
|
||||||
nativeSetEnv( "UNSECURE_STORAGE_DIR", Globals.DataDir );
|
nativeSetEnv( "UNSECURE_STORAGE_DIR", Globals.DataDir );
|
||||||
SdcardAppPath.get().setEnv(p);
|
SdcardAppPath.get().setEnv(p);
|
||||||
@@ -646,9 +691,27 @@ public class Settings
|
|||||||
nativeSetEnv( "ANDROID_PACKAGE_NAME", p.getPackageName() );
|
nativeSetEnv( "ANDROID_PACKAGE_NAME", p.getPackageName() );
|
||||||
nativeSetEnv( "ANDROID_PACKAGE_PATH", p.getPackageCodePath() );
|
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_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 {
|
try {
|
||||||
nativeSetEnv( "ANDROID_APP_NAME", p.getString(p.getApplicationInfo().labelRes) );
|
nativeSetEnv( "ANDROID_APP_NAME", p.getString(p.getApplicationInfo().labelRes) );
|
||||||
} catch (Exception eeeeee) {}
|
} 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());
|
Log.d("SDL", "libSDL: Is running on OUYA: " + p.isRunningOnOUYA());
|
||||||
if( p.isRunningOnOUYA() )
|
if( p.isRunningOnOUYA() )
|
||||||
{
|
{
|
||||||
@@ -682,63 +745,6 @@ public class Settings
|
|||||||
} catch (Exception eeeee) {}
|
} 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
|
abstract static class SdcardAppPath
|
||||||
{
|
{
|
||||||
public static SdcardAppPath get()
|
public static SdcardAppPath get()
|
||||||
@@ -947,6 +953,7 @@ public class Settings
|
|||||||
Save(MainActivity.instance);
|
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 nativeSetAccelerometerSettings(int sensitivity, int centerPos);
|
||||||
private static native void nativeSetMouseUsed(int RightClickMethod, int ShowScreenUnderFinger, int LeftClickMethod,
|
private static native void nativeSetMouseUsed(int RightClickMethod, int ShowScreenUnderFinger, int LeftClickMethod,
|
||||||
int MoveMouseWithJoystick, int ClickMouseWithDpad, int MaxForce, int MaxRadius,
|
int MoveMouseWithJoystick, int ClickMouseWithDpad, int MaxForce, int MaxRadius,
|
||||||
@@ -958,7 +965,7 @@ public class Settings
|
|||||||
int HoverJitterFilter, int RightMouseButtonLongPress,
|
int HoverJitterFilter, int RightMouseButtonLongPress,
|
||||||
int MoveMouseWithGyroscope, int MoveMouseWithGyroscopeSpeed,
|
int MoveMouseWithGyroscope, int MoveMouseWithGyroscopeSpeed,
|
||||||
int ForceScreenUpdateMouseClick, int ScreenFollowsMouse);
|
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 nativeSetAccelerometerUsed();
|
||||||
private static native void nativeSetMultitouchUsed();
|
private static native void nativeSetMultitouchUsed();
|
||||||
private static native void nativeSetTouchscreenKeyboardUsed();
|
private static native void nativeSetTouchscreenKeyboardUsed();
|
||||||
@@ -967,8 +974,8 @@ public class Settings
|
|||||||
private static native void nativeSetCompatibilityHacks();
|
private static native void nativeSetCompatibilityHacks();
|
||||||
private static native void nativeSetVideoMultithreaded();
|
private static native void nativeSetVideoMultithreaded();
|
||||||
private static native void nativeSetVideoForceSoftwareMode();
|
private static native void nativeSetVideoForceSoftwareMode();
|
||||||
private static native void nativeSetupScreenKeyboard(int size, int drawsize, int theme, int transparency, int floatingScreenJoystick);
|
public static native void nativeSetupScreenKeyboard(int size, int drawsize, int theme, int transparency, int floatingScreenJoystick, int buttonAmount);
|
||||||
private static native void nativeSetupScreenKeyboardButtons(byte[] img);
|
public static native void nativeSetupScreenKeyboardButtons(byte[] img);
|
||||||
private static native void nativeInitKeymap();
|
private static native void nativeInitKeymap();
|
||||||
private static native int nativeGetKeymapKey(int key);
|
private static native int nativeGetKeymapKey(int key);
|
||||||
private static native void nativeSetKeymapKey(int javakey, 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 nativeSetKeymapKeyScreenKb(int keynum, int key);
|
||||||
private static native void nativeSetScreenKbKeyUsed(int keynum, int used);
|
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 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 int nativeGetKeymapKeyMultitouchGesture(int keynum);
|
||||||
private static native void nativeSetKeymapKeyMultitouchGesture(int keynum, int key);
|
private static native void nativeSetKeymapKeyMultitouchGesture(int keynum, int key);
|
||||||
private static native void nativeSetMultitouchGestureSensitivity(int sensitivity);
|
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 void nativeSetEnv(final String name, final String value);
|
||||||
public static native int nativeChmod(final String name, int mode);
|
public static native int nativeChmod(final String name, int mode);
|
||||||
public static native void nativeChdir(final String dir);
|
public static native void nativeChdir(final String dir);
|
||||||
|
|||||||
@@ -248,6 +248,7 @@ class SettingsMenu
|
|||||||
new SettingsMenuKeyboard.ScreenGesturesConfig(),
|
new SettingsMenuKeyboard.ScreenGesturesConfig(),
|
||||||
new SettingsMenuMisc.VideoSettingsConfig(),
|
new SettingsMenuMisc.VideoSettingsConfig(),
|
||||||
new SettingsMenuMisc.CommandlineConfig(),
|
new SettingsMenuMisc.CommandlineConfig(),
|
||||||
|
new SettingsMenuMisc.StorageAccessConfig(),
|
||||||
new SettingsMenuMisc.ResetToDefaultsConfig(),
|
new SettingsMenuMisc.ResetToDefaultsConfig(),
|
||||||
new OkButton(),
|
new OkButton(),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ import android.widget.EditText;
|
|||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.Gravity;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.SpannedString;
|
import android.text.SpannedString;
|
||||||
@@ -276,10 +277,10 @@ class SettingsMenuKeyboard extends SettingsMenu
|
|||||||
void run (final MainActivity p)
|
void run (final MainActivity p)
|
||||||
{
|
{
|
||||||
p.setText(p.getResources().getString(R.string.remap_hwkeys_press));
|
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;
|
MainActivity p;
|
||||||
public KeyRemapTool(MainActivity _p)
|
public KeyRemapTool(MainActivity _p)
|
||||||
@@ -287,9 +288,10 @@ class SettingsMenuKeyboard extends SettingsMenu
|
|||||||
p = _p;
|
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;
|
int keyIndex = keyCode;
|
||||||
if( keyIndex < 0 )
|
if( keyIndex < 0 )
|
||||||
keyIndex = 0;
|
keyIndex = 0;
|
||||||
@@ -336,6 +338,7 @@ class SettingsMenuKeyboard extends SettingsMenu
|
|||||||
AlertDialog alert = builder.create();
|
AlertDialog alert = builder.create();
|
||||||
alert.setOwnerActivity(p);
|
alert.setOwnerActivity(p);
|
||||||
alert.show();
|
alert.show();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
public void ShowAllKeys(final int KeyIndex)
|
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) + " 4",
|
||||||
p.getResources().getString(R.string.remap_screenkb_button) + " 5",
|
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) + " 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);
|
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++ )
|
for( int i = 0; i < Math.min(6, Globals.AppTouchscreenKeyboardKeysNames.length); i++ )
|
||||||
items[i+2] = items[i+2] + " - " + Globals.AppTouchscreenKeyboardKeysNames[i].replace("_", " ");
|
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);
|
AlertDialog.Builder builder = new AlertDialog.Builder(p);
|
||||||
builder.setTitle(p.getResources().getString(R.string.remap_screenkb));
|
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) + " 4",
|
||||||
p.getResources().getString(R.string.remap_screenkb_button) + " 5",
|
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) + " 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("_", " ");
|
items[i] = items[i] + " - " + Globals.AppTouchscreenKeyboardKeysNames[i].replace("_", " ");
|
||||||
|
|
||||||
if( currentButton >= Globals.RemapScreenKbKeycode.length )
|
if( currentButton >= Globals.RemapScreenKbKeycode.length )
|
||||||
@@ -452,7 +457,12 @@ class SettingsMenuKeyboard extends SettingsMenu
|
|||||||
goBack(p);
|
goBack(p);
|
||||||
return;
|
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);
|
showRemapScreenKbConfig2(p, currentButton + 1);
|
||||||
return;
|
return;
|
||||||
@@ -623,13 +633,19 @@ class SettingsMenuKeyboard extends SettingsMenu
|
|||||||
void run (final MainActivity p)
|
void run (final MainActivity p)
|
||||||
{
|
{
|
||||||
p.setText(p.getResources().getString(R.string.screenkb_custom_layout_help));
|
p.setText(p.getResources().getString(R.string.screenkb_custom_layout_help));
|
||||||
|
if (Globals.ImmersiveMode)
|
||||||
|
DimSystemStatusBar.dim(p.getVideoLayout(), p.getWindow());
|
||||||
|
p.getVideoLayout().getHandler().postDelayed(new Runnable()
|
||||||
|
{
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
CustomizeScreenKbLayoutTool tool = new CustomizeScreenKbLayoutTool(p);
|
CustomizeScreenKbLayoutTool tool = new CustomizeScreenKbLayoutTool(p);
|
||||||
p.touchListener = tool;
|
|
||||||
p.keyListener = tool;
|
|
||||||
Globals.TouchscreenKeyboardSize = Globals.TOUCHSCREEN_KEYBOARD_CUSTOM;
|
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;
|
MainActivity p;
|
||||||
FrameLayout layout = null;
|
FrameLayout layout = null;
|
||||||
@@ -648,16 +664,33 @@ class SettingsMenuKeyboard extends SettingsMenu
|
|||||||
R.drawable.b5,
|
R.drawable.b5,
|
||||||
R.drawable.b6,
|
R.drawable.b6,
|
||||||
R.drawable.dpad,
|
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;
|
int oldX = 0, oldY = 0;
|
||||||
boolean resizing = false;
|
boolean resizing = false;
|
||||||
|
|
||||||
public CustomizeScreenKbLayoutTool(MainActivity _p)
|
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;
|
p = _p;
|
||||||
layout = new FrameLayout(p);
|
layout = new FrameLayout(p);
|
||||||
p.getVideoLayout().addView(layout);
|
p.getVideoLayout().addView(layout);
|
||||||
|
layout.setFocusable(true);
|
||||||
|
layout.setFocusableInTouchMode(true);
|
||||||
|
layout.requestFocus();
|
||||||
|
layout.setOnTouchListener(this);
|
||||||
|
layout.setOnKeyListener(this);
|
||||||
boundary = new ImageView(p);
|
boundary = new ImageView(p);
|
||||||
boundary.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
|
boundary.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
|
||||||
boundary.setScaleType(ImageView.ScaleType.MATRIX);
|
boundary.setScaleType(ImageView.ScaleType.MATRIX);
|
||||||
@@ -665,30 +698,28 @@ class SettingsMenuKeyboard extends SettingsMenu
|
|||||||
boundary.setImageBitmap(boundaryBmp);
|
boundary.setImageBitmap(boundaryBmp);
|
||||||
layout.addView(boundary);
|
layout.addView(boundary);
|
||||||
currentButton = -1;
|
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;
|
final int displayX = p.getVideoLayout().getWidth();
|
||||||
int displayY = 480;
|
final int displayY = p.getVideoLayout().getHeight();
|
||||||
try {
|
|
||||||
DisplayMetrics dm = new DisplayMetrics();
|
if( Globals.TouchscreenKeyboardSize != Globals.TOUCHSCREEN_KEYBOARD_CUSTOM )
|
||||||
p.getWindowManager().getDefaultDisplay().getMetrics(dm);
|
{
|
||||||
displayX = dm.widthPixels;
|
DemoRenderer.nativeResize(displayX, displayY, 0);
|
||||||
displayY = dm.heightPixels;
|
Settings.nativeSetJoystickUsed( Globals.AppUsesThirdJoystick ? 3 : (Globals.AppUsesSecondJoystick ? 2 : (Globals.AppUsesJoystick ? 1 : 0)) );
|
||||||
} catch (Exception eeeee) {}
|
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++ )
|
for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ )
|
||||||
{
|
{
|
||||||
@@ -696,37 +727,7 @@ class SettingsMenuKeyboard extends SettingsMenu
|
|||||||
continue;
|
continue;
|
||||||
if( currentButton == -1 )
|
if( currentButton == -1 )
|
||||||
currentButton = i;
|
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] );
|
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] = new ImageView(p);
|
||||||
imgs[i].setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
|
imgs[i].setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
|
||||||
@@ -744,9 +745,34 @@ class SettingsMenuKeyboard extends SettingsMenu
|
|||||||
}
|
}
|
||||||
boundary.bringToFront();
|
boundary.bringToFront();
|
||||||
if( currentButton == -1 )
|
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
|
else
|
||||||
setupButton(currentButton);
|
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)
|
void setupButton(int i)
|
||||||
@@ -774,10 +800,15 @@ class SettingsMenuKeyboard extends SettingsMenu
|
|||||||
buttonText = "Joystick 2";
|
buttonText = "Joystick 2";
|
||||||
if( i == 9 )
|
if( i == 9 )
|
||||||
buttonText = "Joystick 3";
|
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);
|
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 )
|
if( ev.getAction() == MotionEvent.ACTION_DOWN )
|
||||||
{
|
{
|
||||||
@@ -842,18 +873,19 @@ class SettingsMenuKeyboard extends SettingsMenu
|
|||||||
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
|
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
|
||||||
boundary.setImageMatrix(m);
|
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 )
|
if( keyCode == KeyEvent.KEYCODE_BACK )
|
||||||
{
|
{
|
||||||
p.getVideoLayout().removeView(layout);
|
p.getVideoLayout().removeView(layout);
|
||||||
layout = null;
|
layout = null;
|
||||||
p.touchListener = null;
|
|
||||||
p.keyListener = null;
|
|
||||||
goBack(p);
|
goBack(p);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -324,6 +324,7 @@ class SettingsMenuMisc extends SettingsMenu
|
|||||||
p.getResources().getString(R.string.mouse_keepaspectratio),
|
p.getResources().getString(R.string.mouse_keepaspectratio),
|
||||||
p.getResources().getString(R.string.video_smooth),
|
p.getResources().getString(R.string.video_smooth),
|
||||||
p.getResources().getString(R.string.video_immersive),
|
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_autodetect),
|
||||||
p.getResources().getString(R.string.video_orientation_vertical),
|
p.getResources().getString(R.string.video_orientation_vertical),
|
||||||
p.getResources().getString(R.string.video_bpp_24),
|
p.getResources().getString(R.string.video_bpp_24),
|
||||||
@@ -333,6 +334,7 @@ class SettingsMenuMisc extends SettingsMenu
|
|||||||
Globals.KeepAspectRatio,
|
Globals.KeepAspectRatio,
|
||||||
Globals.VideoLinearFilter,
|
Globals.VideoLinearFilter,
|
||||||
Globals.ImmersiveMode,
|
Globals.ImmersiveMode,
|
||||||
|
Globals.DrawInDisplayCutout,
|
||||||
Globals.AutoDetectOrientation,
|
Globals.AutoDetectOrientation,
|
||||||
!Globals.HorizontalOrientation,
|
!Globals.HorizontalOrientation,
|
||||||
Globals.VideoDepthBpp == 24,
|
Globals.VideoDepthBpp == 24,
|
||||||
@@ -345,6 +347,7 @@ class SettingsMenuMisc extends SettingsMenu
|
|||||||
p.getResources().getString(R.string.mouse_keepaspectratio),
|
p.getResources().getString(R.string.mouse_keepaspectratio),
|
||||||
p.getResources().getString(R.string.video_smooth),
|
p.getResources().getString(R.string.video_smooth),
|
||||||
p.getResources().getString(R.string.video_immersive),
|
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_autodetect),
|
||||||
p.getResources().getString(R.string.video_orientation_vertical),
|
p.getResources().getString(R.string.video_orientation_vertical),
|
||||||
p.getResources().getString(R.string.video_bpp_24),
|
p.getResources().getString(R.string.video_bpp_24),
|
||||||
@@ -355,6 +358,7 @@ class SettingsMenuMisc extends SettingsMenu
|
|||||||
Globals.KeepAspectRatio,
|
Globals.KeepAspectRatio,
|
||||||
Globals.VideoLinearFilter,
|
Globals.VideoLinearFilter,
|
||||||
Globals.ImmersiveMode,
|
Globals.ImmersiveMode,
|
||||||
|
Globals.DrawInDisplayCutout,
|
||||||
Globals.AutoDetectOrientation,
|
Globals.AutoDetectOrientation,
|
||||||
!Globals.HorizontalOrientation,
|
!Globals.HorizontalOrientation,
|
||||||
Globals.VideoDepthBpp == 24,
|
Globals.VideoDepthBpp == 24,
|
||||||
@@ -365,7 +369,7 @@ class SettingsMenuMisc extends SettingsMenu
|
|||||||
defaults = defaults2;
|
defaults = defaults2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Globals.Using_SDL_1_3)
|
if(Globals.UsingSDL2)
|
||||||
{
|
{
|
||||||
CharSequence[] items2 = {
|
CharSequence[] items2 = {
|
||||||
p.getResources().getString(R.string.mouse_keepaspectratio),
|
p.getResources().getString(R.string.mouse_keepaspectratio),
|
||||||
@@ -390,14 +394,16 @@ class SettingsMenuMisc extends SettingsMenu
|
|||||||
if( item == 2 )
|
if( item == 2 )
|
||||||
Globals.ImmersiveMode = isChecked;
|
Globals.ImmersiveMode = isChecked;
|
||||||
if( item == 3 )
|
if( item == 3 )
|
||||||
Globals.AutoDetectOrientation = isChecked;
|
Globals.DrawInDisplayCutout = isChecked;
|
||||||
if( item == 4 )
|
if( item == 4 )
|
||||||
Globals.HorizontalOrientation = !isChecked;
|
Globals.AutoDetectOrientation = isChecked;
|
||||||
if( item == 5 )
|
if( item == 5 )
|
||||||
Globals.VideoDepthBpp = (isChecked ? 24 : 16);
|
Globals.HorizontalOrientation = !isChecked;
|
||||||
if( item == 6 )
|
if( item == 6 )
|
||||||
Globals.TvBorders = isChecked;
|
Globals.VideoDepthBpp = (isChecked ? 24 : 16);
|
||||||
if( item == 7 )
|
if( item == 7 )
|
||||||
|
Globals.TvBorders = isChecked;
|
||||||
|
if( item == 8 )
|
||||||
Globals.MultiThreadedVideo = isChecked;
|
Globals.MultiThreadedVideo = isChecked;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -437,7 +443,7 @@ class SettingsMenuMisc extends SettingsMenu
|
|||||||
String readmes[] = Globals.ReadmeText.split("\\^");
|
String readmes[] = Globals.ReadmeText.split("\\^");
|
||||||
String lang = new String(Locale.getDefault().getLanguage()) + ":";
|
String lang = new String(Locale.getDefault().getLanguage()) + ":";
|
||||||
if( p.isRunningOnOUYA() )
|
if( p.isRunningOnOUYA() )
|
||||||
lang = "ouya:";
|
lang = "tv:";
|
||||||
String readme = readmes[0];
|
String readme = readmes[0];
|
||||||
String buttonName = "", buttonUrl = "";
|
String buttonName = "", buttonUrl = "";
|
||||||
for( String r: readmes )
|
for( String r: readmes )
|
||||||
@@ -469,10 +475,14 @@ class SettingsMenuMisc extends SettingsMenu
|
|||||||
text.setPadding(0, 5, 0, 20);
|
text.setPadding(0, 5, 0, 20);
|
||||||
text.setTextSize(20.0f);
|
text.setTextSize(20.0f);
|
||||||
text.setGravity(Gravity.CENTER);
|
text.setGravity(Gravity.CENTER);
|
||||||
|
text.setFocusable(false);
|
||||||
|
text.setFocusableInTouchMode(false);
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(p);
|
AlertDialog.Builder builder = new AlertDialog.Builder(p);
|
||||||
ScrollView scroll = new ScrollView(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));
|
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];
|
final AlertDialog alertDismiss[] = new AlertDialog[1];
|
||||||
ok.setOnClickListener(new View.OnClickListener()
|
ok.setOnClickListener(new View.OnClickListener()
|
||||||
{
|
{
|
||||||
@@ -485,7 +495,6 @@ class SettingsMenuMisc extends SettingsMenu
|
|||||||
LinearLayout layout = new LinearLayout(p);
|
LinearLayout layout = new LinearLayout(p);
|
||||||
layout.setOrientation(LinearLayout.VERTICAL);
|
layout.setOrientation(LinearLayout.VERTICAL);
|
||||||
layout.addView(scroll);
|
layout.addView(scroll);
|
||||||
//layout.addView(text);
|
|
||||||
layout.addView(ok);
|
layout.addView(ok);
|
||||||
if( buttonName.length() > 0 )
|
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
|
static class CommandlineConfig extends Menu
|
||||||
{
|
{
|
||||||
String title(final MainActivity p)
|
String title(final MainActivity p)
|
||||||
@@ -554,12 +599,10 @@ class SettingsMenuMisc extends SettingsMenu
|
|||||||
edit.setFocusableInTouchMode(true);
|
edit.setFocusableInTouchMode(true);
|
||||||
edit.setFocusable(true);
|
edit.setFocusable(true);
|
||||||
if (Globals.CommandLine.length() == 0)
|
if (Globals.CommandLine.length() == 0)
|
||||||
Globals.CommandLine = "SDL_app";
|
Globals.CommandLine = "App";
|
||||||
if (Globals.CommandLine.indexOf(" ") == -1)
|
edit.setText(Globals.CommandLine.replace(" ", "\n").replace(" ", " "));
|
||||||
Globals.CommandLine += " ";
|
|
||||||
edit.setText(Globals.CommandLine.substring(Globals.CommandLine.indexOf(" ")).replace(" ", "\n").replace(" ", " "));
|
|
||||||
edit.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
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);
|
//edit.setMaxLines(100);
|
||||||
builder.setView(edit);
|
builder.setView(edit);
|
||||||
|
|
||||||
@@ -567,18 +610,23 @@ class SettingsMenuMisc extends SettingsMenu
|
|||||||
{
|
{
|
||||||
public void onClick(DialogInterface dialog, int item)
|
public void onClick(DialogInterface dialog, int item)
|
||||||
{
|
{
|
||||||
Globals.CommandLine = "SDL_app";
|
Globals.CommandLine = "";
|
||||||
String args[] = edit.getText().toString().split("\n");
|
String args[] = edit.getText().toString().split("\n");
|
||||||
|
if( args.length == 1 )
|
||||||
|
{
|
||||||
|
Globals.CommandLine = args[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
boolean firstArg = true;
|
boolean firstArg = true;
|
||||||
for( String arg: args )
|
for( String arg: args )
|
||||||
{
|
{
|
||||||
|
if( !firstArg )
|
||||||
Globals.CommandLine += " ";
|
Globals.CommandLine += " ";
|
||||||
if( firstArg )
|
|
||||||
Globals.CommandLine += arg;
|
|
||||||
else
|
|
||||||
Globals.CommandLine += arg.replace(" ", " ");
|
Globals.CommandLine += arg.replace(" ", " ");
|
||||||
firstArg = false;
|
firstArg = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
goBack(p);
|
goBack(p);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ class SettingsMenuMouse extends SettingsMenu
|
|||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
Globals.LeftClickMethod = item;
|
Globals.LeftClickMethod = item;
|
||||||
if( item == Mouse.LEFT_CLICK_WITH_KEY )
|
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 )
|
else if( item == Mouse.LEFT_CLICK_WITH_TIMEOUT || item == Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT )
|
||||||
showLeftClickTimeoutConfig(p);
|
showLeftClickTimeoutConfig(p);
|
||||||
else
|
else
|
||||||
@@ -343,7 +343,7 @@ class SettingsMenuMouse extends SettingsMenu
|
|||||||
Globals.RightClickMethod = item;
|
Globals.RightClickMethod = item;
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
if( item == Mouse.RIGHT_CLICK_WITH_KEY )
|
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 )
|
else if( item == Mouse.RIGHT_CLICK_WITH_TIMEOUT )
|
||||||
showRightClickTimeoutConfig(p);
|
showRightClickTimeoutConfig(p);
|
||||||
else
|
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;
|
MainActivity p;
|
||||||
boolean leftClick;
|
boolean leftClick;
|
||||||
@@ -404,9 +404,10 @@ class SettingsMenuMouse extends SettingsMenu
|
|||||||
this.leftClick = leftClick;
|
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;
|
int keyIndex = keyCode;
|
||||||
if( keyIndex < 0 )
|
if( keyIndex < 0 )
|
||||||
keyIndex = 0;
|
keyIndex = 0;
|
||||||
@@ -419,6 +420,7 @@ class SettingsMenuMouse extends SettingsMenu
|
|||||||
Globals.RightClickKey = keyIndex;
|
Globals.RightClickKey = keyIndex;
|
||||||
|
|
||||||
goBack(p);
|
goBack(p);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -686,10 +688,10 @@ class SettingsMenuMouse extends SettingsMenu
|
|||||||
void run (final MainActivity p)
|
void run (final MainActivity p)
|
||||||
{
|
{
|
||||||
p.setText(p.getResources().getString(R.string.measurepressure_touchplease));
|
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;
|
MainActivity p;
|
||||||
ArrayList<Integer> force = new ArrayList<Integer>();
|
ArrayList<Integer> force = new ArrayList<Integer>();
|
||||||
@@ -701,7 +703,8 @@ class SettingsMenuMouse extends SettingsMenu
|
|||||||
p = _p;
|
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)));
|
force.add(new Integer((int)(ev.getPressure() * 1000.0)));
|
||||||
radius.add(new Integer((int)(ev.getSize() * 1000.0)));
|
radius.add(new Integer((int)(ev.getSize() * 1000.0)));
|
||||||
@@ -712,12 +715,13 @@ class SettingsMenuMouse extends SettingsMenu
|
|||||||
|
|
||||||
if( force.size() >= maxEventAmount )
|
if( force.size() >= maxEventAmount )
|
||||||
{
|
{
|
||||||
p.touchListener = null;
|
p.getVideoLayout().setOnTouchListener(null);
|
||||||
Globals.ClickScreenPressure = getAverageForce();
|
Globals.ClickScreenPressure = getAverageForce();
|
||||||
Globals.ClickScreenTouchspotSize = getAverageRadius();
|
Globals.ClickScreenTouchspotSize = getAverageRadius();
|
||||||
Log.i("SDL", "SDL: measured average force " + Globals.ClickScreenPressure + " radius " + Globals.ClickScreenTouchspotSize);
|
Log.i("SDL", "SDL: measured average force " + Globals.ClickScreenPressure + " radius " + Globals.ClickScreenTouchspotSize);
|
||||||
goBack(p);
|
goBack(p);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getAverageForce()
|
int getAverageForce()
|
||||||
@@ -756,11 +760,11 @@ class SettingsMenuMouse extends SettingsMenu
|
|||||||
Globals.TouchscreenCalibration[2] = 0;
|
Globals.TouchscreenCalibration[2] = 0;
|
||||||
Globals.TouchscreenCalibration[3] = 0;
|
Globals.TouchscreenCalibration[3] = 0;
|
||||||
ScreenEdgesCalibrationTool tool = new ScreenEdgesCalibrationTool(p);
|
ScreenEdgesCalibrationTool tool = new ScreenEdgesCalibrationTool(p);
|
||||||
p.touchListener = tool;
|
p.getVideoLayout().setOnTouchListener(tool);
|
||||||
p.keyListener = tool;
|
p.getVideoLayout().setOnKeyListener(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
static class ScreenEdgesCalibrationTool implements MainActivity.TouchEventsListener, MainActivity.KeyEventsListener
|
static class ScreenEdgesCalibrationTool implements View.OnTouchListener, View.OnKeyListener
|
||||||
{
|
{
|
||||||
MainActivity p;
|
MainActivity p;
|
||||||
ImageView img;
|
ImageView img;
|
||||||
@@ -783,7 +787,8 @@ class SettingsMenuMouse extends SettingsMenu
|
|||||||
p.getVideoLayout().addView(img);
|
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] &&
|
if( Globals.TouchscreenCalibration[0] == Globals.TouchscreenCalibration[1] &&
|
||||||
Globals.TouchscreenCalibration[1] == Globals.TouchscreenCalibration[2] &&
|
Globals.TouchscreenCalibration[1] == Globals.TouchscreenCalibration[2] &&
|
||||||
@@ -808,14 +813,17 @@ class SettingsMenuMouse extends SettingsMenu
|
|||||||
Globals.TouchscreenCalibration[2], Globals.TouchscreenCalibration[3]);
|
Globals.TouchscreenCalibration[2], Globals.TouchscreenCalibration[3]);
|
||||||
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
|
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
|
||||||
img.setImageMatrix(m);
|
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.getVideoLayout().setOnTouchListener(null);
|
||||||
p.keyListener = null;
|
p.getVideoLayout().setOnKeyListener(null);
|
||||||
p.getVideoLayout().removeView(img);
|
p.getVideoLayout().removeView(img);
|
||||||
goBack(p);
|
goBack(p);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,11 +33,13 @@ import javax.microedition.khronos.egl.EGLDisplay;
|
|||||||
import javax.microedition.khronos.egl.EGLSurface;
|
import javax.microedition.khronos.egl.EGLSurface;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.ByteOrder;
|
import java.nio.ByteOrder;
|
||||||
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@@ -65,48 +67,20 @@ import android.view.Display;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.content.pm.PackageManager;
|
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
|
abstract class DifferentTouchInput
|
||||||
{
|
{
|
||||||
public abstract void process(final MotionEvent event);
|
public abstract void process(final MotionEvent event);
|
||||||
public abstract void processGenericEvent(final MotionEvent event);
|
public abstract void processGenericEvent(final MotionEvent event);
|
||||||
|
|
||||||
public static int ExternalMouseDetected = Mouse.MOUSE_HW_INPUT_FINGER;
|
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();
|
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 :
|
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 :
|
((event.getSource() & InputDevice.SOURCE_STYLUS) == InputDevice.SOURCE_STYLUS) ? Mouse.MOUSE_HW_INPUT_STYLUS :
|
||||||
Mouse.MOUSE_HW_INPUT_FINGER;
|
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 )
|
if( ExternalMouseDetected != hwMouseEvent )
|
||||||
{
|
{
|
||||||
ExternalMouseDetected = hwMouseEvent;
|
ExternalMouseDetected = hwMouseEvent;
|
||||||
@@ -361,12 +341,10 @@ abstract class DifferentTouchInput
|
|||||||
}
|
}
|
||||||
private static class IcsTouchInput extends GingerbreadTouchInput
|
private static class IcsTouchInput extends GingerbreadTouchInput
|
||||||
{
|
{
|
||||||
float hatX = 0.0f, hatY = 0.0f;
|
|
||||||
private static class Holder
|
private static class Holder
|
||||||
{
|
{
|
||||||
private static final IcsTouchInput sInstance = new IcsTouchInput();
|
private static final IcsTouchInput sInstance = new IcsTouchInput();
|
||||||
}
|
}
|
||||||
private int buttonState = 0;
|
|
||||||
public void process(final MotionEvent event)
|
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());
|
//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)
|
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 )
|
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
|
// 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(
|
DemoGLSurfaceView.nativeGamepadAnalogJoystickInput(
|
||||||
event.getAxisValue(MotionEvent.AXIS_X), event.getAxisValue(MotionEvent.AXIS_Y),
|
event.getAxisValue(MotionEvent.AXIS_X), event.getAxisValue(MotionEvent.AXIS_Y),
|
||||||
event.getAxisValue(MotionEvent.AXIS_Z), event.getAxisValue(MotionEvent.AXIS_RZ),
|
event.getAxisValue(MotionEvent.AXIS_Z), event.getAxisValue(MotionEvent.AXIS_RZ),
|
||||||
event.getAxisValue(MotionEvent.AXIS_LTRIGGER), event.getAxisValue(MotionEvent.AXIS_RTRIGGER),
|
event.getAxisValue(MotionEvent.AXIS_LTRIGGER), event.getAxisValue(MotionEvent.AXIS_RTRIGGER),
|
||||||
(hatX == 0.0f && hatY == 0.0f) ? 0 : 1 );
|
event.getAxisValue(MotionEvent.AXIS_HAT_X), event.getAxisValue(MotionEvent.AXIS_HAT_Y),
|
||||||
|
processGamepadDeviceId(event.getDevice()) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Process mousewheel
|
// 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
|
class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
||||||
@@ -613,6 +642,9 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
|||||||
mHeight = h - h % 2;
|
mHeight = h - h % 2;
|
||||||
mGl = gl;
|
mGl = gl;
|
||||||
nativeResize(mWidth, mHeight, Globals.KeepAspectRatio ? 1 : 0);
|
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;
|
int mLastPendingResize = 0;
|
||||||
@@ -644,31 +676,9 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
|||||||
if (mWidth != 0 && mHeight != 0 && (mWidth != ww || mHeight != hh))
|
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);
|
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.ResetVideoSurface();
|
||||||
DemoRenderer.super.onWindowResize(ww, hh);
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Globals.AutoDetectOrientation && (ww > hh) != (mWidth > mHeight))
|
if (Globals.AutoDetectOrientation && (ww > hh) != (mWidth > mHeight))
|
||||||
Globals.HorizontalOrientation = (ww > hh);
|
Globals.HorizontalOrientation = (ww > hh);
|
||||||
}
|
}
|
||||||
@@ -711,8 +721,15 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
|||||||
if( Globals.AudioBufferConfig >= 2 )
|
if( Globals.AudioBufferConfig >= 2 )
|
||||||
Thread.currentThread().setPriority( (Thread.NORM_PRIORITY + Thread.MIN_PRIORITY) / 2 ); // Lower than normal
|
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,
|
nativeInit( Globals.DataDir,
|
||||||
Globals.CommandLine,
|
commandline,
|
||||||
( (Globals.SwVideoMode && Globals.MultiThreadedVideo) || Globals.CompatibilityHacksVideo ) ? 1 : 0,
|
( (Globals.SwVideoMode && Globals.MultiThreadedVideo) || Globals.CompatibilityHacksVideo ) ? 1 : 0,
|
||||||
0 );
|
0 );
|
||||||
System.exit(0); // The main() returns here - I don't bother with deinit stuff, just terminate process
|
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( ! super.SwapBuffers() && Globals.NonBlockingSwapBuffers )
|
||||||
{
|
{
|
||||||
if(mRatelimitTouchEvents)
|
|
||||||
{
|
|
||||||
synchronized(this)
|
|
||||||
{
|
|
||||||
this.notify();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mGlContextLost) {
|
if(mGlContextLost) {
|
||||||
mGlContextLost = false;
|
mGlContextLost = false;
|
||||||
Settings.SetupTouchscreenKeyboardGraphics(context); // Reload on-screen buttons graphics
|
DemoGLSurfaceView.SetupTouchscreenKeyboardGraphics(context); // Reload on-screen buttons graphics
|
||||||
super.SwapBuffers();
|
super.SwapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unblock event processing thread only after we've finished rendering
|
// Unblock event processing thread only after we've finished rendering
|
||||||
if(mRatelimitTouchEvents)
|
|
||||||
{
|
|
||||||
synchronized(this)
|
|
||||||
{
|
|
||||||
this.notify();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if( context.isScreenKeyboardShown() && !context.keyboardWithoutTextInputShown )
|
if( context.isScreenKeyboardShown() && !context.keyboardWithoutTextInputShown )
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -836,6 +839,12 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
|||||||
Clipboard.get().set(context, s);
|
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()
|
public void exitApp()
|
||||||
{
|
{
|
||||||
nativeDone();
|
nativeDone();
|
||||||
@@ -936,6 +945,11 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSystemMousePointerVisible(int visible)
|
||||||
|
{
|
||||||
|
context.setSystemMousePointerVisible(visible);
|
||||||
|
}
|
||||||
|
|
||||||
public void restartMyself(String restartParams)
|
public void restartMyself(String restartParams)
|
||||||
{
|
{
|
||||||
Intent intent = new Intent(context, RestartMainActivity.class);
|
Intent intent = new Intent(context, RestartMainActivity.class);
|
||||||
@@ -959,7 +973,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
|||||||
|
|
||||||
private native void nativeInitJavaCallbacks();
|
private native void nativeInitJavaCallbacks();
|
||||||
private native void nativeInit(String CurrentPath, String CommandLine, int multiThreadedVideo, int unused);
|
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 nativeDone();
|
||||||
private native void nativeGlContextLost();
|
private native void nativeGlContextLost();
|
||||||
public native void nativeGlContextRecreated();
|
public native void nativeGlContextRecreated();
|
||||||
@@ -983,32 +997,114 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
|||||||
public int mWidth = 0;
|
public int mWidth = 0;
|
||||||
public int mHeight = 0;
|
public int mHeight = 0;
|
||||||
int mOrientationFrameHackyCounter = 0;
|
int mOrientationFrameHackyCounter = 0;
|
||||||
|
|
||||||
public static final boolean mRatelimitTouchEvents = true; //(Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class DemoGLSurfaceView extends GLSurfaceView_SDL {
|
class DemoGLSurfaceView extends GLSurfaceView_SDL {
|
||||||
|
|
||||||
public DemoGLSurfaceView(MainActivity context) {
|
public DemoGLSurfaceView(MainActivity context) {
|
||||||
super(context);
|
super(context);
|
||||||
mParent = context;
|
mParent = context;
|
||||||
setEGLConfigChooser(Globals.VideoDepthBpp, Globals.NeedDepthBuffer, Globals.NeedStencilBuffer, Globals.NeedGles2, Globals.NeedGles3);
|
setEGLConfigChooser(Globals.VideoDepthBpp, Globals.NeedDepthBuffer, Globals.NeedStencilBuffer, Globals.NeedGles2, Globals.NeedGles3);
|
||||||
mRenderer = new DemoRenderer(context);
|
mRenderer = new DemoRenderer(context);
|
||||||
setRenderer(mRenderer);
|
setRenderer(mRenderer);
|
||||||
|
DifferentTouchInput.registerInputManagerCallbacks(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onKeyDown(int keyCode, final KeyEvent event)
|
||||||
|
{
|
||||||
|
//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
|
@Override
|
||||||
public boolean onTouchEvent(final MotionEvent event)
|
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( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH )
|
||||||
{
|
{
|
||||||
if (getX() != 0)
|
if (getX() != 0)
|
||||||
event.offsetLocation(-getX(), -getY());
|
event.offsetLocation(-getX(), -getY());
|
||||||
}
|
}
|
||||||
DifferentTouchInput.touchInput.process(event);
|
DifferentTouchInput.touchInput.process(event);
|
||||||
if( DemoRenderer.mRatelimitTouchEvents )
|
|
||||||
{
|
|
||||||
limitEventRate(event);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1016,33 +1112,47 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
|
|||||||
public boolean onGenericMotionEvent (final MotionEvent event)
|
public boolean onGenericMotionEvent (final MotionEvent event)
|
||||||
{
|
{
|
||||||
DifferentTouchInput.touchInput.processGenericEvent(event);
|
DifferentTouchInput.touchInput.processGenericEvent(event);
|
||||||
if( DemoRenderer.mRatelimitTouchEvents )
|
|
||||||
{
|
|
||||||
limitEventRate(event);
|
|
||||||
}
|
|
||||||
return true;
|
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
|
DifferentTouchInput.capturedMouseX += event.getX();
|
||||||
// With Froyo the rate of touch events seems to be limited by OS, but they are arriving faster then we're redrawing anyway
|
DifferentTouchInput.capturedMouseY += event.getY();
|
||||||
if((event.getAction() == MotionEvent.ACTION_MOVE ||
|
if (DifferentTouchInput.capturedMouseX < 0)
|
||||||
event.getAction() == MotionEvent.ACTION_HOVER_MOVE))
|
DifferentTouchInput.capturedMouseX = 0;
|
||||||
{
|
if (DifferentTouchInput.capturedMouseY < 0)
|
||||||
synchronized(mRenderer)
|
DifferentTouchInput.capturedMouseY = 0;
|
||||||
{
|
if (DifferentTouchInput.capturedMouseX >= this.getWidth())
|
||||||
try
|
DifferentTouchInput.capturedMouseX = this.getWidth() - 1;
|
||||||
{
|
if (DifferentTouchInput.capturedMouseY >= this.getHeight())
|
||||||
mRenderer.wait(300L); // And sometimes the app decides not to render at all, so this timeout should not be big.
|
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);
|
||||||
}
|
}
|
||||||
catch (InterruptedException e)
|
|
||||||
|
@Override
|
||||||
|
public void onPointerCaptureChange (boolean hasCapture)
|
||||||
{
|
{
|
||||||
Log.v("SDL", "DemoGLSurfaceView::limitEventRate(): Who dared to interrupt my slumber?");
|
Log.v("SDL", "DemoGLSurfaceView::onPointerCaptureChange(): " + hasCapture);
|
||||||
Thread.interrupted();
|
super.onPointerCaptureChange(hasCapture);
|
||||||
}
|
DifferentTouchInput.capturedMouseX = this.getWidth() / 2;
|
||||||
}
|
DifferentTouchInput.capturedMouseY = this.getHeight() / 2;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void exitApp() {
|
public void exitApp() {
|
||||||
@@ -1076,17 +1186,110 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
|
|||||||
mRenderer.nativeGlContextRecreated();
|
mRenderer.nativeGlContextRecreated();
|
||||||
if( mRenderer.accelerometer != null && mRenderer.accelerometer.openedBySDL ) // For some reason it crashes here often - are we getting this event before initialization?
|
if( mRenderer.accelerometer != null && mRenderer.accelerometer.openedBySDL ) // For some reason it crashes here often - are we getting this event before initialization?
|
||||||
mRenderer.accelerometer.start();
|
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;
|
DemoRenderer mRenderer;
|
||||||
MainActivity mParent;
|
MainActivity mParent;
|
||||||
|
|
||||||
public static native void nativeMotionEvent( int x, int y, int action, int pointerId, int pressure, int radius );
|
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 nativeHardwareMouseDetected( int detected );
|
||||||
public static native void nativeMouseButtonsPressed( int buttonId, int pressedState );
|
public static native void nativeMouseButtonsPressed( int buttonId, int pressedState );
|
||||||
public static native void nativeMouseWheel( int scrollX, int scrollY );
|
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 nativeScreenVisibleRect( int x, int y, int w, int h );
|
||||||
public static native void nativeScreenKeyboardShown( int shown );
|
public static native void nativeScreenKeyboardShown( int shown );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ public class CloudSave implements GameHelper.GameHelperListener {
|
|||||||
|
|
||||||
// The game helper object. This class is mainly a wrapper around this object.
|
// The game helper object. This class is mainly a wrapper around this object.
|
||||||
protected GameHelper mHelper;
|
protected GameHelper mHelper;
|
||||||
|
public int REQUEST_CLOUD_SAVE_ID = 38;
|
||||||
|
|
||||||
MainActivity parent;
|
MainActivity parent;
|
||||||
|
|
||||||
@@ -72,6 +73,8 @@ public class CloudSave implements GameHelper.GameHelperListener {
|
|||||||
boolean createNewSave = false;
|
boolean createNewSave = false;
|
||||||
public void onActivityResult(int request, int response, Intent intent)
|
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));
|
Log.d("SDL", "CloudSave: onActivityResult() response " + response + " intent " + (intent != null));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -119,7 +122,7 @@ public class CloudSave implements GameHelper.GameHelperListener {
|
|||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
parent.startActivityForResult(snapshotIntent, 0);
|
parent.startActivityForResult(snapshotIntent, REQUEST_CLOUD_SAVE_ID);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
semaphore.acquireUninterruptibly();
|
semaphore.acquireUninterruptibly();
|
||||||
@@ -192,7 +195,7 @@ public class CloudSave implements GameHelper.GameHelperListener {
|
|||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
parent.startActivityForResult(snapshotIntent, 0);
|
parent.startActivityForResult(snapshotIntent, REQUEST_CLOUD_SAVE_ID);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
semaphore.acquireUninterruptibly();
|
semaphore.acquireUninterruptibly();
|
||||||
@@ -361,10 +364,6 @@ public class CloudSave implements GameHelper.GameHelperListener {
|
|||||||
mHelper.enableDebugLog(enabled);
|
mHelper.enableDebugLog(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getInvitationId() {
|
|
||||||
return mHelper.getInvitationId();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void reconnectClient() {
|
public void reconnectClient() {
|
||||||
mHelper.reconnectClient();
|
mHelper.reconnectClient();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
import com.google.android.gms.games.Games.GamesOptions;
|
import com.google.android.gms.games.Games.GamesOptions;
|
||||||
import com.google.android.gms.games.GamesActivityResultCodes;
|
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,
|
public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
|
||||||
GoogleApiClient.OnConnectionFailedListener {
|
GoogleApiClient.OnConnectionFailedListener {
|
||||||
@@ -121,11 +115,9 @@ public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
|
|||||||
// Client request flags
|
// Client request flags
|
||||||
public final static int CLIENT_NONE = 0x00;
|
public final static int CLIENT_NONE = 0x00;
|
||||||
public final static int CLIENT_GAMES = 0x01;
|
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_APPSTATE = 0x04;
|
||||||
public final static int CLIENT_SNAPSHOT = 0x05;
|
public final static int CLIENT_SNAPSHOT = 0x05;
|
||||||
public final static int CLIENT_ALL = CLIENT_GAMES //| CLIENT_PLUS
|
public final static int CLIENT_ALL = CLIENT_GAMES | CLIENT_APPSTATE | CLIENT_SNAPSHOT;
|
||||||
| CLIENT_APPSTATE | CLIENT_SNAPSHOT;
|
|
||||||
|
|
||||||
// What clients were requested? (bit flags)
|
// What clients were requested? (bit flags)
|
||||||
int mRequestedClients = CLIENT_NONE;
|
int mRequestedClients = CLIENT_NONE;
|
||||||
@@ -157,24 +149,6 @@ public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
|
|||||||
|
|
||||||
Handler mHandler;
|
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
|
// Listener
|
||||||
GameHelperListener mListener = null;
|
GameHelperListener mListener = null;
|
||||||
|
|
||||||
@@ -290,7 +264,6 @@ public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
|
|||||||
|
|
||||||
if (0 != (mRequestedClients & CLIENT_SNAPSHOT)) {
|
if (0 != (mRequestedClients & CLIENT_SNAPSHOT)) {
|
||||||
builder.addScope(Drive.SCOPE_APPFOLDER);
|
builder.addScope(Drive.SCOPE_APPFOLDER);
|
||||||
builder.addApi(Drive.API);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mGoogleApiClientBuilder = builder;
|
mGoogleApiClientBuilder = builder;
|
||||||
@@ -414,101 +387,6 @@ public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
|
|||||||
mActivity = null;
|
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 */
|
/** Enables debug logging */
|
||||||
public void enableDebugLog(boolean enabled) {
|
public void enableDebugLog(boolean enabled) {
|
||||||
mDebugLog = enabled;
|
mDebugLog = enabled;
|
||||||
@@ -686,8 +564,6 @@ public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
|
|||||||
}
|
}
|
||||||
debugLog("Starting connection.");
|
debugLog("Starting connection.");
|
||||||
mConnecting = true;
|
mConnecting = true;
|
||||||
mInvitation = null;
|
|
||||||
mTurnBasedMatch = null;
|
|
||||||
mGoogleApiClient.connect();
|
mGoogleApiClient.connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -712,27 +588,6 @@ public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
|
|||||||
|
|
||||||
if (connectionHint != null) {
|
if (connectionHint != null) {
|
||||||
debugLog("onConnected: connection hint provided. Checking for invite.");
|
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
|
// we're good to go
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ class GameHelperUtils {
|
|||||||
return "RESULT_CANCELED";
|
return "RESULT_CANCELED";
|
||||||
case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
|
case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
|
||||||
return "RESULT_APP_MISCONFIGURED";
|
return "RESULT_APP_MISCONFIGURED";
|
||||||
case GamesActivityResultCodes.RESULT_LEFT_ROOM:
|
|
||||||
return "RESULT_LEFT_ROOM";
|
|
||||||
case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
|
case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
|
||||||
return "RESULT_LICENSE_FAILED";
|
return "RESULT_LICENSE_FAILED";
|
||||||
case GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED:
|
case GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED:
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
<string name="storage_phone">Внутреннее хранение - %d Мб</string>
|
<string name="storage_phone">Внутреннее хранение - %d Мб</string>
|
||||||
<string name="storage_sd">SD карта - %d Мб</string>
|
<string name="storage_sd">SD карта - %d Мб</string>
|
||||||
<string name="storage_question">Куда сохранять данные приложения</string>
|
<string name="storage_question">Куда сохранять данные приложения</string>
|
||||||
|
<string name="storage_access">Разрешение на запись на SD карту</string>
|
||||||
<string name="optional_downloads">Дополнительные загрузки</string>
|
<string name="optional_downloads">Дополнительные загрузки</string>
|
||||||
<string name="ok">Продолжить</string>
|
<string name="ok">Продолжить</string>
|
||||||
<string name="controls_arrows">Стрелки / джойстик / Dpad</string>
|
<string name="controls_arrows">Стрелки / джойстик / Dpad</string>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
<string name="storage_phone">Внутрішнє зберігання - %d Мб</string>
|
<string name="storage_phone">Внутрішнє зберігання - %d Мб</string>
|
||||||
<string name="storage_sd">SD карта - %d Мб</string>
|
<string name="storage_sd">SD карта - %d Мб</string>
|
||||||
<string name="storage_question">Куди зберігати дані програми</string>
|
<string name="storage_question">Куди зберігати дані програми</string>
|
||||||
|
<string name="storage_access">Дозвіл на запис на SD карту</string>
|
||||||
<string name="optional_downloads">Додаткові завантаження</string>
|
<string name="optional_downloads">Додаткові завантаження</string>
|
||||||
<string name="ok">ОК</string>
|
<string name="ok">ОК</string>
|
||||||
<string name="controls_arrows">Стрілки / джойстік / Dpad</string>
|
<string name="controls_arrows">Стрілки / джойстік / Dpad</string>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<string name="init">初始化中</string>
|
<string name="init">初始化中</string>
|
||||||
<string name="please_wait">正在下载数据,请稍等</string>
|
<string name="please_wait">正在下载数据,请稍候</string>
|
||||||
|
|
||||||
<string name="device_config">设备配置</string>
|
<string name="device_config">设备配置</string>
|
||||||
<string name="device_change_cfg">更改设备配置</string>
|
<string name="device_change_cfg">更改设备配置</string>
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
<string name="storage_question">数据文件安装位置</string>
|
<string name="storage_question">数据文件安装位置</string>
|
||||||
<string name="optional_downloads">下载</string>
|
<string name="optional_downloads">下载</string>
|
||||||
<string name="downloads">下载</string>
|
<string name="downloads">下载</string>
|
||||||
<string name="ok">好</string>
|
<string name="ok">完成</string>
|
||||||
<string name="cancel">取消</string>
|
<string name="cancel">取消</string>
|
||||||
|
|
||||||
<string name="controls_arrows">箭头 / 操纵杆 / 方向键</string>
|
<string name="controls_arrows">箭头 / 操纵杆 / 方向键</string>
|
||||||
@@ -163,6 +163,7 @@
|
|||||||
|
|
||||||
<string name="display_size_mouse">鼠标仿真模式</string>
|
<string name="display_size_mouse">鼠标仿真模式</string>
|
||||||
<string name="display_size">显示仿真鼠标的大小</string>
|
<string name="display_size">显示仿真鼠标的大小</string>
|
||||||
|
<string name="display_size_desktop">桌面版,无仿真</string>
|
||||||
<string name="display_size_large">大(适用于平板电脑)</string>
|
<string name="display_size_large">大(适用于平板电脑)</string>
|
||||||
<string name="display_size_small">小,放大镜</string>
|
<string name="display_size_small">小,放大镜</string>
|
||||||
<string name="display_size_small_touchpad">小,触摸模式</string>
|
<string name="display_size_small_touchpad">小,触摸模式</string>
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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>
|
<string name="app_name">Commander Genius</string>
|
||||||
|
|
||||||
|
|
||||||
@@ -24,6 +26,7 @@
|
|||||||
<string name="storage_custom">Specify directory</string>
|
<string name="storage_custom">Specify directory</string>
|
||||||
<string name="storage_commandline">Command line parameters, one argument per line</string>
|
<string name="storage_commandline">Command line parameters, one argument per line</string>
|
||||||
<string name="storage_question">Data installation location</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="optional_downloads">Downloads</string>
|
||||||
<string name="downloads">Downloads</string>
|
<string name="downloads">Downloads</string>
|
||||||
<string name="ok">OK</string>
|
<string name="ok">OK</string>
|
||||||
@@ -157,6 +160,7 @@
|
|||||||
<string name="video_orientation_autodetect">Auto-detect screen orientation</string>
|
<string name="video_orientation_autodetect">Auto-detect screen orientation</string>
|
||||||
<string name="video_bpp_24">24 bpp screen color depth</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_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="tv_borders">TV borders</string>
|
||||||
|
|
||||||
<string name="text_edit_click_here">Tap to start typing, press Back when done</string>
|
<string name="text_edit_click_here">Tap to start typing, press Back when done</string>
|
||||||
|
|||||||
@@ -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);
|
|
||||||
}
|
|
||||||
@@ -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()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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();
|
|
||||||
}
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
1
project/javaSDL2/DataDownloader.java
Symbolic link
1
project/javaSDL2/DataDownloader.java
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../java/DataDownloader.java
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -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
|
|
||||||
}
|
|
||||||
1
project/javaSDL2/Globals.java
Symbolic link
1
project/javaSDL2/Globals.java
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../java/Globals.java
|
||||||
@@ -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
1
project/javaSDL2/Mouse.java
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../java/Mouse.java
|
||||||
1
project/javaSDL2/SDL_Keys.java
Symbolic link
1
project/javaSDL2/SDL_Keys.java
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../java/SDL_Keys.java
|
||||||
@@ -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
1
project/javaSDL2/Settings.java
Symbolic link
1
project/javaSDL2/Settings.java
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../java/Settings.java
|
||||||
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
48
project/javaSDL2/Stubs.java
Normal file
48
project/javaSDL2/Stubs.java
Normal 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) {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
1
project/javaSDL2/XZInputStream.java
Symbolic link
1
project/javaSDL2/XZInputStream.java
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../java/XZInputStream.java
|
||||||
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
1
project/javaSDL2/translations
Symbolic link
1
project/javaSDL2/translations
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../java/translations
|
||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
|
|
||||||
@@ -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.
|
|
||||||
@@ -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>
|
|
||||||
@@ -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>
|
|
||||||
@@ -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>
|
|
||||||
@@ -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>
|
|
||||||
@@ -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>
|
|
||||||
@@ -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>
|
|
||||||
@@ -4,12 +4,22 @@ ifneq ($(strip $(filter mad, $(COMPILED_LIBRARIES))),)
|
|||||||
SDL_MIXER_USE_LIBMAD := 1
|
SDL_MIXER_USE_LIBMAD := 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Disable timidity library inside sdl2_mixer, we have our own version of timidity used by OpenTTD
|
||||||
|
SUPPORT_MID_TIMIDITY := 0
|
||||||
|
# Enable png and jpeg modules inside sdl2_image
|
||||||
|
SUPPORT_JPG := true
|
||||||
|
SUPPORT_PNG := true
|
||||||
|
|
||||||
NDK_VERSION := $(strip $(patsubst android-ndk-%,%,$(filter android-ndk-%, $(subst /, ,$(dir $(TARGET_CC))))))
|
NDK_VERSION := $(strip $(patsubst android-ndk-%,%,$(filter android-ndk-%, $(subst /, ,$(dir $(TARGET_CC))))))
|
||||||
#$(info NDK version $(NDK_VERSION)) # This warning puzzles ndk-gdb
|
#$(info NDK version $(NDK_VERSION)) # This warning puzzles ndk-gdb
|
||||||
ifneq ($(filter r1 r2 r3 r4 r5 r6 r7 r8,$(NDK_VERSION)),)
|
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
|
endif
|
||||||
|
|
||||||
|
ifdef ANDROID_NDK_HOME
|
||||||
|
NDK_PATH := $(ANDROID_NDK_HOME)
|
||||||
|
else
|
||||||
NDK_PATH := $(shell dirname $(shell which ndk-build))
|
NDK_PATH := $(shell dirname $(shell which ndk-build))
|
||||||
|
endif
|
||||||
|
|
||||||
include $(call all-subdir-makefiles)
|
include $(call all-subdir-makefiles)
|
||||||
|
|||||||
@@ -2,6 +2,16 @@ APP_PROJECT_PATH := $(call my-dir)/..
|
|||||||
|
|
||||||
include jni/Settings.mk
|
include jni/Settings.mk
|
||||||
|
|
||||||
APP_STL := $(if $(filter clang%, $(NDK_TOOLCHAIN_VERSION)), c++_static, gnustl_static)
|
ifneq ($(filter c++_shared, $(APP_MODULES)),)
|
||||||
APP_CFLAGS := -O3 -DNDEBUG -g # arm-linux-androideabi-4.4.3 crashes in -O0 mode on SDL sources
|
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
|
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)))
|
||||||
|
|||||||
@@ -1,34 +1,120 @@
|
|||||||
# Makefile to build precompiled libraries, which cannot be built using standard NDK makefiles
|
# 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
|
ARCH_LIST ?= arm64-v8a x86_64 armeabi-v7a x86
|
||||||
ARCHES64 := arm64-v8a
|
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_LIBS := icudata icui18n icuio icutest icutu icuuc iculx icu-le-hb
|
||||||
ICU := $(foreach ARCH, $(ARCHES32), $(foreach NAME, $(ICU_LIBS), icuuc/lib/$(ARCH)/libicu$(NAME).a))
|
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):
|
.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 && \
|
cd iconv/src && \
|
||||||
./build.sh && \
|
for ARCH in $(ARCH_LIST); do \
|
||||||
for ARCH in $(ARCHES32); do \
|
$(shell echo "#=Compiling iconv for $$ARCH") \
|
||||||
mkdir -p ../lib/$$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/libiconv.so $$ARCH/libcharset.so ../lib/$$ARCH/ ; \
|
||||||
cp -f $$ARCH/include/*.h ../include/ ; \
|
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/libicu*.a ../../icuuc/lib/$$ARCH/ ; \
|
||||||
cp -f $$ARCH/include/layout/*.h ../../icuuc/include/layout/ ; \
|
[ -d ../../icuuc/share ] || cp -rf $$ARCH/share ../../icuuc/ ; \
|
||||||
cp -f $$ARCH/include/unicode/*.h ../../icuuc/include/unicode/ ; \
|
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
|
done
|
||||||
|
|
||||||
$(OPENSSL):
|
$(OPENSSL): openssl/compile.sh
|
||||||
cd 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
1
project/jni/SDL2/include
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../sdl2/include
|
||||||
1
project/jni/SDL2_image/include
Symbolic link
1
project/jni/SDL2_image/include
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../sdl2_image
|
||||||
1
project/jni/SDL2_mixer/include
Symbolic link
1
project/jni/SDL2_mixer/include
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../sdl2_mixer/include
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user