Compare commits
659 Commits
python3_te
...
12.2.rev11
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
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
|
||||
156
.github/workflows/ballfield.yml
vendored
Normal file
156
.github/workflows/ballfield.yml
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
# Copyright (C) 2021-2021 Sergii Pylypenko <x.pelya.x@gmail.com>
|
||||
#
|
||||
# This software is provided 'as-is', without any express or implied
|
||||
# warranty. In no event will the authors be held liable for any damages
|
||||
# arising from the use of this software.
|
||||
#
|
||||
# Permission is granted to anyone to use this software for any purpose,
|
||||
# including commercial applications, and to alter it and redistribute it
|
||||
# freely, subject to the following restrictions:
|
||||
#
|
||||
# 1. The origin of this software must not be misrepresented; you must not
|
||||
# claim that you wrote the original software. If you use this software
|
||||
# in a product, an acknowledgment in the product documentation would be
|
||||
# appreciated but is not required.
|
||||
# 2. Altered source versions must be plainly marked as such, and must not be
|
||||
# misrepresented as being the original software.
|
||||
# 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
name: ballfield
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
tags:
|
||||
- '*'
|
||||
pull_request: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
env:
|
||||
APP_NAME: ballfield
|
||||
# It takes one hour per one architecture to build Boost and ICU libraries, and Github limits CI script duration to 6 hours
|
||||
ARCH_LIST: armeabi-v7a arm64-v8a x86 x86_64
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out the repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 1
|
||||
submodules: false
|
||||
|
||||
- name: Check out submodules
|
||||
# There are many more submodules in this repo, we don't need them all
|
||||
run: >
|
||||
git submodule update --init --recursive --depth=1
|
||||
project/jni/boost/src project/jni/iconv/src
|
||||
project/jni/sdl2 project/jni/sdl2_image
|
||||
project/jni/sdl2_mixer project/jni/sdl2_ttf
|
||||
|
||||
- name: Symlink the application dir
|
||||
run: |
|
||||
ln -s ${APP_NAME} project/jni/application/src
|
||||
|
||||
- name: Set architectures list
|
||||
run: |
|
||||
sed -i "s/MultiABI=.*/MultiABI='${ARCH_LIST}'/g" project/jni/application/src/AndroidAppSettings.cfg
|
||||
|
||||
# - name: Get Boost revision
|
||||
# id: boost-rev
|
||||
# run: echo "::set-output name=BOOST_REV::`git -C project/jni/boost/src rev-parse HEAD`"
|
||||
#
|
||||
# - name: Get ICU revision
|
||||
# id: icu-rev
|
||||
# run: echo "::set-output name=ICU_REV::`git -C project/jni/iconv/src rev-parse HEAD`"
|
||||
#
|
||||
# - name: Copy Boost libraries from cache
|
||||
# uses: actions/cache@v2
|
||||
# id: cache-boost
|
||||
# with:
|
||||
# # The same SDL revision will produce the same libraries
|
||||
# key: ${{steps.boost-rev.outputs.BOOST_REV}}
|
||||
# path: |
|
||||
# build-android/project/jni/boost/include
|
||||
# build-android/project/jni/boost/lib
|
||||
#
|
||||
# - name: Copy ICU libraries from cache
|
||||
# uses: actions/cache@v2
|
||||
# id: cache-icu
|
||||
# with:
|
||||
# # The same SDL revision will produce the same libraries
|
||||
# key: ${{steps.icu-rev.outputs.ICU_REV}}
|
||||
# path: |
|
||||
# build-android/project/jni/iconv/include
|
||||
# build-android/project/jni/iconv/lib
|
||||
# build-android/project/jni/icuuc/include
|
||||
# build-android/project/jni/icuuc/lib
|
||||
#
|
||||
# - name: Touch cached Boost timestamps
|
||||
# if: steps.cache-boost.outputs.cache-hit == 'true' || steps.cache-icu.outputs.cache-hit == 'true'
|
||||
# working-directory: build-android
|
||||
# run: touch project/jni/boost/lib/*/* || true
|
||||
#
|
||||
# - name: Touch cached ICU timestamps
|
||||
# if: steps.cache-boost.outputs.cache-hit == 'true' || steps.cache-icu.outputs.cache-hit == 'true'
|
||||
# working-directory: build-android
|
||||
# run: touch project/jni/iconv/lib/*/* project/jni/icuuc/lib/*/* || true
|
||||
|
||||
- name: Patch Java files and build Boost, ICU, and OpenSSL
|
||||
run: |
|
||||
export PATH=$ANDROID_NDK_LATEST_HOME:$PATH
|
||||
./changeAppSettings.sh
|
||||
|
||||
- name: Set up Gradle and Android SDK licenses
|
||||
working-directory: project
|
||||
run: |
|
||||
for Y in `seq 20`; do echo y; done | sudo $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses
|
||||
./gradlew assembleRelease || true
|
||||
for Y in `seq 20`; do echo y; done | sudo $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses --sdk_root=`pwd`
|
||||
mkdir -p $HOME/.android
|
||||
keytool -genkey -v -keystore $HOME/.android/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Debug, OU=Debug, O=Debug, L=Debug, ST=Debug, C=Debug"
|
||||
echo "sdk.dir=$ANDROID_SDK_ROOT" > local.properties
|
||||
echo "proguard.config=proguard.cfg;proguard-local.cfg" >> local.properties
|
||||
|
||||
- name: Hyper turbo build script GOOOOOOOOOOOO
|
||||
run: |
|
||||
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/31.0.0:$PATH
|
||||
./build.sh
|
||||
|
||||
- name: App signing keys
|
||||
run: |
|
||||
echo "$ANDROID_KEYSTORE_B64" | base64 -d > keystore.jks || true
|
||||
echo "$ANDROID_UPLOAD_KEYSTORE_B64" | base64 -d > upload_keystore.jks || true
|
||||
find keystore.jks -empty -delete || true
|
||||
find upload_keystore.jks -empty -delete || true
|
||||
env:
|
||||
ANDROID_KEYSTORE_B64: "${{secrets.ANDROID_KEYSTORE_B64}}"
|
||||
ANDROID_UPLOAD_KEYSTORE_B64: "${{secrets.ANDROID_UPLOAD_KEYSTORE_B64}}"
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/31.0.0:$PATH
|
||||
if [ -e keystore.jks ]; then
|
||||
export ANDROID_KEYSTORE_FILE=`pwd`/keystore.jks
|
||||
fi
|
||||
if [ -e upload_keystore.jks ]; then
|
||||
export ANDROID_UPLOAD_KEYSTORE_FILE=`pwd`/upload_keystore.jks
|
||||
fi
|
||||
mkdir -p upload/
|
||||
./sign.sh
|
||||
mv *.apk upload/
|
||||
./signBundle.sh
|
||||
mv *.aab upload/
|
||||
env:
|
||||
ANDROID_KEYSTORE_PASS: "${{secrets.ANDROID_KEYSTORE_PASS}}"
|
||||
ANDROID_KEYSTORE_ALIAS: "${{secrets.ANDROID_KEYSTORE_ALIAS}}"
|
||||
ANDROID_UPLOAD_KEYSTORE_PASS: "${{secrets.ANDROID_UPLOAD_KEYSTORE_PASS}}"
|
||||
ANDROID_UPLOAD_KEYSTORE_ALIAS: "${{secrets.ANDROID_UPLOAD_KEYSTORE_ALIAS}}"
|
||||
|
||||
# Github actions is dumb and won't let you download single files from artifacts, so break up the artifacts instead
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{env.APP_NAME}}
|
||||
path: upload
|
||||
if-no-files-found: error
|
||||
156
.github/workflows/sdl2-demo.yml
vendored
Normal file
156
.github/workflows/sdl2-demo.yml
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
# Copyright (C) 2021-2021 Sergii Pylypenko <x.pelya.x@gmail.com>
|
||||
#
|
||||
# This software is provided 'as-is', without any express or implied
|
||||
# warranty. In no event will the authors be held liable for any damages
|
||||
# arising from the use of this software.
|
||||
#
|
||||
# Permission is granted to anyone to use this software for any purpose,
|
||||
# including commercial applications, and to alter it and redistribute it
|
||||
# freely, subject to the following restrictions:
|
||||
#
|
||||
# 1. The origin of this software must not be misrepresented; you must not
|
||||
# claim that you wrote the original software. If you use this software
|
||||
# in a product, an acknowledgment in the product documentation would be
|
||||
# appreciated but is not required.
|
||||
# 2. Altered source versions must be plainly marked as such, and must not be
|
||||
# misrepresented as being the original software.
|
||||
# 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
name: sdl2-demo
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
tags:
|
||||
- '*'
|
||||
pull_request: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
env:
|
||||
APP_NAME: sdl2-demo
|
||||
# It takes one hour per one architecture to build Boost and ICU libraries, and Github limits CI script duration to 6 hours
|
||||
ARCH_LIST: armeabi-v7a arm64-v8a x86 x86_64
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out the repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 1
|
||||
submodules: false
|
||||
|
||||
- name: Check out submodules
|
||||
# There are many more submodules in this repo, we don't need them all
|
||||
run: >
|
||||
git submodule update --init --recursive --depth=1
|
||||
project/jni/boost/src project/jni/iconv/src
|
||||
project/jni/sdl2 project/jni/sdl2_image
|
||||
project/jni/sdl2_mixer project/jni/sdl2_ttf
|
||||
|
||||
- name: Symlink the application dir
|
||||
run: |
|
||||
ln -s ${APP_NAME} project/jni/application/src
|
||||
|
||||
- name: Set architectures list
|
||||
run: |
|
||||
sed -i "s/MultiABI=.*/MultiABI='${ARCH_LIST}'/g" project/jni/application/src/AndroidAppSettings.cfg
|
||||
|
||||
# - name: Get Boost revision
|
||||
# id: boost-rev
|
||||
# run: echo "::set-output name=BOOST_REV::`git -C project/jni/boost/src rev-parse HEAD`"
|
||||
#
|
||||
# - name: Get ICU revision
|
||||
# id: icu-rev
|
||||
# run: echo "::set-output name=ICU_REV::`git -C project/jni/iconv/src rev-parse HEAD`"
|
||||
#
|
||||
# - name: Copy Boost libraries from cache
|
||||
# uses: actions/cache@v2
|
||||
# id: cache-boost
|
||||
# with:
|
||||
# # The same SDL revision will produce the same libraries
|
||||
# key: ${{steps.boost-rev.outputs.BOOST_REV}}
|
||||
# path: |
|
||||
# build-android/project/jni/boost/include
|
||||
# build-android/project/jni/boost/lib
|
||||
#
|
||||
# - name: Copy ICU libraries from cache
|
||||
# uses: actions/cache@v2
|
||||
# id: cache-icu
|
||||
# with:
|
||||
# # The same SDL revision will produce the same libraries
|
||||
# key: ${{steps.icu-rev.outputs.ICU_REV}}
|
||||
# path: |
|
||||
# build-android/project/jni/iconv/include
|
||||
# build-android/project/jni/iconv/lib
|
||||
# build-android/project/jni/icuuc/include
|
||||
# build-android/project/jni/icuuc/lib
|
||||
#
|
||||
# - name: Touch cached Boost timestamps
|
||||
# if: steps.cache-boost.outputs.cache-hit == 'true' || steps.cache-icu.outputs.cache-hit == 'true'
|
||||
# working-directory: build-android
|
||||
# run: touch project/jni/boost/lib/*/* || true
|
||||
#
|
||||
# - name: Touch cached ICU timestamps
|
||||
# if: steps.cache-boost.outputs.cache-hit == 'true' || steps.cache-icu.outputs.cache-hit == 'true'
|
||||
# working-directory: build-android
|
||||
# run: touch project/jni/iconv/lib/*/* project/jni/icuuc/lib/*/* || true
|
||||
|
||||
- name: Patch Java files and build Boost, ICU, and OpenSSL
|
||||
run: |
|
||||
export PATH=$ANDROID_NDK_LATEST_HOME:$PATH
|
||||
./changeAppSettings.sh
|
||||
|
||||
- name: Set up Gradle and Android SDK licenses
|
||||
working-directory: project
|
||||
run: |
|
||||
for Y in `seq 20`; do echo y; done | sudo $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses
|
||||
./gradlew assembleRelease || true
|
||||
for Y in `seq 20`; do echo y; done | sudo $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses --sdk_root=`pwd`
|
||||
mkdir -p $HOME/.android
|
||||
keytool -genkey -v -keystore $HOME/.android/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Debug, OU=Debug, O=Debug, L=Debug, ST=Debug, C=Debug"
|
||||
echo "sdk.dir=$ANDROID_SDK_ROOT" > local.properties
|
||||
echo "proguard.config=proguard.cfg;proguard-local.cfg" >> local.properties
|
||||
|
||||
- name: Hyper turbo build script GOOOOOOOOOOOO
|
||||
run: |
|
||||
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/31.0.0:$PATH
|
||||
./build.sh
|
||||
|
||||
- name: App signing keys
|
||||
run: |
|
||||
echo "$ANDROID_KEYSTORE_B64" | base64 -d > keystore.jks || true
|
||||
echo "$ANDROID_UPLOAD_KEYSTORE_B64" | base64 -d > upload_keystore.jks || true
|
||||
find keystore.jks -empty -delete || true
|
||||
find upload_keystore.jks -empty -delete || true
|
||||
env:
|
||||
ANDROID_KEYSTORE_B64: "${{secrets.ANDROID_KEYSTORE_B64}}"
|
||||
ANDROID_UPLOAD_KEYSTORE_B64: "${{secrets.ANDROID_UPLOAD_KEYSTORE_B64}}"
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/31.0.0:$PATH
|
||||
if [ -e keystore.jks ]; then
|
||||
export ANDROID_KEYSTORE_FILE=`pwd`/keystore.jks
|
||||
fi
|
||||
if [ -e upload_keystore.jks ]; then
|
||||
export ANDROID_UPLOAD_KEYSTORE_FILE=`pwd`/upload_keystore.jks
|
||||
fi
|
||||
mkdir -p upload/
|
||||
./sign.sh
|
||||
mv *.apk upload/
|
||||
./signBundle.sh
|
||||
mv *.aab upload/
|
||||
env:
|
||||
ANDROID_KEYSTORE_PASS: "${{secrets.ANDROID_KEYSTORE_PASS}}"
|
||||
ANDROID_KEYSTORE_ALIAS: "${{secrets.ANDROID_KEYSTORE_ALIAS}}"
|
||||
ANDROID_UPLOAD_KEYSTORE_PASS: "${{secrets.ANDROID_UPLOAD_KEYSTORE_PASS}}"
|
||||
ANDROID_UPLOAD_KEYSTORE_ALIAS: "${{secrets.ANDROID_UPLOAD_KEYSTORE_ALIAS}}"
|
||||
|
||||
# Github actions is dumb and won't let you download single files from artifacts, so break up the artifacts instead
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{env.APP_NAME}}
|
||||
path: upload
|
||||
if-no-files-found: error
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -11,6 +11,7 @@
|
||||
/project/jni/Settings.mk
|
||||
/project/jni/application/*/libapplication*.so
|
||||
/project/jni/application/src
|
||||
/project/jni/boost_*
|
||||
/project/res/drawable-xhdpi/ouya_icon.png
|
||||
/project/res/drawable/app_icon.png
|
||||
/project/proguard-project.txt
|
||||
@@ -19,3 +20,7 @@
|
||||
/project/jni/android-support
|
||||
/project/res/drawable/banner.png
|
||||
/project/res/drawable-xhdpi/ouya_icon.png
|
||||
/project/app/build.gradle
|
||||
/project/app/.gradle
|
||||
/project/app/build
|
||||
/project/assetpack/build
|
||||
|
||||
98
.gitmodules
vendored
98
.gitmodules
vendored
@@ -1,81 +1,25 @@
|
||||
[submodule "project/jni/application/NewRAW"]
|
||||
path = project/jni/application/NewRAW
|
||||
url = git@github.com:usineur/android-newraw.git
|
||||
[submodule "project/jni/boost/src"]
|
||||
path = project/jni/boost/src
|
||||
url = git@github.com:pelya/Boost-for-Android.git
|
||||
branch = master2
|
||||
update = merge
|
||||
[submodule "project/jni/application/commandergenius/commandergenius"]
|
||||
path = project/jni/application/commandergenius/commandergenius
|
||||
url = git@github.com:gerstrong/Commander-Genius.git
|
||||
[submodule "project/jni/application/openarena/engine"]
|
||||
path = project/jni/application/openarena/engine
|
||||
url = git@github.com:pelya/openarena-engine.git
|
||||
[submodule "project/jni/application/scummvm/scummvm"]
|
||||
path = project/jni/application/scummvm/scummvm
|
||||
url = git@github.com:scummvm/scummvm.git
|
||||
[submodule "project/jni/application/openarena/vm"]
|
||||
path = project/jni/application/openarena/vm
|
||||
url = git@github.com:pelya/openarena-vm
|
||||
[submodule "project/jni/application/teeworlds/src"]
|
||||
path = project/jni/application/teeworlds/src
|
||||
url = git@github.com:pelya/teeworlds.git
|
||||
[submodule "project/jni/application/c-dogs/src"]
|
||||
path = project/jni/application/c-dogs/src
|
||||
url = git@github.com:cxong/cdogs-sdl.git
|
||||
[submodule "project/jni/application/xserver/xserver"]
|
||||
path = project/jni/application/xserver/xserver
|
||||
url = git@github.com:pelya/xserver.git
|
||||
branch = xsdl2
|
||||
update = merge
|
||||
[submodule "android-shmem"]
|
||||
path = project/jni/shmem
|
||||
url = git@github.com:pelya/android-shmem.git
|
||||
branch = master
|
||||
update = merge
|
||||
[submodule "project/jni/application/hid-pc-keyboard/src"]
|
||||
path = project/jni/application/hid-pc-keyboard/src
|
||||
url = git@github.com:pelya/android-keyboard-gadget.git
|
||||
branch = master
|
||||
update = merge
|
||||
[submodule "project/jni/iconv/src"]
|
||||
path = project/jni/iconv/src
|
||||
url = git@github.com:pelya/libiconv-libicu-android.git
|
||||
[submodule "project/jni/icuuc/src"]
|
||||
path = project/jni/icuuc/src
|
||||
url = git@github.com:pelya/libiconv-libicu-android.git
|
||||
url = https://github.com/pelya/libiconv-libicu-android.git
|
||||
branch = master
|
||||
update = merge
|
||||
[submodule "project/jni/application/openttd/src"]
|
||||
path = project/jni/application/openttd/src
|
||||
url = 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
|
||||
[submodule "project/jni/python3/python3-android"]
|
||||
path = project/jni/python3/python3-android
|
||||
url = http://github.com/gerstrong/python3-android.git
|
||||
|
||||
url = https://github.com/n-ice-community/openttd-android.git
|
||||
branch = 12
|
||||
[submodule "project/jni/sdl2"]
|
||||
path = project/jni/sdl2
|
||||
url = https://github.com/libsdl-org/SDL.git
|
||||
branch = main
|
||||
[submodule "project/jni/sdl2_image"]
|
||||
path = project/jni/sdl2_image
|
||||
url = https://github.com/libsdl-org/SDL_image
|
||||
branch = main
|
||||
[submodule "project/jni/sdl2_ttf"]
|
||||
path = project/jni/sdl2_ttf
|
||||
url = https://github.com/libsdl-org/SDL_ttf.git
|
||||
branch = main
|
||||
[submodule "project/jni/sdl2_mixer"]
|
||||
path = project/jni/sdl2_mixer
|
||||
url = https://github.com/libsdl-org/SDL_mixer.git
|
||||
branch = master
|
||||
|
||||
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: 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.
|
||||
|
||||
285
build.sh
285
build.sh
@@ -1,34 +1,45 @@
|
||||
#!/bin/sh
|
||||
#set -eu # Bashism, does not work with default shell on Ubuntu 12.04
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Handle any error or die
|
||||
set -e
|
||||
|
||||
THIS_BUILD_DIR=$(dirname "$0")
|
||||
install_apk=false
|
||||
run_apk=false
|
||||
sign_apk=false
|
||||
sign_bundle=false
|
||||
build_release=true
|
||||
quick_rebuild=false
|
||||
QUICK_REBUILD_ARGS=
|
||||
do_zipalign=true
|
||||
|
||||
if [ "$#" -gt 0 -a "$1" = "-s" ]; then
|
||||
shift
|
||||
sign_apk=true
|
||||
# Fix Gradle compilation error
|
||||
if [ -z "$ANDROID_NDK_HOME" ]; then
|
||||
export ANDROID_NDK_HOME="$(which ndk-build | sed 's@/ndk-build@@')"
|
||||
fi
|
||||
|
||||
if [ "$#" -gt 0 -a "$1" = "-i" ]; then
|
||||
shift
|
||||
install_apk=true
|
||||
fi
|
||||
|
||||
if [ "$#" -gt 0 -a "$1" = "-r" ]; then
|
||||
shift
|
||||
install_apk=true
|
||||
run_apk=true
|
||||
fi
|
||||
|
||||
if [ "$#" -gt 0 -a "$1" = "-q" ]; then
|
||||
shift
|
||||
quick_rebuild=true
|
||||
QUICK_REBUILD_ARGS=APP_ABI=armeabi-v7a
|
||||
fi
|
||||
while getopts "sirqbhz" OPT
|
||||
do
|
||||
case $OPT in
|
||||
s) sign_apk=true;;
|
||||
i) install_apk=true;;
|
||||
r) install_apk=true ; run_apk=true;;
|
||||
q) echo "Quick rebuild does not work anymore with Gradle!";;
|
||||
b) sign_bundle=true;;
|
||||
z) do_zipalign=false;;
|
||||
h)
|
||||
echo "Usage: $0 [-s] [-i] [-r] [-q] [debug|release] [app-name]"
|
||||
echo " -s: sign .apk file after building"
|
||||
echo " -b: sign .aab app bundle file after building"
|
||||
echo " -i: install APK file to device after building"
|
||||
echo " -r: run APK file on device after building"
|
||||
echo " -z: skip zipalign and apksigner"
|
||||
echo " debug: build debug package"
|
||||
echo " release: build release package (default)"
|
||||
echo " app-name: directory under project/jni/application to be compiled"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $(expr $OPTIND - 1)
|
||||
|
||||
if [ "$#" -gt 0 -a "$1" = "release" ]; then
|
||||
shift
|
||||
@@ -41,7 +52,7 @@ if [ "$#" -gt 0 -a "$1" = "debug" ]; then
|
||||
export NDK_DEBUG=1
|
||||
fi
|
||||
|
||||
if [ "$#" -gt 0 -a "$1" '!=' "-h" ]; then
|
||||
if [ "$#" -gt 0 ]; then
|
||||
echo "Switching build target to $1"
|
||||
if [ -e project/jni/application/$1 ]; then
|
||||
rm -f project/jni/application/src
|
||||
@@ -49,60 +60,41 @@ if [ "$#" -gt 0 -a "$1" '!=' "-h" ]; then
|
||||
else
|
||||
echo "Error: no app $1 under project/jni/application"
|
||||
echo "Available applications:"
|
||||
cd project/jni/application
|
||||
pushd project/jni/application
|
||||
for f in *; do
|
||||
if [ -e "$f/AndroidAppSettings.cfg" ]; then
|
||||
echo "$f"
|
||||
fi
|
||||
done
|
||||
popd
|
||||
exit 1
|
||||
fi
|
||||
shift
|
||||
fi
|
||||
|
||||
if [ "$#" -gt 0 -a "$1" = "-h" ]; then
|
||||
echo "Usage: $0 [-s] [-i] [-r] [-q] [debug|release] [app-name]"
|
||||
echo " -s: sign APK file after building"
|
||||
echo " -i: install APK file to device after building"
|
||||
echo " -r: run APK file on device after building"
|
||||
echo " -q: quick-rebuild C code, without rebuilding Java files"
|
||||
echo " debug: build debug package"
|
||||
echo " release: build release package (default)"
|
||||
echo " app-name: directory under project/jni/application to be compiled"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
NDK_TOOLCHAIN_VERSION=$GCCVER
|
||||
[ -z "$NDK_TOOLCHAIN_VERSION" ] && NDK_TOOLCHAIN_VERSION=4.9
|
||||
|
||||
# Set here your own NDK path if needed
|
||||
# export PATH=$PATH:~/src/endless_space/android-ndk-r7
|
||||
NDKBUILDPATH=$PATH
|
||||
export `grep "AppFullName=" AndroidAppSettings.cfg`
|
||||
if ( grep "package $AppFullName;" project/src/Globals.java > /dev/null 2>&1 && \
|
||||
[ "`readlink AndroidAppSettings.cfg`" -ot "project/src/Globals.java" ] && \
|
||||
[ -z "`find project/java/* project/AndroidManifestTemplate.xml -cnewer project/src/Globals.java`" ] ) ; then true ; else
|
||||
./changeAppSettings.sh -a || exit 1
|
||||
if [ ! -e project/local.properties ] || \
|
||||
! grep -q "package $(grep -Po 'AppFullName\=\K[.[:alnum:]]+' AndroidAppSettings.cfg);" 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 \
|
||||
)" \
|
||||
];
|
||||
then
|
||||
./changeAppSettings.sh -a
|
||||
sleep 1
|
||||
touch project/src/Globals.java
|
||||
fi
|
||||
if $build_release ; then
|
||||
sed -i 's/android:debuggable="true"/android:debuggable="false"/g' project/AndroidManifest.xml
|
||||
else
|
||||
sed -i 's/android:debuggable="false"/android:debuggable="true"/g' project/AndroidManifest.xml
|
||||
fi
|
||||
|
||||
[ -e project/local.properties ] || {
|
||||
android update project -p project -t android-23 || exit 1
|
||||
rm -f project/src/Globals.java
|
||||
}
|
||||
|
||||
MYARCH=linux-x86_64
|
||||
if [ -z "$NCPU" ]; then
|
||||
NCPU=4
|
||||
NCPU=8
|
||||
if uname -s | grep -i "linux" > /dev/null ; then
|
||||
MYARCH=linux-x86_64
|
||||
NCPU=`cat /proc/cpuinfo | grep -c -i processor`
|
||||
NCPU=$(cat /proc/cpuinfo | grep -c -i processor)
|
||||
fi
|
||||
if uname -s | grep -i "darwin" > /dev/null ; then
|
||||
MYARCH=darwin-x86_64
|
||||
@@ -111,100 +103,85 @@ if [ -z "$NCPU" ]; then
|
||||
MYARCH=windows-x86_64
|
||||
fi
|
||||
fi
|
||||
export BUILD_NUM_CPUS=$NCPU
|
||||
|
||||
$quick_rebuild || rm -r -f project/bin/* # New Android SDK introduced some lame-ass optimizations to the build system which we should take care about
|
||||
[ -x project/jni/application/src/AndroidPreBuild.sh ] && {
|
||||
cd project/jni/application/src
|
||||
./AndroidPreBuild.sh || { echo "AndroidPreBuild.sh returned with error" ; exit 1 ; }
|
||||
cd ../../../..
|
||||
}
|
||||
|
||||
strip_libs() {
|
||||
grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
|
||||
echo Stripping libapplication-armeabi.so by hand && \
|
||||
rm obj/local/armeabi/libapplication.so && \
|
||||
cp jni/application/src/libapplication-armeabi.so obj/local/armeabi/libapplication.so && \
|
||||
cp jni/application/src/libapplication-armeabi.so libs/armeabi/libapplication.so && \
|
||||
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-${NDK_TOOLCHAIN_VERSION}/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi/libapplication.so
|
||||
grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
|
||||
grep "MultiABI=" ../AndroidAppSettings.cfg | grep "y\\|all\\|armeabi-v7a" > /dev/null && \
|
||||
echo Stripping libapplication-armeabi-v7a.so by hand && \
|
||||
rm obj/local/armeabi-v7a/libapplication.so && \
|
||||
cp jni/application/src/libapplication-armeabi-v7a.so obj/local/armeabi-v7a/libapplication.so && \
|
||||
cp jni/application/src/libapplication-armeabi-v7a.so libs/armeabi-v7a/libapplication.so && \
|
||||
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-${NDK_TOOLCHAIN_VERSION}/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi-v7a/libapplication.so
|
||||
grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
|
||||
grep "MultiABI=" ../AndroidAppSettings.cfg | grep "all\\|mips" > /dev/null && \
|
||||
echo Stripping libapplication-mips.so by hand && \
|
||||
rm obj/local/mips/libapplication.so && \
|
||||
cp jni/application/src/libapplication-mips.so obj/local/mips/libapplication.so && \
|
||||
cp jni/application/src/libapplication-mips.so libs/mips/libapplication.so && \
|
||||
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/mipsel-linux-android-${NDK_TOOLCHAIN_VERSION}/prebuilt/$MYARCH/bin/mipsel-linux-android-strip --strip-unneeded libs/mips/libapplication.so
|
||||
grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
|
||||
grep "MultiABI=" ../AndroidAppSettings.cfg | grep "all\\|x86" > /dev/null && \
|
||||
echo Stripping libapplication-x86.so by hand && \
|
||||
rm obj/local/x86/libapplication.so && \
|
||||
cp jni/application/src/libapplication-x86.so obj/local/x86/libapplication.so && \
|
||||
cp jni/application/src/libapplication-x86.so libs/x86/libapplication.so && \
|
||||
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/x86-${NDK_TOOLCHAIN_VERSION}/prebuilt/$MYARCH/bin/i686-linux-android-strip --strip-unneeded libs/x86/libapplication.so
|
||||
grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
|
||||
grep "MultiABI=" ../AndroidAppSettings.cfg | grep "all\\|x86_64" > /dev/null && \
|
||||
echo Stripping libapplication-x86_64.so by hand && \
|
||||
rm obj/local/x86_64/libapplication.so && \
|
||||
cp jni/application/src/libapplication-x86_64.so obj/local/x86_64/libapplication.so && \
|
||||
cp jni/application/src/libapplication-x86_64.so libs/x86_64/libapplication.so && \
|
||||
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/x86_64-${NDK_TOOLCHAIN_VERSION}/prebuilt/$MYARCH/bin/x86_64-linux-android-strip --strip-unneeded libs/x86_64/libapplication.so
|
||||
grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
|
||||
grep "MultiABI=" ../AndroidAppSettings.cfg | grep "all\\|arm64-v8a" > /dev/null && \
|
||||
echo Stripping libapplication-arm64-v8a.so by hand && \
|
||||
rm obj/local/arm64-v8a/libapplication.so && \
|
||||
cp jni/application/src/libapplication-arm64-v8a.so obj/local/arm64-v8a/libapplication.so && \
|
||||
cp jni/application/src/libapplication-arm64-v8a.so libs/arm64-v8a/libapplication.so && \
|
||||
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/aarch64-linux-android-${NDK_TOOLCHAIN_VERSION}/prebuilt/$MYARCH/bin/aarch64-linux-android-strip --strip-unneeded libs/arm64-v8a/libapplication.so
|
||||
grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
|
||||
grep "MultiABI=" ../AndroidAppSettings.cfg | grep "all\\|mips64" > /dev/null && \
|
||||
echo Stripping libapplication-mips64.so by hand && \
|
||||
rm obj/local/mips64/libapplication.so && \
|
||||
cp jni/application/src/libapplication-mips64.so obj/local/mips64/libapplication.so && \
|
||||
cp jni/application/src/libapplication-mips64.so libs/mips64/libapplication.so && \
|
||||
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/mips64el-linux-android-${NDK_TOOLCHAIN_VERSION}/prebuilt/$MYARCH/bin/mips64el-linux-android-strip --strip-unneeded libs/mips64/libapplication.so
|
||||
return 0
|
||||
}
|
||||
if [ -x project/jni/application/src/AndroidPreBuild.sh ]; then
|
||||
pushd project/jni/application/src
|
||||
./AndroidPreBuild.sh
|
||||
popd
|
||||
fi
|
||||
|
||||
cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU nice -n19 ndk-build -j$NCPU V=1 $QUICK_REBUILD_ARGS && \
|
||||
strip_libs && \
|
||||
cd .. && ./copyAssets.sh && cd project && \
|
||||
{ if $build_release ; then \
|
||||
$quick_rebuild && { \
|
||||
ln -s -f libs lib ; \
|
||||
zip -u -r bin/MainActivity-release-unsigned.apk lib assets || exit 1 ; \
|
||||
} || ant release || exit 1 ; \
|
||||
[ '!' -x jni/application/src/AndroidPostBuild.sh ] || {
|
||||
cd jni/application/src ; \
|
||||
./AndroidPostBuild.sh `pwd`/../../../bin/MainActivity-release-unsigned.apk || exit 1 ; \
|
||||
cd ../../.. ; \
|
||||
} || exit 1 ; \
|
||||
jarsigner -verbose -keystore ~/.android/debug.keystore -storepass android -sigalg MD5withRSA -digestalg SHA1 bin/MainActivity-release-unsigned.apk androiddebugkey || exit 1 ; \
|
||||
rm -f bin/MainActivity-debug.apk ; \
|
||||
zipalign 4 bin/MainActivity-release-unsigned.apk bin/MainActivity-debug.apk || exit 1 ; \
|
||||
else \
|
||||
$quick_rebuild && { \
|
||||
ln -s -f libs lib ; \
|
||||
zip -u -r bin/MainActivity-debug-unaligned.apk lib assets || exit 1 ; \
|
||||
jarsigner -verbose -keystore ~/.android/debug.keystore -storepass android -sigalg MD5withRSA -digestalg SHA1 bin/MainActivity-debug-unaligned.apk androiddebugkey || exit 1 ; \
|
||||
rm -f bin/MainActivity-debug.apk ; \
|
||||
zipalign 4 bin/MainActivity-debug-unaligned.apk bin/MainActivity-debug.apk || exit 1 ; \
|
||||
} || ant debug || exit 1 ; \
|
||||
fi ; } && \
|
||||
{ if $sign_apk; then cd .. && ./sign.sh && cd project ; else true ; fi ; } && \
|
||||
{ $install_apk && [ -n "`adb devices | tail -n +2`" ] && \
|
||||
{ cd bin && adb install -r MainActivity-debug.apk | grep 'Failure' && \
|
||||
adb uninstall `grep AppFullName ../../AndroidAppSettings.cfg | sed 's/.*=//'` && adb install -r MainActivity-debug.apk ; } ; \
|
||||
true ; } && \
|
||||
{ $run_apk && { \
|
||||
ActivityName="`grep AppFullName ../../AndroidAppSettings.cfg | sed 's/.*=//'`/.MainActivity" ; \
|
||||
RUN_APK="adb shell am start -n $ActivityName" ; \
|
||||
echo "Running $ActivityName on the USB-connected device:" ; \
|
||||
echo "$RUN_APK" ; \
|
||||
eval $RUN_APK ; } ; \
|
||||
true ; } || exit 1
|
||||
if grep -q 'CustomBuildScript=y' ./AndroidAppSettings.cfg; then
|
||||
${ANDROID_NDK_HOME}/ndk-build -C project -j$NCPU V=1 CUSTOM_BUILD_SCRIPT_FIRST_PASS=1 NDK_APP_STRIP_MODE=none
|
||||
make -C project/jni/application -f CustomBuildScript.mk
|
||||
fi
|
||||
|
||||
${ANDROID_NDK_HOME}/ndk-build -C project -j$NCPU V=1 NDK_APP_STRIP_MODE=none
|
||||
./copyAssets.sh
|
||||
pushd project
|
||||
if $build_release ; then
|
||||
if [ -x ./gradlew ]; then
|
||||
./gradlew assembleRelease
|
||||
else
|
||||
gradle assembleRelease
|
||||
fi
|
||||
if [ -x jni/application/src/AndroidPostBuild.sh ]; then
|
||||
pushd jni/application/src
|
||||
./AndroidPostBuild.sh ${THIS_BUILD_DIR}/project/app/build/outputs/apk/release/app-release-unsigned.apk
|
||||
popd
|
||||
fi
|
||||
../copyAssets.sh pack-binaries app/build/outputs/apk/release/app-release-unsigned.apk
|
||||
rm -f app/build/outputs/apk/release/app-release.apk
|
||||
if $do_zipalign; then
|
||||
zipalign -p 4 app/build/outputs/apk/release/app-release-unsigned.apk app/build/outputs/apk/release/app-release.apk
|
||||
apksigner sign --ks ~/.android/debug.keystore --ks-key-alias androiddebugkey --ks-pass pass:android app/build/outputs/apk/release/app-release.apk
|
||||
fi
|
||||
else
|
||||
if [ -x ./gradlew ]; then
|
||||
./gradlew assembleDebug
|
||||
else
|
||||
gradle assembleDebug
|
||||
fi
|
||||
if [ -x jni/application/src/AndroidPostBuild.sh ]; then
|
||||
pushd jni/application/src
|
||||
./AndroidPostBuild.sh ${THIS_BUILD_DIR}/project/app/build/outputs/apk/debug/app-debug.apk
|
||||
popd
|
||||
fi
|
||||
mkdir -p app/build/outputs/apk/release
|
||||
../copyAssets.sh pack-binaries app/build/outputs/apk/debug/app-debug.apk
|
||||
rm -f app/build/outputs/apk/release/app-release.apk
|
||||
if $do_zipalign; then
|
||||
zipalign -p 4 app/build/outputs/apk/debug/app-debug.apk app/build/outputs/apk/release/app-release.apk
|
||||
apksigner sign --ks ~/.android/debug.keystore --ks-key-alias androiddebugkey --ks-pass pass:android app/build/outputs/apk/release/app-release.apk
|
||||
fi
|
||||
fi
|
||||
|
||||
if $sign_apk; then
|
||||
pushd ..
|
||||
./sign.sh
|
||||
popd
|
||||
fi
|
||||
|
||||
if $sign_bundle; then
|
||||
pushd ..
|
||||
./signBundle.sh
|
||||
popd
|
||||
fi
|
||||
if $install_apk && [ -n "$(adb devices | tail -n +2)" ]; then
|
||||
if $sign_apk; then
|
||||
APPNAME=$(grep AppName ../AndroidAppSettings.cfg | sed 's/.*=//' | tr -d '"' | tr " '/" '---')
|
||||
APPVER=$(grep AppVersionName ../AndroidAppSettings.cfg | sed 's/.*=//' | tr -d '"' | tr " '/" '---')
|
||||
adb install -r ../$APPNAME-$APPVER.apk ;
|
||||
else
|
||||
adb install -r app/build/outputs/apk/release/app-release.apk
|
||||
fi
|
||||
fi
|
||||
|
||||
if $run_apk; then
|
||||
ActivityName="$(grep AppFullName ../AndroidAppSettings.cfg | sed 's/.*=//')/.MainActivity"
|
||||
RUN_APK="adb shell am start -n $ActivityName"
|
||||
echo "Running $ActivityName on the USB-connected device:"
|
||||
echo "$RUN_APK"
|
||||
eval $RUN_APK
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
ARCHES="arm64-v8a armeabi-v7a x86 x86_64"
|
||||
|
||||
if [ "$1" = "pack-binaries" -o "$1" = "pack-binaries-bundle" ]; then
|
||||
[ -e jni/application/src/AndroidData/lib ] || exit 0
|
||||
[ -e jni/application/src/AndroidData/binaries*.zip ] && {
|
||||
echo "Error: binaries.zip no longer supported in Android 10"
|
||||
echo "Copy your executable binaries to AndroidData/lib/arm64-v8a"
|
||||
echo "Then execute them using \$LIBDIR or getenv(\"LIBDIR\")"
|
||||
exit 0
|
||||
}
|
||||
APK="`pwd`/$2"
|
||||
echo "Copying binaries to .apk file"
|
||||
cd jni/application/src/AndroidData/ || exit 1
|
||||
if [ "$1" = "pack-binaries-bundle" ]; then
|
||||
rm -rf base
|
||||
mkdir -p base
|
||||
cp -L -r lib base/
|
||||
zip -r -D "$APK" base || exit 1
|
||||
rm -rf base
|
||||
else
|
||||
zip -r -D "$APK" lib || exit 1
|
||||
fi
|
||||
cd ../../../../
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Copying app data files from project/jni/application/src/AndroidData to project/assets"
|
||||
mkdir -p project/assets
|
||||
rm -f -r project/assets/*
|
||||
if [ -d "project/jni/application/src/AndroidData" ] ; then
|
||||
cp -L -r project/jni/application/src/AndroidData/* project/assets/
|
||||
exit 0 # Do not split assets, this was needed only for Andorid 2.3 with it's stupid limitations
|
||||
for F in project/assets/*; do
|
||||
if [ `cat $F | wc -c` -gt 1000000 ] ; then
|
||||
echo "The file $F is bigger than 1 megabyte - splitting it into smaller chunks"
|
||||
split -b 1000000 -a 3 -d $F $F && rm $F || { echo "Error: 'split' command not installed" ; exit 1 ; }
|
||||
fi
|
||||
for F in project/jni/application/src/AndroidData/*; do
|
||||
[ "$F" = "project/jni/application/src/AndroidData/lib" ] && continue
|
||||
[ "$F" = "project/jni/application/src/AndroidData/assetpack" ] && continue
|
||||
cp -L -r "$F" project/assets/
|
||||
done
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -5,16 +5,19 @@ APPVER=`grep AppVersionName AndroidAppSettings.cfg | sed 's/.*=//' | tr -d '"' |
|
||||
|
||||
ARCHIVER=gzip
|
||||
EXT=gz
|
||||
which xz > /dev/null && ARCHIVER="xz -z" && EXT=xz
|
||||
which pxz > /dev/null && ARCHIVER=pxz && EXT=xz || echo "Install pxz for faster archiving: sudo apt-get isntall pxz"
|
||||
which xz > /dev/null && ARCHIVER="xz -z -T 0" && EXT=xz
|
||||
#which pxz > /dev/null && ARCHIVER=pxz && EXT=xz || echo "Install pxz for faster archiving: sudo apt-get install pxz"
|
||||
|
||||
# TODO: Boost, Python and ffmpeg are stored in repository as precompiled binaries, the proper way to fix that is to build them using scripts, and remove that binaries
|
||||
# --exclude="*.a" --exclude="*.so"
|
||||
tar -c --exclude-vcs --exclude="*.o" --exclude="*.d" --exclude="*.dep" \
|
||||
--exclude="libboost_*.a" --exclude="libcharset.so" --exclude="libiconv.so" \
|
||||
--exclude="libicu*.a" --exclude="libharfbuzz.a" --exclude="libcrypto.so*" --exclude="libssl.so*" \
|
||||
`git ls-files --exclude-standard | grep -v '^project/jni/application/.*'` \
|
||||
`find project/jni/application -maxdepth 1 -type f -o -type l` \
|
||||
project/jni/application/src \
|
||||
project/jni/application/`readlink project/jni/application/src` \
|
||||
project/AndroidManifest.xml project/src \
|
||||
project/obj/local/armeabi-v7a/*.so project/obj/local/x86/*.so \
|
||||
project/obj/local/armeabi-v7a/*.so project/obj/local/arm64-v8a/*.so project/obj/local/x86/*.so project/obj/local/x86_64/*.so \
|
||||
project/app/build/outputs/mapping/release/mapping.txt \
|
||||
"$@" | $ARCHIVER > $APPNAME-$APPVER-src.tar.$EXT
|
||||
|
||||
3
project/.gitignore
vendored
Normal file
3
project/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
/.gradle
|
||||
/build
|
||||
|
||||
@@ -7,17 +7,21 @@
|
||||
>
|
||||
<application android:label="@string/app_name"
|
||||
android:icon="@drawable/icon"
|
||||
android:debuggable="true"
|
||||
android:allowBackup="true"
|
||||
android:banner="@drawable/banner"
|
||||
android:isGame="true"
|
||||
android:extractNativeLibs="true"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme"
|
||||
>
|
||||
<activity android:name=".MainActivity"
|
||||
<activity android:name="MainActivity"
|
||||
android:label="@string/app_name"
|
||||
android:alwaysRetainTaskState="true"
|
||||
android:launchMode="singleTask"
|
||||
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection"
|
||||
android:windowSoftInputMode="stateUnspecified"
|
||||
android:theme="@style/AppTheme"
|
||||
android:exported="true"
|
||||
>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
@@ -27,20 +31,33 @@
|
||||
<category android:name="android.intent.category.LEANBACK_LAUNCHER" /> <!-- Android TV requires this -->
|
||||
<category android:name="tv.ouya.intent.category.GAME" /> <!-- For that one user who still got an OUYA in his living room and won't throw it away just because someone else decides that it's dead -->
|
||||
</intent-filter>
|
||||
<!-- ==OPENFILE== --> <intent-filter>
|
||||
<!-- ==OPENFILE== --> <action android:name="android.intent.action.VIEW" />
|
||||
<!-- ==OPENFILE== --> <category android:name="android.intent.category.DEFAULT" />
|
||||
<!-- ==OPENFILE== --> <category android:name="android.intent.category.BROWSABLE" />
|
||||
<!-- ==OPENFILE== --> <data android:scheme="file" />
|
||||
<!-- ==OPENFILE== --> <data android:mimeType="*/*" />
|
||||
<!-- ==OPENFILE== --> <data android:host="*" />
|
||||
<!-- ==OPENFILE== --> <data android:pathPattern=".*\\.==OPENFILE-EXT==" />
|
||||
<!-- ==OPENFILE== --> <data android:pathPattern=".*\\..*\\.==OPENFILE-EXT==" />
|
||||
<!-- ==OPENFILE== --> <data android:pathPattern=".*\\..*\\..*\\.==OPENFILE-EXT==" />
|
||||
<!-- ==OPENFILE== --> <data android:pathPattern=".*\\..*\\..*\\..*\\.==OPENFILE-EXT==" />
|
||||
<!-- ==OPENFILE== --> </intent-filter>
|
||||
</activity>
|
||||
<!-- ==ADMOB== --> <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection"/>
|
||||
<!-- ==ADMOB== --> <meta-data android:name="com.google.android.gms.version" android:value="4323000" /> <!-- Change this value to the actual Google Play SDK version -->
|
||||
<!-- ==ADMOB== --> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
|
||||
<!-- ==GOOGLEPLAYGAMESERVICES== --> <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="@string/google_play_game_services_app_id" />
|
||||
<!-- ==GOOGLEPLAYGAMESERVICES== --> <meta-data android:name="com.google.android.gms.appstate.APP_ID" android:value="@string/google_play_game_services_app_id" />
|
||||
<!-- ==GOOGLEPLAYGAMESERVICES== --> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
|
||||
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" /> <!-- Samsung's multiwindow -->
|
||||
<activity android:name=".RestartMainActivity"
|
||||
<activity android:name="RestartMainActivity"
|
||||
android:label="@string/app_name"
|
||||
android:alwaysRetainTaskState="true"
|
||||
android:launchMode="singleTask"
|
||||
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection"
|
||||
android:windowSoftInputMode="stateUnspecified"
|
||||
android:process=":RestartMainActivity"
|
||||
android:exported="true"
|
||||
/>
|
||||
<service android:name=".DummyService"
|
||||
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection"
|
||||
@@ -48,20 +65,29 @@
|
||||
/>
|
||||
</application>
|
||||
|
||||
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="25"/>
|
||||
<!-- ==INTERNET== --> <uses-permission android:name="android.permission.INTERNET" />
|
||||
<!-- ==EXTERNAL_STORAGE== --> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<!-- ==EXTERNAL_STORAGE== --> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<!-- ==NOT_EXTERNAL_STORAGE== --> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="18" /> <!-- App has write access to it's own dir on SD card without this permission on Android 4.4 and above -->
|
||||
<!-- ==NOT_EXTERNAL_STORAGE== --> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />
|
||||
<!-- ==NOT_EXTERNAL_STORAGE== --> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="18" /> <!-- App has write access to it's own dir on SD card without this permission on Android 4.4 and above -->
|
||||
<!-- ==READ_OBB== --> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />
|
||||
<!-- ==READ_OBB== --> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <!-- OBB file requires explicit permission before Marshmallow -->
|
||||
<!-- ==RECORD_AUDIO== --> <uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<!-- ==ADMOB== --> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<!-- ==FOREGROUND_SERVICE== --> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
|
||||
<!-- <uses-permission android:name="android.permission.VIBRATE"></uses-permission> --> <!-- Vibrator not supported yet by SDL -->
|
||||
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" /> <!-- Allow TV boxes -->
|
||||
<uses-feature android:name="android.hardware.faketouch" android:required="false"/> <!-- Allow TV boxes -->
|
||||
<uses-feature android:name="android.software.leanback" android:required="false" /> <!-- Android TV requires this -->
|
||||
<uses-feature android:name="android.hardware.microphone" android:required="false" /> <!-- Android TV requires this -->
|
||||
<uses-feature android:name="android.hardware.gamepad" android:required="false"/> <!-- Android TV requires this -->
|
||||
<uses-feature android:name="android.hardware.telephony" android:required="false"/> <!-- Android TV requires this -->
|
||||
<uses-feature android:name="android.hardware.camera" android:required="false"/> <!-- Android TV requires this -->
|
||||
<uses-feature android:name="android.hardware.nfc" android:required="false"/> <!-- Android TV requires this -->
|
||||
<uses-feature android:name="android.hardware.location.gps" android:required="false"/> <!-- Android TV requires this -->
|
||||
<uses-feature android:name="android.hardware.sensor" android:required="false"/> <!-- Android TV requires this -->
|
||||
<!-- ==SCREEN-SIZE-SMALL== --> <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" />
|
||||
<!-- ==SCREEN-SIZE-NORMAL== --> <supports-screens android:smallScreens="false" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" />
|
||||
<!-- ==SCREEN-SIZE-LARGE== --> <supports-screens android:smallScreens="false" android:normalScreens="false" android:largeScreens="true" android:xlargeScreens="true" />
|
||||
|
||||
38
project/app/build-template.gradle
Normal file
38
project/app/build-template.gradle
Normal file
@@ -0,0 +1,38 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk 31
|
||||
|
||||
defaultConfig {
|
||||
applicationId "net.olofson.ballfield"
|
||||
minSdk 16
|
||||
targetSdk 31
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), '../proguard-local.cfg', '../proguard.cfg'
|
||||
}
|
||||
releaseWithDebugInfo {
|
||||
initWith release
|
||||
ndk {
|
||||
debugSymbolLevel 'FULL'
|
||||
}
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
assetPacks = [":assetpack"] // ==ASSETPACK==
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||
implementation 'com.google.android.gms:play-services-games:21.0.0' // ==GOOGLEPLAYGAMESERVICES==
|
||||
}
|
||||
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
|
||||
17
project/build.gradle
Normal file
17
project/build.gradle
Normal file
@@ -0,0 +1,17 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:7.0.3"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="MainActivity" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
Version Control Systems. -->
|
||||
<property file="local.properties" />
|
||||
|
||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||
'android' tool to add properties to it.
|
||||
This is the place to change some Ant specific build properties.
|
||||
Here are some properties you may want to change/update:
|
||||
|
||||
source.dir
|
||||
The name of the source directory. Default is 'src'.
|
||||
out.dir
|
||||
The name of the output directory. Default is 'bin'.
|
||||
|
||||
For other overridable properties, look at the beginning of the rules
|
||||
files in the SDK, at tools/ant/build.xml
|
||||
|
||||
Properties related to the SDK location or the project target should
|
||||
be updated using the 'android' tool with the 'update' action.
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems.
|
||||
|
||||
-->
|
||||
<property file="ant.properties" />
|
||||
|
||||
<!-- if sdk.dir was not set from one of the property file, then
|
||||
get it from the ANDROID_HOME env var.
|
||||
This must be done before we load project.properties since
|
||||
the proguard config can use sdk.dir -->
|
||||
<property environment="env" />
|
||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
||||
<isset property="env.ANDROID_HOME" />
|
||||
</condition>
|
||||
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
This contains project specific properties such as project target, and library
|
||||
dependencies. Lower level build properties are stored in ant.properties
|
||||
(or in .classpath for Eclipse projects).
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="project.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
<!--
|
||||
Import per project custom build rules if present at the root of the project.
|
||||
This is the place to put custom intermediary targets such as:
|
||||
-pre-build
|
||||
-pre-compile
|
||||
-post-compile (This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||
-post-package
|
||||
-post-build
|
||||
-pre-clean
|
||||
-->
|
||||
<import file="custom_rules.xml" optional="true" />
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: 1 -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
</project>
|
||||
19
project/gradle.properties
Normal file
19
project/gradle.properties
Normal file
@@ -0,0 +1,19 @@
|
||||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app"s APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Automatically convert third-party libraries to use AndroidX
|
||||
android.enableJetifier=true
|
||||
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 @@
|
||||
#Sat Nov 27 22:44:43 EET 2021
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
185
project/gradlew
vendored
Executable file
185
project/gradlew
vendored
Executable file
@@ -0,0 +1,185 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
89
project/gradlew.bat
vendored
Normal file
89
project/gradlew.bat
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -29,6 +29,7 @@ import android.view.KeyEvent;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.os.Environment;
|
||||
import android.view.View;
|
||||
|
||||
import android.widget.TextView;
|
||||
import java.net.URLConnection;
|
||||
@@ -52,10 +53,16 @@ import java.util.Arrays;
|
||||
import android.text.SpannedString;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
import android.os.storage.StorageManager;
|
||||
import android.os.storage.OnObbStateChangeListener;
|
||||
import android.content.res.AssetManager;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
|
||||
class CountingInputStream extends BufferedInputStream
|
||||
{
|
||||
@@ -170,7 +177,6 @@ class DataDownloader extends Thread
|
||||
{
|
||||
Parent = _Parent;
|
||||
Status = new StatusWriter( _Status, _Parent );
|
||||
//Status.setText( "Connecting to " + Globals.DataDownloadUrl );
|
||||
outFilesDir = Globals.DataDir;
|
||||
DownloadComplete = false;
|
||||
this.start();
|
||||
@@ -186,7 +192,6 @@ class DataDownloader extends Thread
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Parent.keyListener = new BackKeyListener(Parent);
|
||||
String [] downloadFiles = Globals.DataDownloadUrl;
|
||||
int total = 0;
|
||||
int count = 0;
|
||||
@@ -209,7 +214,16 @@ class DataDownloader extends Thread
|
||||
downloadFiles[i].contains("<ARCH>") &&
|
||||
! DownloadDataFile(downloadFiles[i].replace("<ARCH>", android.os.Build.CPU_ABI2), DOWNLOAD_FLAG_FILENAME + String.valueOf(i) + ".flag", count+1, total, i) ) )
|
||||
{
|
||||
DownloadFailed = true;
|
||||
if (!Parent.getFilesDir().getAbsolutePath().equals(Globals.DataDir))
|
||||
{
|
||||
Globals.DataDir = Parent.getFilesDir().getAbsolutePath();
|
||||
Globals.DownloadToSdcard = false;
|
||||
Log.i("SDL", "Switching download destination directory to internal storage and restarting the app: " + Globals.DataDir);
|
||||
Settings.Save(Parent);
|
||||
Intent intent = new Intent(Parent, RestartMainActivity.class);
|
||||
Parent.startActivity(intent);
|
||||
System.exit(0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -217,7 +231,6 @@ class DataDownloader extends Thread
|
||||
}
|
||||
}
|
||||
DownloadComplete = true;
|
||||
Parent.keyListener = null;
|
||||
initParent();
|
||||
}
|
||||
|
||||
@@ -261,20 +274,6 @@ class DataDownloader extends Thread
|
||||
if( ! matched )
|
||||
throw new IOException();
|
||||
Status.setText( res.getString(R.string.download_unneeded) );
|
||||
for( int i = 1; i < downloadUrls.length; i++ )
|
||||
{
|
||||
if( downloadUrls[i].indexOf("obb:") == 0 ) // APK expansion file provided by Google Play
|
||||
{
|
||||
String url = getObbFilePath(downloadUrls[i]);
|
||||
if (new File(url).length() > 256)
|
||||
{
|
||||
Writer writer = new OutputStreamWriter(new FileOutputStream(url), "UTF-8");
|
||||
writer.write("Extracted and truncated\n");
|
||||
writer.close();
|
||||
Log.i("SDL", "Truncated file from expansion: " + url);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} catch ( IOException e ) {
|
||||
forceOverwrite = true;
|
||||
@@ -287,7 +286,7 @@ class DataDownloader extends Thread
|
||||
Log.i("SDL", "Downloading data to: '" + outFilesDir + "'");
|
||||
try {
|
||||
File outDir = new File( outFilesDir );
|
||||
if( !(outDir.exists() && outDir.isDirectory()) )
|
||||
if( !outDir.exists() )
|
||||
outDir.mkdirs();
|
||||
OutputStream out = new FileOutputStream( getOutFilePath(".nomedia") );
|
||||
out.flush();
|
||||
@@ -304,6 +303,9 @@ class DataDownloader extends Thread
|
||||
boolean DoNotUnzip = false;
|
||||
boolean FileInAssets = false;
|
||||
boolean FileInExpansion = false;
|
||||
boolean MountObb = false;
|
||||
final boolean[] ObbMounted = new boolean[] { false };
|
||||
final boolean[] ObbMountedError = new boolean[] { false };
|
||||
String url = "";
|
||||
|
||||
int downloadUrlIndex = 1;
|
||||
@@ -329,31 +331,61 @@ class DataDownloader extends Thread
|
||||
partialDownloadLen = partialDownload.length();
|
||||
}
|
||||
Status.setText( downloadCount + "/" + downloadTotal + ": " + res.getString(R.string.connecting_to, url) );
|
||||
if( url.indexOf("obb:") == 0 ) // APK expansion file provided by Google Play
|
||||
if( url.equals("assetpack") )
|
||||
{
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M)
|
||||
if( Parent.assetPackPath != null )
|
||||
{
|
||||
int permissionCheck = Parent.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
if (permissionCheck != PackageManager.PERMISSION_GRANTED && !Parent.writeExternalStoragePermissionDialogAnswered)
|
||||
{
|
||||
Parent.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
|
||||
while( !Parent.writeExternalStoragePermissionDialogAnswered )
|
||||
{
|
||||
try{ Thread.sleep(300); } catch (InterruptedException e) {}
|
||||
}
|
||||
}
|
||||
Log.i("SDL", "Found asset pack: " + Parent.assetPackPath);
|
||||
return true;
|
||||
}
|
||||
|
||||
Log.i("SDL", "Asset pack is not installed");
|
||||
downloadUrlIndex++;
|
||||
continue;
|
||||
}
|
||||
else if( url.indexOf("obb:") == 0 || url.indexOf("mnt:") == 0 ) // APK expansion file provided by Google Play
|
||||
{
|
||||
boolean tmpMountObb = ( url.indexOf("mnt:") == 0 );
|
||||
url = getObbFilePath(url);
|
||||
InputStream stream1 = null;
|
||||
|
||||
try {
|
||||
stream1 = new FileInputStream(url);
|
||||
stream1.read();
|
||||
stream1.close();
|
||||
Log.i("SDL", "Fetching file from expansion: " + url);
|
||||
FileInExpansion = true;
|
||||
MountObb = tmpMountObb;
|
||||
break;
|
||||
} catch( Exception e ) {
|
||||
} catch( IOException ee ) {
|
||||
Log.i("SDL", "Failed to open file, requesting storage read permission: " + url);
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M)
|
||||
{
|
||||
int permissionCheck = Parent.checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE);
|
||||
if (permissionCheck != PackageManager.PERMISSION_GRANTED && !Parent.readExternalStoragePermissionDialogAnswered)
|
||||
{
|
||||
Parent.requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 0);
|
||||
while( !Parent.readExternalStoragePermissionDialogAnswered )
|
||||
{
|
||||
try{ Thread.sleep(300); } catch (InterruptedException e) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch( Exception eee ) {
|
||||
Log.i("SDL", "Failed to open file: " + url);
|
||||
downloadUrlIndex++;
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
stream1 = new FileInputStream(url);
|
||||
stream1.read();
|
||||
stream1.close();
|
||||
Log.i("SDL", "Fetching file from expansion: " + url);
|
||||
FileInExpansion = true;
|
||||
MountObb = tmpMountObb;
|
||||
break;
|
||||
} catch( Exception eee ) {
|
||||
Log.i("SDL", "Failed to open file: " + url);
|
||||
downloadUrlIndex++;
|
||||
continue;
|
||||
@@ -422,6 +454,51 @@ class DataDownloader extends Thread
|
||||
}
|
||||
}
|
||||
|
||||
if( MountObb )
|
||||
{
|
||||
Log.i("SDL", "Mounting OBB file: " + url);
|
||||
StorageManager sm = (StorageManager) Parent.getSystemService(Context.STORAGE_SERVICE);
|
||||
if( !sm.mountObb(url, null, new OnObbStateChangeListener()
|
||||
{
|
||||
public void onObbStateChange(String path, int state)
|
||||
{
|
||||
if (state == OnObbStateChangeListener.MOUNTED ||
|
||||
state == OnObbStateChangeListener.ERROR_ALREADY_MOUNTED)
|
||||
{
|
||||
ObbMounted[0] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ObbMountedError[0] = true;
|
||||
}
|
||||
}
|
||||
}) )
|
||||
{
|
||||
Log.i("SDL", "Cannot mount OBB file '" + url + "'");
|
||||
Status.setText( res.getString(R.string.error_dl_from, url) );
|
||||
return false;
|
||||
}
|
||||
while( !ObbMounted[0] )
|
||||
{
|
||||
try{ Thread.sleep(300); } catch (InterruptedException e) {}
|
||||
if( ObbMountedError[0] )
|
||||
{
|
||||
Log.i("SDL", "Cannot mount OBB file '" + url + "'");
|
||||
Status.setText( res.getString(R.string.error_dl_from, url) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Parent.ObbMountPath = sm.getMountedObbPath(url);
|
||||
if( Parent.ObbMountPath == null )
|
||||
{
|
||||
Log.i("SDL", "Cannot mount OBB file '" + url + "'");
|
||||
Status.setText( res.getString(R.string.error_dl_from, url) );
|
||||
return false;
|
||||
}
|
||||
Log.i("SDL", "Mounted OBB file '" + url + "' to path " + Parent.ObbMountPath);
|
||||
return true;
|
||||
}
|
||||
|
||||
if( FileInExpansion )
|
||||
{
|
||||
Log.i("SDL", "Count file size: '" + url);
|
||||
@@ -513,15 +590,7 @@ class DataDownloader extends Thread
|
||||
|
||||
try {
|
||||
stream.close();
|
||||
if( FileInExpansion )
|
||||
{
|
||||
Writer writer = new OutputStreamWriter(new FileOutputStream(url), "UTF-8");
|
||||
writer.write("Extracted and truncated\n");
|
||||
writer.close();
|
||||
Log.i("SDL", "Truncated file from expansion: " + url);
|
||||
}
|
||||
} catch( java.io.IOException e ) {
|
||||
Log.i("SDL", "Error truncating file from expansion: " + url);
|
||||
};
|
||||
|
||||
return true;
|
||||
@@ -781,7 +850,7 @@ class DataDownloader extends Thread
|
||||
public MainActivity Parent;
|
||||
public void run()
|
||||
{
|
||||
Parent.initSDL();
|
||||
Parent.downloadFinishedInitSDL();
|
||||
}
|
||||
}
|
||||
Callback cb = new Callback();
|
||||
@@ -799,57 +868,13 @@ class DataDownloader extends Thread
|
||||
|
||||
private String getObbFilePath(final String url)
|
||||
{
|
||||
// "obb:" or "mnt:" - same length
|
||||
return Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/obb/" +
|
||||
Parent.getPackageName() + "/" + url.substring("obb:".length()) + "." + Parent.getPackageName() + ".obb";
|
||||
}
|
||||
|
||||
public class BackKeyListener implements MainActivity.KeyEventsListener
|
||||
{
|
||||
MainActivity p;
|
||||
public BackKeyListener(MainActivity _p)
|
||||
{
|
||||
p = _p;
|
||||
}
|
||||
|
||||
public void onKeyEvent(final int keyCode)
|
||||
{
|
||||
if( DownloadFailed )
|
||||
System.exit(1);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(p);
|
||||
builder.setTitle(p.getResources().getString(R.string.cancel_download));
|
||||
builder.setMessage(p.getResources().getString(R.string.cancel_download) + (DownloadCanBeResumed ? " " + p.getResources().getString(R.string.cancel_download_resume) : ""));
|
||||
|
||||
builder.setPositiveButton(p.getResources().getString(R.string.yes), new DialogInterface.OnClickListener()
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int item)
|
||||
{
|
||||
System.exit(1);
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(p.getResources().getString(R.string.no), new DialogInterface.OnClickListener()
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int item)
|
||||
{
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
|
||||
{
|
||||
public void onCancel(DialogInterface dialog)
|
||||
{
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.setOwnerActivity(p);
|
||||
alert.show();
|
||||
}
|
||||
}
|
||||
|
||||
public StatusWriter Status;
|
||||
public boolean DownloadComplete = false;
|
||||
public boolean DownloadFailed = false;
|
||||
public boolean DownloadCanBeResumed = false;
|
||||
private MainActivity Parent;
|
||||
private String outFilesDir = null;
|
||||
|
||||
@@ -92,6 +92,8 @@ import android.inputmethodservice.Keyboard;
|
||||
import android.app.Notification;
|
||||
import android.app.PendingIntent;
|
||||
import android.widget.RemoteViews;
|
||||
import android.os.Build;
|
||||
import android.app.NotificationChannel;
|
||||
|
||||
public class DummyService extends Service
|
||||
{
|
||||
@@ -110,13 +112,29 @@ public class DummyService extends Service
|
||||
System.exit(0);
|
||||
}
|
||||
Log.v("SDL", "Starting dummy service - displaying notification");
|
||||
Notification ntf = new Notification();
|
||||
ntf.icon = R.drawable.icon;
|
||||
ntf.flags |= Notification.FLAG_NO_CLEAR;
|
||||
Notification.Builder builder;
|
||||
if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.O )
|
||||
{
|
||||
String channelId = "app_running_ntf";
|
||||
NotificationChannel channel = new NotificationChannel(channelId,
|
||||
getString(R.string.notification_app_is_running, getString(getApplicationInfo().labelRes)),
|
||||
NotificationManager.IMPORTANCE_LOW);
|
||||
NotificationManager mgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
mgr.createNotificationChannel(channel);
|
||||
builder = new Notification.Builder(this, channelId);
|
||||
}
|
||||
else
|
||||
{
|
||||
builder = new Notification.Builder(this);
|
||||
}
|
||||
Notification ntf = builder
|
||||
.setSmallIcon(R.drawable.icon)
|
||||
.setTicker(getString(getApplicationInfo().labelRes))
|
||||
.setOngoing(true)
|
||||
.build();
|
||||
PendingIntent killIntent = PendingIntent.getService(this, 5, new Intent(Intent.ACTION_DELETE, null, this, DummyService.class), PendingIntent.FLAG_CANCEL_CURRENT);
|
||||
PendingIntent showIntent = PendingIntent.getActivity(this, 0, new Intent("", null, this, MainActivity.class), PendingIntent.FLAG_CANCEL_CURRENT);
|
||||
ntf.deleteIntent = killIntent;
|
||||
ntf.tickerText = getString(getApplicationInfo().labelRes);
|
||||
RemoteViews view = new RemoteViews(getPackageName(), R.layout.notification);
|
||||
view.setCharSequence(R.id.notificationText, "setText", getString(R.string.notification_app_is_running, getString(getApplicationInfo().labelRes)));
|
||||
view.setOnClickPendingIntent(R.id.notificationText, showIntent);
|
||||
|
||||
@@ -40,6 +40,7 @@ import android.util.Log;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
import android.app.KeyguardManager;
|
||||
import android.graphics.Rect;
|
||||
|
||||
/**
|
||||
* An implementation of SurfaceView that uses the dedicated surface for
|
||||
@@ -1015,7 +1016,7 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
|
||||
mRenderMode = RENDERMODE_CONTINUOUSLY;
|
||||
mRenderer = renderer;
|
||||
mRenderer.setSwapBuffersCallback(this);
|
||||
setName("GLThread");
|
||||
setName("SDLVideoThread");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -32,9 +32,14 @@ class Globals
|
||||
public static String ApplicationName = "CommanderGenius";
|
||||
public static String AppLibraries[] = { "sdl-1.2", };
|
||||
public static String AppMainLibraries[] = { "application", "sdl_main" };
|
||||
public static String LibraryNamesMap[][] = { { "crypto", "crypto.so.sdl.1" }, { "ssl", "ssl.so.sdl.1" }, { "curl", "curl-sdl" } }; // Because some libraries are named differently to not clash with system libs
|
||||
public static final boolean Using_SDL_1_3 = false;
|
||||
public static final boolean Using_SDL_2_0 = false;
|
||||
public static String LibraryNamesMap[][] = {
|
||||
{ "crypto", "crypto.so.sdl.1" },
|
||||
{ "ssl", "ssl.so.sdl.1" },
|
||||
{ "curl", "curl-sdl" },
|
||||
{ "expat", "expat-sdl" },
|
||||
{ "sqlite3", "sqlite3-sdl" },
|
||||
}; // Because some libraries are named differently to not clash with system libs
|
||||
public static final boolean UsingSDL2 = false;
|
||||
public static String[] DataDownloadUrl = { "Data files are 2 Mb|https://sourceforge.net/projects/libsdl-android/files/CommanderGenius/commandergenius-data.zip/download", "High-quality GFX and music - 40 Mb|https://sourceforge.net/projects/libsdl-android/files/CommanderGenius/commandergenius-hqp.zip/download" };
|
||||
public static boolean SwVideoMode = false;
|
||||
public static boolean NeedDepthBuffer = false;
|
||||
@@ -42,7 +47,7 @@ class Globals
|
||||
public static boolean NeedGles2 = false;
|
||||
public static boolean NeedGles3 = false;
|
||||
public static boolean CompatibilityHacksVideo = false;
|
||||
public static boolean CompatibilityHacksForceScreenUpdateMouseClick = true;
|
||||
public static boolean CompatibilityHacksForceScreenUpdateMouseClick = false;
|
||||
public static boolean CompatibilityHacksStaticInit = false;
|
||||
public static boolean CompatibilityHacksTextInputEmulatesHwKeyboard = false;
|
||||
public static int TextInputKeyboard = 0;
|
||||
@@ -85,13 +90,15 @@ class Globals
|
||||
public static boolean HorizontalOrientation = true;
|
||||
public static boolean AutoDetectOrientation = false;
|
||||
public static boolean ImmersiveMode = true;
|
||||
public static boolean DrawInDisplayCutout = false;
|
||||
public static boolean HideSystemMousePointer = false;
|
||||
public static boolean DownloadToSdcard = true;
|
||||
public static boolean PhoneHasArrowKeys = false;
|
||||
public static boolean UseAccelerometerAsArrowKeys = false;
|
||||
public static boolean UseTouchscreenKeyboard = true;
|
||||
public static int TouchscreenKeyboardSize = 1;
|
||||
public static final int TOUCHSCREEN_KEYBOARD_CUSTOM = 4;
|
||||
public static int TouchscreenKeyboardDrawSize = 1;
|
||||
public static int TouchscreenKeyboardDrawSize = 2;
|
||||
public static int TouchscreenKeyboardTheme = 2;
|
||||
public static int TouchscreenKeyboardTransparency = 2;
|
||||
public static boolean FloatingScreenJoystick = false;
|
||||
@@ -124,12 +131,66 @@ class Globals
|
||||
public static boolean KeepAspectRatio = KeepAspectRatioDefaultSetting;
|
||||
public static boolean TvBorders = true;
|
||||
public static int RemapHwKeycode[] = new int[SDL_Keys.JAVA_KEYCODE_LAST];
|
||||
public static int RemapScreenKbKeycode[] = new int[6];
|
||||
public static int ScreenKbControlsLayout[][] = AppUsesThirdJoystick ? // Values for 800x480 resolution
|
||||
new int[][] { { 0, 303, 177, 480 }, { 0, 0, 48, 48 }, { 400, 392, 488, 480 }, { 312, 392, 400, 480 }, { 400, 304, 488, 392 }, { 312, 304, 400, 392 }, { 400, 216, 488, 304 }, { 312, 216, 400, 304 }, { 623, 303, 800, 480 }, { 623, 126, 800, 303 } } :
|
||||
AppUsesSecondJoystick ?
|
||||
new int[][] { { 0, 303, 177, 480 }, { 0, 0, 48, 48 }, { 400, 392, 488, 480 }, { 312, 392, 400, 480 }, { 400, 304, 488, 392 }, { 312, 304, 400, 392 }, { 400, 216, 488, 304 }, { 312, 216, 400, 304 }, { 623, 303, 800, 480 } } :
|
||||
new int[][] { { 0, 303, 177, 480 }, { 0, 0, 48, 48 }, { 712, 392, 800, 480 }, { 624, 392, 712, 480 }, { 712, 304, 800, 392 }, { 624, 304, 712, 392 }, { 712, 216, 800, 304 }, { 624, 216, 712, 304 } };
|
||||
public static int RemapScreenKbKeycode[] = new int[12];
|
||||
// Values for 800x480 resolution
|
||||
public static int ScreenKbControlsLayout[][] =
|
||||
AppUsesThirdJoystick ? new int[][]
|
||||
{
|
||||
{ 0, 303, 177, 480 }, // Main joystick/DPAD
|
||||
{ 0, 0, 48, 48 }, // Text input button
|
||||
{ 400, 392, 488, 480 }, // Button 0
|
||||
{ 312, 392, 400, 480 }, // Button 1
|
||||
{ 400, 304, 488, 392 }, // Button 2
|
||||
{ 312, 304, 400, 392 }, // Button 3
|
||||
{ 400, 216, 488, 304 }, // Button 4
|
||||
{ 312, 216, 400, 304 }, // Button 5
|
||||
{ 623, 303, 800, 480 }, // Joystick 2
|
||||
{ 623, 126, 800, 303 }, // Joystick 3
|
||||
{ 400, 392, 488, 480 }, // Button 6 - copy of button 0, to be redefined in the code
|
||||
{ 312, 392, 400, 480 }, // Button 7 - copy of button 1, to be redefined in the code
|
||||
{ 400, 304, 488, 392 }, // Button 8 - copy of button 2, to be redefined in the code
|
||||
{ 312, 304, 400, 392 }, // Button 9 - copy of button 3, to be redefined in the code
|
||||
{ 400, 216, 488, 304 }, // Button 10 - copy of button 4, to be redefined in the code
|
||||
{ 312, 216, 400, 304 }, // Button 11 - copy of button 5, to be redefined in the code
|
||||
}
|
||||
: AppUsesSecondJoystick ? new int[][]
|
||||
{
|
||||
{ 0, 303, 177, 480 }, // Main joystick/DPAD
|
||||
{ 0, 0, 48, 48 }, // Text input button
|
||||
{ 400, 392, 488, 480 }, // Button 0
|
||||
{ 312, 392, 400, 480 }, // Button 1
|
||||
{ 400, 304, 488, 392 }, // Button 2
|
||||
{ 312, 304, 400, 392 }, // Button 3
|
||||
{ 400, 216, 488, 304 }, // Button 4
|
||||
{ 312, 216, 400, 304 }, // Button 5
|
||||
{ 623, 303, 800, 480 }, // Joystick 2
|
||||
{ 0, 0, 0, 0, }, // Joystick 3
|
||||
{ 400, 392, 488, 480 }, // Button 6 - copy of button 0, to be redefined in the code
|
||||
{ 312, 392, 400, 480 }, // Button 7 - copy of button 1, to be redefined in the code
|
||||
{ 400, 304, 488, 392 }, // Button 8 - copy of button 2, to be redefined in the code
|
||||
{ 312, 304, 400, 392 }, // Button 9 - copy of button 3, to be redefined in the code
|
||||
{ 400, 216, 488, 304 }, // Button 10 - copy of button 4, to be redefined in the code
|
||||
{ 312, 216, 400, 304 }, // Button 11 - copy of button 5, to be redefined in the code
|
||||
}
|
||||
: new int[][]
|
||||
{
|
||||
{ 0, 303, 177, 480 }, // Main joystick/DPAD
|
||||
{ 0, 0, 48, 48 }, // Text input button
|
||||
{ 712, 392, 800, 480 }, // Button 0
|
||||
{ 624, 392, 712, 480 }, // Button 1
|
||||
{ 712, 304, 800, 392 }, // Button 2
|
||||
{ 624, 304, 712, 392 }, // Button 3
|
||||
{ 712, 216, 800, 304 }, // Button 4
|
||||
{ 624, 216, 712, 304 }, // Button 5
|
||||
{ 0, 0, 0, 0, }, // Joystick 2
|
||||
{ 0, 0, 0, 0, }, // Joystick 3
|
||||
{ 536, 392, 624, 480 }, // Button 6
|
||||
{ 448, 392, 536, 480 }, // Button 7
|
||||
{ 536, 304, 624, 392 }, // Button 8
|
||||
{ 448, 304, 536, 392 }, // Button 9
|
||||
{ 536, 216, 624, 304 }, // Button 10
|
||||
{ 448, 216, 536, 304 }, // Button 11
|
||||
};
|
||||
public static boolean ScreenKbControlsShown[] = new boolean[ScreenKbControlsLayout.length]; /* Also joystick and text input button added */
|
||||
public static int RemapMultitouchGestureKeycode[] = new int[4];
|
||||
public static boolean MultitouchGesturesUsed[] = new boolean[4];
|
||||
|
||||
@@ -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.os.Build;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
|
||||
|
||||
// TODO: too much code here, split into multiple files, possibly auto-generated menus?
|
||||
@@ -85,6 +86,8 @@ public class Settings
|
||||
static boolean settingsLoaded = false;
|
||||
static boolean settingsChanged = false;
|
||||
static final int SETTINGS_FILE_VERSION = 5;
|
||||
static boolean convertButtonSizeFromOldSdlVersion = false;
|
||||
static int settingsAppVersion = 0;
|
||||
|
||||
static void Save(final MainActivity p)
|
||||
{
|
||||
@@ -187,6 +190,9 @@ public class Settings
|
||||
out.writeBoolean(Globals.AutoDetectOrientation);
|
||||
out.writeBoolean(Globals.TvBorders);
|
||||
out.writeBoolean(Globals.ForceHardwareMouse);
|
||||
convertButtonSizeFromOldSdlVersion = false;
|
||||
out.writeBoolean(convertButtonSizeFromOldSdlVersion);
|
||||
out.writeBoolean(Globals.DrawInDisplayCutout);
|
||||
|
||||
out.close();
|
||||
settingsLoaded = true;
|
||||
@@ -196,13 +202,157 @@ public class Settings
|
||||
} catch ( IOException e ) {};
|
||||
}
|
||||
|
||||
static void Load( final MainActivity p )
|
||||
static boolean LoadConfig( final MainActivity p )
|
||||
{
|
||||
if(settingsLoaded) // Prevent starting twice
|
||||
Globals.OptionalDataDownload = new boolean[Globals.DataDownloadUrl.length];
|
||||
for( int i = 0; i < Globals.DataDownloadUrl.length; i++ )
|
||||
{
|
||||
if( Globals.DataDownloadUrl[i].indexOf("!") == 0 )
|
||||
{
|
||||
Globals.OptionalDataDownload[i] = true;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
ObjectInputStream settingsFile = new ObjectInputStream(new FileInputStream( p.getFilesDir().getAbsolutePath() + "/" + SettingsFileName ));
|
||||
if( settingsFile.readInt() != SETTINGS_FILE_VERSION )
|
||||
throw new IOException();
|
||||
Globals.DownloadToSdcard = settingsFile.readBoolean();
|
||||
Globals.PhoneHasArrowKeys = settingsFile.readBoolean();
|
||||
settingsFile.readBoolean();
|
||||
Globals.UseAccelerometerAsArrowKeys = settingsFile.readBoolean();
|
||||
Globals.UseTouchscreenKeyboard = settingsFile.readBoolean();
|
||||
Globals.TouchscreenKeyboardSize = settingsFile.readInt();
|
||||
convertButtonSizeFromOldSdlVersion = true; // Will be changed to false if we read the remainder of the config file
|
||||
Globals.AccelerometerSensitivity = settingsFile.readInt();
|
||||
Globals.AccelerometerCenterPos = settingsFile.readInt();
|
||||
settingsFile.readInt();
|
||||
Globals.AudioBufferConfig = settingsFile.readInt();
|
||||
Globals.TouchscreenKeyboardTheme = settingsFile.readInt();
|
||||
Globals.RightClickMethod = settingsFile.readInt();
|
||||
Globals.ShowScreenUnderFinger = settingsFile.readInt();
|
||||
Globals.LeftClickMethod = settingsFile.readInt();
|
||||
Globals.MoveMouseWithJoystick = settingsFile.readBoolean();
|
||||
Globals.ClickMouseWithDpad = settingsFile.readBoolean();
|
||||
Globals.ClickScreenPressure = settingsFile.readInt();
|
||||
Globals.ClickScreenTouchspotSize = settingsFile.readInt();
|
||||
Globals.KeepAspectRatio = settingsFile.readBoolean();
|
||||
Globals.MoveMouseWithJoystickSpeed = settingsFile.readInt();
|
||||
Globals.MoveMouseWithJoystickAccel = settingsFile.readInt();
|
||||
int readKeysSize = settingsFile.readInt();
|
||||
for( int i = 0; i < readKeysSize; i++ )
|
||||
{
|
||||
Globals.RemapHwKeycode[i] = settingsFile.readInt();
|
||||
}
|
||||
int readScreenKbRemapKeysSize = settingsFile.readInt();
|
||||
if( readScreenKbRemapKeysSize > Globals.RemapScreenKbKeycode.length )
|
||||
throw new IOException();
|
||||
for( int i = 0; i < readScreenKbRemapKeysSize; i++ )
|
||||
{
|
||||
Globals.RemapScreenKbKeycode[i] = settingsFile.readInt();
|
||||
}
|
||||
int readScreenKbShownSize = settingsFile.readInt();
|
||||
if( readScreenKbShownSize > Globals.ScreenKbControlsShown.length )
|
||||
throw new IOException();
|
||||
for( int i = 0; i < readScreenKbShownSize; i++ )
|
||||
{
|
||||
Globals.ScreenKbControlsShown[i] = settingsFile.readBoolean();
|
||||
}
|
||||
Globals.TouchscreenKeyboardTransparency = settingsFile.readInt();
|
||||
if( settingsFile.readInt() != Globals.RemapMultitouchGestureKeycode.length )
|
||||
throw new IOException();
|
||||
for( int i = 0; i < Globals.RemapMultitouchGestureKeycode.length; i++ )
|
||||
{
|
||||
Globals.RemapMultitouchGestureKeycode[i] = settingsFile.readInt();
|
||||
Globals.MultitouchGesturesUsed[i] = settingsFile.readBoolean();
|
||||
}
|
||||
Globals.MultitouchGestureSensitivity = settingsFile.readInt();
|
||||
for( int i = 0; i < Globals.TouchscreenCalibration.length; i++ )
|
||||
Globals.TouchscreenCalibration[i] = settingsFile.readInt();
|
||||
StringBuilder b = new StringBuilder();
|
||||
int len = settingsFile.readInt();
|
||||
for( int i = 0; i < len; i++ )
|
||||
b.append( settingsFile.readChar() );
|
||||
Globals.DataDir = b.toString();
|
||||
|
||||
b = new StringBuilder();
|
||||
len = settingsFile.readInt();
|
||||
for( int i = 0; i < len; i++ )
|
||||
b.append( settingsFile.readChar() );
|
||||
Globals.CommandLine = b.toString();
|
||||
|
||||
int screenKbControlsLayoutSize = settingsFile.readInt();
|
||||
if( screenKbControlsLayoutSize > Globals.ScreenKbControlsLayout.length )
|
||||
throw new IOException();
|
||||
for( int i = 0; i < screenKbControlsLayoutSize; i++ )
|
||||
for( int ii = 0; ii < 4; ii++ )
|
||||
Globals.ScreenKbControlsLayout[i][ii] = settingsFile.readInt();
|
||||
Globals.LeftClickKey = settingsFile.readInt();
|
||||
Globals.RightClickKey = settingsFile.readInt();
|
||||
Globals.VideoLinearFilter = settingsFile.readBoolean();
|
||||
Globals.LeftClickTimeout = settingsFile.readInt();
|
||||
Globals.RightClickTimeout = settingsFile.readInt();
|
||||
Globals.RelativeMouseMovement = settingsFile.readBoolean();
|
||||
Globals.RelativeMouseMovementSpeed = settingsFile.readInt();
|
||||
Globals.RelativeMouseMovementAccel = settingsFile.readInt();
|
||||
Globals.MultiThreadedVideo = settingsFile.readBoolean();
|
||||
|
||||
Globals.OptionalDataDownload = new boolean[settingsFile.readInt()];
|
||||
for(int i = 0; i < Globals.OptionalDataDownload.length; i++)
|
||||
Globals.OptionalDataDownload[i] = settingsFile.readBoolean();
|
||||
settingsFile.readBoolean(); // Unused
|
||||
Globals.TouchscreenKeyboardDrawSize = settingsFile.readInt();
|
||||
settingsAppVersion = settingsFile.readInt();
|
||||
// Gyroscope calibration data, now unused
|
||||
settingsFile.readFloat();
|
||||
settingsFile.readFloat();
|
||||
settingsFile.readFloat();
|
||||
settingsFile.readFloat();
|
||||
settingsFile.readFloat();
|
||||
settingsFile.readFloat();
|
||||
settingsFile.readFloat();
|
||||
settingsFile.readFloat();
|
||||
settingsFile.readFloat();
|
||||
|
||||
Globals.OuyaEmulation = settingsFile.readBoolean();
|
||||
Globals.HoverJitterFilter = settingsFile.readBoolean();
|
||||
Globals.MoveMouseWithGyroscope = settingsFile.readBoolean();
|
||||
Globals.MoveMouseWithGyroscopeSpeed = settingsFile.readInt();
|
||||
Globals.FingerHover = settingsFile.readBoolean();
|
||||
Globals.FloatingScreenJoystick = settingsFile.readBoolean();
|
||||
Globals.GenerateSubframeTouchEvents = settingsFile.readBoolean();
|
||||
Globals.VideoDepthBpp = settingsFile.readInt();
|
||||
Globals.HorizontalOrientation = settingsFile.readBoolean();
|
||||
Globals.ImmersiveMode = settingsFile.readBoolean();
|
||||
Globals.AutoDetectOrientation = settingsFile.readBoolean();
|
||||
Globals.TvBorders = settingsFile.readBoolean();
|
||||
Globals.ForceHardwareMouse = settingsFile.readBoolean();
|
||||
convertButtonSizeFromOldSdlVersion = settingsFile.readBoolean();
|
||||
Globals.DrawInDisplayCutout = settingsFile.readBoolean();
|
||||
|
||||
Log.i("SDL", "libSDL: Settings.LoadConfig(): loaded settings successfully");
|
||||
settingsFile.close();
|
||||
|
||||
return true;
|
||||
|
||||
} catch( FileNotFoundException e ) {
|
||||
Log.i("SDL", "libSDL: settings file not found: " + e);
|
||||
} catch( SecurityException e ) {
|
||||
Log.i("SDL", "libSDL: settings file cannot be opened: " + e);
|
||||
} catch( IOException e ) {
|
||||
Log.i("SDL", "libSDL: settings file cannot be read: " + e);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void ProcessConfig( final MainActivity p )
|
||||
{
|
||||
if( settingsLoaded ) // Prevent starting twice
|
||||
{
|
||||
return;
|
||||
}
|
||||
Log.i("SDL", "libSDL: Settings.Load(): enter");
|
||||
Log.i("SDL", "libSDL: Settings.ProcessConfig(): enter");
|
||||
nativeInitKeymap();
|
||||
for( int i = 0; i < SDL_Keys.JAVA_KEYCODE_LAST; i++ )
|
||||
{
|
||||
@@ -224,12 +374,14 @@ public class Settings
|
||||
}
|
||||
Globals.ScreenKbControlsShown[0] = (Globals.AppNeedsArrowKeys || Globals.AppUsesJoystick);
|
||||
Globals.ScreenKbControlsShown[1] = Globals.AppNeedsTextInput;
|
||||
for( int i = 2; i < Globals.ScreenKbControlsShown.length; i++ )
|
||||
for( int i = 2; i < 8; i++ )
|
||||
Globals.ScreenKbControlsShown[i] = ( i - 2 < Globals.AppTouchscreenKeyboardKeysAmount );
|
||||
if( Globals.AppUsesSecondJoystick )
|
||||
Globals.ScreenKbControlsShown[8] = true;
|
||||
if( Globals.AppUsesThirdJoystick )
|
||||
Globals.ScreenKbControlsShown[9] = true;
|
||||
for( int i = 10; i < Globals.ScreenKbControlsShown.length; i++ )
|
||||
Globals.ScreenKbControlsShown[i] = ( i - 4 < Globals.AppTouchscreenKeyboardKeysAmount );
|
||||
for( int i = 0; i < Globals.RemapMultitouchGestureKeycode.length; i++ )
|
||||
{
|
||||
int sdlKey = nativeGetKeymapKeyMultitouchGesture(i);
|
||||
@@ -270,130 +422,20 @@ public class Settings
|
||||
// ICS update sends events in a proper way
|
||||
Globals.RemapHwKeycode[112] = SDL_1_2_Keycodes.SDLK_UNKNOWN;
|
||||
}
|
||||
convertButtonSizeFromOldSdlVersion = false;
|
||||
|
||||
try {
|
||||
ObjectInputStream settingsFile = new ObjectInputStream(new FileInputStream( p.getFilesDir().getAbsolutePath() + "/" + SettingsFileName ));
|
||||
if( settingsFile.readInt() != SETTINGS_FILE_VERSION )
|
||||
throw new IOException();
|
||||
Globals.DownloadToSdcard = settingsFile.readBoolean();
|
||||
Globals.PhoneHasArrowKeys = settingsFile.readBoolean();
|
||||
settingsFile.readBoolean();
|
||||
Globals.UseAccelerometerAsArrowKeys = settingsFile.readBoolean();
|
||||
Globals.UseTouchscreenKeyboard = settingsFile.readBoolean();
|
||||
Globals.TouchscreenKeyboardSize = settingsFile.readInt();
|
||||
Globals.AccelerometerSensitivity = settingsFile.readInt();
|
||||
Globals.AccelerometerCenterPos = settingsFile.readInt();
|
||||
settingsFile.readInt();
|
||||
Globals.AudioBufferConfig = settingsFile.readInt();
|
||||
Globals.TouchscreenKeyboardTheme = settingsFile.readInt();
|
||||
Globals.RightClickMethod = settingsFile.readInt();
|
||||
Globals.ShowScreenUnderFinger = settingsFile.readInt();
|
||||
Globals.LeftClickMethod = settingsFile.readInt();
|
||||
Globals.MoveMouseWithJoystick = settingsFile.readBoolean();
|
||||
Globals.ClickMouseWithDpad = settingsFile.readBoolean();
|
||||
Globals.ClickScreenPressure = settingsFile.readInt();
|
||||
Globals.ClickScreenTouchspotSize = settingsFile.readInt();
|
||||
Globals.KeepAspectRatio = settingsFile.readBoolean();
|
||||
Globals.MoveMouseWithJoystickSpeed = settingsFile.readInt();
|
||||
Globals.MoveMouseWithJoystickAccel = settingsFile.readInt();
|
||||
int readKeys = settingsFile.readInt();
|
||||
for( int i = 0; i < readKeys; i++ )
|
||||
{
|
||||
Globals.RemapHwKeycode[i] = settingsFile.readInt();
|
||||
}
|
||||
if( settingsFile.readInt() != Globals.RemapScreenKbKeycode.length )
|
||||
throw new IOException();
|
||||
for( int i = 0; i < Globals.RemapScreenKbKeycode.length; i++ )
|
||||
{
|
||||
Globals.RemapScreenKbKeycode[i] = settingsFile.readInt();
|
||||
}
|
||||
if( settingsFile.readInt() != Globals.ScreenKbControlsShown.length )
|
||||
throw new IOException();
|
||||
for( int i = 0; i < Globals.ScreenKbControlsShown.length; i++ )
|
||||
{
|
||||
Globals.ScreenKbControlsShown[i] = settingsFile.readBoolean();
|
||||
}
|
||||
Globals.TouchscreenKeyboardTransparency = settingsFile.readInt();
|
||||
if( settingsFile.readInt() != Globals.RemapMultitouchGestureKeycode.length )
|
||||
throw new IOException();
|
||||
for( int i = 0; i < Globals.RemapMultitouchGestureKeycode.length; i++ )
|
||||
{
|
||||
Globals.RemapMultitouchGestureKeycode[i] = settingsFile.readInt();
|
||||
Globals.MultitouchGesturesUsed[i] = settingsFile.readBoolean();
|
||||
}
|
||||
Globals.MultitouchGestureSensitivity = settingsFile.readInt();
|
||||
for( int i = 0; i < Globals.TouchscreenCalibration.length; i++ )
|
||||
Globals.TouchscreenCalibration[i] = settingsFile.readInt();
|
||||
StringBuilder b = new StringBuilder();
|
||||
int len = settingsFile.readInt();
|
||||
for( int i = 0; i < len; i++ )
|
||||
b.append( settingsFile.readChar() );
|
||||
Globals.DataDir = b.toString();
|
||||
settingsLoaded = LoadConfig(p);
|
||||
|
||||
b = new StringBuilder();
|
||||
len = settingsFile.readInt();
|
||||
for( int i = 0; i < len; i++ )
|
||||
b.append( settingsFile.readChar() );
|
||||
Globals.CommandLine = b.toString();
|
||||
|
||||
if( settingsFile.readInt() != Globals.ScreenKbControlsLayout.length )
|
||||
throw new IOException();
|
||||
for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ )
|
||||
for( int ii = 0; ii < 4; ii++ )
|
||||
Globals.ScreenKbControlsLayout[i][ii] = settingsFile.readInt();
|
||||
Globals.LeftClickKey = settingsFile.readInt();
|
||||
Globals.RightClickKey = settingsFile.readInt();
|
||||
Globals.VideoLinearFilter = settingsFile.readBoolean();
|
||||
Globals.LeftClickTimeout = settingsFile.readInt();
|
||||
Globals.RightClickTimeout = settingsFile.readInt();
|
||||
Globals.RelativeMouseMovement = settingsFile.readBoolean();
|
||||
Globals.RelativeMouseMovementSpeed = settingsFile.readInt();
|
||||
Globals.RelativeMouseMovementAccel = settingsFile.readInt();
|
||||
Globals.MultiThreadedVideo = settingsFile.readBoolean();
|
||||
|
||||
Globals.OptionalDataDownload = new boolean[settingsFile.readInt()];
|
||||
for(int i = 0; i < Globals.OptionalDataDownload.length; i++)
|
||||
Globals.OptionalDataDownload[i] = settingsFile.readBoolean();
|
||||
settingsFile.readBoolean(); // Unused
|
||||
Globals.TouchscreenKeyboardDrawSize = settingsFile.readInt();
|
||||
int cfgVersion = settingsFile.readInt();
|
||||
// Gyroscope calibration data, now unused
|
||||
settingsFile.readFloat();
|
||||
settingsFile.readFloat();
|
||||
settingsFile.readFloat();
|
||||
settingsFile.readFloat();
|
||||
settingsFile.readFloat();
|
||||
settingsFile.readFloat();
|
||||
settingsFile.readFloat();
|
||||
settingsFile.readFloat();
|
||||
settingsFile.readFloat();
|
||||
|
||||
Globals.OuyaEmulation = settingsFile.readBoolean();
|
||||
Globals.HoverJitterFilter = settingsFile.readBoolean();
|
||||
Globals.MoveMouseWithGyroscope = settingsFile.readBoolean();
|
||||
Globals.MoveMouseWithGyroscopeSpeed = settingsFile.readInt();
|
||||
Globals.FingerHover = settingsFile.readBoolean();
|
||||
Globals.FloatingScreenJoystick = settingsFile.readBoolean();
|
||||
Globals.GenerateSubframeTouchEvents = settingsFile.readBoolean();
|
||||
Globals.VideoDepthBpp = settingsFile.readInt();
|
||||
Globals.HorizontalOrientation = settingsFile.readBoolean();
|
||||
Globals.ImmersiveMode = settingsFile.readBoolean();
|
||||
Globals.AutoDetectOrientation = settingsFile.readBoolean();
|
||||
Globals.TvBorders = settingsFile.readBoolean();
|
||||
Globals.ForceHardwareMouse = settingsFile.readBoolean();
|
||||
|
||||
settingsLoaded = true;
|
||||
|
||||
Log.i("SDL", "libSDL: Settings.Load(): loaded settings successfully");
|
||||
settingsFile.close();
|
||||
|
||||
Log.i("SDL", "libSDL: old cfg version " + cfgVersion + ", our version " + p.getApplicationVersion());
|
||||
if( cfgVersion != p.getApplicationVersion() )
|
||||
if (settingsLoaded)
|
||||
{
|
||||
Log.i("SDL", "libSDL: Settings.ProcessConfig(): loaded settings successfully");
|
||||
Log.i("SDL", "libSDL: old app version " + settingsAppVersion + ", new app version " + p.getApplicationVersion());
|
||||
if( settingsAppVersion != p.getApplicationVersion() )
|
||||
{
|
||||
DeleteFilesOnUpgrade(p);
|
||||
if( Globals.ResetSdlConfigForThisVersion )
|
||||
{
|
||||
Log.i("SDL", "libSDL: old cfg version " + cfgVersion + ", our version " + p.getApplicationVersion() + " and we need to clean up config file");
|
||||
Log.i("SDL", "libSDL: old app version " + settingsAppVersion + ", new app version " + p.getApplicationVersion() + " and we need to clean up config file");
|
||||
// Delete settings file, and restart the application
|
||||
DeleteSdlConfigOnUpgradeAndRestart(p);
|
||||
}
|
||||
@@ -401,20 +443,21 @@ public class Settings
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
} catch( FileNotFoundException e ) {
|
||||
Log.i("SDL", "libSDL: settings file not found: " + e);
|
||||
} catch( SecurityException e ) {
|
||||
Log.i("SDL", "libSDL: settings file cannot be opened: " + e);
|
||||
} catch ( IOException e ) {
|
||||
Log.i("SDL", "libSDL: settings file cannot be read: " + e);
|
||||
DeleteFilesOnUpgrade(p);
|
||||
if( Globals.ResetSdlConfigForThisVersion )
|
||||
{
|
||||
Log.i("SDL", "libSDL: old cfg version unknown or too old, our version " + p.getApplicationVersion() + " and we need to clean up config file");
|
||||
DeleteSdlConfigOnUpgradeAndRestart(p);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Log.i("SDL", "libSDL: settings cannot be loaded");
|
||||
DeleteFilesOnUpgrade(p);
|
||||
if (convertButtonSizeFromOldSdlVersion && Globals.TouchscreenKeyboardSize + 1 < Globals.TOUCHSCREEN_KEYBOARD_CUSTOM)
|
||||
{
|
||||
Globals.TouchscreenKeyboardSize ++; // New default button size is bigger, but we are keeping old button size for existing installations
|
||||
//if (Globals.AppTouchscreenKeyboardKeysAmount <= 4 && Globals.TouchscreenKeyboardSize + 1 < Globals.TOUCHSCREEN_KEYBOARD_CUSTOM)
|
||||
// Globals.TouchscreenKeyboardSize ++; // If there are only 4 buttons they are even bigger
|
||||
}
|
||||
if( Globals.ResetSdlConfigForThisVersion && settingsAppVersion != 0 )
|
||||
{
|
||||
Log.i("SDL", "libSDL: old cfg version unknown or too old, our version " + p.getApplicationVersion() + " and we need to clean up config file");
|
||||
DeleteSdlConfigOnUpgradeAndRestart(p);
|
||||
}
|
||||
|
||||
if( Globals.DataDir.length() == 0 )
|
||||
{
|
||||
@@ -593,8 +636,9 @@ public class Settings
|
||||
Globals.TouchscreenKeyboardDrawSize,
|
||||
Globals.TouchscreenKeyboardTheme,
|
||||
Globals.TouchscreenKeyboardTransparency,
|
||||
Globals.FloatingScreenJoystick ? 1 : 0 );
|
||||
SetupTouchscreenKeyboardGraphics(p);
|
||||
Globals.FloatingScreenJoystick ? 1 : 0,
|
||||
Globals.AppTouchscreenKeyboardKeysAmount );
|
||||
DemoGLSurfaceView.SetupTouchscreenKeyboardGraphics(p);
|
||||
for( int i = 0; i < Globals.RemapScreenKbKeycode.length; i++ )
|
||||
nativeSetKeymapKeyScreenKb(i, SDL_Keys.values[Globals.RemapScreenKbKeycode[i]]);
|
||||
if( Globals.TouchscreenKeyboardSize == Globals.TOUCHSCREEN_KEYBOARD_CUSTOM )
|
||||
@@ -629,9 +673,10 @@ public class Settings
|
||||
Log.i("SDL", "libSDL: setting envvar LANGUAGE to '" + lang + "'");
|
||||
nativeSetEnv( "LANG", lang );
|
||||
nativeSetEnv( "LANGUAGE", lang );
|
||||
// TODO: get current user name and set envvar USER, the API is not availalbe on Android 1.6 so I don't bother with this
|
||||
nativeSetEnv( "ARCH", android.os.Build.CPU_ABI );
|
||||
nativeSetEnv( "APPDIR", p.getFilesDir().getAbsolutePath() );
|
||||
nativeSetEnv( "SECURE_STORAGE_DIR", p.getFilesDir().getAbsolutePath() );
|
||||
nativeSetEnv( "LIBDIR", p.getApplicationInfo().nativeLibraryDir );
|
||||
nativeSetEnv( "DATADIR", Globals.DataDir );
|
||||
nativeSetEnv( "UNSECURE_STORAGE_DIR", Globals.DataDir );
|
||||
SdcardAppPath.get().setEnv(p);
|
||||
@@ -646,9 +691,27 @@ public class Settings
|
||||
nativeSetEnv( "ANDROID_PACKAGE_NAME", p.getPackageName() );
|
||||
nativeSetEnv( "ANDROID_PACKAGE_PATH", p.getPackageCodePath() );
|
||||
nativeSetEnv( "ANDROID_MY_OWN_APP_FILE", p.getPackageResourcePath() ); // This may be different from p.getPackageCodePath() on multi-user systems, but should still be the same .apk file
|
||||
nativeSetEnv( "ANDROID_OBB_DIR", Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/obb/" + p.getPackageName() );
|
||||
try {
|
||||
nativeSetEnv( "ANDROID_OBB_DIR", p.getObbDir().getAbsolutePath() );
|
||||
} catch (Exception eeeeeee) {}
|
||||
if( p.ObbMountPath != null )
|
||||
{
|
||||
nativeSetEnv( "ANDROID_OBB_MOUNT_DIR", p.ObbMountPath );
|
||||
}
|
||||
if( p.assetPackPath != null )
|
||||
{
|
||||
nativeSetEnv( "ANDROID_ASSET_PACK_PATH", p.assetPackPath );
|
||||
}
|
||||
try {
|
||||
nativeSetEnv( "ANDROID_APP_NAME", p.getString(p.getApplicationInfo().labelRes) );
|
||||
} catch (Exception eeeeee) {}
|
||||
try {
|
||||
PackageInfo pInfo = p.getPackageManager().getPackageInfo(p.getPackageName(), 0);
|
||||
nativeSetEnv( "ANDROID_PACKAGE_VERSION_NAME", pInfo.versionName );
|
||||
nativeSetEnv( "ANDROID_PACKAGE_VERSION_CODE", String.valueOf(pInfo.versionCode) );
|
||||
} catch (PackageManager.NameNotFoundException eeeeeeee) {
|
||||
}
|
||||
Log.d("SDL", "libSDL: Is running on OUYA: " + p.isRunningOnOUYA());
|
||||
if( p.isRunningOnOUYA() )
|
||||
{
|
||||
@@ -682,63 +745,6 @@ public class Settings
|
||||
} catch (Exception eeeee) {}
|
||||
}
|
||||
|
||||
static byte [] loadRaw(Activity p, int res)
|
||||
{
|
||||
byte [] buf = new byte[65536 * 2];
|
||||
byte [] a = new byte[1048576 * 5]; // We need 5Mb buffer for Keen theme, and this Java code is inefficient
|
||||
int written = 0;
|
||||
try{
|
||||
InputStream is = new GZIPInputStream(p.getResources().openRawResource(res));
|
||||
int readed = 0;
|
||||
while( (readed = is.read(buf)) >= 0 )
|
||||
{
|
||||
if( written + readed > a.length )
|
||||
{
|
||||
byte [] b = new byte [written + readed];
|
||||
System.arraycopy(a, 0, b, 0, written);
|
||||
a = b;
|
||||
}
|
||||
System.arraycopy(buf, 0, a, written, readed);
|
||||
written += readed;
|
||||
}
|
||||
} catch(Exception e) {};
|
||||
byte [] b = new byte [written];
|
||||
System.arraycopy(a, 0, b, 0, written);
|
||||
return b;
|
||||
}
|
||||
|
||||
static void SetupTouchscreenKeyboardGraphics(Activity p)
|
||||
{
|
||||
if( Globals.UseTouchscreenKeyboard )
|
||||
{
|
||||
if(Globals.TouchscreenKeyboardTheme < 0)
|
||||
Globals.TouchscreenKeyboardTheme = 0;
|
||||
if(Globals.TouchscreenKeyboardTheme > 9)
|
||||
Globals.TouchscreenKeyboardTheme = 9;
|
||||
|
||||
if( Globals.TouchscreenKeyboardTheme == 0 )
|
||||
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.ultimatedroid));
|
||||
if( Globals.TouchscreenKeyboardTheme == 1 )
|
||||
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.simpletheme));
|
||||
if( Globals.TouchscreenKeyboardTheme == 2 )
|
||||
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.sun));
|
||||
if( Globals.TouchscreenKeyboardTheme == 3 )
|
||||
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.keen));
|
||||
if( Globals.TouchscreenKeyboardTheme == 4 )
|
||||
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.retro));
|
||||
if( Globals.TouchscreenKeyboardTheme == 5 )
|
||||
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.gba));
|
||||
if( Globals.TouchscreenKeyboardTheme == 6 )
|
||||
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.psx));
|
||||
if( Globals.TouchscreenKeyboardTheme == 7 )
|
||||
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.snes));
|
||||
if( Globals.TouchscreenKeyboardTheme == 8 )
|
||||
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.dualshock));
|
||||
if( Globals.TouchscreenKeyboardTheme == 9 )
|
||||
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.n64));
|
||||
}
|
||||
}
|
||||
|
||||
abstract static class SdcardAppPath
|
||||
{
|
||||
public static SdcardAppPath get()
|
||||
@@ -947,6 +953,7 @@ public class Settings
|
||||
Save(MainActivity.instance);
|
||||
}
|
||||
|
||||
// libsdl-1.2.so, does not exist in SDL2
|
||||
private static native void nativeSetAccelerometerSettings(int sensitivity, int centerPos);
|
||||
private static native void nativeSetMouseUsed(int RightClickMethod, int ShowScreenUnderFinger, int LeftClickMethod,
|
||||
int MoveMouseWithJoystick, int ClickMouseWithDpad, int MaxForce, int MaxRadius,
|
||||
@@ -958,7 +965,7 @@ public class Settings
|
||||
int HoverJitterFilter, int RightMouseButtonLongPress,
|
||||
int MoveMouseWithGyroscope, int MoveMouseWithGyroscopeSpeed,
|
||||
int ForceScreenUpdateMouseClick, int ScreenFollowsMouse);
|
||||
private static native void nativeSetJoystickUsed(int amount);
|
||||
public static native void nativeSetJoystickUsed(int amount);
|
||||
private static native void nativeSetAccelerometerUsed();
|
||||
private static native void nativeSetMultitouchUsed();
|
||||
private static native void nativeSetTouchscreenKeyboardUsed();
|
||||
@@ -967,8 +974,8 @@ public class Settings
|
||||
private static native void nativeSetCompatibilityHacks();
|
||||
private static native void nativeSetVideoMultithreaded();
|
||||
private static native void nativeSetVideoForceSoftwareMode();
|
||||
private static native void nativeSetupScreenKeyboard(int size, int drawsize, int theme, int transparency, int floatingScreenJoystick);
|
||||
private static native void nativeSetupScreenKeyboardButtons(byte[] img);
|
||||
public static native void nativeSetupScreenKeyboard(int size, int drawsize, int theme, int transparency, int floatingScreenJoystick, int buttonAmount);
|
||||
public static native void nativeSetupScreenKeyboardButtons(byte[] img);
|
||||
private static native void nativeInitKeymap();
|
||||
private static native int nativeGetKeymapKey(int key);
|
||||
private static native void nativeSetKeymapKey(int javakey, int key);
|
||||
@@ -976,10 +983,12 @@ public class Settings
|
||||
private static native void nativeSetKeymapKeyScreenKb(int keynum, int key);
|
||||
private static native void nativeSetScreenKbKeyUsed(int keynum, int used);
|
||||
private static native void nativeSetScreenKbKeyLayout(int keynum, int x1, int y1, int x2, int y2);
|
||||
public static native int nativeGetScreenKeyboardButtonLayout(int button, int coord);
|
||||
private static native int nativeGetKeymapKeyMultitouchGesture(int keynum);
|
||||
private static native void nativeSetKeymapKeyMultitouchGesture(int keynum, int key);
|
||||
private static native void nativeSetMultitouchGestureSensitivity(int sensitivity);
|
||||
private static native void nativeSetTouchscreenCalibration(int x1, int y1, int x2, int y2);
|
||||
public static native void nativeSetTouchscreenCalibration(int x1, int y1, int x2, int y2);
|
||||
// libsdl_native_helpers.so, exists in both versions
|
||||
public static native void nativeSetEnv(final String name, final String value);
|
||||
public static native int nativeChmod(final String name, int mode);
|
||||
public static native void nativeChdir(final String dir);
|
||||
|
||||
@@ -248,6 +248,7 @@ class SettingsMenu
|
||||
new SettingsMenuKeyboard.ScreenGesturesConfig(),
|
||||
new SettingsMenuMisc.VideoSettingsConfig(),
|
||||
new SettingsMenuMisc.CommandlineConfig(),
|
||||
new SettingsMenuMisc.StorageAccessConfig(),
|
||||
new SettingsMenuMisc.ResetToDefaultsConfig(),
|
||||
new OkButton(),
|
||||
};
|
||||
|
||||
@@ -57,6 +57,7 @@ import android.widget.EditText;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.Button;
|
||||
import android.view.View;
|
||||
import android.view.Gravity;
|
||||
import android.widget.LinearLayout;
|
||||
import android.text.Editable;
|
||||
import android.text.SpannedString;
|
||||
@@ -276,10 +277,10 @@ class SettingsMenuKeyboard extends SettingsMenu
|
||||
void run (final MainActivity p)
|
||||
{
|
||||
p.setText(p.getResources().getString(R.string.remap_hwkeys_press));
|
||||
p.keyListener = new KeyRemapTool(p);
|
||||
p.getVideoLayout().setOnKeyListener(new KeyRemapTool(p));
|
||||
}
|
||||
|
||||
public static class KeyRemapTool implements MainActivity.KeyEventsListener
|
||||
public static class KeyRemapTool implements View.OnKeyListener
|
||||
{
|
||||
MainActivity p;
|
||||
public KeyRemapTool(MainActivity _p)
|
||||
@@ -287,9 +288,10 @@ class SettingsMenuKeyboard extends SettingsMenu
|
||||
p = _p;
|
||||
}
|
||||
|
||||
public void onKeyEvent(final int keyCode)
|
||||
@Override
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event)
|
||||
{
|
||||
p.keyListener = null;
|
||||
p.getVideoLayout().setOnKeyListener(null);
|
||||
int keyIndex = keyCode;
|
||||
if( keyIndex < 0 )
|
||||
keyIndex = 0;
|
||||
@@ -336,6 +338,7 @@ class SettingsMenuKeyboard extends SettingsMenu
|
||||
AlertDialog alert = builder.create();
|
||||
alert.setOwnerActivity(p);
|
||||
alert.show();
|
||||
return true;
|
||||
}
|
||||
public void ShowAllKeys(final int KeyIndex)
|
||||
{
|
||||
@@ -383,26 +386,22 @@ class SettingsMenuKeyboard extends SettingsMenu
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 4",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 5",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 6",
|
||||
p.getResources().getString(R.string.remap_screenkb_joystick) + " 2",
|
||||
p.getResources().getString(R.string.remap_screenkb_joystick) + " 3",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 7",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 8",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 9",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 10",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 11",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 12",
|
||||
};
|
||||
|
||||
boolean defaults[] = Arrays.copyOf(Globals.ScreenKbControlsShown, Globals.ScreenKbControlsShown.length);
|
||||
if( Globals.AppUsesSecondJoystick )
|
||||
{
|
||||
items = Arrays.copyOf(items, items.length + 1);
|
||||
items[items.length - 1] = p.getResources().getString(R.string.remap_screenkb_joystick) + " 2";
|
||||
defaults = Arrays.copyOf(defaults, defaults.length + 1);
|
||||
defaults[defaults.length - 1] = true;
|
||||
}
|
||||
if( Globals.AppUsesThirdJoystick )
|
||||
{
|
||||
items = Arrays.copyOf(items, items.length + 1);
|
||||
items[items.length - 1] = p.getResources().getString(R.string.remap_screenkb_joystick) + " 3";
|
||||
defaults = Arrays.copyOf(defaults, defaults.length + 1);
|
||||
defaults[defaults.length - 1] = true;
|
||||
}
|
||||
|
||||
for( int i = 0; i < Math.min(6, Globals.AppTouchscreenKeyboardKeysNames.length); i++ )
|
||||
items[i+2] = items[i+2] + " - " + Globals.AppTouchscreenKeyboardKeysNames[i].replace("_", " ");
|
||||
for( int i = 6; i < Math.min(12, Globals.AppTouchscreenKeyboardKeysNames.length); i++ )
|
||||
items[i+4] = items[i+4] + " - " + Globals.AppTouchscreenKeyboardKeysNames[i].replace("_", " ");
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(p);
|
||||
builder.setTitle(p.getResources().getString(R.string.remap_screenkb));
|
||||
@@ -442,9 +441,15 @@ class SettingsMenuKeyboard extends SettingsMenu
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 4",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 5",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 6",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 7",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 8",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 9",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 10",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 11",
|
||||
p.getResources().getString(R.string.remap_screenkb_button) + " 12",
|
||||
};
|
||||
|
||||
for( int i = 0; i < Math.min(6, Globals.AppTouchscreenKeyboardKeysNames.length); i++ )
|
||||
for( int i = 0; i < Math.min(12, Globals.AppTouchscreenKeyboardKeysNames.length); i++ )
|
||||
items[i] = items[i] + " - " + Globals.AppTouchscreenKeyboardKeysNames[i].replace("_", " ");
|
||||
|
||||
if( currentButton >= Globals.RemapScreenKbKeycode.length )
|
||||
@@ -452,7 +457,12 @@ class SettingsMenuKeyboard extends SettingsMenu
|
||||
goBack(p);
|
||||
return;
|
||||
}
|
||||
if( ! Globals.ScreenKbControlsShown[currentButton + 2] )
|
||||
if( currentButton < 6 && ! Globals.ScreenKbControlsShown[currentButton + 2] )
|
||||
{
|
||||
showRemapScreenKbConfig2(p, currentButton + 1);
|
||||
return;
|
||||
}
|
||||
if( currentButton >= 6 && ! Globals.ScreenKbControlsShown[currentButton + 4] )
|
||||
{
|
||||
showRemapScreenKbConfig2(p, currentButton + 1);
|
||||
return;
|
||||
@@ -623,13 +633,19 @@ class SettingsMenuKeyboard extends SettingsMenu
|
||||
void run (final MainActivity p)
|
||||
{
|
||||
p.setText(p.getResources().getString(R.string.screenkb_custom_layout_help));
|
||||
CustomizeScreenKbLayoutTool tool = new CustomizeScreenKbLayoutTool(p);
|
||||
p.touchListener = tool;
|
||||
p.keyListener = tool;
|
||||
Globals.TouchscreenKeyboardSize = Globals.TOUCHSCREEN_KEYBOARD_CUSTOM;
|
||||
if (Globals.ImmersiveMode)
|
||||
DimSystemStatusBar.dim(p.getVideoLayout(), p.getWindow());
|
||||
p.getVideoLayout().getHandler().postDelayed(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
CustomizeScreenKbLayoutTool tool = new CustomizeScreenKbLayoutTool(p);
|
||||
Globals.TouchscreenKeyboardSize = Globals.TOUCHSCREEN_KEYBOARD_CUSTOM;
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
|
||||
static class CustomizeScreenKbLayoutTool implements MainActivity.TouchEventsListener, MainActivity.KeyEventsListener
|
||||
static class CustomizeScreenKbLayoutTool implements View.OnTouchListener, View.OnKeyListener
|
||||
{
|
||||
MainActivity p;
|
||||
FrameLayout layout = null;
|
||||
@@ -648,16 +664,33 @@ class SettingsMenuKeyboard extends SettingsMenu
|
||||
R.drawable.b5,
|
||||
R.drawable.b6,
|
||||
R.drawable.dpad,
|
||||
R.drawable.dpad
|
||||
R.drawable.dpad,
|
||||
R.drawable.b1,
|
||||
R.drawable.b2,
|
||||
R.drawable.b3,
|
||||
R.drawable.b4,
|
||||
R.drawable.b5,
|
||||
R.drawable.b6,
|
||||
};
|
||||
int oldX = 0, oldY = 0;
|
||||
boolean resizing = false;
|
||||
|
||||
|
||||
public CustomizeScreenKbLayoutTool(MainActivity _p)
|
||||
{
|
||||
if( buttons.length != Globals.ScreenKbControlsLayout.length )
|
||||
{
|
||||
Log.i("SDL", "Assertion failed: buttons.length != Globals.ScreenKbControlsLayout.length" );
|
||||
throw new RuntimeException("Assertion failed: buttons.length != Globals.ScreenKbControlsLayout.length");
|
||||
}
|
||||
|
||||
p = _p;
|
||||
layout = new FrameLayout(p);
|
||||
p.getVideoLayout().addView(layout);
|
||||
layout.setFocusable(true);
|
||||
layout.setFocusableInTouchMode(true);
|
||||
layout.requestFocus();
|
||||
layout.setOnTouchListener(this);
|
||||
layout.setOnKeyListener(this);
|
||||
boundary = new ImageView(p);
|
||||
boundary.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
|
||||
boundary.setScaleType(ImageView.ScaleType.MATRIX);
|
||||
@@ -665,30 +698,28 @@ class SettingsMenuKeyboard extends SettingsMenu
|
||||
boundary.setImageBitmap(boundaryBmp);
|
||||
layout.addView(boundary);
|
||||
currentButton = -1;
|
||||
if( Globals.TouchscreenKeyboardTheme == 2 )
|
||||
{
|
||||
buttons = new int[] {
|
||||
R.drawable.sun_dpad,
|
||||
R.drawable.sun_keyboard,
|
||||
R.drawable.sun_b1,
|
||||
R.drawable.sun_b2,
|
||||
R.drawable.sun_b3,
|
||||
R.drawable.sun_b4,
|
||||
R.drawable.sun_b5,
|
||||
R.drawable.sun_b6,
|
||||
R.drawable.sun_dpad,
|
||||
R.drawable.sun_dpad
|
||||
};
|
||||
}
|
||||
|
||||
int displayX = 800;
|
||||
int displayY = 480;
|
||||
try {
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
p.getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
displayX = dm.widthPixels;
|
||||
displayY = dm.heightPixels;
|
||||
} catch (Exception eeeee) {}
|
||||
final int displayX = p.getVideoLayout().getWidth();
|
||||
final int displayY = p.getVideoLayout().getHeight();
|
||||
|
||||
if( Globals.TouchscreenKeyboardSize != Globals.TOUCHSCREEN_KEYBOARD_CUSTOM )
|
||||
{
|
||||
DemoRenderer.nativeResize(displayX, displayY, 0);
|
||||
Settings.nativeSetJoystickUsed( Globals.AppUsesThirdJoystick ? 3 : (Globals.AppUsesSecondJoystick ? 2 : (Globals.AppUsesJoystick ? 1 : 0)) );
|
||||
Settings.nativeSetupScreenKeyboard( Globals.TouchscreenKeyboardSize,
|
||||
Globals.TouchscreenKeyboardDrawSize,
|
||||
Globals.TouchscreenKeyboardTheme,
|
||||
Globals.TouchscreenKeyboardTransparency,
|
||||
Globals.FloatingScreenJoystick ? 1 : 0,
|
||||
Globals.AppTouchscreenKeyboardKeysAmount );
|
||||
for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ )
|
||||
{
|
||||
Globals.ScreenKbControlsLayout[i][0] = Settings.nativeGetScreenKeyboardButtonLayout(i, 0);
|
||||
Globals.ScreenKbControlsLayout[i][1] = Settings.nativeGetScreenKeyboardButtonLayout(i, 1);
|
||||
Globals.ScreenKbControlsLayout[i][2] = Settings.nativeGetScreenKeyboardButtonLayout(i, 2);
|
||||
Globals.ScreenKbControlsLayout[i][3] = Settings.nativeGetScreenKeyboardButtonLayout(i, 3);
|
||||
}
|
||||
}
|
||||
|
||||
for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ )
|
||||
{
|
||||
@@ -696,37 +727,7 @@ class SettingsMenuKeyboard extends SettingsMenu
|
||||
continue;
|
||||
if( currentButton == -1 )
|
||||
currentButton = i;
|
||||
//Log.i("SDL", "Screen kb button " + i + " coords " + Globals.ScreenKbControlsLayout[i][0] + ":" + Globals.ScreenKbControlsLayout[i][1] + ":" + Globals.ScreenKbControlsLayout[i][2] + ":" + Globals.ScreenKbControlsLayout[i][3] );
|
||||
// Check if the button is off screen edge or shrunk to zero
|
||||
if( Globals.ScreenKbControlsLayout[i][0] > Globals.ScreenKbControlsLayout[i][2] - displayY/12 )
|
||||
Globals.ScreenKbControlsLayout[i][0] = Globals.ScreenKbControlsLayout[i][2] - displayY/12;
|
||||
if( Globals.ScreenKbControlsLayout[i][1] > Globals.ScreenKbControlsLayout[i][3] - displayY/12 )
|
||||
Globals.ScreenKbControlsLayout[i][1] = Globals.ScreenKbControlsLayout[i][3] - displayY/12;
|
||||
if( Globals.ScreenKbControlsLayout[i][0] < Globals.ScreenKbControlsLayout[i][2] - displayY*2/3 )
|
||||
Globals.ScreenKbControlsLayout[i][0] = Globals.ScreenKbControlsLayout[i][2] - displayY*2/3;
|
||||
if( Globals.ScreenKbControlsLayout[i][1] < Globals.ScreenKbControlsLayout[i][3] - displayY*2/3 )
|
||||
Globals.ScreenKbControlsLayout[i][1] = Globals.ScreenKbControlsLayout[i][3] - displayY*2/3;
|
||||
if( Globals.ScreenKbControlsLayout[i][0] < 0 )
|
||||
{
|
||||
Globals.ScreenKbControlsLayout[i][2] += -Globals.ScreenKbControlsLayout[i][0];
|
||||
Globals.ScreenKbControlsLayout[i][0] = 0;
|
||||
}
|
||||
if( Globals.ScreenKbControlsLayout[i][2] > displayX )
|
||||
{
|
||||
Globals.ScreenKbControlsLayout[i][0] -= Globals.ScreenKbControlsLayout[i][2] - displayX;
|
||||
Globals.ScreenKbControlsLayout[i][2] = displayX;
|
||||
}
|
||||
if( Globals.ScreenKbControlsLayout[i][1] < 0 )
|
||||
{
|
||||
Globals.ScreenKbControlsLayout[i][3] += -Globals.ScreenKbControlsLayout[i][1];
|
||||
Globals.ScreenKbControlsLayout[i][1] = 0;
|
||||
}
|
||||
if( Globals.ScreenKbControlsLayout[i][3] > displayY )
|
||||
{
|
||||
Globals.ScreenKbControlsLayout[i][1] -= Globals.ScreenKbControlsLayout[i][3] - displayY;
|
||||
Globals.ScreenKbControlsLayout[i][3] = displayY;
|
||||
}
|
||||
//Log.i("SDL", "After bounds check coords " + Globals.ScreenKbControlsLayout[i][0] + ":" + Globals.ScreenKbControlsLayout[i][1] + ":" + Globals.ScreenKbControlsLayout[i][2] + ":" + Globals.ScreenKbControlsLayout[i][3] );
|
||||
Log.i("SDL", "Screen kb button " + i + " coords " + Globals.ScreenKbControlsLayout[i][0] + ":" + Globals.ScreenKbControlsLayout[i][1] + ":" + Globals.ScreenKbControlsLayout[i][2] + ":" + Globals.ScreenKbControlsLayout[i][3] );
|
||||
|
||||
imgs[i] = new ImageView(p);
|
||||
imgs[i].setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
|
||||
@@ -744,9 +745,34 @@ class SettingsMenuKeyboard extends SettingsMenu
|
||||
}
|
||||
boundary.bringToFront();
|
||||
if( currentButton == -1 )
|
||||
onKeyEvent( KeyEvent.KEYCODE_BACK ); // All buttons disabled - do not show anything
|
||||
onKey( null, KeyEvent.KEYCODE_BACK, null ); // All buttons disabled - do not show anything
|
||||
else
|
||||
setupButton(currentButton);
|
||||
|
||||
final Button backButton = new Button(p);
|
||||
backButton.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
backButton.setText(android.R.string.ok);
|
||||
//backButton.setTop(displayY / 30);
|
||||
//backButton.setLeft(displayX / 2);
|
||||
backButton.setOnClickListener(new View.OnClickListener()
|
||||
{
|
||||
public void onClick(View v)
|
||||
{
|
||||
p.getVideoLayout().removeView(layout);
|
||||
layout = null;
|
||||
goBack(p);
|
||||
}
|
||||
});
|
||||
layout.addView(backButton, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
Gravity.TOP | Gravity.CENTER_HORIZONTAL));
|
||||
layout.getHandler().postDelayed(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
//backButton.setLeft(displayX / 2 - backButton.getWidth() / 2);
|
||||
//backButton.setLeft(displayX / 2);
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
|
||||
void setupButton(int i)
|
||||
@@ -774,10 +800,15 @@ class SettingsMenuKeyboard extends SettingsMenu
|
||||
buttonText = "Joystick 2";
|
||||
if( i == 9 )
|
||||
buttonText = "Joystick 3";
|
||||
if( i >= 10 && i <= 15 )
|
||||
buttonText = p.getResources().getString(R.string.remap_screenkb_button) + (i - 4);
|
||||
if( i >= 10 && i - 4 < Globals.AppTouchscreenKeyboardKeysNames.length )
|
||||
buttonText = Globals.AppTouchscreenKeyboardKeysNames[i - 4].replace("_", " ");
|
||||
p.setText(p.getResources().getString(R.string.screenkb_custom_layout_help) + "\n" + buttonText);
|
||||
}
|
||||
|
||||
public void onTouchEvent(final MotionEvent ev)
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent ev)
|
||||
{
|
||||
if( ev.getAction() == MotionEvent.ACTION_DOWN )
|
||||
{
|
||||
@@ -842,18 +873,19 @@ class SettingsMenuKeyboard extends SettingsMenu
|
||||
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
|
||||
boundary.setImageMatrix(m);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void onKeyEvent(final int keyCode)
|
||||
@Override
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event)
|
||||
{
|
||||
if( keyCode == KeyEvent.KEYCODE_BACK )
|
||||
{
|
||||
p.getVideoLayout().removeView(layout);
|
||||
layout = null;
|
||||
p.touchListener = null;
|
||||
p.keyListener = null;
|
||||
goBack(p);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -871,7 +903,7 @@ class SettingsMenuKeyboard extends SettingsMenu
|
||||
p.getResources().getString(R.string.screenkb_floating_joystick),
|
||||
};
|
||||
|
||||
boolean defaults[] = {
|
||||
boolean defaults[] = {
|
||||
Globals.FloatingScreenJoystick,
|
||||
};
|
||||
|
||||
|
||||
@@ -324,6 +324,7 @@ class SettingsMenuMisc extends SettingsMenu
|
||||
p.getResources().getString(R.string.mouse_keepaspectratio),
|
||||
p.getResources().getString(R.string.video_smooth),
|
||||
p.getResources().getString(R.string.video_immersive),
|
||||
p.getResources().getString(R.string.video_draw_cutout),
|
||||
p.getResources().getString(R.string.video_orientation_autodetect),
|
||||
p.getResources().getString(R.string.video_orientation_vertical),
|
||||
p.getResources().getString(R.string.video_bpp_24),
|
||||
@@ -333,6 +334,7 @@ class SettingsMenuMisc extends SettingsMenu
|
||||
Globals.KeepAspectRatio,
|
||||
Globals.VideoLinearFilter,
|
||||
Globals.ImmersiveMode,
|
||||
Globals.DrawInDisplayCutout,
|
||||
Globals.AutoDetectOrientation,
|
||||
!Globals.HorizontalOrientation,
|
||||
Globals.VideoDepthBpp == 24,
|
||||
@@ -345,6 +347,7 @@ class SettingsMenuMisc extends SettingsMenu
|
||||
p.getResources().getString(R.string.mouse_keepaspectratio),
|
||||
p.getResources().getString(R.string.video_smooth),
|
||||
p.getResources().getString(R.string.video_immersive),
|
||||
p.getResources().getString(R.string.video_draw_cutout),
|
||||
p.getResources().getString(R.string.video_orientation_autodetect),
|
||||
p.getResources().getString(R.string.video_orientation_vertical),
|
||||
p.getResources().getString(R.string.video_bpp_24),
|
||||
@@ -355,6 +358,7 @@ class SettingsMenuMisc extends SettingsMenu
|
||||
Globals.KeepAspectRatio,
|
||||
Globals.VideoLinearFilter,
|
||||
Globals.ImmersiveMode,
|
||||
Globals.DrawInDisplayCutout,
|
||||
Globals.AutoDetectOrientation,
|
||||
!Globals.HorizontalOrientation,
|
||||
Globals.VideoDepthBpp == 24,
|
||||
@@ -365,7 +369,7 @@ class SettingsMenuMisc extends SettingsMenu
|
||||
defaults = defaults2;
|
||||
}
|
||||
|
||||
if(Globals.Using_SDL_1_3)
|
||||
if(Globals.UsingSDL2)
|
||||
{
|
||||
CharSequence[] items2 = {
|
||||
p.getResources().getString(R.string.mouse_keepaspectratio),
|
||||
@@ -390,14 +394,16 @@ class SettingsMenuMisc extends SettingsMenu
|
||||
if( item == 2 )
|
||||
Globals.ImmersiveMode = isChecked;
|
||||
if( item == 3 )
|
||||
Globals.AutoDetectOrientation = isChecked;
|
||||
Globals.DrawInDisplayCutout = isChecked;
|
||||
if( item == 4 )
|
||||
Globals.HorizontalOrientation = !isChecked;
|
||||
Globals.AutoDetectOrientation = isChecked;
|
||||
if( item == 5 )
|
||||
Globals.VideoDepthBpp = (isChecked ? 24 : 16);
|
||||
Globals.HorizontalOrientation = !isChecked;
|
||||
if( item == 6 )
|
||||
Globals.TvBorders = isChecked;
|
||||
Globals.VideoDepthBpp = (isChecked ? 24 : 16);
|
||||
if( item == 7 )
|
||||
Globals.TvBorders = isChecked;
|
||||
if( item == 8 )
|
||||
Globals.MultiThreadedVideo = isChecked;
|
||||
}
|
||||
});
|
||||
@@ -437,7 +443,7 @@ class SettingsMenuMisc extends SettingsMenu
|
||||
String readmes[] = Globals.ReadmeText.split("\\^");
|
||||
String lang = new String(Locale.getDefault().getLanguage()) + ":";
|
||||
if( p.isRunningOnOUYA() )
|
||||
lang = "ouya:";
|
||||
lang = "tv:";
|
||||
String readme = readmes[0];
|
||||
String buttonName = "", buttonUrl = "";
|
||||
for( String r: readmes )
|
||||
@@ -469,10 +475,14 @@ class SettingsMenuMisc extends SettingsMenu
|
||||
text.setPadding(0, 5, 0, 20);
|
||||
text.setTextSize(20.0f);
|
||||
text.setGravity(Gravity.CENTER);
|
||||
text.setFocusable(false);
|
||||
text.setFocusableInTouchMode(false);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(p);
|
||||
ScrollView scroll = new ScrollView(p);
|
||||
scroll.setFocusable(false);
|
||||
scroll.setFocusableInTouchMode(false);
|
||||
scroll.addView(text, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
Button ok = new Button(p);
|
||||
final Button ok = new Button(p);
|
||||
final AlertDialog alertDismiss[] = new AlertDialog[1];
|
||||
ok.setOnClickListener(new View.OnClickListener()
|
||||
{
|
||||
@@ -485,7 +495,6 @@ class SettingsMenuMisc extends SettingsMenu
|
||||
LinearLayout layout = new LinearLayout(p);
|
||||
layout.setOrientation(LinearLayout.VERTICAL);
|
||||
layout.addView(scroll);
|
||||
//layout.addView(text);
|
||||
layout.addView(ok);
|
||||
if( buttonName.length() > 0 )
|
||||
{
|
||||
@@ -539,6 +548,42 @@ class SettingsMenuMisc extends SettingsMenu
|
||||
}
|
||||
}
|
||||
|
||||
public static class StorageAccessConfig extends Menu
|
||||
{
|
||||
public static int REQUEST_STORAGE_ID = 42;
|
||||
|
||||
public static void onActivityResult(final MainActivity p, final int requestCode, final int resultCode, final Intent resultData)
|
||||
{
|
||||
if (requestCode == REQUEST_STORAGE_ID)
|
||||
{
|
||||
if (resultCode == Activity.RESULT_OK)
|
||||
{
|
||||
Uri treeUri = resultData.getData();
|
||||
p.getContentResolver().takePersistableUriPermission(treeUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
||||
Log.i("SDL", "Storage write permission granted to path " + treeUri.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.i("SDL", "Storage write permission rejected");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String title(final MainActivity p)
|
||||
{
|
||||
return p.getResources().getString(R.string.storage_access);
|
||||
}
|
||||
void run (final MainActivity p)
|
||||
{
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP)
|
||||
{
|
||||
p.startActivityForResult(new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE), REQUEST_STORAGE_ID);
|
||||
}
|
||||
|
||||
goBack(p);
|
||||
}
|
||||
}
|
||||
|
||||
static class CommandlineConfig extends Menu
|
||||
{
|
||||
String title(final MainActivity p)
|
||||
@@ -554,12 +599,10 @@ class SettingsMenuMisc extends SettingsMenu
|
||||
edit.setFocusableInTouchMode(true);
|
||||
edit.setFocusable(true);
|
||||
if (Globals.CommandLine.length() == 0)
|
||||
Globals.CommandLine = "SDL_app";
|
||||
if (Globals.CommandLine.indexOf(" ") == -1)
|
||||
Globals.CommandLine += " ";
|
||||
edit.setText(Globals.CommandLine.substring(Globals.CommandLine.indexOf(" ")).replace(" ", "\n").replace(" ", " "));
|
||||
Globals.CommandLine = "App";
|
||||
edit.setText(Globals.CommandLine.replace(" ", "\n").replace(" ", " "));
|
||||
edit.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
||||
edit.setMinLines(2);
|
||||
edit.setMinLines(1);
|
||||
//edit.setMaxLines(100);
|
||||
builder.setView(edit);
|
||||
|
||||
@@ -567,17 +610,22 @@ class SettingsMenuMisc extends SettingsMenu
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int item)
|
||||
{
|
||||
Globals.CommandLine = "SDL_app";
|
||||
Globals.CommandLine = "";
|
||||
String args[] = edit.getText().toString().split("\n");
|
||||
boolean firstArg = true;
|
||||
for( String arg: args )
|
||||
if( args.length == 1 )
|
||||
{
|
||||
Globals.CommandLine += " ";
|
||||
if( firstArg )
|
||||
Globals.CommandLine += arg;
|
||||
else
|
||||
Globals.CommandLine = args[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean firstArg = true;
|
||||
for( String arg: args )
|
||||
{
|
||||
if( !firstArg )
|
||||
Globals.CommandLine += " ";
|
||||
Globals.CommandLine += arg.replace(" ", " ");
|
||||
firstArg = false;
|
||||
firstArg = false;
|
||||
}
|
||||
}
|
||||
dialog.dismiss();
|
||||
goBack(p);
|
||||
|
||||
@@ -267,7 +267,7 @@ class SettingsMenuMouse extends SettingsMenu
|
||||
dialog.dismiss();
|
||||
Globals.LeftClickMethod = item;
|
||||
if( item == Mouse.LEFT_CLICK_WITH_KEY )
|
||||
p.keyListener = new KeyRemapToolMouseClick(p, true);
|
||||
p.getVideoLayout().setOnKeyListener(new KeyRemapToolMouseClick(p, true));
|
||||
else if( item == Mouse.LEFT_CLICK_WITH_TIMEOUT || item == Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT )
|
||||
showLeftClickTimeoutConfig(p);
|
||||
else
|
||||
@@ -343,7 +343,7 @@ class SettingsMenuMouse extends SettingsMenu
|
||||
Globals.RightClickMethod = item;
|
||||
dialog.dismiss();
|
||||
if( item == Mouse.RIGHT_CLICK_WITH_KEY )
|
||||
p.keyListener = new KeyRemapToolMouseClick(p, false);
|
||||
p.getVideoLayout().setOnKeyListener(new KeyRemapToolMouseClick(p, false));
|
||||
else if( item == Mouse.RIGHT_CLICK_WITH_TIMEOUT )
|
||||
showRightClickTimeoutConfig(p);
|
||||
else
|
||||
@@ -393,7 +393,7 @@ class SettingsMenuMouse extends SettingsMenu
|
||||
}
|
||||
}
|
||||
|
||||
public static class KeyRemapToolMouseClick implements MainActivity.KeyEventsListener
|
||||
public static class KeyRemapToolMouseClick implements View.OnKeyListener
|
||||
{
|
||||
MainActivity p;
|
||||
boolean leftClick;
|
||||
@@ -404,9 +404,10 @@ class SettingsMenuMouse extends SettingsMenu
|
||||
this.leftClick = leftClick;
|
||||
}
|
||||
|
||||
public void onKeyEvent(final int keyCode)
|
||||
@Override
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event)
|
||||
{
|
||||
p.keyListener = null;
|
||||
p.getVideoLayout().setOnKeyListener(null);
|
||||
int keyIndex = keyCode;
|
||||
if( keyIndex < 0 )
|
||||
keyIndex = 0;
|
||||
@@ -419,6 +420,7 @@ class SettingsMenuMouse extends SettingsMenu
|
||||
Globals.RightClickKey = keyIndex;
|
||||
|
||||
goBack(p);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -686,10 +688,10 @@ class SettingsMenuMouse extends SettingsMenu
|
||||
void run (final MainActivity p)
|
||||
{
|
||||
p.setText(p.getResources().getString(R.string.measurepressure_touchplease));
|
||||
p.touchListener = new TouchMeasurementTool(p);
|
||||
p.getVideoLayout().setOnTouchListener(new TouchMeasurementTool(p));
|
||||
}
|
||||
|
||||
public static class TouchMeasurementTool implements MainActivity.TouchEventsListener
|
||||
public static class TouchMeasurementTool implements View.OnTouchListener
|
||||
{
|
||||
MainActivity p;
|
||||
ArrayList<Integer> force = new ArrayList<Integer>();
|
||||
@@ -701,7 +703,8 @@ class SettingsMenuMouse extends SettingsMenu
|
||||
p = _p;
|
||||
}
|
||||
|
||||
public void onTouchEvent(final MotionEvent ev)
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent ev)
|
||||
{
|
||||
force.add(new Integer((int)(ev.getPressure() * 1000.0)));
|
||||
radius.add(new Integer((int)(ev.getSize() * 1000.0)));
|
||||
@@ -712,12 +715,13 @@ class SettingsMenuMouse extends SettingsMenu
|
||||
|
||||
if( force.size() >= maxEventAmount )
|
||||
{
|
||||
p.touchListener = null;
|
||||
p.getVideoLayout().setOnTouchListener(null);
|
||||
Globals.ClickScreenPressure = getAverageForce();
|
||||
Globals.ClickScreenTouchspotSize = getAverageRadius();
|
||||
Log.i("SDL", "SDL: measured average force " + Globals.ClickScreenPressure + " radius " + Globals.ClickScreenTouchspotSize);
|
||||
goBack(p);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int getAverageForce()
|
||||
@@ -756,11 +760,11 @@ class SettingsMenuMouse extends SettingsMenu
|
||||
Globals.TouchscreenCalibration[2] = 0;
|
||||
Globals.TouchscreenCalibration[3] = 0;
|
||||
ScreenEdgesCalibrationTool tool = new ScreenEdgesCalibrationTool(p);
|
||||
p.touchListener = tool;
|
||||
p.keyListener = tool;
|
||||
p.getVideoLayout().setOnTouchListener(tool);
|
||||
p.getVideoLayout().setOnKeyListener(tool);
|
||||
}
|
||||
|
||||
static class ScreenEdgesCalibrationTool implements MainActivity.TouchEventsListener, MainActivity.KeyEventsListener
|
||||
static class ScreenEdgesCalibrationTool implements View.OnTouchListener, View.OnKeyListener
|
||||
{
|
||||
MainActivity p;
|
||||
ImageView img;
|
||||
@@ -783,7 +787,8 @@ class SettingsMenuMouse extends SettingsMenu
|
||||
p.getVideoLayout().addView(img);
|
||||
}
|
||||
|
||||
public void onTouchEvent(final MotionEvent ev)
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent ev)
|
||||
{
|
||||
if( Globals.TouchscreenCalibration[0] == Globals.TouchscreenCalibration[1] &&
|
||||
Globals.TouchscreenCalibration[1] == Globals.TouchscreenCalibration[2] &&
|
||||
@@ -808,14 +813,17 @@ class SettingsMenuMouse extends SettingsMenu
|
||||
Globals.TouchscreenCalibration[2], Globals.TouchscreenCalibration[3]);
|
||||
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
|
||||
img.setImageMatrix(m);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void onKeyEvent(final int keyCode)
|
||||
@Override
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event)
|
||||
{
|
||||
p.touchListener = null;
|
||||
p.keyListener = null;
|
||||
p.getVideoLayout().setOnTouchListener(null);
|
||||
p.getVideoLayout().setOnKeyListener(null);
|
||||
p.getVideoLayout().removeView(img);
|
||||
goBack(p);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,11 +33,13 @@ import javax.microedition.khronos.egl.EGLDisplay;
|
||||
import javax.microedition.khronos.egl.EGLSurface;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.LinkedList;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Build;
|
||||
@@ -65,48 +67,20 @@ import android.view.Display;
|
||||
import android.net.Uri;
|
||||
import android.Manifest;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.hardware.input.InputManager;
|
||||
import android.graphics.Rect;
|
||||
|
||||
|
||||
class Mouse
|
||||
{
|
||||
public static final int LEFT_CLICK_NORMAL = 0;
|
||||
public static final int LEFT_CLICK_NEAR_CURSOR = 1;
|
||||
public static final int LEFT_CLICK_WITH_MULTITOUCH = 2;
|
||||
public static final int LEFT_CLICK_WITH_PRESSURE = 3;
|
||||
public static final int LEFT_CLICK_WITH_KEY = 4;
|
||||
public static final int LEFT_CLICK_WITH_TIMEOUT = 5;
|
||||
public static final int LEFT_CLICK_WITH_TAP = 6;
|
||||
public static final int LEFT_CLICK_WITH_TAP_OR_TIMEOUT = 7;
|
||||
|
||||
public static final int RIGHT_CLICK_NONE = 0;
|
||||
public static final int RIGHT_CLICK_WITH_MULTITOUCH = 1;
|
||||
public static final int RIGHT_CLICK_WITH_PRESSURE = 2;
|
||||
public static final int RIGHT_CLICK_WITH_KEY = 3;
|
||||
public static final int RIGHT_CLICK_WITH_TIMEOUT = 4;
|
||||
|
||||
public static final int SDL_FINGER_DOWN = 0;
|
||||
public static final int SDL_FINGER_UP = 1;
|
||||
public static final int SDL_FINGER_MOVE = 2;
|
||||
public static final int SDL_FINGER_HOVER = 3;
|
||||
|
||||
public static final int ZOOM_NONE = 0;
|
||||
public static final int ZOOM_MAGNIFIER = 1;
|
||||
|
||||
public static final int MOUSE_HW_INPUT_FINGER = 0;
|
||||
public static final int MOUSE_HW_INPUT_STYLUS = 1;
|
||||
public static final int MOUSE_HW_INPUT_MOUSE = 2;
|
||||
|
||||
public static final int MAX_HOVER_DISTANCE = 1024;
|
||||
public static final int HOVER_REDRAW_SCREEN = 1024 * 10;
|
||||
public static final float MAX_PRESSURE = 1024.0f;
|
||||
}
|
||||
|
||||
abstract class DifferentTouchInput
|
||||
{
|
||||
public abstract void process(final MotionEvent event);
|
||||
public abstract void processGenericEvent(final MotionEvent event);
|
||||
|
||||
public static int ExternalMouseDetected = Mouse.MOUSE_HW_INPUT_FINGER;
|
||||
public static int buttonState = 0;
|
||||
|
||||
public static float capturedMouseX = 0;
|
||||
public static float capturedMouseY = 0;
|
||||
|
||||
public static DifferentTouchInput touchInput = getInstance();
|
||||
|
||||
@@ -318,6 +292,12 @@ abstract class DifferentTouchInput
|
||||
int hwMouseEvent = ((event.getSource() & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE || Globals.ForceHardwareMouse) ? Mouse.MOUSE_HW_INPUT_MOUSE :
|
||||
((event.getSource() & InputDevice.SOURCE_STYLUS) == InputDevice.SOURCE_STYLUS) ? Mouse.MOUSE_HW_INPUT_STYLUS :
|
||||
Mouse.MOUSE_HW_INPUT_FINGER;
|
||||
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O )
|
||||
{
|
||||
if( (event.getSource() & InputDevice.SOURCE_MOUSE_RELATIVE) == InputDevice.SOURCE_MOUSE_RELATIVE )
|
||||
hwMouseEvent = Mouse.MOUSE_HW_INPUT_MOUSE;
|
||||
}
|
||||
|
||||
if( ExternalMouseDetected != hwMouseEvent )
|
||||
{
|
||||
ExternalMouseDetected = hwMouseEvent;
|
||||
@@ -361,12 +341,10 @@ abstract class DifferentTouchInput
|
||||
}
|
||||
private static class IcsTouchInput extends GingerbreadTouchInput
|
||||
{
|
||||
float hatX = 0.0f, hatY = 0.0f;
|
||||
private static class Holder
|
||||
{
|
||||
private static final IcsTouchInput sInstance = new IcsTouchInput();
|
||||
}
|
||||
private int buttonState = 0;
|
||||
public void process(final MotionEvent event)
|
||||
{
|
||||
//Log.i("SDL", "Got motion event, type " + (int)(event.getAction()) + " X " + (int)event.getX() + " Y " + (int)event.getY() + " buttons " + buttonState + " source " + event.getSource());
|
||||
@@ -388,37 +366,16 @@ abstract class DifferentTouchInput
|
||||
}
|
||||
public void processGenericEvent(final MotionEvent event)
|
||||
{
|
||||
// Joysticks are supported since Honeycomb, but I don't care about it, because very little devices have it
|
||||
// Joysticks are supported since Honeycomb, but I don't care about it, because very few devices have it
|
||||
if( (event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == InputDevice.SOURCE_CLASS_JOYSTICK )
|
||||
{
|
||||
// event.getAxisValue(AXIS_HAT_X) and event.getAxisValue(AXIS_HAT_Y) are joystick arrow keys, on Nvidia Shield and some other joysticks
|
||||
if( event.getAxisValue(MotionEvent.AXIS_HAT_X) != hatX )
|
||||
{
|
||||
hatX = event.getAxisValue(MotionEvent.AXIS_HAT_X);
|
||||
if( hatX == 0.0f )
|
||||
{
|
||||
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_LEFT, 0, 0);
|
||||
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_RIGHT, 0, 0);
|
||||
}
|
||||
else
|
||||
DemoGLSurfaceView.nativeKey(hatX < 0.0f ? KeyEvent.KEYCODE_DPAD_LEFT : KeyEvent.KEYCODE_DPAD_RIGHT, 1, 0);
|
||||
}
|
||||
if( event.getAxisValue(MotionEvent.AXIS_HAT_Y) != hatY )
|
||||
{
|
||||
hatY = event.getAxisValue(MotionEvent.AXIS_HAT_Y);
|
||||
if( hatY == 0.0f )
|
||||
{
|
||||
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_UP, 0, 0);
|
||||
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_DOWN, 0, 0);
|
||||
}
|
||||
else
|
||||
DemoGLSurfaceView.nativeKey(hatY < 0.0f ? KeyEvent.KEYCODE_DPAD_UP : KeyEvent.KEYCODE_DPAD_DOWN, 1, 0);
|
||||
}
|
||||
DemoGLSurfaceView.nativeGamepadAnalogJoystickInput(
|
||||
event.getAxisValue(MotionEvent.AXIS_X), event.getAxisValue(MotionEvent.AXIS_Y),
|
||||
event.getAxisValue(MotionEvent.AXIS_Z), event.getAxisValue(MotionEvent.AXIS_RZ),
|
||||
event.getAxisValue(MotionEvent.AXIS_LTRIGGER), event.getAxisValue(MotionEvent.AXIS_RTRIGGER),
|
||||
(hatX == 0.0f && hatY == 0.0f) ? 0 : 1 );
|
||||
event.getAxisValue(MotionEvent.AXIS_LTRIGGER), event.getAxisValue(MotionEvent.AXIS_RTRIGGER),
|
||||
event.getAxisValue(MotionEvent.AXIS_HAT_X), event.getAxisValue(MotionEvent.AXIS_HAT_Y),
|
||||
processGamepadDeviceId(event.getDevice()) );
|
||||
return;
|
||||
}
|
||||
// Process mousewheel
|
||||
@@ -573,6 +530,78 @@ abstract class DifferentTouchInput
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int gamepadIds[] = new int[4]; // Maximum 4 gamepads at the moment
|
||||
|
||||
public static int processGamepadDeviceId(InputDevice device)
|
||||
{
|
||||
if( device == null )
|
||||
return 0;
|
||||
int source = device.getSources();
|
||||
if( (source & InputDevice.SOURCE_CLASS_JOYSTICK) != InputDevice.SOURCE_CLASS_JOYSTICK &&
|
||||
(source & InputDevice.SOURCE_GAMEPAD) != InputDevice.SOURCE_GAMEPAD )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int deviceId = device.getId();
|
||||
for( int i = 0; i < gamepadIds.length; i++ )
|
||||
{
|
||||
if (gamepadIds[i] == deviceId)
|
||||
return i + 1;
|
||||
}
|
||||
for( int i = 0; i < gamepadIds.length; i++ )
|
||||
{
|
||||
if (gamepadIds[i] == 0)
|
||||
{
|
||||
Log.i("SDL", "libSDL: gamepad added: deviceId " + deviceId + " gamepadId " + (i + 1));
|
||||
gamepadIds[i] = deviceId;
|
||||
return i + 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void registerInputManagerCallbacks(Context context)
|
||||
{
|
||||
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN )
|
||||
{
|
||||
JellyBeanInputManager.Holder.sInstance.register(context);
|
||||
}
|
||||
}
|
||||
|
||||
private static class JellyBeanInputManager
|
||||
{
|
||||
private static class Holder
|
||||
{
|
||||
private static final JellyBeanInputManager sInstance = new JellyBeanInputManager();
|
||||
}
|
||||
private static class Listener implements InputManager.InputDeviceListener
|
||||
{
|
||||
public void onInputDeviceAdded(int deviceId)
|
||||
{
|
||||
}
|
||||
public void onInputDeviceChanged(int deviceId)
|
||||
{
|
||||
onInputDeviceRemoved(deviceId);
|
||||
}
|
||||
public void onInputDeviceRemoved(int deviceId)
|
||||
{
|
||||
for( int i = 0; i < gamepadIds.length; i++ )
|
||||
{
|
||||
if (gamepadIds[i] == deviceId)
|
||||
{
|
||||
Log.i("SDL", "libSDL: gamepad removed: deviceId " + deviceId + " gamepadId "+ (i + 1));
|
||||
gamepadIds[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void register(Context context)
|
||||
{
|
||||
InputManager manager = (InputManager) context.getSystemService(Context.INPUT_SERVICE);
|
||||
manager.registerInputDeviceListener(new Listener(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
||||
@@ -613,6 +642,9 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
||||
mHeight = h - h % 2;
|
||||
mGl = gl;
|
||||
nativeResize(mWidth, mHeight, Globals.KeepAspectRatio ? 1 : 0);
|
||||
if( Globals.TouchscreenCalibration[2] > Globals.TouchscreenCalibration[0] )
|
||||
Settings.nativeSetTouchscreenCalibration(Globals.TouchscreenCalibration[0], Globals.TouchscreenCalibration[1],
|
||||
Globals.TouchscreenCalibration[2], Globals.TouchscreenCalibration[3]);
|
||||
}
|
||||
|
||||
int mLastPendingResize = 0;
|
||||
@@ -644,30 +676,8 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
||||
if (mWidth != 0 && mHeight != 0 && (mWidth != ww || mHeight != hh))
|
||||
{
|
||||
Log.i("SDL", "libSDL: DemoRenderer.onWindowResize(): screen size changed from " + mWidth + "x" + mHeight + " to " + ww + "x" + hh);
|
||||
if (Globals.SwVideoMode &&
|
||||
(Math.abs(display.getWidth() - ww) > display.getWidth() / 10 ||
|
||||
Math.abs(display.getHeight() - hh) > display.getHeight() / 10))
|
||||
{
|
||||
Log.i("SDL", "Multiwindow detected - enabling screen orientation autodetection");
|
||||
Globals.AutoDetectOrientation = true;
|
||||
context.setScreenOrientation();
|
||||
DemoRenderer.super.ResetVideoSurface();
|
||||
DemoRenderer.super.onWindowResize(ww, hh);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.i("SDL", "System button bar hidden - re-init video to avoid black bar at the top");
|
||||
DemoRenderer.super.ResetVideoSurface();
|
||||
DemoRenderer.super.onWindowResize(ww, hh);
|
||||
}
|
||||
}
|
||||
if (mWidth == 0 && mHeight == 0)
|
||||
{
|
||||
if ((ww > hh) != (display.getWidth() > display.getHeight()))
|
||||
{
|
||||
Log.i("SDL", "Multiwindow detected - app window size " + ww + "x" + hh + " but display dimensions are " + display.getWidth() + "x" + display.getHeight());
|
||||
Globals.AutoDetectOrientation = true;
|
||||
}
|
||||
DemoRenderer.super.ResetVideoSurface();
|
||||
DemoRenderer.super.onWindowResize(ww, hh);
|
||||
}
|
||||
if (Globals.AutoDetectOrientation && (ww > hh) != (mWidth > mHeight))
|
||||
Globals.HorizontalOrientation = (ww > hh);
|
||||
@@ -710,9 +720,16 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
||||
// Tweak video thread priority, if user selected big audio buffer
|
||||
if( Globals.AudioBufferConfig >= 2 )
|
||||
Thread.currentThread().setPriority( (Thread.NORM_PRIORITY + Thread.MIN_PRIORITY) / 2 ); // Lower than normal
|
||||
// Calls main() and never returns, hehe - we'll call eglSwapBuffers() from native code
|
||||
// Calls main() and never returns, hehe - we'll call eglSwapBuffers() from native code
|
||||
String commandline = Globals.CommandLine;
|
||||
if( context.getIntent() != null && context.getIntent().getScheme() != null &&
|
||||
context.getIntent().getScheme().compareTo(android.content.ContentResolver.SCHEME_FILE) == 0 &&
|
||||
context.getIntent().getData() != null && context.getIntent().getData().getPath() != null )
|
||||
{
|
||||
commandline += " " + context.getIntent().getData().getPath();
|
||||
}
|
||||
nativeInit( Globals.DataDir,
|
||||
Globals.CommandLine,
|
||||
commandline,
|
||||
( (Globals.SwVideoMode && Globals.MultiThreadedVideo) || Globals.CompatibilityHacksVideo ) ? 1 : 0,
|
||||
0 );
|
||||
System.exit(0); // The main() returns here - I don't bother with deinit stuff, just terminate process
|
||||
@@ -722,30 +739,16 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
||||
{
|
||||
if( ! super.SwapBuffers() && Globals.NonBlockingSwapBuffers )
|
||||
{
|
||||
if(mRatelimitTouchEvents)
|
||||
{
|
||||
synchronized(this)
|
||||
{
|
||||
this.notify();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(mGlContextLost) {
|
||||
mGlContextLost = false;
|
||||
Settings.SetupTouchscreenKeyboardGraphics(context); // Reload on-screen buttons graphics
|
||||
DemoGLSurfaceView.SetupTouchscreenKeyboardGraphics(context); // Reload on-screen buttons graphics
|
||||
super.SwapBuffers();
|
||||
}
|
||||
|
||||
// Unblock event processing thread only after we've finished rendering
|
||||
if(mRatelimitTouchEvents)
|
||||
{
|
||||
synchronized(this)
|
||||
{
|
||||
this.notify();
|
||||
}
|
||||
}
|
||||
if( context.isScreenKeyboardShown() && !context.keyboardWithoutTextInputShown )
|
||||
{
|
||||
try {
|
||||
@@ -836,6 +839,12 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
||||
Clipboard.get().set(context, s);
|
||||
}
|
||||
|
||||
public void setCapturedMousePosition(int x, int y) // Called from native code
|
||||
{
|
||||
DifferentTouchInput.capturedMouseX = x;
|
||||
DifferentTouchInput.capturedMouseY = y;
|
||||
}
|
||||
|
||||
public void exitApp()
|
||||
{
|
||||
nativeDone();
|
||||
@@ -936,6 +945,11 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
||||
}
|
||||
}
|
||||
|
||||
public void setSystemMousePointerVisible(int visible)
|
||||
{
|
||||
context.setSystemMousePointerVisible(visible);
|
||||
}
|
||||
|
||||
public void restartMyself(String restartParams)
|
||||
{
|
||||
Intent intent = new Intent(context, RestartMainActivity.class);
|
||||
@@ -959,7 +973,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
||||
|
||||
private native void nativeInitJavaCallbacks();
|
||||
private native void nativeInit(String CurrentPath, String CommandLine, int multiThreadedVideo, int unused);
|
||||
private native void nativeResize(int w, int h, int keepAspectRatio);
|
||||
public static native void nativeResize(int w, int h, int keepAspectRatio);
|
||||
private native void nativeDone();
|
||||
private native void nativeGlContextLost();
|
||||
public native void nativeGlContextRecreated();
|
||||
@@ -983,32 +997,114 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
||||
public int mWidth = 0;
|
||||
public int mHeight = 0;
|
||||
int mOrientationFrameHackyCounter = 0;
|
||||
|
||||
public static final boolean mRatelimitTouchEvents = true; //(Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO);
|
||||
}
|
||||
|
||||
class DemoGLSurfaceView extends GLSurfaceView_SDL {
|
||||
|
||||
public DemoGLSurfaceView(MainActivity context) {
|
||||
super(context);
|
||||
mParent = context;
|
||||
setEGLConfigChooser(Globals.VideoDepthBpp, Globals.NeedDepthBuffer, Globals.NeedStencilBuffer, Globals.NeedGles2, Globals.NeedGles3);
|
||||
mRenderer = new DemoRenderer(context);
|
||||
setRenderer(mRenderer);
|
||||
DifferentTouchInput.registerInputManagerCallbacks(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(final MotionEvent event)
|
||||
public boolean onKeyDown(int keyCode, final KeyEvent event)
|
||||
{
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
//Log.v("SDL", "DemoGLSurfaceView::onKeyDown(): keyCode " + keyCode + " event.getSource() " + event.getSource());
|
||||
if( keyCode == KeyEvent.KEYCODE_BACK )
|
||||
{
|
||||
boolean mouseInput = false;
|
||||
if( (event.getSource() & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE )
|
||||
mouseInput = true;
|
||||
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O )
|
||||
{
|
||||
if( (event.getSource() & InputDevice.SOURCE_MOUSE_RELATIVE) == InputDevice.SOURCE_MOUSE_RELATIVE )
|
||||
mouseInput = true;
|
||||
}
|
||||
if( mouseInput )
|
||||
{
|
||||
// Stupid Samsung and stupid Acer remaps right mouse button to BACK key
|
||||
nativeMouseButtonsPressed(2, 1);
|
||||
return true;
|
||||
}
|
||||
else if( mParent.keyboardWithoutTextInputShown )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if( nativeKey( keyCode, 1, event.getUnicodeChar(), DifferentTouchInput.processGamepadDeviceId(event.getDevice()) ) == 0 )
|
||||
return super.onKeyDown(keyCode, event);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, final KeyEvent event)
|
||||
{
|
||||
if( keyCode == KeyEvent.KEYCODE_BACK )
|
||||
{
|
||||
boolean mouseInput = false;
|
||||
if( (event.getSource() & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE )
|
||||
mouseInput = true;
|
||||
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O )
|
||||
{
|
||||
if( (event.getSource() & InputDevice.SOURCE_MOUSE_RELATIVE) == InputDevice.SOURCE_MOUSE_RELATIVE )
|
||||
mouseInput = true;
|
||||
}
|
||||
if( mouseInput )
|
||||
{
|
||||
// Stupid Samsung and stupid Acer remaps right mouse button to BACK key
|
||||
nativeMouseButtonsPressed(2, 0);
|
||||
return true;
|
||||
}
|
||||
else if( mParent.keyboardWithoutTextInputShown )
|
||||
{
|
||||
mParent.showScreenKeyboardWithoutTextInputField(0); // Hide keyboard
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if( nativeKey( keyCode, 0, event.getUnicodeChar(), DifferentTouchInput.processGamepadDeviceId(event.getDevice()) ) == 0 )
|
||||
return super.onKeyUp(keyCode, event);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyMultiple(int keyCode, int repeatCount, final KeyEvent event)
|
||||
{
|
||||
if( event.getCharacters() != null )
|
||||
{
|
||||
// Non-English text input
|
||||
for( int i = 0; i < event.getCharacters().length(); i++ )
|
||||
{
|
||||
nativeKey( event.getKeyCode(), 1, event.getCharacters().codePointAt(i), 0 );
|
||||
nativeKey( event.getKeyCode(), 0, event.getCharacters().codePointAt(i), 0 );
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(final MotionEvent event)
|
||||
{
|
||||
if( mParent.keyboardWithoutTextInputShown && mParent._screenKeyboard != null &&
|
||||
mParent._screenKeyboard.getY() <= event.getY() )
|
||||
{
|
||||
event.offsetLocation(-mParent._screenKeyboard.getX(), -mParent._screenKeyboard.getY());
|
||||
mParent._screenKeyboard.onTouchEvent(event);
|
||||
return true;
|
||||
}
|
||||
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH )
|
||||
{
|
||||
if (getX() != 0)
|
||||
event.offsetLocation(-getX(), -getY());
|
||||
}
|
||||
DifferentTouchInput.touchInput.process(event);
|
||||
if( DemoRenderer.mRatelimitTouchEvents )
|
||||
{
|
||||
limitEventRate(event);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -1016,33 +1112,47 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
|
||||
public boolean onGenericMotionEvent (final MotionEvent event)
|
||||
{
|
||||
DifferentTouchInput.touchInput.processGenericEvent(event);
|
||||
if( DemoRenderer.mRatelimitTouchEvents )
|
||||
{
|
||||
limitEventRate(event);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void limitEventRate(final MotionEvent event)
|
||||
|
||||
@Override
|
||||
public boolean onCapturedPointerEvent (final MotionEvent event)
|
||||
{
|
||||
// Wait a bit, and try to synchronize to app framerate, or event thread will eat all CPU and we'll lose FPS
|
||||
// With Froyo the rate of touch events seems to be limited by OS, but they are arriving faster then we're redrawing anyway
|
||||
if((event.getAction() == MotionEvent.ACTION_MOVE ||
|
||||
event.getAction() == MotionEvent.ACTION_HOVER_MOVE))
|
||||
{
|
||||
synchronized(mRenderer)
|
||||
{
|
||||
try
|
||||
{
|
||||
mRenderer.wait(300L); // And sometimes the app decides not to render at all, so this timeout should not be big.
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
Log.v("SDL", "DemoGLSurfaceView::limitEventRate(): Who dared to interrupt my slumber?");
|
||||
Thread.interrupted();
|
||||
}
|
||||
}
|
||||
}
|
||||
DifferentTouchInput.capturedMouseX += event.getX();
|
||||
DifferentTouchInput.capturedMouseY += event.getY();
|
||||
if (DifferentTouchInput.capturedMouseX < 0)
|
||||
DifferentTouchInput.capturedMouseX = 0;
|
||||
if (DifferentTouchInput.capturedMouseY < 0)
|
||||
DifferentTouchInput.capturedMouseY = 0;
|
||||
if (DifferentTouchInput.capturedMouseX >= this.getWidth())
|
||||
DifferentTouchInput.capturedMouseX = this.getWidth() - 1;
|
||||
if (DifferentTouchInput.capturedMouseY >= this.getHeight())
|
||||
DifferentTouchInput.capturedMouseY = this.getHeight() - 1;
|
||||
|
||||
//Log.v("SDL", "SDL DemoGLSurfaceView::onCapturedPointerEvent(): X " + DifferentTouchInput.capturedMouseX + " Y " + DifferentTouchInput.capturedMouseY +
|
||||
// " W " + this.getWidth() + " H " + this.getHeight() + " getX " + event.getX() + " getY " + event.getY() +
|
||||
// " RelX " + event.getAxisValue(MotionEvent.AXIS_RELATIVE_X) + " RelY " + event.getAxisValue(MotionEvent.AXIS_RELATIVE_Y) );
|
||||
|
||||
event.setLocation(DifferentTouchInput.capturedMouseX, DifferentTouchInput.capturedMouseY);
|
||||
event.setAction(MotionEvent.ACTION_HOVER_MOVE);
|
||||
|
||||
int scrollX = Math.round(event.getAxisValue(MotionEvent.AXIS_HSCROLL));
|
||||
int scrollY = Math.round(event.getAxisValue(MotionEvent.AXIS_VSCROLL));
|
||||
if (scrollX != 0 || scrollY != 0)
|
||||
DemoGLSurfaceView.nativeMouseWheel(scrollX, scrollY);
|
||||
|
||||
//Log.v("SDL", "DemoGLSurfaceView::onCapturedPointerEvent(): XY " + event.getX() + " " + event.getY() + " action " + event.getAction() + " scroll " + scrollX + " " + scrollY);
|
||||
|
||||
return this.onTouchEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPointerCaptureChange (boolean hasCapture)
|
||||
{
|
||||
Log.v("SDL", "DemoGLSurfaceView::onPointerCaptureChange(): " + hasCapture);
|
||||
super.onPointerCaptureChange(hasCapture);
|
||||
DifferentTouchInput.capturedMouseX = this.getWidth() / 2;
|
||||
DifferentTouchInput.capturedMouseY = this.getHeight() / 2;
|
||||
}
|
||||
|
||||
public void exitApp() {
|
||||
@@ -1076,17 +1186,110 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
|
||||
mRenderer.nativeGlContextRecreated();
|
||||
if( mRenderer.accelerometer != null && mRenderer.accelerometer.openedBySDL ) // For some reason it crashes here often - are we getting this event before initialization?
|
||||
mRenderer.accelerometer.start();
|
||||
captureMouse(true);
|
||||
};
|
||||
|
||||
public void captureMouse(boolean capture)
|
||||
{
|
||||
if( capture )
|
||||
{
|
||||
setFocusableInTouchMode(true);
|
||||
setFocusable(true);
|
||||
requestFocus();
|
||||
if( Globals.HideSystemMousePointer && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O )
|
||||
{
|
||||
postDelayed( new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Log.v("SDL", "captureMouse::requestPointerCapture() delayed");
|
||||
requestPointerCapture();
|
||||
}
|
||||
}, 50 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( Globals.HideSystemMousePointer && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O )
|
||||
{
|
||||
postDelayed( new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Log.v("SDL", "captureMouse::releasePointerCapture()");
|
||||
releasePointerCapture();
|
||||
}
|
||||
}, 50 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static byte [] loadRaw(Activity p, int res)
|
||||
{
|
||||
byte [] buf = new byte[65536 * 2];
|
||||
byte [] a = new byte[1048576 * 5]; // We need 5Mb buffer for Keen theme, and this Java code is inefficient
|
||||
int written = 0;
|
||||
try{
|
||||
InputStream is = new GZIPInputStream(p.getResources().openRawResource(res));
|
||||
int readed = 0;
|
||||
while( (readed = is.read(buf)) >= 0 )
|
||||
{
|
||||
if( written + readed > a.length )
|
||||
{
|
||||
byte [] b = new byte [written + readed];
|
||||
System.arraycopy(a, 0, b, 0, written);
|
||||
a = b;
|
||||
}
|
||||
System.arraycopy(buf, 0, a, written, readed);
|
||||
written += readed;
|
||||
}
|
||||
} catch(Exception e) {};
|
||||
byte [] b = new byte [written];
|
||||
System.arraycopy(a, 0, b, 0, written);
|
||||
return b;
|
||||
}
|
||||
|
||||
static void SetupTouchscreenKeyboardGraphics(Activity p)
|
||||
{
|
||||
if( Globals.UseTouchscreenKeyboard )
|
||||
{
|
||||
if(Globals.TouchscreenKeyboardTheme < 0)
|
||||
Globals.TouchscreenKeyboardTheme = 0;
|
||||
if(Globals.TouchscreenKeyboardTheme > 9)
|
||||
Globals.TouchscreenKeyboardTheme = 9;
|
||||
|
||||
if( Globals.TouchscreenKeyboardTheme == 0 )
|
||||
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.ultimatedroid));
|
||||
if( Globals.TouchscreenKeyboardTheme == 1 )
|
||||
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.simpletheme));
|
||||
if( Globals.TouchscreenKeyboardTheme == 2 )
|
||||
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.sun));
|
||||
if( Globals.TouchscreenKeyboardTheme == 3 )
|
||||
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.keen));
|
||||
if( Globals.TouchscreenKeyboardTheme == 4 )
|
||||
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.retro));
|
||||
if( Globals.TouchscreenKeyboardTheme == 5 )
|
||||
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.gba));
|
||||
if( Globals.TouchscreenKeyboardTheme == 6 )
|
||||
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.psx));
|
||||
if( Globals.TouchscreenKeyboardTheme == 7 )
|
||||
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.snes));
|
||||
if( Globals.TouchscreenKeyboardTheme == 8 )
|
||||
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.dualshock));
|
||||
if( Globals.TouchscreenKeyboardTheme == 9 )
|
||||
Settings.nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.n64));
|
||||
}
|
||||
}
|
||||
|
||||
DemoRenderer mRenderer;
|
||||
MainActivity mParent;
|
||||
|
||||
public static native void nativeMotionEvent( int x, int y, int action, int pointerId, int pressure, int radius );
|
||||
public static native int nativeKey( int keyCode, int down, int unicode );
|
||||
public static native int nativeKey( int keyCode, int down, int unicode, int gamepadId );
|
||||
public static native void nativeHardwareMouseDetected( int detected );
|
||||
public static native void nativeMouseButtonsPressed( int buttonId, int pressedState );
|
||||
public static native void nativeMouseWheel( int scrollX, int scrollY );
|
||||
public static native void nativeGamepadAnalogJoystickInput( float stick1x, float stick1y, float stick2x, float stick2y, float ltrigger, float rtrigger, int usingHat );
|
||||
public static native void nativeGamepadAnalogJoystickInput( float stick1x, float stick1y, float stick2x, float stick2y, float ltrigger, float rtrigger, float dpadx, float dpady, int gamepadId );
|
||||
public static native void nativeScreenVisibleRect( int x, int y, int w, int h );
|
||||
public static native void nativeScreenKeyboardShown( int shown );
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ public class CloudSave implements GameHelper.GameHelperListener {
|
||||
|
||||
// The game helper object. This class is mainly a wrapper around this object.
|
||||
protected GameHelper mHelper;
|
||||
public int REQUEST_CLOUD_SAVE_ID = 38;
|
||||
|
||||
MainActivity parent;
|
||||
|
||||
@@ -72,6 +73,8 @@ public class CloudSave implements GameHelper.GameHelperListener {
|
||||
boolean createNewSave = false;
|
||||
public void onActivityResult(int request, int response, Intent intent)
|
||||
{
|
||||
if (request != REQUEST_CLOUD_SAVE_ID)
|
||||
return;
|
||||
Log.d("SDL", "CloudSave: onActivityResult() response " + response + " intent " + (intent != null));
|
||||
try
|
||||
{
|
||||
@@ -119,7 +122,7 @@ public class CloudSave implements GameHelper.GameHelperListener {
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
parent.startActivityForResult(snapshotIntent, 0);
|
||||
parent.startActivityForResult(snapshotIntent, REQUEST_CLOUD_SAVE_ID);
|
||||
}
|
||||
});
|
||||
semaphore.acquireUninterruptibly();
|
||||
@@ -192,7 +195,7 @@ public class CloudSave implements GameHelper.GameHelperListener {
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
parent.startActivityForResult(snapshotIntent, 0);
|
||||
parent.startActivityForResult(snapshotIntent, REQUEST_CLOUD_SAVE_ID);
|
||||
}
|
||||
});
|
||||
semaphore.acquireUninterruptibly();
|
||||
@@ -361,10 +364,6 @@ public class CloudSave implements GameHelper.GameHelperListener {
|
||||
mHelper.enableDebugLog(enabled);
|
||||
}
|
||||
|
||||
public String getInvitationId() {
|
||||
return mHelper.getInvitationId();
|
||||
}
|
||||
|
||||
public void reconnectClient() {
|
||||
mHelper.reconnectClient();
|
||||
}
|
||||
|
||||
@@ -37,12 +37,6 @@ import com.google.android.gms.drive.Drive;
|
||||
import com.google.android.gms.games.Games;
|
||||
import com.google.android.gms.games.Games.GamesOptions;
|
||||
import com.google.android.gms.games.GamesActivityResultCodes;
|
||||
import com.google.android.gms.games.multiplayer.Invitation;
|
||||
import com.google.android.gms.games.multiplayer.Multiplayer;
|
||||
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch;
|
||||
import com.google.android.gms.games.request.GameRequest;
|
||||
//import com.google.android.gms.plus.Plus;
|
||||
//import com.google.android.gms.plus.Plus.PlusOptions;
|
||||
|
||||
public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
|
||||
GoogleApiClient.OnConnectionFailedListener {
|
||||
@@ -121,11 +115,9 @@ public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
|
||||
// Client request flags
|
||||
public final static int CLIENT_NONE = 0x00;
|
||||
public final static int CLIENT_GAMES = 0x01;
|
||||
//public final static int CLIENT_PLUS = 0x02;
|
||||
public final static int CLIENT_APPSTATE = 0x04;
|
||||
public final static int CLIENT_SNAPSHOT = 0x05;
|
||||
public final static int CLIENT_ALL = CLIENT_GAMES //| CLIENT_PLUS
|
||||
| CLIENT_APPSTATE | CLIENT_SNAPSHOT;
|
||||
public final static int CLIENT_ALL = CLIENT_GAMES | CLIENT_APPSTATE | CLIENT_SNAPSHOT;
|
||||
|
||||
// What clients were requested? (bit flags)
|
||||
int mRequestedClients = CLIENT_NONE;
|
||||
@@ -157,24 +149,6 @@ public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
|
||||
|
||||
Handler mHandler;
|
||||
|
||||
/*
|
||||
* If we got an invitation when we connected to the games client, it's here.
|
||||
* Otherwise, it's null.
|
||||
*/
|
||||
Invitation mInvitation;
|
||||
|
||||
/*
|
||||
* If we got turn-based match when we connected to the games client, it's
|
||||
* here. Otherwise, it's null.
|
||||
*/
|
||||
TurnBasedMatch mTurnBasedMatch;
|
||||
|
||||
/*
|
||||
* If we have incoming requests when we connected to the games client, they
|
||||
* are here. Otherwise, it's null.
|
||||
*/
|
||||
ArrayList<GameRequest> mRequests;
|
||||
|
||||
// Listener
|
||||
GameHelperListener mListener = null;
|
||||
|
||||
@@ -414,101 +388,6 @@ public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
|
||||
mActivity = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the invitation ID received through an invitation notification.
|
||||
* This should be called from your GameHelperListener's
|
||||
*
|
||||
* @link{GameHelperListener#onSignInSucceeded method, to check if there's an
|
||||
* invitation available. In that
|
||||
* case, accept the invitation.
|
||||
* @return The id of the invitation, or null if none was received.
|
||||
*/
|
||||
public String getInvitationId() {
|
||||
if (!mGoogleApiClient.isConnected()) {
|
||||
Log.w(TAG,
|
||||
"Warning: getInvitationId() should only be called when signed in, "
|
||||
+ "that is, after getting onSignInSuceeded()");
|
||||
}
|
||||
return mInvitation == null ? null : mInvitation.getInvitationId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the invitation received through an invitation notification. This
|
||||
* should be called from your GameHelperListener's
|
||||
*
|
||||
* @link{GameHelperListener#onSignInSucceeded method, to check if there's an
|
||||
* invitation available. In that
|
||||
* case, accept the invitation.
|
||||
* @return The invitation, or null if none was received.
|
||||
*/
|
||||
public Invitation getInvitation() {
|
||||
if (!mGoogleApiClient.isConnected()) {
|
||||
Log.w(TAG,
|
||||
"Warning: getInvitation() should only be called when signed in, "
|
||||
+ "that is, after getting onSignInSuceeded()");
|
||||
}
|
||||
return mInvitation;
|
||||
}
|
||||
|
||||
public boolean hasInvitation() {
|
||||
return mInvitation != null;
|
||||
}
|
||||
|
||||
public boolean hasTurnBasedMatch() {
|
||||
return mTurnBasedMatch != null;
|
||||
}
|
||||
|
||||
public boolean hasRequests() {
|
||||
return mRequests != null;
|
||||
}
|
||||
|
||||
public void clearInvitation() {
|
||||
mInvitation = null;
|
||||
}
|
||||
|
||||
public void clearTurnBasedMatch() {
|
||||
mTurnBasedMatch = null;
|
||||
}
|
||||
|
||||
public void clearRequests() {
|
||||
mRequests = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tbmp match received through an invitation notification. This
|
||||
* should be called from your GameHelperListener's
|
||||
*
|
||||
* @link{GameHelperListener#onSignInSucceeded method, to check if there's a
|
||||
* match available.
|
||||
* @return The match, or null if none was received.
|
||||
*/
|
||||
public TurnBasedMatch getTurnBasedMatch() {
|
||||
if (!mGoogleApiClient.isConnected()) {
|
||||
Log.w(TAG,
|
||||
"Warning: getTurnBasedMatch() should only be called when signed in, "
|
||||
+ "that is, after getting onSignInSuceeded()");
|
||||
}
|
||||
return mTurnBasedMatch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the requests received through the onConnected bundle. This should
|
||||
* be called from your GameHelperListener's
|
||||
*
|
||||
* @link{GameHelperListener#onSignInSucceeded method, to check if there are
|
||||
* incoming requests that must be
|
||||
* handled.
|
||||
* @return The requests, or null if none were received.
|
||||
*/
|
||||
public ArrayList<GameRequest> getRequests() {
|
||||
if (!mGoogleApiClient.isConnected()) {
|
||||
Log.w(TAG, "Warning: getRequests() should only be called "
|
||||
+ "when signed in, "
|
||||
+ "that is, after getting onSignInSuceeded()");
|
||||
}
|
||||
return mRequests;
|
||||
}
|
||||
|
||||
/** Enables debug logging */
|
||||
public void enableDebugLog(boolean enabled) {
|
||||
mDebugLog = enabled;
|
||||
@@ -686,8 +565,6 @@ public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
|
||||
}
|
||||
debugLog("Starting connection.");
|
||||
mConnecting = true;
|
||||
mInvitation = null;
|
||||
mTurnBasedMatch = null;
|
||||
mGoogleApiClient.connect();
|
||||
}
|
||||
|
||||
@@ -712,27 +589,6 @@ public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
|
||||
|
||||
if (connectionHint != null) {
|
||||
debugLog("onConnected: connection hint provided. Checking for invite.");
|
||||
Invitation inv = connectionHint
|
||||
.getParcelable(Multiplayer.EXTRA_INVITATION);
|
||||
if (inv != null && inv.getInvitationId() != null) {
|
||||
// retrieve and cache the invitation ID
|
||||
debugLog("onConnected: connection hint has a room invite!");
|
||||
mInvitation = inv;
|
||||
debugLog("Invitation ID: " + mInvitation.getInvitationId());
|
||||
}
|
||||
|
||||
// Do we have any requests pending?
|
||||
mRequests = Games.Requests
|
||||
.getGameRequestsFromBundle(connectionHint);
|
||||
if (!mRequests.isEmpty()) {
|
||||
// We have requests in onConnected's connectionHint.
|
||||
debugLog("onConnected: connection hint has " + mRequests.size()
|
||||
+ " request(s)");
|
||||
}
|
||||
|
||||
debugLog("onConnected: connection hint provided. Checking for TBMP game.");
|
||||
mTurnBasedMatch = connectionHint
|
||||
.getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH);
|
||||
}
|
||||
|
||||
// we're good to go
|
||||
|
||||
@@ -42,8 +42,6 @@ class GameHelperUtils {
|
||||
return "RESULT_CANCELED";
|
||||
case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
|
||||
return "RESULT_APP_MISCONFIGURED";
|
||||
case GamesActivityResultCodes.RESULT_LEFT_ROOM:
|
||||
return "RESULT_LEFT_ROOM";
|
||||
case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
|
||||
return "RESULT_LICENSE_FAILED";
|
||||
case GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED:
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<string name="storage_phone">Внутреннее хранение - %d Мб</string>
|
||||
<string name="storage_sd">SD карта - %d Мб</string>
|
||||
<string name="storage_question">Куда сохранять данные приложения</string>
|
||||
<string name="storage_access">Разрешение на запись на SD карту</string>
|
||||
<string name="optional_downloads">Дополнительные загрузки</string>
|
||||
<string name="ok">Продолжить</string>
|
||||
<string name="controls_arrows">Стрелки / джойстик / Dpad</string>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<string name="storage_phone">Внутрішнє зберігання - %d Мб</string>
|
||||
<string name="storage_sd">SD карта - %d Мб</string>
|
||||
<string name="storage_question">Куди зберігати дані програми</string>
|
||||
<string name="storage_access">Дозвіл на запис на SD карту</string>
|
||||
<string name="optional_downloads">Додаткові завантаження</string>
|
||||
<string name="ok">ОК</string>
|
||||
<string name="controls_arrows">Стрілки / джойстік / Dpad</string>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
|
||||
<string name="init">初始化中</string>
|
||||
<string name="please_wait">正在下载数据,请稍等</string>
|
||||
<string name="please_wait">正在下载数据,请稍候</string>
|
||||
|
||||
<string name="device_config">设备配置</string>
|
||||
<string name="device_change_cfg">更改设备配置</string>
|
||||
@@ -26,7 +26,7 @@
|
||||
<string name="storage_question">数据文件安装位置</string>
|
||||
<string name="optional_downloads">下载</string>
|
||||
<string name="downloads">下载</string>
|
||||
<string name="ok">好</string>
|
||||
<string name="ok">完成</string>
|
||||
<string name="cancel">取消</string>
|
||||
|
||||
<string name="controls_arrows">箭头 / 操纵杆 / 方向键</string>
|
||||
@@ -163,6 +163,7 @@
|
||||
|
||||
<string name="display_size_mouse">鼠标仿真模式</string>
|
||||
<string name="display_size">显示仿真鼠标的大小</string>
|
||||
<string name="display_size_desktop">桌面版,无仿真</string>
|
||||
<string name="display_size_large">大(适用于平板电脑)</string>
|
||||
<string name="display_size_small">小,放大镜</string>
|
||||
<string name="display_size_small_touchpad">小,触摸模式</string>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<resources
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:ignore="MissingTranslation">
|
||||
<string name="app_name">Commander Genius</string>
|
||||
|
||||
|
||||
@@ -24,6 +26,7 @@
|
||||
<string name="storage_custom">Specify directory</string>
|
||||
<string name="storage_commandline">Command line parameters, one argument per line</string>
|
||||
<string name="storage_question">Data installation location</string>
|
||||
<string name="storage_access">Permission to write to SD card</string>
|
||||
<string name="optional_downloads">Downloads</string>
|
||||
<string name="downloads">Downloads</string>
|
||||
<string name="ok">OK</string>
|
||||
@@ -157,6 +160,7 @@
|
||||
<string name="video_orientation_autodetect">Auto-detect screen orientation</string>
|
||||
<string name="video_bpp_24">24 bpp screen color depth</string>
|
||||
<string name="video_immersive">Hide system navigation buttons / immersive mode</string>
|
||||
<string name="video_draw_cutout">Draw in display cutout area</string>
|
||||
<string name="tv_borders">TV borders</string>
|
||||
|
||||
<string name="text_edit_click_here">Tap to start typing, press Back when done</string>
|
||||
|
||||
@@ -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,19 @@ ifneq ($(strip $(filter mad, $(COMPILED_LIBRARIES))),)
|
||||
SDL_MIXER_USE_LIBMAD := 1
|
||||
endif
|
||||
|
||||
# Disable timidity library inside sdl2_mixer, we have our own version of timidity used by OpenTTD
|
||||
SUPPORT_MID_TIMIDITY := 0
|
||||
|
||||
NDK_VERSION := $(strip $(patsubst android-ndk-%,%,$(filter android-ndk-%, $(subst /, ,$(dir $(TARGET_CC))))))
|
||||
#$(info NDK version $(NDK_VERSION)) # This warning puzzles ndk-gdb
|
||||
ifneq ($(filter r1 r2 r3 r4 r5 r6 r7 r8,$(NDK_VERSION)),)
|
||||
$(error Your NDK $(NDK_VERSION) is too old, please download NDK r4b, r5c or r6 from http://developer.android.com)
|
||||
$(error Your NDK $(NDK_VERSION) is too old, please download NDK from http://developer.android.com)
|
||||
endif
|
||||
|
||||
ifdef ANDROID_NDK_HOME
|
||||
NDK_PATH := $(ANDROID_NDK_HOME)
|
||||
else
|
||||
NDK_PATH := $(shell dirname $(shell which ndk-build))
|
||||
endif
|
||||
|
||||
include $(call all-subdir-makefiles)
|
||||
|
||||
@@ -2,6 +2,16 @@ APP_PROJECT_PATH := $(call my-dir)/..
|
||||
|
||||
include jni/Settings.mk
|
||||
|
||||
APP_STL := $(if $(filter clang%, $(NDK_TOOLCHAIN_VERSION)), c++_static, gnustl_static)
|
||||
APP_CFLAGS := -O3 -DNDEBUG -g # arm-linux-androideabi-4.4.3 crashes in -O0 mode on SDL sources
|
||||
ifneq ($(filter c++_shared, $(APP_MODULES)),)
|
||||
APP_STL := c++_shared
|
||||
else
|
||||
APP_STL := none
|
||||
endif
|
||||
APP_CFLAGS := -g
|
||||
ifneq ($(NDK_DEBUG),1)
|
||||
APP_CFLAGS += -Oz -DNDEBUG # -Oz works best with clang
|
||||
endif
|
||||
APP_PIE := true # This feature makes executables incompatible to Android API 15 or lower, but executables without PIE will not run on Android 5.0 and newer
|
||||
SDL_EXCLUDE_LIBGCC := -Wl,--exclude-libs,libgcc.a
|
||||
SDL_EXCLUDE_LIBUNWIND := -Wl,--exclude-libs,libunwind.a
|
||||
APP_LDFLAGS = $(if $(filter clang%, $(NDK_TOOLCHAIN_VERSION)), $(SDL_EXCLUDE_LIBGCC) $(if $(filter armeabi%, $(APP_ABI)), $(SDL_EXCLUDE_LIBUNWIND)))
|
||||
|
||||
@@ -1,39 +1,119 @@
|
||||
# Makefile to build precompiled libraries, which cannot be built using standard NDK makefiles
|
||||
# TODO: libboost, libffmpeg, libpython (used only in GemRB)
|
||||
# TODO: libffmpeg, libpython (used only in GemRB)
|
||||
|
||||
ARCHES32 := armeabi armeabi-v7a x86 mips
|
||||
ARCHES64 := arm64-v8a
|
||||
ARCH_LIST ?= arm64-v8a x86_64 armeabi-v7a x86
|
||||
ifeq ($(strip $(ARCH_LIST)),all)
|
||||
ARCH_LIST := arm64-v8a x86_64 armeabi-v7a x86
|
||||
endif
|
||||
|
||||
ICONV := $(foreach ARCH, $(ARCHES32), iconv/lib/$(ARCH)/libiconv.so iconv/lib/$(ARCH)/libcharset.so)
|
||||
ICONV := $(foreach ARCH, $(ARCH_LIST), iconv/lib/$(ARCH)/libiconv.so iconv/lib/$(ARCH)/libcharset.so)
|
||||
|
||||
ICU_LIBS := data i18n io le lx test tu uc
|
||||
ICU := $(foreach ARCH, $(ARCHES32), $(foreach NAME, $(ICU_LIBS), icuuc/lib/$(ARCH)/libicu$(NAME).a))
|
||||
ICU_LIBS := icudata icui18n icuio icutest icutu icuuc iculx icu-le-hb
|
||||
ICU := $(foreach ARCH, $(ARCH_LIST), $(foreach NAME, $(ICU_LIBS), icuuc/lib/$(ARCH)/lib$(NAME).a))
|
||||
|
||||
OPENSSL := $(foreach ARCH, $(ARCHES32) $(ARCHES64), openssl/lib-$(ARCH)/libcrypto.so.sdl.1.so openssl/lib-$(ARCH)/libssl.so.sdl.1.so)
|
||||
OPENSSL := $(foreach ARCH, $(ARCH_LIST), openssl/lib/$(ARCH)/libcrypto.so.sdl.1.so openssl/lib/$(ARCH)/libssl.so.sdl.1.so)
|
||||
|
||||
PYTHON3 := $(foreach ARCH, $(ARCHES32) $(ARCHES64), python3/lib-$(ARCH)/libcrypto.so.sdl.1.so python3/lib-$(ARCH)/libssl.so.sdl.1.so)
|
||||
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 \
|
||||
|
||||
LIBS := $(ICONV) $(ICU) $(OPENSSL) $(PYTHON3)
|
||||
|
||||
prebuilt-libraries: $(LIBS)
|
||||
BOOST := $(foreach ARCH, $(ARCH_LIST), $(foreach NAME, $(strip $(BOOST_LIBS)), boost/lib/$(ARCH)/libboost_$(NAME).a))
|
||||
|
||||
.NOTPARALLEL: $(LIBS)
|
||||
.PHONY: all boost icu openssl
|
||||
|
||||
$(ICONV) $(ICU):
|
||||
cd iconv/src && \
|
||||
./build.sh && \
|
||||
for ARCH in $(ARCHES32); do \
|
||||
mkdir -p ../lib/$$ARCH ; \
|
||||
all: $(ICONV) $(ICU) $(OPENSSL) $(BOOST)
|
||||
|
||||
boost: $(BOOST) $(foreach NAME, $(strip $(BOOST_LIBS)), boost_$(NAME))
|
||||
|
||||
icu: $(ICONV) $(ICU)
|
||||
|
||||
openssl: $(OPENSSL)
|
||||
|
||||
$(ICONV) $(ICU): iconv/src/build.sh
|
||||
cd iconv/src && \
|
||||
for ARCH in $(ARCH_LIST); do \
|
||||
$(shell echo "#=Compiling iconv for $$ARCH") \
|
||||
env ARCHS=$$ARCH PATH=$(PATH):${ANDROID_NDK_HOME} ./build.sh && \
|
||||
mkdir -p ../lib/$$ARCH ../include ; \
|
||||
cp -f $$ARCH/libiconv.so $$ARCH/libcharset.so ../lib/$$ARCH/ ; \
|
||||
cp -f $$ARCH/include/*.h ../include/ ; \
|
||||
mkdir -p ../../icuuc/lib/$$ARCH ../../icuuc/include/layout ../../icuuc/include/unicode ; \
|
||||
mkdir -p ../../icuuc/lib/$$ARCH ../../icuuc/include/unicode ../../icuuc/include/layout ; \
|
||||
cp -f $$ARCH/libicu*.a ../../icuuc/lib/$$ARCH/ ; \
|
||||
cp -f $$ARCH/include/layout/*.h ../../icuuc/include/layout/ ; \
|
||||
cp -f $$ARCH/include/unicode/*.h ../../icuuc/include/unicode/ ; \
|
||||
cp -f $$ARCH/include/layout/*.h ../../icuuc/include/layout/ ; \
|
||||
cp -f $$ARCH/include/icu-le-hb/layout/*.h ../../icuuc/include/layout/ ; \
|
||||
done
|
||||
|
||||
$(OPENSSL):
|
||||
cd openssl && ./compile.sh
|
||||
$(OPENSSL): openssl/compile.sh
|
||||
cd openssl && env ARCH_LIST="$(ARCH_LIST)" ./compile.sh
|
||||
|
||||
$(PYTHON3):
|
||||
cd python3 && ./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
|
||||
1
project/jni/SDL2_ttf/include
Symbolic link
1
project/jni/SDL2_ttf/include
Symbolic link
@@ -0,0 +1 @@
|
||||
../sdl2_ttf
|
||||
@@ -1,12 +1,24 @@
|
||||
|
||||
SDL_VERSION := 1.2
|
||||
|
||||
# To filter out static libs from all libs in makefile
|
||||
APP_AVAILABLE_STATIC_LIBS := jpeg png freetype fontconfig xerces ogg vorbis flac boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread boost_locale glu icudata icutest icui18n icuio icule iculx icutu icuuc sdl_savepng android_support gl4es nanogl
|
||||
APP_AVAILABLE_STATIC_LIBS := jpeg png webp freetype fontconfig xerces ogg vorbis tremor flac \
|
||||
boost_atomic boost_chrono boost_container boost_context boost_contract boost_coroutine boost_date_time boost_exception boost_filesystem \
|
||||
boost_graph boost_iostreams boost_json boost_locale boost_log boost_log_setup boost_math_c99 boost_math_c99f boost_math_c99l boost_math_tr1 \
|
||||
boost_math_tr1f boost_math_tr1l boost_nowide boost_prg_exec_monitor boost_program_options boost_random boost_regex boost_serialization \
|
||||
boost_system boost_test_exec_monitor boost_thread boost_timer boost_type_erasure boost_unit_test_framework boost_wave boost_wserialization \
|
||||
glu icudata icutest icui18n icuio icule iculx icutu icuuc icu-le-hb harfbuzz sdl_savepng android_support \
|
||||
gl4es nanogl gd guichan glm
|
||||
|
||||
# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2
|
||||
APP_MODULES := application sdl-1.2 sdl_main sdl_native_helpers jpeg png ogg flac vorbis freetype tremor ogg
|
||||
APP_MODULES := application sdl-1.2 sdl_native_helpers jpeg png ogg flac vorbis freetype tremor ogg
|
||||
|
||||
ifeq ($(CUSTOM_BUILD_SCRIPT_FIRST_PASS),)
|
||||
APP_MODULES += application $(if $(filter 1.2, $(SDL_VERSION)), sdl_main)
|
||||
endif
|
||||
|
||||
ifeq ($(APP_ABI),)
|
||||
APP_ABI := armeabi
|
||||
APP_ABI := arm64-v8a armeabi-v7a x86 x86_64
|
||||
endif
|
||||
|
||||
# The namespace in Java file, with dots replaced with underscores
|
||||
@@ -52,13 +64,6 @@ USE_GL4ES :=
|
||||
|
||||
SDL_ADDITIONAL_CFLAGS := -DSDL_ANDROID_KEYCODE_MOUSE=UNKNOWN -DSDL_ANDROID_KEYCODE_0=LCTRL -DSDL_ANDROID_KEYCODE_1=LALT -DSDL_ANDROID_KEYCODE_2=SPACE -DSDL_ANDROID_KEYCODE_3=RETURN -DSDL_ANDROID_KEYCODE_4=RETURN
|
||||
|
||||
SDL_VERSION := 1.2
|
||||
|
||||
# Link-time optimization enabled for optimization junkies. -O999 etc
|
||||
#APP_CFLAGS := -flto
|
||||
#APP_CXXFLAGS := -flto
|
||||
#APP_LDFLAGS := -flto
|
||||
# Latest GCC got better LTO support
|
||||
NDK_TOOLCHAIN_VERSION := clang
|
||||
|
||||
APP_PLATFORM := android-18
|
||||
APP_PLATFORM := android-16
|
||||
|
||||
@@ -3,8 +3,21 @@ LOCAL_PATH := $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := application
|
||||
|
||||
APPDIR := $(shell readlink $(LOCAL_PATH)/src)
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := $(if $(filter 1.2, $(SDL_VERSION)), sdl-1.2, SDL2) $(filter-out $(APP_AVAILABLE_STATIC_LIBS), $(COMPILED_LIBRARIES))
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := $(filter $(APP_AVAILABLE_STATIC_LIBS), $(COMPILED_LIBRARIES))
|
||||
|
||||
LOCAL_LDLIBS := $(APPLICATION_GLES_LIBRARY) -ldl -llog -lz
|
||||
|
||||
LOCAL_LDFLAGS := -Lobj/local/$(TARGET_ARCH_ABI)
|
||||
|
||||
LOCAL_LDFLAGS += $(APPLICATION_ADDITIONAL_LDFLAGS)
|
||||
|
||||
ifeq ($(APPLICATION_CUSTOM_BUILD_SCRIPT),)
|
||||
|
||||
APP_SUBDIRS := $(patsubst $(LOCAL_PATH)/%, %, $(shell find $(LOCAL_PATH)/$(APPDIR) -path '*/.svn' -prune -o -type d -print))
|
||||
ifneq ($(APPLICATION_SUBDIRS_BUILD),)
|
||||
APPLICATION_SUBDIRS_BUILD_NONRECURSIVE := $(addprefix $(APPDIR)/, $(filter-out %/*, $(APPLICATION_SUBDIRS_BUILD)))
|
||||
@@ -14,9 +27,10 @@ APPLICATION_SUBDIRS_BUILD_RECURSIVE := $(patsubst $(LOCAL_PATH)/%, %, $(APPLICAT
|
||||
APP_SUBDIRS := $(APPLICATION_SUBDIRS_BUILD_NONRECURSIVE) $(APPLICATION_SUBDIRS_BUILD_RECURSIVE)
|
||||
endif
|
||||
|
||||
LOCAL_SRC_FILES := $(filter %.c %.cpp, $(APP_SUBDIRS))
|
||||
APP_SUBDIRS := $(filter-out %.c %.cpp, $(APP_SUBDIRS))
|
||||
LOCAL_SRC_FILES := $(filter %.c %.cpp %.cc, $(APP_SUBDIRS))
|
||||
APP_SUBDIRS := $(filter-out %.c %.cpp %.cc, $(APP_SUBDIRS))
|
||||
LOCAL_SRC_FILES += $(foreach F, $(APP_SUBDIRS), $(addprefix $(F)/,$(notdir $(wildcard $(LOCAL_PATH)/$(F)/*.cpp))))
|
||||
LOCAL_SRC_FILES += $(foreach F, $(APP_SUBDIRS), $(addprefix $(F)/,$(notdir $(wildcard $(LOCAL_PATH)/$(F)/*.cc))))
|
||||
LOCAL_SRC_FILES += $(foreach F, $(APP_SUBDIRS), $(addprefix $(F)/,$(notdir $(wildcard $(LOCAL_PATH)/$(F)/*.c))))
|
||||
LOCAL_SRC_FILES := $(filter-out $(addprefix $(APPDIR)/, $(APPLICATION_BUILD_EXCLUDE)), $(LOCAL_SRC_FILES))
|
||||
|
||||
@@ -32,7 +46,7 @@ LOCAL_CFLAGS += $(foreach D, $(LOCAL_C_INCLUDES), -iquote$(D))
|
||||
LOCAL_C_INCLUDES :=
|
||||
endif
|
||||
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../sdl-$(SDL_VERSION)/include
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../$(strip $(if $(filter 1.2, $(SDL_VERSION)), sdl-1.2, SDL2))/include
|
||||
LOCAL_C_INCLUDES += $(foreach L, $(COMPILED_LIBRARIES), $(LOCAL_PATH)/../$(L)/include)
|
||||
|
||||
LOCAL_CFLAGS += $(APPLICATION_ADDITIONAL_CFLAGS)
|
||||
@@ -41,93 +55,13 @@ LOCAL_CPPFLAGS += $(APPLICATION_ADDITIONAL_CPPFLAGS)
|
||||
# Change C++ file extension as appropriate
|
||||
LOCAL_CPP_EXTENSION := .cpp .cxx .cc
|
||||
|
||||
ifneq ($(APPLICATION_CUSTOM_BUILD_SCRIPT),)
|
||||
LOCAL_SRC_FILES := dummy.c
|
||||
endif
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := sdl-$(SDL_VERSION) $(filter-out $(APP_AVAILABLE_STATIC_LIBS), $(COMPILED_LIBRARIES))
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := $(filter $(APP_AVAILABLE_STATIC_LIBS), $(COMPILED_LIBRARIES))
|
||||
|
||||
APP_STL := gnustl_static
|
||||
|
||||
LOCAL_LDLIBS := $(APPLICATION_GLES_LIBRARY) -ldl -llog -lz # -lgnustl_static
|
||||
|
||||
LOCAL_LDFLAGS := -Lobj/local/$(TARGET_ARCH_ABI)
|
||||
|
||||
LOCAL_LDFLAGS += $(APPLICATION_ADDITIONAL_LDFLAGS)
|
||||
|
||||
LOCAL_CPP_EXTENSION := .cpp .cxx .cc
|
||||
|
||||
SDL_APP_LIB_DEPENDS-$(TARGET_ARCH_ABI) := $(LOCAL_PATH)/src/AndroidBuild.sh $(LOCAL_PATH)/src/AndroidAppSettings.cfg
|
||||
SDL_APP_LIB_DEPENDS-$(TARGET_ARCH_ABI) += $(foreach LIB, $(LOCAL_SHARED_LIBRARIES), obj/local/$(TARGET_ARCH_ABI)/lib$(LIB).so)
|
||||
SDL_APP_LIB_DEPENDS-$(TARGET_ARCH_ABI) += $(foreach LIB, $(LOCAL_STATIC_LIBRARIES), obj/local/$(TARGET_ARCH_ABI)/lib$(LIB).a)
|
||||
|
||||
.PHONY: obj/local/$(TARGET_ARCH_ABI)/libcrypto.so obj/local/$(TARGET_ARCH_ABI)/libssl.so obj/local/$(TARGET_ARCH_ABI)/libcurl.so
|
||||
obj/local/$(TARGET_ARCH_ABI)/libcrypto.so: obj/local/$(TARGET_ARCH_ABI)/libcrypto.so.sdl.0.so
|
||||
obj/local/$(TARGET_ARCH_ABI)/libssl.so: obj/local/$(TARGET_ARCH_ABI)/libssl.so.sdl.0.so
|
||||
obj/local/$(TARGET_ARCH_ABI)/libcurl.so: obj/local/$(TARGET_ARCH_ABI)/libcurl-sdl.so
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
ifneq ($(APPLICATION_CUSTOM_BUILD_SCRIPT),)
|
||||
else ifeq ($(CUSTOM_BUILD_SCRIPT_FIRST_PASS),) # APPLICATION_CUSTOM_BUILD_SCRIPT and not CUSTOM_BUILD_SCRIPT_FIRST_PASS
|
||||
|
||||
# TODO: here we're digging inside NDK internal build system, that's not portable
|
||||
# NDK r5b provided the $(PREBUILT_SHARED_LIBRARY) target, however it requires .so file to be already present on disk
|
||||
# Also I cannot just launch AndroidBuild.sh from makefile because other libraries are not rebuilt and linking will fail
|
||||
.PHONY: OVERRIDE_CUSTOM_LIB
|
||||
OVERRIDE_CUSTOM_LIB:
|
||||
# Prevent ./AndroidBuild.sh to be invoked in parallel for different architectures, it may do things like downloading files which work poorly when launched in parallel
|
||||
# .NOTPARALLEL prevents other sources from building in parallel, so we're using flock shell command here
|
||||
# There is flock command on Linux, but it fails to lock a file, and mkdir is more portable
|
||||
PARALLEL_LOCK := until mkdir .lock >/dev/null 2>&1; do sleep 1; done
|
||||
PARALLEL_UNLOCK := rmdir .lock >/dev/null 2>&1
|
||||
LOCAL_SRC_FILES := $(APPDIR)/libapplication-$(TARGET_ARCH_ABI).so
|
||||
LOCAL_MODULE_FILENAME := libapplication
|
||||
|
||||
LOCAL_PATH_SDL_APPLICATION := $(LOCAL_PATH)
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
||||
$(shell cd $(LOCAL_PATH_SDL_APPLICATION)/src && $(PARALLEL_UNLOCK))
|
||||
|
||||
obj/local/armeabi/libapplication.so: $(LOCAL_PATH)/src/libapplication-armeabi.so
|
||||
|
||||
$(LOCAL_PATH)/src/libapplication-armeabi.so: $(SDL_APP_LIB_DEPENDS-armeabi) OVERRIDE_CUSTOM_LIB
|
||||
cd $(LOCAL_PATH_SDL_APPLICATION)/src && $(PARALLEL_LOCK) && \
|
||||
./AndroidBuild.sh armeabi arm-linux-androideabi && $(PARALLEL_UNLOCK) && \
|
||||
{ [ -e libapplication.so ] && ln -s libapplication.so libapplication-armeabi.so || true ; }
|
||||
|
||||
obj/local/armeabi-v7a/libapplication.so: $(LOCAL_PATH)/src/libapplication-armeabi-v7a.so
|
||||
|
||||
$(LOCAL_PATH)/src/libapplication-armeabi-v7a.so: $(SDL_APP_LIB_DEPENDS-armeabi-v7a) OVERRIDE_CUSTOM_LIB
|
||||
cd $(LOCAL_PATH_SDL_APPLICATION)/src && $(PARALLEL_LOCK) && \
|
||||
./AndroidBuild.sh armeabi-v7a arm-linux-androideabi && $(PARALLEL_UNLOCK)
|
||||
|
||||
obj/local/armeabi-v7a-hard/libapplication.so: $(LOCAL_PATH)/src/libapplication-armeabi-v7a-hard.so
|
||||
|
||||
$(LOCAL_PATH)/src/libapplication-armeabi-v7a-hard.so: $(SDL_APP_LIB_DEPENDS-armeabi-v7a-hard) OVERRIDE_CUSTOM_LIB
|
||||
cd $(LOCAL_PATH_SDL_APPLICATION)/src && $(PARALLEL_LOCK) && \
|
||||
./AndroidBuild.sh armeabi-v7a-hard arm-linux-androideabi && $(PARALLEL_UNLOCK)
|
||||
|
||||
obj/local/mips/libapplication.so: $(LOCAL_PATH)/src/libapplication-mips.so
|
||||
|
||||
$(LOCAL_PATH)/src/libapplication-mips.so: $(SDL_APP_LIB_DEPENDS-mips) OVERRIDE_CUSTOM_LIB
|
||||
cd $(LOCAL_PATH_SDL_APPLICATION)/src && $(PARALLEL_LOCK) && \
|
||||
./AndroidBuild.sh mips mipsel-linux-android && $(PARALLEL_UNLOCK)
|
||||
|
||||
obj/local/x86/libapplication.so: $(LOCAL_PATH)/src/libapplication-x86.so
|
||||
|
||||
$(LOCAL_PATH)/src/libapplication-x86.so: $(SDL_APP_LIB_DEPENDS-x86) OVERRIDE_CUSTOM_LIB
|
||||
cd $(LOCAL_PATH_SDL_APPLICATION)/src && $(PARALLEL_LOCK) && \
|
||||
./AndroidBuild.sh x86 i686-linux-android && $(PARALLEL_UNLOCK)
|
||||
|
||||
obj/local/arm64-v8a/libapplication.so: $(LOCAL_PATH)/src/libapplication-arm64-v8a.so
|
||||
|
||||
$(LOCAL_PATH)/src/libapplication-arm64-v8a.so: $(SDL_APP_LIB_DEPENDS-arm64-v8a) OVERRIDE_CUSTOM_LIB
|
||||
cd $(LOCAL_PATH_SDL_APPLICATION)/src && $(PARALLEL_LOCK) && \
|
||||
./AndroidBuild.sh arm64-v8a aarch64-linux-android && $(PARALLEL_UNLOCK)
|
||||
|
||||
obj/local/x86_64/libapplication.so: $(LOCAL_PATH)/src/libapplication-x86_64.so
|
||||
|
||||
$(LOCAL_PATH)/src/libapplication-x86_64.so: $(SDL_APP_LIB_DEPENDS-x86_64) OVERRIDE_CUSTOM_LIB
|
||||
cd $(LOCAL_PATH_SDL_APPLICATION)/src && $(PARALLEL_LOCK) && \
|
||||
./AndroidBuild.sh x86_64 x86_64-linux-android && $(PARALLEL_UNLOCK)
|
||||
|
||||
endif # $(APPLICATION_CUSTOM_BUILD_SCRIPT)
|
||||
endif
|
||||
|
||||
54
project/jni/application/CustomBuildScript.mk
Normal file
54
project/jni/application/CustomBuildScript.mk
Normal file
@@ -0,0 +1,54 @@
|
||||
include ../Settings.mk
|
||||
|
||||
APPDIR := $(shell readlink src)
|
||||
|
||||
all: $(foreach ARCH, $(APP_ABI), $(APPDIR)/libapplication-$(ARCH).so)
|
||||
|
||||
.PHONY: all $(foreach ARCH, $(APP_ABI), $(APPDIR)/libapplication-$(ARCH).so)
|
||||
|
||||
TARGET_GCC_PREFIX_armeabi-v7a := arm-linux-androideabi
|
||||
TARGET_GCC_PREFIX_x86 := i686-linux-android
|
||||
TARGET_GCC_PREFIX_arm64-v8a := aarch64-linux-android
|
||||
TARGET_GCC_PREFIX_x86_64 := x86_64-linux-android
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := $(filter $(APP_AVAILABLE_STATIC_LIBS), $(COMPILED_LIBRARIES))
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := sdl-$(SDL_VERSION) $(filter-out $(APP_AVAILABLE_STATIC_LIBS), $(COMPILED_LIBRARIES))
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := $(patsubst crypto, crypto.so.sdl.1, $(LOCAL_SHARED_LIBRARIES))
|
||||
LOCAL_SHARED_LIBRARIES := $(patsubst ssl, ssl.so.sdl.1, $(LOCAL_SHARED_LIBRARIES))
|
||||
LOCAL_SHARED_LIBRARIES := $(patsubst curl, curl-sdl, $(LOCAL_SHARED_LIBRARIES))
|
||||
LOCAL_SHARED_LIBRARIES := $(patsubst expat, expat-sdl, $(LOCAL_SHARED_LIBRARIES))
|
||||
|
||||
define DEPENDS_FOR_ARCH =
|
||||
|
||||
../../obj/local/$(1)/$(2):
|
||||
make -C .. -f Makefile.prebuilt $$(abspath $$@)
|
||||
|
||||
SDL_APP_LIB_DEPENDS_$(1) += ../../obj/local/$(1)/$(2)
|
||||
|
||||
#$$(warning === ../../obj/local/$(1)/$(2):)
|
||||
|
||||
endef
|
||||
|
||||
$(foreach ARCH, $(APP_ABI), $(foreach LIB, $(LOCAL_SHARED_LIBRARIES), $(eval $(call DEPENDS_FOR_ARCH,$(ARCH),lib$(LIB).so))))
|
||||
|
||||
$(foreach ARCH, $(APP_ABI), $(foreach LIB, $(LOCAL_STATIC_LIBRARIES), $(eval $(call DEPENDS_FOR_ARCH,$(ARCH),lib$(LIB).a))))
|
||||
|
||||
define BUILD_FOR_ARCH =
|
||||
|
||||
SDL_APP_LIB_DEPENDS_$(1) += $$(APPDIR)/AndroidBuild.sh $$(APPDIR)/AndroidAppSettings.cfg
|
||||
|
||||
$$(APPDIR)/libapplication-$(1).so: $$(SDL_APP_LIB_DEPENDS_$(1))
|
||||
cd $$(APPDIR) && ./AndroidBuild.sh $(1) $$(TARGET_GCC_PREFIX_$(1))
|
||||
@objdump -p $$@ | grep 'SONAME' && { \
|
||||
objdump -p $$@ | grep 'SONAME *libapplication.so' || { \
|
||||
rm $$@ ; echo 'Error: $$@ must have SONAME set to "libapplication.so", add option -Wl,-soname=libapplication.so to your linker flags' ; \
|
||||
} ; \
|
||||
}
|
||||
|
||||
#$$(warning ====== $$(APPDIR)/libapplication-$(1).so: ==> $$(SDL_APP_LIB_DEPENDS_$(1)))
|
||||
|
||||
endef
|
||||
|
||||
$(foreach ARCH, $(APP_ABI), $(eval $(call BUILD_FOR_ARCH,$(ARCH))))
|
||||
Submodule project/jni/application/NewRAW deleted from 65b7361c8e
@@ -1,34 +0,0 @@
|
||||
# The application settings for Android libSDL port
|
||||
AppSettingVersion=16
|
||||
LibSdlVersion=1.2
|
||||
AppName="REminiscence"
|
||||
AppFullName=fr.freecyxdown.sdl
|
||||
ScreenOrientation=h
|
||||
InhibitSuspend=n
|
||||
AppDataDownloadUrl="Data files size is 1 Mb|http://anddev.at.ua/data/reminiscence-data.zip?attredirects=0&d=1"
|
||||
SdlVideoResize=y
|
||||
SdlVideoResizeKeepAspect=n
|
||||
NeedDepthBuffer=n
|
||||
AppUsesMouse=n
|
||||
AppNeedsTwoButtonMouse=n
|
||||
AppNeedsArrowKeys=y
|
||||
AppNeedsTextInput=y
|
||||
AppUsesJoystick=n
|
||||
AppHandlesJoystickSensitivity=n
|
||||
AppUsesMultitouch=n
|
||||
NonBlockingSwapBuffers=n
|
||||
RedefinedKeys="RSHIFT RETURN BACKSPACE RETURN SPACE"
|
||||
AppTouchscreenKeyboardKeysAmount=3
|
||||
AppTouchscreenKeyboardKeysAmountAutoFire=0
|
||||
RedefinedKeysScreenKb="RSHIFT RETURN BACKSPACE RETURN SPACE"
|
||||
MultiABI=n
|
||||
AppVersionCode=01901
|
||||
AppVersionName="0.1.9"
|
||||
CompiledLibraries="jpeg png"
|
||||
CustomBuildScript=n
|
||||
AppCflags='-Dmain=SDL_main -DBYPASS_PROTECTION'
|
||||
AppLdflags=''
|
||||
AppSubdirsBuild=''
|
||||
AppUseCrystaXToolchain=n
|
||||
AppCmdline=''
|
||||
ReadmeText='^You may press "Home" now - the data will be downloaded in background'
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
LOCAL_PATH=`dirname $0`
|
||||
LOCAL_PATH=`cd $LOCAL_PATH && pwd`
|
||||
|
||||
# Hacks for broken configure scripts
|
||||
#rm -rf $LOCAL_PATH/../../obj/local/armeabi/libSDL_*.so
|
||||
#rm -rf $LOCAL_PATH/../../obj/local/armeabi/libsdl_main.so
|
||||
|
||||
# Uncomment if your configure expects SDL libraries in form "libSDL_name.so"
|
||||
#if [ -e $LOCAL_PATH/../../obj/local/armeabi/libsdl_mixer.so ] ; then
|
||||
# ln -sf libsdl_mixer.so $LOCAL_PATH/../../obj/local/armeabi/libSDL_Mixer.so
|
||||
#fi
|
||||
|
||||
#for F in $LOCAL_PATH/../../obj/local/armeabi/libsdl_*.so; do
|
||||
# LIBNAME=`echo $F | sed "s@$LOCAL_PATH/../../obj/local/armeabi/libsdl_\(.*\)[.]so@\1@"`
|
||||
# ln -sf libsdl_$LIBNAME.so $LOCAL_PATH/../../obj/local/armeabi/libSDL_$LIBNAME.so
|
||||
#done
|
||||
|
||||
../setEnvironment.sh make -C REminiscence-0.1.9 -j2 && cp -f REminiscence-0.1.9/rs libapplication.so
|
||||
@@ -1,340 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
@@ -1,29 +0,0 @@
|
||||
|
||||
SDL_CFLAGS = `sdl-config --cflags` -Dmain=SDL_main -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DANDROID -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I/home/lubomyr/src/endless_space/android-ndk-r4-crystax/build/platforms/android-8/arch-arm/usr/include -I/home/lubomyr/project/jni/sdl-1.2/include
|
||||
SDL_LIBS = `sdl-config --libs` -nostdlib -Wl,-soname,libapplication.so -Wl,-shared,-Bsymbolic -Wl,--whole-archive -Wl,--no-whole-archive /home/lubomyr/src/endless_space/android-ndk-r4-crystax/build/prebuilt/linux-x86/arm-eabi-4.4.0/arm-eabi/lib/libstdc++.a /home/lubomyr/src/endless_space/android-ndk-r4-crystax/build/platforms/android-8/arch-arm/usr/lib/libc.a -L/home/lubomyr/project/obj/local/armeabi -lsdl-1.2 -lm -llog -lgcc -L/home/lubomyr/src/endless_space/android-ndk-r4-crystax/build/platforms/android-8/arch-arm/usr/lib
|
||||
|
||||
DEFINES = -DBYPASS_PROTECTION
|
||||
#DEFINES = -DBYPASS_PROTECTION -DNDEBUG
|
||||
|
||||
CXX = arm-eabi-g++
|
||||
CXXFLAGS:= -g -Wall -Wuninitialized -Wno-unknown-pragmas -Wshadow -Wimplicit
|
||||
CXXFLAGS+= -Wundef -Wreorder -Wwrite-strings -Wnon-virtual-dtor -Wno-multichar
|
||||
CXXFLAGS+= $(SDL_CFLAGS) $(DEFINES)
|
||||
|
||||
SRCS = collision.cpp cutscene.cpp file.cpp game.cpp graphics.cpp main.cpp menu.cpp \
|
||||
mixer.cpp mod_player.cpp piege.cpp resource.cpp scaler.cpp sfx_player.cpp \
|
||||
staticres.cpp systemstub_sdl.cpp unpack.cpp util.cpp video.cpp
|
||||
|
||||
OBJS = $(SRCS:.cpp=.o)
|
||||
DEPS = $(SRCS:.cpp=.d)
|
||||
|
||||
rs: $(OBJS)
|
||||
$(CXX) $(LDFLAGS) -o $@ $(OBJS) $(SDL_LIBS) -lz
|
||||
|
||||
.cpp.o:
|
||||
$(CXX) $(CXXFLAGS) -MMD -c $< -o $*.o
|
||||
|
||||
clean:
|
||||
rm -f *.o *.d
|
||||
|
||||
-include $(DEPS)
|
||||
@@ -1,138 +0,0 @@
|
||||
|
||||
REminiscence README
|
||||
Release version: 0.1.9 (Mar 16 2007)
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
About:
|
||||
------
|
||||
|
||||
REminiscence is a re-implementation of the engine used in the game Flashback
|
||||
made by Delphine Software and released in 1992. More informations about the
|
||||
game can be found at [1], [2] and [3].
|
||||
|
||||
|
||||
Supported Versions:
|
||||
-------------------
|
||||
|
||||
Only the PC DOS versions are supported. The engine has been reported to work
|
||||
with english, french, german and spanish versions of the game.
|
||||
|
||||
|
||||
Compiling:
|
||||
----------
|
||||
|
||||
Tweak the Makefile if needed and type make (only gcc3 has been tested so far).
|
||||
The SDL and zlib libraries are required.
|
||||
|
||||
|
||||
Data Files:
|
||||
-----------
|
||||
|
||||
You will need the original files, here is the required list :
|
||||
|
||||
FB_TXT.FNT
|
||||
GLOBAL.ICN
|
||||
GLOBAL.FIB
|
||||
GLOBAL.SPC
|
||||
*.OFF
|
||||
*.SPR
|
||||
*.MAP
|
||||
*.PAL
|
||||
*.ANI
|
||||
*.CT
|
||||
*.MBK
|
||||
*.OBJ
|
||||
*.PGE
|
||||
*.RP
|
||||
*.TBN
|
||||
*.CMD
|
||||
*.POL
|
||||
*CINE.*
|
||||
|
||||
If you have a version distributed by SSI, you'll have to rename some files :
|
||||
|
||||
logosssi.cmd -> logos.cmd
|
||||
logosssi.pol -> logos.pol
|
||||
menu1ssi.map -> menu1.map
|
||||
menu1ssi.pal -> menu1.pal
|
||||
|
||||
In order to hear music, you'll need the original music files (.mod) of the
|
||||
amiga version. Copy them to the DATA directory and rename them like this :
|
||||
|
||||
mod.flashback-ascenseur
|
||||
mod.flashback-ceinturea
|
||||
mod.flashback-chute
|
||||
mod.flashback-desintegr
|
||||
mod.flashback-donneobjt
|
||||
mod.flashback-fin
|
||||
mod.flashback-fin2
|
||||
mod.flashback-game_over
|
||||
mod.flashback-holocube
|
||||
mod.flashback-introb
|
||||
mod.flashback-jungle
|
||||
mod.flashback-logo
|
||||
mod.flashback-memoire
|
||||
mod.flashback-missionca
|
||||
mod.flashback-options1
|
||||
mod.flashback-options2
|
||||
mod.flashback-reunion
|
||||
mod.flashback-taxi
|
||||
mod.flashback-teleport2
|
||||
mod.flashback-teleporta
|
||||
mod.flashback-voyage
|
||||
|
||||
|
||||
Running:
|
||||
--------
|
||||
|
||||
By default, the engine will try to load the game data files from the 'DATA'
|
||||
directory (as the original game did). The savestates are saved in the current
|
||||
directory. These paths can be changed using command line switches :
|
||||
|
||||
Usage: rs [OPTIONS]...
|
||||
--datapath=PATH Path to data files (default 'DATA')
|
||||
--savepath=PATH Path to save files (default '.')
|
||||
|
||||
In-game hotkeys :
|
||||
|
||||
Arrow Keys move Conrad
|
||||
Enter use the current inventory object
|
||||
Shift talk / use / run / shoot
|
||||
Escape display the options
|
||||
Backspace display the inventory
|
||||
Alt Enter toggle windowed/fullscreen mode
|
||||
Alt + and - change video scaler
|
||||
Ctrl S save game state
|
||||
Ctrl L load game state
|
||||
Ctrl + and - change game state slot
|
||||
Ctrl R toggle input keys record
|
||||
Ctrl P toggle input keys replay
|
||||
|
||||
Debug hotkeys :
|
||||
|
||||
Ctrl F toggle fast mode
|
||||
Ctrl I set Conrad life counter to 32767
|
||||
Ctrl B toggle display of updated dirty blocks
|
||||
Ctrl M mirror mode (just a hack, really)
|
||||
|
||||
|
||||
Credits:
|
||||
--------
|
||||
|
||||
Delphine Software, obviously, for making another great game.
|
||||
Yaz0r, Pixel and gawd for sharing information they gathered on the game.
|
||||
|
||||
|
||||
Contact:
|
||||
--------
|
||||
|
||||
Gregory Montoir, cyx@users.sourceforge.net
|
||||
|
||||
|
||||
URLs:
|
||||
-----
|
||||
|
||||
[1] http://www.mobygames.com/game/flashback-the-quest-for-identity
|
||||
[2] http://en.wikipedia.org/wiki/Flashback:_The_Quest_for_Identity
|
||||
[3] http://ramal.free.fr/fb_en.htm
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user