Compare commits
319 Commits
fheroes2
...
sdl_androi
| Author | SHA1 | Date | |
|---|---|---|---|
| 557d36c11f | |||
| d40d02fc69 | |||
| 4604ab965f | |||
| 832d647e1e | |||
| 39c71f8db5 | |||
| f78755e303 | |||
| 78b470bc4f | |||
| f86b75c1d0 | |||
| 5afec88058 | |||
| eadbd04f81 | |||
| c9ce3ced58 | |||
| 86aa68b95a | |||
| 07e2a663ba | |||
| d2748a5c1a | |||
| a3cf17d96e | |||
|
|
474099d226 | ||
|
|
d90957f51f | ||
|
|
bfb68c161b | ||
|
|
ed13ef776c | ||
| 24205dc948 | |||
| 13c29b3ed2 | |||
|
|
cdfb2dea96 | ||
|
|
c6ec8da264 | ||
|
|
1852b09c9b | ||
|
|
4c0ee01285 | ||
|
|
9eb294a4d5 | ||
|
|
10b199e707 | ||
|
|
f14a9db4b0 | ||
|
|
cf4e7deba7 | ||
|
|
902259cad7 | ||
|
|
0b93255121 | ||
|
|
d87f0fc47c | ||
|
|
67efe70542 | ||
|
|
d75428ec05 | ||
|
|
9aa360df04 | ||
|
|
b0124577c1 | ||
|
|
a7401cfaf7 | ||
|
|
5f53581671 | ||
|
|
6c5703bf22 | ||
|
|
e5d8d9d3a4 | ||
|
|
3b286cc24c | ||
|
|
9a1f5ca352 | ||
|
|
66d66011ce | ||
|
|
c869ac6a8a | ||
|
|
c6e9cf6274 | ||
|
|
6cc124b1df | ||
|
|
ac2fe0ffa1 | ||
|
|
1def252c9b | ||
|
|
73210a9428 | ||
|
|
c9a563e627 | ||
|
|
c3aabf9f7c | ||
|
|
6932189f21 | ||
|
|
601d40b414 | ||
|
|
242bad58b8 | ||
|
|
52e6f828dd | ||
|
|
543df95d62 | ||
|
|
a288880b4a | ||
|
|
fb4a4c7497 | ||
|
|
c1e3582042 | ||
|
|
1f301e2d7c | ||
|
|
e17bf11a15 | ||
|
|
940b04c8ce | ||
|
|
8073d82624 | ||
|
|
5824a4cfce | ||
|
|
42ec5d69c2 | ||
|
|
f17ebbea79 | ||
|
|
17cf60d021 | ||
|
|
bce8691e45 | ||
|
|
a8927c121a | ||
|
|
a8e98dd68b | ||
|
|
956660cd30 | ||
|
|
ba816271e4 | ||
|
|
b6c922f135 | ||
| 7f98205bcc | |||
| 2a82f63627 | |||
| 891b1dfdd9 | |||
| 5bc1e861c5 | |||
| a82486d0c7 | |||
| 2dd2503044 | |||
| 9249dd3ffc | |||
|
|
2e0cc86345 | ||
|
|
ec163bba3b | ||
|
|
b0415e5629 | ||
|
|
f04a74421d | ||
|
|
8d7a7cdf84 | ||
|
|
4b73aece3c | ||
|
|
0baa3f3eee | ||
|
|
8473363012 | ||
|
|
a92f6cf9b8 | ||
|
|
adbe81a060 | ||
|
|
6e8c289854 | ||
|
|
895977f0c8 | ||
|
|
921e814669 | ||
|
|
2e44deacdf | ||
| b8337a5253 | |||
| 70e2889675 | |||
|
|
42b6d73fbf | ||
|
|
3fcfacdf58 | ||
|
|
370435341a | ||
|
|
cb8fe0ee00 | ||
|
|
fab45c98f6 | ||
|
|
ab50f67695 | ||
|
|
ee0df4f895 | ||
| f5d3dec88d | |||
| 767969b04d | |||
| b84940de47 | |||
| a26ff60b8f | |||
| 9439ee7927 | |||
| eeb1b54cd5 | |||
| bcdfccc28e | |||
| 6a67ec9197 | |||
|
|
c6fdfc4cbe | ||
|
|
881d81cc50 | ||
|
|
d40a4b599e | ||
|
|
62611e60f4 | ||
|
|
e4939e3f3f | ||
|
|
8c03645bce | ||
|
|
38f8308926 | ||
|
|
32c747f580 | ||
|
|
fbc7ee1d2b | ||
|
|
899a3b3630 | ||
|
|
84a08cad8e | ||
|
|
e058499e89 | ||
|
|
c87e13d96f | ||
|
|
e080e70bda | ||
|
|
71411d22d5 | ||
| ca643807d2 | |||
| 1c488fe457 | |||
|
|
c9e4d8685a | ||
|
|
86452912a0 | ||
|
|
8d02011e82 | ||
|
|
e2a3938297 | ||
|
|
798fd0f5e1 | ||
|
|
6916b2cce9 | ||
|
|
d3d938c27d | ||
|
|
37c77c100f | ||
|
|
bc0f10c2bf | ||
|
|
f793806d7e | ||
|
|
1c9ff9d98e | ||
|
|
55303806d9 | ||
|
|
8d10d1ff0f | ||
|
|
bbaa42c1ec | ||
|
|
10c751afc3 | ||
|
|
532acc9192 | ||
|
|
20ffa0a809 | ||
|
|
999cefb359 | ||
|
|
ad753cbdd8 | ||
|
|
a961c62043 | ||
|
|
d30371b546 | ||
|
|
37769ef1e1 | ||
|
|
5073ac8df9 | ||
|
|
c130231878 | ||
|
|
8a72407d0e | ||
|
|
8aecf92fee | ||
|
|
00873a5014 | ||
|
|
dece0f3418 | ||
|
|
d3860a6bb4 | ||
|
|
c37381b20f | ||
|
|
3d7782a0db | ||
|
|
6dce6d6690 | ||
|
|
3512b70469 | ||
|
|
2b96250b11 | ||
|
|
27bb3eb642 | ||
|
|
c7a57c155b | ||
|
|
5793ce78fb | ||
|
|
bc710aa7b6 | ||
|
|
45a8f1868e | ||
|
|
4fa235395f | ||
|
|
26c565e2ba | ||
|
|
03b1fde421 | ||
|
|
44047831b3 | ||
|
|
e549b41333 | ||
|
|
c22deddf28 | ||
|
|
20cc7839e5 | ||
|
|
da41bde2a0 | ||
|
|
b1f3d180b3 | ||
|
|
021ebb853e | ||
|
|
1d0efd062b | ||
|
|
d7ef921317 | ||
|
|
04316911e9 | ||
|
|
8edb321123 | ||
|
|
292775eb07 | ||
|
|
fc054fc4f0 | ||
|
|
7dae18fa7d | ||
|
|
47e6527a6f | ||
|
|
bdb958b7d4 | ||
|
|
2f2a2b4fa4 | ||
|
|
8d50979447 | ||
|
|
272fea83c2 | ||
|
|
8f8ea18517 | ||
|
|
32339a9610 | ||
|
|
821196ab38 | ||
|
|
91e6c9f28e | ||
|
|
7babb91d22 | ||
|
|
79c0dc8b96 | ||
|
|
1f88f05321 | ||
|
|
2d98c49a21 | ||
|
|
8f3d943292 | ||
|
|
dcfb99b8e7 | ||
|
|
3093207884 | ||
|
|
9dda18bc61 | ||
|
|
11bd50e1f5 | ||
|
|
964f88c9f7 | ||
|
|
77a2647367 | ||
|
|
24f0179cab | ||
|
|
00b4f92348 | ||
|
|
f8868bf7a0 | ||
|
|
901aecadc0 | ||
|
|
094d04a4c2 | ||
|
|
ef8b1d2c7d | ||
|
|
4cdad6573b | ||
|
|
c8c1cac242 | ||
|
|
466c97d06f | ||
|
|
dd57a9afbd | ||
|
|
624c560aef | ||
|
|
4c8936706a | ||
|
|
d84eac20a4 | ||
|
|
04fc1e2dbb | ||
|
|
919bf9a378 | ||
|
|
a235249f57 | ||
|
|
aa0fe18bf6 | ||
|
|
2195d19f25 | ||
|
|
1cc02b548c | ||
|
|
71f1a35b44 | ||
|
|
51e23ec3ec | ||
|
|
7efe1a42a3 | ||
|
|
33ceea2f40 | ||
|
|
40d637742e | ||
|
|
7e90cf5cd5 | ||
|
|
f8125547e5 | ||
|
|
02bed5f5f0 | ||
|
|
bd33a3a38b | ||
|
|
87fb5d176d | ||
|
|
caaac4cbd9 | ||
|
|
b63e1c0ed8 | ||
|
|
dd1d2c1be6 | ||
|
|
eb0114a628 | ||
|
|
bfa4bbe20a | ||
|
|
87b27b3418 | ||
|
|
f7be0781d9 | ||
|
|
3ac05002f0 | ||
|
|
22e2154d7e | ||
|
|
c2689dc7a5 | ||
|
|
c470f348c4 | ||
|
|
077acc6880 | ||
|
|
211ab6b8be | ||
|
|
50df6e53d0 | ||
|
|
05615e643d | ||
|
|
b325c826e4 | ||
|
|
22ea75c91f | ||
|
|
fc47eac67f | ||
|
|
5e27a1f850 | ||
|
|
cc6cebb094 | ||
|
|
4cf9c797ce | ||
|
|
206ee15e1f | ||
|
|
ed8df2e026 | ||
|
|
3906994ec4 | ||
|
|
21adbe6a1e | ||
|
|
c5d8e8b3c7 | ||
|
|
134b5c6bb6 | ||
|
|
d18f028de7 | ||
|
|
f1ca4e520d | ||
|
|
11c23767fb | ||
|
|
b9dfad3516 | ||
|
|
326ebb7607 | ||
|
|
c728df6a80 | ||
|
|
a692b244eb | ||
|
|
c08e0e6db3 | ||
|
|
1215590f90 | ||
|
|
d863f8f2fe | ||
|
|
09672ef3ee | ||
|
|
76f5ae99ab | ||
|
|
222e626ff2 | ||
|
|
8d9c8259af | ||
|
|
522bef87f9 | ||
|
|
dfe6f6b1c1 | ||
|
|
09ad04bf1a | ||
|
|
0605f7e6d8 | ||
|
|
a5a0daffa2 | ||
|
|
c6a7d713d1 | ||
|
|
e451732de7 | ||
|
|
5c2dd33dff | ||
|
|
a3d5595519 | ||
|
|
a8207ceeae | ||
|
|
c77c68b9f6 | ||
|
|
3dfadf7da1 | ||
|
|
f84b9c5406 | ||
|
|
3ceb3c73ff | ||
|
|
597b140a6c | ||
|
|
cbc8ec5944 | ||
|
|
047bf70ef8 | ||
|
|
23e010f203 | ||
|
|
55026dec85 | ||
|
|
46826b2d17 | ||
|
|
138cd60d30 | ||
|
|
bb3c954a59 | ||
|
|
14c94d5deb | ||
|
|
4d4f33ed90 | ||
|
|
d502c0acb1 | ||
|
|
ae8b343156 | ||
|
|
170f7d680e | ||
|
|
3a3269901a | ||
|
|
636559b5af | ||
|
|
2b45093c2c | ||
|
|
4a5c9ea8c5 | ||
|
|
c4cb02f731 | ||
|
|
c928f762f9 | ||
|
|
67f32a7cc8 | ||
|
|
12993efb3a | ||
|
|
c1890b2a4d | ||
|
|
c476167ea1 | ||
|
|
2aa6ae455c | ||
|
|
eae038b006 | ||
|
|
82c4111733 | ||
|
|
8746ad9623 | ||
|
|
03dca0c4ed | ||
|
|
7a548f6259 | ||
|
|
0502bd9416 | ||
|
|
c937f769c6 |
7
.editorconfig
Normal file
7
.editorconfig
Normal file
@@ -0,0 +1,7 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
indent_style = tab
|
||||
charset = utf-8
|
||||
142
.github/workflows/ballfield.yml
vendored
Normal file
142
.github/workflows/ballfield.yml
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
# Copyright (C) 2021-2021 Sergii Pylypenko <x.pelya.x@gmail.com>
|
||||
#
|
||||
# This software is provided 'as-is', without any express or implied
|
||||
# warranty. In no event will the authors be held liable for any damages
|
||||
# arising from the use of this software.
|
||||
#
|
||||
# Permission is granted to anyone to use this software for any purpose,
|
||||
# including commercial applications, and to alter it and redistribute it
|
||||
# freely, subject to the following restrictions:
|
||||
#
|
||||
# 1. The origin of this software must not be misrepresented; you must not
|
||||
# claim that you wrote the original software. If you use this software
|
||||
# in a product, an acknowledgment in the product documentation would be
|
||||
# appreciated but is not required.
|
||||
# 2. Altered source versions must be plainly marked as such, and must not be
|
||||
# misrepresented as being the original software.
|
||||
# 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
name: ballfield
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
tags:
|
||||
- '*'
|
||||
pull_request: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
env:
|
||||
APP_NAME: ballfield
|
||||
# It takes one hour per one architecture to build Boost and ICU libraries, and Github limits CI script duration to 6 hours
|
||||
ARCH_LIST: armeabi-v7a arm64-v8a x86 x86_64
|
||||
ANDROID_BUILD_TOOLS: 33.0.2
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: 'read'
|
||||
id-token: 'write'
|
||||
|
||||
steps:
|
||||
- name: Java 17
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: 17
|
||||
distribution: temurin
|
||||
|
||||
- name: Check out the repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
submodules: false
|
||||
|
||||
- name: Check out submodules
|
||||
# There are many more submodules in this repo, we don't need them all
|
||||
run: >
|
||||
git submodule update --init --recursive --depth=1
|
||||
project/jni/boost/src project/jni/iconv/src
|
||||
project/jni/sdl2 project/jni/sdl2_image
|
||||
project/jni/sdl2_mixer project/jni/sdl2_ttf
|
||||
|
||||
- name: Symlink the application dir
|
||||
run: |
|
||||
ln -s ${APP_NAME} project/jni/application/src
|
||||
|
||||
- name: Set architectures list
|
||||
run: |
|
||||
sed -i "s/MultiABI=.*/MultiABI='${ARCH_LIST}'/g" project/jni/application/src/AndroidAppSettings.cfg
|
||||
|
||||
- name: Patch Java files and build Boost, ICU, and OpenSSL
|
||||
run: |
|
||||
export PATH=$ANDROID_NDK_LATEST_HOME:$PATH
|
||||
./changeAppSettings.sh
|
||||
|
||||
- name: Set up Gradle and Android SDK licenses
|
||||
working-directory: project
|
||||
run: |
|
||||
for Y in `seq 20`; do echo y; done | sudo $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses
|
||||
./gradlew assembleRelease || true
|
||||
for Y in `seq 20`; do echo y; done | sudo $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses --sdk_root=`pwd`
|
||||
mkdir -p $HOME/.android
|
||||
keytool -genkey -v -keystore $HOME/.android/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Debug, OU=Debug, O=Debug, L=Debug, ST=Debug, C=Debug"
|
||||
echo "sdk.dir=$ANDROID_SDK_ROOT" > local.properties
|
||||
echo "proguard.config=proguard.cfg;proguard-local.cfg" >> local.properties
|
||||
|
||||
- name: Hyper turbo build script GOOOOOOOOOOOO
|
||||
run: |
|
||||
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS:$PATH
|
||||
./build.sh
|
||||
|
||||
- name: App signing keys
|
||||
run: |
|
||||
echo "$ANDROID_KEYSTORE_B64" | base64 -d > keystore.jks || true
|
||||
echo "$ANDROID_UPLOAD_KEYSTORE_B64" | base64 -d > upload_keystore.jks || true
|
||||
find keystore.jks -empty -delete || true
|
||||
find upload_keystore.jks -empty -delete || true
|
||||
env:
|
||||
ANDROID_KEYSTORE_B64: "${{secrets.ANDROID_KEYSTORE_B64}}"
|
||||
ANDROID_UPLOAD_KEYSTORE_B64: "${{secrets.ANDROID_UPLOAD_KEYSTORE_B64}}"
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS:$PATH
|
||||
if [ -e keystore.jks ]; then
|
||||
export ANDROID_KEYSTORE_FILE=`pwd`/keystore.jks
|
||||
fi
|
||||
if [ -e upload_keystore.jks ]; then
|
||||
export ANDROID_UPLOAD_KEYSTORE_FILE=`pwd`/upload_keystore.jks
|
||||
fi
|
||||
mkdir -p upload/
|
||||
./sign.sh
|
||||
mv *.apk upload/
|
||||
./signBundle.sh
|
||||
mv *.aab upload/
|
||||
env:
|
||||
ANDROID_KEYSTORE_PASS: "${{secrets.ANDROID_KEYSTORE_PASS}}"
|
||||
ANDROID_KEYSTORE_ALIAS: "${{secrets.ANDROID_KEYSTORE_ALIAS}}"
|
||||
ANDROID_UPLOAD_KEYSTORE_PASS: "${{secrets.ANDROID_UPLOAD_KEYSTORE_PASS}}"
|
||||
ANDROID_UPLOAD_KEYSTORE_ALIAS: "${{secrets.ANDROID_UPLOAD_KEYSTORE_ALIAS}}"
|
||||
|
||||
# Github actions is dumb and won't let you download single files from artifacts, so break up the artifacts instead
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{env.APP_NAME}}
|
||||
path: upload
|
||||
if-no-files-found: error
|
||||
|
||||
- uses: r0adkll/upload-google-play@v1
|
||||
continue-on-error: true
|
||||
with:
|
||||
serviceAccountJsonPlainText: ${{secrets.SERVICE_ACCOUNT_JSON}}
|
||||
packageName: net.olofson.ballfield
|
||||
releaseFiles: upload/*.aab
|
||||
#track: beta
|
||||
track: production
|
||||
status: completed
|
||||
# inAppUpdatePriority: 2
|
||||
# userFraction: 1
|
||||
# whatsNewDirectory: distribution/whatsnew
|
||||
# mappingFile: app/build/outputs/mapping/release/mapping.txt
|
||||
# debugSymbols: app/intermediates/merged_native_libs/release/out/lib
|
||||
160
.github/workflows/openttd.yml
vendored
Normal file
160
.github/workflows/openttd.yml
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
# Copyright (C) 2021-2021 Sergii Pylypenko <x.pelya.x@gmail.com>
|
||||
#
|
||||
# This software is provided 'as-is', without any express or implied
|
||||
# warranty. In no event will the authors be held liable for any damages
|
||||
# arising from the use of this software.
|
||||
#
|
||||
# Permission is granted to anyone to use this software for any purpose,
|
||||
# including commercial applications, and to alter it and redistribute it
|
||||
# freely, subject to the following restrictions:
|
||||
#
|
||||
# 1. The origin of this software must not be misrepresented; you must not
|
||||
# claim that you wrote the original software. If you use this software
|
||||
# in a product, an acknowledgment in the product documentation would be
|
||||
# appreciated but is not required.
|
||||
# 2. Altered source versions must be plainly marked as such, and must not be
|
||||
# misrepresented as being the original software.
|
||||
# 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
name: openttd
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
tags:
|
||||
- '*'
|
||||
pull_request: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
env:
|
||||
APP_NAME: openttd
|
||||
# It takes one hour per one architecture to build Boost and ICU libraries, and Github limits CI script duration to 6 hours
|
||||
ARCH_LIST: armeabi-v7a arm64-v8a x86 x86_64
|
||||
ANDROID_BUILD_TOOLS: 33.0.2
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Java 17
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: 17
|
||||
distribution: temurin
|
||||
|
||||
- name: Check out the repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
submodules: false
|
||||
|
||||
- name: Check out submodules
|
||||
# There are many more submodules in this repo, we don't need them all
|
||||
run: >
|
||||
git submodule update --init --recursive --depth=1
|
||||
project/jni/application/${APP_NAME}
|
||||
project/jni/boost/src project/jni/iconv/src
|
||||
project/jni/sdl2 project/jni/sdl2_image
|
||||
project/jni/sdl2_mixer project/jni/sdl2_ttf
|
||||
|
||||
- name: Symlink the application dir
|
||||
run: |
|
||||
ln -s ${APP_NAME} project/jni/application/src
|
||||
|
||||
- name: Set architectures list
|
||||
run: |
|
||||
sed -i "s/MultiABI=.*/MultiABI='${ARCH_LIST}'/g" project/jni/application/src/AndroidAppSettings.cfg
|
||||
|
||||
- name: Get ICU revision
|
||||
id: icu-rev
|
||||
run: echo "ICU_REV=`git -C project/jni/iconv/src rev-parse HEAD`::`echo ${ARCH_LIST} | sed 's/ /:/g'`" >> $GITHUB_ENV
|
||||
|
||||
- name: Copy ICU libraries from cache
|
||||
uses: actions/cache@v2
|
||||
id: cache-icu
|
||||
with:
|
||||
# The same SDL revision will produce the same libraries
|
||||
key: ${{env.ICU_REV}}
|
||||
path: |
|
||||
project/jni/iconv/include
|
||||
project/jni/iconv/lib
|
||||
project/jni/icuuc/include
|
||||
project/jni/icuuc/lib
|
||||
project/jni/icuuc/share/icu
|
||||
|
||||
- name: Touch cached ICU timestamps
|
||||
if: steps.cache-icu.outputs.cache-hit == 'true'
|
||||
run: touch project/jni/iconv/lib/*/* project/jni/icuuc/lib/*/* project/jni/icuuc/share/icu/*/* || true
|
||||
|
||||
- name: Patch Java files and build Boost, ICU, and OpenSSL
|
||||
run: |
|
||||
export PATH=$ANDROID_NDK_LATEST_HOME:$PATH
|
||||
./changeAppSettings.sh
|
||||
|
||||
- name: Set up Gradle and Android SDK licenses
|
||||
working-directory: project
|
||||
run: |
|
||||
for Y in `seq 20`; do echo y; done | sudo $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses
|
||||
./gradlew assembleRelease || true
|
||||
for Y in `seq 20`; do echo y; done | sudo $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses --sdk_root=`pwd`
|
||||
mkdir -p $HOME/.android
|
||||
keytool -genkey -v -keystore $HOME/.android/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Debug, OU=Debug, O=Debug, L=Debug, ST=Debug, C=Debug"
|
||||
echo "sdk.dir=$ANDROID_SDK_ROOT" > local.properties
|
||||
echo "proguard.config=proguard.cfg;proguard-local.cfg" >> local.properties
|
||||
|
||||
- name: Hyper turbo build script GOOOOOOOOOOOO
|
||||
run: |
|
||||
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS:$PATH
|
||||
./build.sh
|
||||
|
||||
- name: App signing keys
|
||||
run: |
|
||||
echo "$ANDROID_KEYSTORE_B64" | base64 -d > keystore.jks || true
|
||||
echo "$ANDROID_UPLOAD_KEYSTORE_B64" | base64 -d > upload_keystore.jks || true
|
||||
find keystore.jks -empty -delete || true
|
||||
find upload_keystore.jks -empty -delete || true
|
||||
env:
|
||||
ANDROID_KEYSTORE_B64: "${{secrets.ANDROID_KEYSTORE_B64}}"
|
||||
ANDROID_UPLOAD_KEYSTORE_B64: "${{secrets.ANDROID_UPLOAD_KEYSTORE_B64}}"
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS:$PATH
|
||||
if [ -e keystore.jks ]; then
|
||||
export ANDROID_KEYSTORE_FILE=`pwd`/keystore.jks
|
||||
fi
|
||||
if [ -e upload_keystore.jks ]; then
|
||||
export ANDROID_UPLOAD_KEYSTORE_FILE=`pwd`/upload_keystore.jks
|
||||
fi
|
||||
mkdir -p upload/
|
||||
./sign.sh
|
||||
mv *.apk upload/
|
||||
./signBundle.sh
|
||||
mv *.aab upload/
|
||||
env:
|
||||
ANDROID_KEYSTORE_PASS: "${{secrets.ANDROID_KEYSTORE_PASS}}"
|
||||
ANDROID_KEYSTORE_ALIAS: "${{secrets.ANDROID_KEYSTORE_ALIAS}}"
|
||||
ANDROID_UPLOAD_KEYSTORE_PASS: "${{secrets.ANDROID_UPLOAD_KEYSTORE_PASS}}"
|
||||
ANDROID_UPLOAD_KEYSTORE_ALIAS: "${{secrets.ANDROID_UPLOAD_KEYSTORE_ALIAS}}"
|
||||
|
||||
# Github actions is dumb and won't let you download single files from artifacts, so break up the artifacts instead
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{env.APP_NAME}}
|
||||
path: upload
|
||||
if-no-files-found: error
|
||||
|
||||
- uses: r0adkll/upload-google-play@v1
|
||||
continue-on-error: true
|
||||
with:
|
||||
serviceAccountJsonPlainText: ${{secrets.SERVICE_ACCOUNT_JSON}}
|
||||
packageName: org.openttd.sdl
|
||||
releaseFiles: upload/*.aab
|
||||
track: beta
|
||||
#track: production
|
||||
status: completed
|
||||
# inAppUpdatePriority: 2
|
||||
# userFraction: 1
|
||||
# whatsNewDirectory: distribution/whatsnew
|
||||
# mappingFile: app/build/outputs/mapping/release/mapping.txt
|
||||
# debugSymbols: app/intermediates/merged_native_libs/release/out/lib
|
||||
123
.github/workflows/sdl2-demo.yml
vendored
Normal file
123
.github/workflows/sdl2-demo.yml
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
# Copyright (C) 2021-2021 Sergii Pylypenko <x.pelya.x@gmail.com>
|
||||
#
|
||||
# This software is provided 'as-is', without any express or implied
|
||||
# warranty. In no event will the authors be held liable for any damages
|
||||
# arising from the use of this software.
|
||||
#
|
||||
# Permission is granted to anyone to use this software for any purpose,
|
||||
# including commercial applications, and to alter it and redistribute it
|
||||
# freely, subject to the following restrictions:
|
||||
#
|
||||
# 1. The origin of this software must not be misrepresented; you must not
|
||||
# claim that you wrote the original software. If you use this software
|
||||
# in a product, an acknowledgment in the product documentation would be
|
||||
# appreciated but is not required.
|
||||
# 2. Altered source versions must be plainly marked as such, and must not be
|
||||
# misrepresented as being the original software.
|
||||
# 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
name: sdl2-demo
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
tags:
|
||||
- '*'
|
||||
pull_request: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
env:
|
||||
APP_NAME: sdl2-demo
|
||||
# It takes one hour per one architecture to build Boost and ICU libraries, and Github limits CI script duration to 6 hours
|
||||
ARCH_LIST: armeabi-v7a arm64-v8a x86 x86_64
|
||||
ANDROID_BUILD_TOOLS: 33.0.2
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Java 17
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: 17
|
||||
distribution: temurin
|
||||
|
||||
- name: Check out the repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 1
|
||||
submodules: false
|
||||
|
||||
- name: Check out submodules
|
||||
# There are many more submodules in this repo, we don't need them all
|
||||
run: >
|
||||
git submodule update --init --recursive --depth=1
|
||||
project/jni/boost/src project/jni/iconv/src
|
||||
project/jni/sdl2 project/jni/sdl2_image
|
||||
project/jni/sdl2_mixer project/jni/sdl2_ttf
|
||||
|
||||
- name: Symlink the application dir
|
||||
run: |
|
||||
ln -s ${APP_NAME} project/jni/application/src
|
||||
|
||||
- name: Set architectures list
|
||||
run: |
|
||||
sed -i "s/MultiABI=.*/MultiABI='${ARCH_LIST}'/g" project/jni/application/src/AndroidAppSettings.cfg
|
||||
|
||||
- name: Patch Java files and build Boost, ICU, and OpenSSL
|
||||
run: |
|
||||
export PATH=$ANDROID_NDK_LATEST_HOME:$PATH
|
||||
./changeAppSettings.sh
|
||||
|
||||
- name: Set up Gradle and Android SDK licenses
|
||||
working-directory: project
|
||||
run: |
|
||||
for Y in `seq 20`; do echo y; done | sudo $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses
|
||||
./gradlew assembleRelease || true
|
||||
for Y in `seq 20`; do echo y; done | sudo $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses --sdk_root=`pwd`
|
||||
mkdir -p $HOME/.android
|
||||
keytool -genkey -v -keystore $HOME/.android/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Debug, OU=Debug, O=Debug, L=Debug, ST=Debug, C=Debug"
|
||||
echo "sdk.dir=$ANDROID_SDK_ROOT" > local.properties
|
||||
echo "proguard.config=proguard.cfg;proguard-local.cfg" >> local.properties
|
||||
|
||||
- name: Hyper turbo build script GOOOOOOOOOOOO
|
||||
run: |
|
||||
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS:$PATH
|
||||
./build.sh
|
||||
|
||||
- name: App signing keys
|
||||
run: |
|
||||
echo "$ANDROID_KEYSTORE_B64" | base64 -d > keystore.jks || true
|
||||
echo "$ANDROID_UPLOAD_KEYSTORE_B64" | base64 -d > upload_keystore.jks || true
|
||||
find keystore.jks -empty -delete || true
|
||||
find upload_keystore.jks -empty -delete || true
|
||||
env:
|
||||
ANDROID_KEYSTORE_B64: "${{secrets.ANDROID_KEYSTORE_B64}}"
|
||||
ANDROID_UPLOAD_KEYSTORE_B64: "${{secrets.ANDROID_UPLOAD_KEYSTORE_B64}}"
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS:$PATH
|
||||
if [ -e keystore.jks ]; then
|
||||
export ANDROID_KEYSTORE_FILE=`pwd`/keystore.jks
|
||||
fi
|
||||
if [ -e upload_keystore.jks ]; then
|
||||
export ANDROID_UPLOAD_KEYSTORE_FILE=`pwd`/upload_keystore.jks
|
||||
fi
|
||||
mkdir -p upload/
|
||||
./sign.sh
|
||||
mv *.apk upload/
|
||||
./signBundle.sh
|
||||
mv *.aab upload/
|
||||
env:
|
||||
ANDROID_KEYSTORE_PASS: "${{secrets.ANDROID_KEYSTORE_PASS}}"
|
||||
ANDROID_KEYSTORE_ALIAS: "${{secrets.ANDROID_KEYSTORE_ALIAS}}"
|
||||
ANDROID_UPLOAD_KEYSTORE_PASS: "${{secrets.ANDROID_UPLOAD_KEYSTORE_PASS}}"
|
||||
ANDROID_UPLOAD_KEYSTORE_ALIAS: "${{secrets.ANDROID_UPLOAD_KEYSTORE_ALIAS}}"
|
||||
|
||||
# Github actions is dumb and won't let you download single files from artifacts, so break up the artifacts instead
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{env.APP_NAME}}
|
||||
path: upload
|
||||
if-no-files-found: error
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -23,3 +23,4 @@
|
||||
/project/app/build.gradle
|
||||
/project/app/.gradle
|
||||
/project/app/build
|
||||
/project/assetpack/build
|
||||
|
||||
95
.gitmodules
vendored
95
.gitmodules
vendored
@@ -1,38 +1,3 @@
|
||||
[submodule "project/jni/application/NewRAW"]
|
||||
path = project/jni/application/NewRAW
|
||||
url = https://github.com/usineur/android-newraw.git
|
||||
[submodule "project/jni/boost/src"]
|
||||
path = project/jni/boost/src
|
||||
url = https://github.com/moritz-wundke/Boost-for-Android.git
|
||||
branch = master
|
||||
update = merge
|
||||
[submodule "project/jni/application/commandergenius/commandergenius"]
|
||||
path = project/jni/application/commandergenius/commandergenius
|
||||
url = https://github.com/gerstrong/Commander-Genius.git
|
||||
[submodule "project/jni/application/openarena/engine"]
|
||||
path = project/jni/application/openarena/engine
|
||||
url = https://github.com/pelya/openarena-engine.git
|
||||
[submodule "project/jni/application/openarena/vm"]
|
||||
path = project/jni/application/openarena/vm
|
||||
url = https://github.com/pelya/openarena-vm
|
||||
[submodule "project/jni/application/teeworlds/src"]
|
||||
path = project/jni/application/teeworlds/src
|
||||
url = https://github.com/pelya/teeworlds.git
|
||||
[submodule "project/jni/application/xserver/xserver"]
|
||||
path = project/jni/application/xserver/xserver
|
||||
url = https://github.com/pelya/xserver.git
|
||||
branch = xsdl-1.20
|
||||
update = merge
|
||||
[submodule "android-shmem"]
|
||||
path = project/jni/shmem
|
||||
url = https://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 = https://github.com/pelya/android-keyboard-gadget.git
|
||||
branch = master
|
||||
update = merge
|
||||
[submodule "project/jni/iconv/src"]
|
||||
path = project/jni/iconv/src
|
||||
url = https://github.com/pelya/libiconv-libicu-android.git
|
||||
@@ -40,47 +5,21 @@
|
||||
update = merge
|
||||
[submodule "project/jni/application/openttd/src"]
|
||||
path = project/jni/application/openttd/src
|
||||
url = https://github.com/pelya/openttd-android.git
|
||||
branch = 1.10
|
||||
[submodule "project/jni/application/uae4all2"]
|
||||
path = project/jni/application/uae4all2
|
||||
url = https://github.com/lubomyr/uae4all2.git
|
||||
[submodule "project/jni/application/basiliskii/basiliskii"]
|
||||
path = project/jni/application/basiliskii/basiliskii
|
||||
url = https://github.com/pelya/BasiliskII-android.git
|
||||
[submodule "project/jni/vncserver/src"]
|
||||
path = project/jni/vncserver/src
|
||||
url = https://github.com/LibVNC/libvncserver.git
|
||||
[submodule "project/jni/application/vice/vice"]
|
||||
path = project/jni/application/vice/vice
|
||||
url = https://github.com/lubomyr/vice-2.4.git
|
||||
[submodule "project/jni/application/xserver/pulseaudio"]
|
||||
path = project/jni/application/xserver/pulseaudio
|
||||
url = https://github.com/pelya/pulseaudio-android.git
|
||||
branch = master
|
||||
[submodule "project/jni/application/supertux/supertux"]
|
||||
path = project/jni/application/supertux/supertux
|
||||
url = https://github.com/pelya/supertux.git
|
||||
[submodule "project/jni/application/fheroes2/fheroes2"]
|
||||
path = project/jni/application/fheroes2/fheroes2
|
||||
url = https://github.com/gerstrong/fheroes2plus.git
|
||||
[submodule "project/jni/application/ninslash/src"]
|
||||
path = project/jni/application/ninslash/src
|
||||
url = https://github.com/pelya/Ninslash.git
|
||||
branch = master
|
||||
update = merge
|
||||
[submodule "project/jni/application/openttd-jgrpp/src"]
|
||||
path = project/jni/application/openttd-jgrpp/src
|
||||
url = https://github.com/pelya/OpenTTD-JGR-patchpack.git
|
||||
branch = android-desktop
|
||||
[submodule "project/jni/application/liero/src"]
|
||||
path = project/jni/application/liero/src
|
||||
url = https://github.com/pelya/liero-android.git
|
||||
[submodule "project/jni/application/openlierox/src"]
|
||||
path = project/jni/application/openlierox/src
|
||||
url = https://github.com/albertz/openlierox.git
|
||||
branch = half-assed-android-port
|
||||
[submodule "project/jni/application/xserver-debian/debian-image"]
|
||||
path = project/jni/application/xserver-debian/debian-image
|
||||
url = https://github.com/pelya/debian-noroot
|
||||
url = https://github.com/n-ice-community/openttd-android.git
|
||||
branch = 14
|
||||
[submodule "project/jni/sdl2"]
|
||||
path = project/jni/sdl2
|
||||
url = https://github.com/libsdl-org/SDL.git
|
||||
branch = main
|
||||
[submodule "project/jni/sdl2_image"]
|
||||
path = project/jni/sdl2_image
|
||||
url = https://github.com/libsdl-org/SDL_image
|
||||
branch = main
|
||||
[submodule "project/jni/sdl2_ttf"]
|
||||
path = project/jni/sdl2_ttf
|
||||
url = https://github.com/libsdl-org/SDL_ttf.git
|
||||
branch = main
|
||||
[submodule "project/jni/sdl2_mixer"]
|
||||
path = project/jni/sdl2_mixer
|
||||
url = https://github.com/libsdl-org/SDL_mixer.git
|
||||
branch = master
|
||||
|
||||
282
build.sh
282
build.sh
@@ -1,34 +1,50 @@
|
||||
#!/bin/sh
|
||||
#set -eu # Bashism, does not work with default shell on Ubuntu 12.04
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Handle any error or die
|
||||
set -e
|
||||
|
||||
THIS_BUILD_DIR=$(dirname "$0")
|
||||
install_apk=false
|
||||
run_apk=false
|
||||
sign_apk=false
|
||||
sign_bundle=false
|
||||
build_release=true
|
||||
quick_rebuild=false
|
||||
QUICK_REBUILD_ARGS=
|
||||
do_zipalign=true
|
||||
named_variant=""
|
||||
base_app_name=""
|
||||
|
||||
if [ "$#" -gt 0 -a "$1" = "-s" ]; then
|
||||
shift
|
||||
sign_apk=true
|
||||
# Fix Gradle compilation error
|
||||
if [ -z "$ANDROID_NDK_HOME" ]; then
|
||||
export ANDROID_NDK_HOME="$(which ndk-build | sed 's@/ndk-build@@')"
|
||||
fi
|
||||
[ -z "$ANDROID_SDK_ROOT" ] && ANDROID_SDK_ROOT="$ANDROID_HOME"
|
||||
|
||||
if [ "$#" -gt 0 -a "$1" = "-i" ]; then
|
||||
shift
|
||||
install_apk=true
|
||||
fi
|
||||
|
||||
if [ "$#" -gt 0 -a "$1" = "-r" ]; then
|
||||
shift
|
||||
install_apk=true
|
||||
run_apk=true
|
||||
fi
|
||||
|
||||
if [ "$#" -gt 0 -a "$1" = "-q" ]; then
|
||||
shift
|
||||
quick_rebuild=true
|
||||
QUICK_REBUILD_ARGS=APP_ABI=armeabi-v7a
|
||||
fi
|
||||
while getopts "sirqbhzv:" OPT
|
||||
do
|
||||
case $OPT in
|
||||
s) sign_apk=true;;
|
||||
i) install_apk=true;;
|
||||
r) install_apk=true ; run_apk=true;;
|
||||
q) echo "Quick rebuild does not work anymore with Gradle!";;
|
||||
b) sign_bundle=true;;
|
||||
z) do_zipalign=false;;
|
||||
v) named_variant=${OPTARG};;
|
||||
h)
|
||||
echo "Usage: $0 [-s] [-i] [-r] [-q] [debug|release] [app-name]"
|
||||
echo " -s: sign .apk file after building"
|
||||
echo " -b: sign .aab app bundle file after building"
|
||||
echo " -i: install APK file to device after building"
|
||||
echo " -r: run APK file on device after building"
|
||||
echo " -z: skip zipalign and apksigner"
|
||||
echo " -v <v>: choose variant, either sdl or fdroid"
|
||||
echo " debug: build debug package"
|
||||
echo " release: build release package (default)"
|
||||
echo " app-name: directory under project/jni/application to be compiled"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $(expr $OPTIND - 1)
|
||||
|
||||
if [ "$#" -gt 0 -a "$1" = "release" ]; then
|
||||
shift
|
||||
@@ -41,7 +57,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,51 +65,56 @@ if [ "$#" -gt 0 -a "$1" '!=' "-h" ]; then
|
||||
else
|
||||
echo "Error: no app $1 under project/jni/application"
|
||||
echo "Available applications:"
|
||||
cd project/jni/application
|
||||
pushd project/jni/application
|
||||
for f in *; do
|
||||
if [ -e "$f/AndroidAppSettings.cfg" ]; then
|
||||
echo "$f"
|
||||
fi
|
||||
done
|
||||
popd
|
||||
exit 1
|
||||
fi
|
||||
shift
|
||||
fi
|
||||
|
||||
if [ "$#" -gt 0 -a "$1" = "-h" ]; then
|
||||
echo "Usage: $0 [-s] [-i] [-r] [-q] [debug|release] [app-name]"
|
||||
echo " -s: sign APK file after building"
|
||||
echo " -i: install APK file to device after building"
|
||||
echo " -r: run APK file on device after building"
|
||||
echo " -q: quick-rebuild C code, without rebuilding Java files"
|
||||
echo " debug: build debug package"
|
||||
echo " release: build release package (default)"
|
||||
echo " app-name: directory under project/jni/application to be compiled"
|
||||
exit 0
|
||||
fi
|
||||
base_app_name=$(grep -Po 'AppFullName\=\K[[:alnum:].]+\.(?=[[:alnum:]]+)' AndroidAppSettings.cfg)
|
||||
[ -z "${named_variant}" ] && named_variant=$(grep -Po 'AppFullName\=\K[[:alnum:].]+' AndroidAppSettings.cfg | grep -Po '[[:alnum:]]+$')
|
||||
|
||||
NDK_TOOLCHAIN_VERSION=$GCCVER
|
||||
[ -z "$NDK_TOOLCHAIN_VERSION" ] && NDK_TOOLCHAIN_VERSION=4.9
|
||||
function project_needs_setup {
|
||||
local app_name=$(grep -Po 'AppFullName\=\K[.[:alnum:]]+' AndroidAppSettings.cfg)
|
||||
|
||||
# Set here your own NDK path if needed
|
||||
# export PATH=$PATH:~/src/endless_space/android-ndk-r7
|
||||
NDKBUILDPATH=$PATH
|
||||
export `grep "AppFullName=" AndroidAppSettings.cfg`
|
||||
if [ -e project/local.properties ] && \
|
||||
( grep "package $AppFullName;" project/src/Globals.java > /dev/null 2>&1 && \
|
||||
[ "`readlink AndroidAppSettings.cfg`" -ot "project/src/Globals.java" ] && \
|
||||
[ -z "`find project/java/* project/AndroidManifestTemplate.xml -cnewer project/src/Globals.java`" ] ) ; then true ; else
|
||||
./changeAppSettings.sh -a || exit 1
|
||||
if [ -z "${base_app_name}" ]; then
|
||||
echo "Could not determine App base name";
|
||||
exit 2
|
||||
fi
|
||||
|
||||
[ ! -e project/local.properties ] || \
|
||||
! grep -q "package ${app_name};" project/src/Globals.java || \
|
||||
! grep -q "package ${base_app_name}${named_variant};" project/src/Globals.java || \
|
||||
[ "$(readlink AndroidAppSettings.cfg)" -nt "project/src/Globals.java" ] || \
|
||||
[ -n "$(find project/java/* \
|
||||
project/javaSDL2/* \
|
||||
project/jni/sdl2/android-project/app/src/main/java/org/libsdl/app/* \
|
||||
project/AndroidManifestTemplate.xml \
|
||||
-cnewer \
|
||||
project/src/Globals.java \
|
||||
)" \
|
||||
]
|
||||
}
|
||||
|
||||
if project_needs_setup;
|
||||
then
|
||||
APP_FULL_NAME="${base_app_name}${named_variant}" ./changeAppSettings.sh -a
|
||||
sleep 1
|
||||
touch project/src/Globals.java
|
||||
fi
|
||||
|
||||
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
|
||||
@@ -102,92 +123,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 && \
|
||||
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\\|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
|
||||
return 0
|
||||
}
|
||||
if [ -x project/jni/application/src/AndroidPreBuild.sh ]; then
|
||||
pushd project/jni/application/src
|
||||
./AndroidPreBuild.sh
|
||||
popd
|
||||
fi
|
||||
|
||||
# Fix Gradle compilation error
|
||||
[ -z "$ANDROID_NDK_HOME" ] && export ANDROID_NDK_HOME="`which ndk-build | sed 's@/ndk-build@@'`"
|
||||
if grep -q 'CustomBuildScript=y' ./AndroidAppSettings.cfg; then
|
||||
NDK_LOG=1 ${ANDROID_NDK_HOME}/ndk-build -C project -j$NCPU V=1 CUSTOM_BUILD_SCRIPT_FIRST_PASS=1 NDK_APP_STRIP_MODE=none
|
||||
make -C project/jni/application -f CustomBuildScript.mk
|
||||
fi
|
||||
|
||||
cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU ndk-build -j$NCPU V=1 $QUICK_REBUILD_ARGS && \
|
||||
strip_libs && \
|
||||
cd .. && ./copyAssets.sh && cd project && \
|
||||
{ if $build_release ; then \
|
||||
$quick_rebuild && { \
|
||||
zip -u -r app/build/outputs/apk/release/app-release-unsigned.apk lib assets || exit 1 ; \
|
||||
} || ./gradlew assembleRelease || exit 1 ; \
|
||||
[ '!' -x jni/application/src/AndroidPostBuild.sh ] || {
|
||||
cd jni/application/src ; \
|
||||
./AndroidPostBuild.sh `pwd`/../../../app/build/outputs/apk/release/app-release-unsigned.apk || exit 1 ; \
|
||||
cd ../../.. ; \
|
||||
} || exit 1 ; \
|
||||
../copyAssets.sh pack-binaries app/build/outputs/apk/release/app-release-unsigned.apk ; \
|
||||
rm -f app/build/outputs/apk/release/app-release.apk ; \
|
||||
zipalign 4 app/build/outputs/apk/release/app-release-unsigned.apk app/build/outputs/apk/release/app-release.apk || exit 1 ; \
|
||||
apksigner sign --ks ~/.android/debug.keystore --ks-key-alias androiddebugkey --ks-pass pass:android app/build/outputs/apk/release/app-release.apk || exit 1 ; \
|
||||
else \
|
||||
./gradlew assembleDebug || exit 1 ; \
|
||||
[ '!' -x jni/application/src/AndroidPostBuild.sh ] || {
|
||||
cd jni/application/src ; \
|
||||
./AndroidPostBuild.sh `pwd`/../../../app/build/outputs/apk/debug/app-debug.apk || exit 1 ; \
|
||||
cd ../../.. ; \
|
||||
} || exit 1 ; \
|
||||
mkdir -p app/build/outputs/apk/release ; \
|
||||
../copyAssets.sh pack-binaries app/build/outputs/apk/debug/app-debug.apk && \
|
||||
rm -f app/build/outputs/apk/release/app-release.apk && \
|
||||
zipalign 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 || exit 1 ; \
|
||||
fi ; } && \
|
||||
{ if $sign_apk; then cd .. && ./sign.sh && cd project ; else true ; fi ; } && \
|
||||
{ $install_apk && [ -n "`adb devices | tail -n +2`" ] && \
|
||||
{ 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 ; } ; \
|
||||
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
|
||||
${ANDROID_NDK_HOME}/ndk-build -C project -j$NCPU V=1 NDK_APP_STRIP_MODE=none
|
||||
./copyAssets.sh
|
||||
pushd project
|
||||
if $build_release ; then
|
||||
if [ -x ./gradlew ]; then
|
||||
./gradlew assembleRelease
|
||||
else
|
||||
gradle assembleRelease
|
||||
fi
|
||||
if [ -x jni/application/src/AndroidPostBuild.sh ]; then
|
||||
pushd jni/application/src
|
||||
./AndroidPostBuild.sh ${THIS_BUILD_DIR}/project/app/build/outputs/apk/release/app-release-unsigned.apk
|
||||
popd
|
||||
fi
|
||||
../copyAssets.sh pack-binaries app/build/outputs/apk/release/app-release-unsigned.apk
|
||||
rm -f app/build/outputs/apk/release/app-release.apk
|
||||
if $do_zipalign; then
|
||||
zipalign -p 4 app/build/outputs/apk/release/app-release-unsigned.apk app/build/outputs/apk/release/app-release.apk
|
||||
apksigner sign --ks ~/.android/debug.keystore --ks-key-alias androiddebugkey --ks-pass pass:android app/build/outputs/apk/release/app-release.apk
|
||||
fi
|
||||
else
|
||||
if [ -x ./gradlew ]; then
|
||||
./gradlew assembleDebug
|
||||
else
|
||||
gradle assembleDebug
|
||||
fi
|
||||
if [ -x jni/application/src/AndroidPostBuild.sh ]; then
|
||||
pushd jni/application/src
|
||||
./AndroidPostBuild.sh ${THIS_BUILD_DIR}/project/app/build/outputs/apk/debug/app-debug.apk
|
||||
popd
|
||||
fi
|
||||
mkdir -p app/build/outputs/apk/release
|
||||
../copyAssets.sh pack-binaries app/build/outputs/apk/debug/app-debug.apk
|
||||
rm -f app/build/outputs/apk/release/app-release.apk
|
||||
if $do_zipalign; then
|
||||
zipalign -p 4 app/build/outputs/apk/debug/app-debug.apk app/build/outputs/apk/release/app-release.apk
|
||||
apksigner sign --ks ~/.android/debug.keystore --ks-key-alias androiddebugkey --ks-pass pass:android app/build/outputs/apk/release/app-release.apk
|
||||
fi
|
||||
fi
|
||||
|
||||
if $sign_apk; then
|
||||
pushd ..
|
||||
./sign.sh
|
||||
popd
|
||||
fi
|
||||
|
||||
if $sign_bundle; then
|
||||
pushd ..
|
||||
./signBundle.sh
|
||||
popd
|
||||
fi
|
||||
if $install_apk && [ -n "$(adb devices | tail -n +2)" ]; then
|
||||
if $sign_apk; then
|
||||
APPNAME=$(grep AppName ../AndroidAppSettings.cfg | sed 's/.*=//' | tr -d '"' | tr " '/" '---')
|
||||
APPVER=$(grep AppVersionName ../AndroidAppSettings.cfg | sed 's/.*=//' | tr -d '"' | tr " '/" '---')
|
||||
adb install -r ../$APPNAME-$APPVER.apk ;
|
||||
else
|
||||
adb install -r app/build/outputs/apk/release/app-release.apk
|
||||
fi
|
||||
fi
|
||||
|
||||
if $run_apk; then
|
||||
ActivityName="$(grep AppFullName ../AndroidAppSettings.cfg | sed 's/.*=//')/.MainActivity"
|
||||
RUN_APK="adb shell am start -n $ActivityName"
|
||||
echo "Running $ActivityName on the USB-connected device:"
|
||||
echo "$RUN_APK"
|
||||
eval $RUN_APK
|
||||
fi
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,36 +3,38 @@
|
||||
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\")"
|
||||
[ -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
|
||||
}
|
||||
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
|
||||
mv lib base/
|
||||
zip -r "$APK" base || exit 1
|
||||
mv base/lib ./
|
||||
rm -rf base
|
||||
else
|
||||
zip -r "$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/
|
||||
rm -rf project/assets/lib
|
||||
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
|
||||
|
||||
1
metadata/en-US/changelogs/1220111.txt
Normal file
1
metadata/en-US/changelogs/1220111.txt
Normal file
@@ -0,0 +1 @@
|
||||
Initial F-Droid release
|
||||
11
metadata/en-US/full_description.txt
Normal file
11
metadata/en-US/full_description.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
NOTE: This is a fork of https://github.com/pelya/openttd-android since development there is on hold currently.
|
||||
|
||||
OpenTTD is an open source reimplementation of the Microprose game Transport Tycoon Deluxe (TTD). As president of a start-up transportation company in (typically) 1950, you have a choice of building rail, road, air and maritime transportation routes to build up your transportation empire. Outsmart your competition by beating them to attractive passenger and commodities routes to become the game's highest-ranking transport company by the year 2050.
|
||||
|
||||
OpenTTD is based on Chris Sawyer's Transport Tycoon Deluxe and introduces a whole set of new features, including multiplayer support, better stations and vehicles, larger maps and a host of other options.
|
||||
|
||||
Posting a full list of features would be futile as it would mean updating this page almost daily, and even then some things might be forgotten. Play with the game to experience all the features yourself, or take a look at the <a href="https://wiki.openttd.org/en/Manual/">Manual</a> for a more thorough listing and explanation of the features and possibilities available.
|
||||
|
||||
Tips:
|
||||
* Scroll the map with two fingers, when you are building roads or stations.
|
||||
* Close dialogs by dragging them to the screen edge.
|
||||
BIN
metadata/en-US/images/icon.png
Normal file
BIN
metadata/en-US/images/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 88 KiB |
BIN
metadata/en-US/images/phoneScreenshots/01.jpg
Normal file
BIN
metadata/en-US/images/phoneScreenshots/01.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 345 KiB |
BIN
metadata/en-US/images/phoneScreenshots/02.jpg
Normal file
BIN
metadata/en-US/images/phoneScreenshots/02.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 224 KiB |
BIN
metadata/en-US/images/phoneScreenshots/03.jpg
Normal file
BIN
metadata/en-US/images/phoneScreenshots/03.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 246 KiB |
BIN
metadata/en-US/images/phoneScreenshots/04.jpg
Normal file
BIN
metadata/en-US/images/phoneScreenshots/04.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 452 KiB |
BIN
metadata/en-US/images/phoneScreenshots/05.jpg
Normal file
BIN
metadata/en-US/images/phoneScreenshots/05.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 315 KiB |
1
metadata/en-US/short_description.txt
Normal file
1
metadata/en-US/short_description.txt
Normal file
@@ -0,0 +1 @@
|
||||
A simulation game based on the popular game "Transport Tycoon Deluxe"
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.package.name"
|
||||
android:versionCode="100"
|
||||
android:versionName="1.0.0"
|
||||
android:installLocation="auto"
|
||||
@@ -14,12 +13,14 @@
|
||||
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" />
|
||||
@@ -43,18 +44,19 @@
|
||||
<!-- ==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"
|
||||
@@ -68,7 +70,7 @@
|
||||
<!-- ==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" android:maxSdkVersion="23" /> <!-- OBB file requires explicit permission before Marshmallow -->
|
||||
<!-- ==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" />
|
||||
|
||||
@@ -1,26 +1,41 @@
|
||||
apply plugin: 'com.android.application'
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion "30.0.0"
|
||||
namespace 'net.olofson.ballfield'
|
||||
compileSdk 33
|
||||
ndkVersion "25.2.9519653"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "net.olofson.ballfield"
|
||||
minSdkVersion 16 // Must match version numbers in project/AndroidManifestTemplate.xml
|
||||
targetSdkVersion 29
|
||||
minSdk 24
|
||||
targetSdk 33
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), '../proguard-local.cfg', '../proguard.cfg'
|
||||
}
|
||||
releaseWithDebugInfo {
|
||||
initWith release
|
||||
ndk {
|
||||
debugSymbolLevel 'FULL'
|
||||
}
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
dependencies { compile 'com.google.android.gms:play-services-games:19.0.0' } // ==GOOGLEPLAYGAMESERVICES==
|
||||
dependencies { compile 'com.google.android.gms:play-services-drive:17.0.0' } // ==GOOGLEPLAYGAMESERVICES==
|
||||
assetPacks = [":assetpack"] // ==ASSETPACK==
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
||||
implementation 'com.google.android.gms:play-services-games:23.1.0' // ==GOOGLEPLAYGAMESERVICES==
|
||||
}
|
||||
|
||||
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
|
||||
@@ -1,25 +1,5 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:4.0.0"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
plugins {
|
||||
id 'com.android.application' version '8.0.1' apply false
|
||||
id 'com.android.library' version '8.0.1' apply false
|
||||
}
|
||||
@@ -6,14 +6,16 @@
|
||||
# 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
|
||||
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
|
||||
# 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
|
||||
# Enables namespacing of each library's R class so that its R class includes only the
|
||||
# resources declared in the library itself and none from the library's dependencies,
|
||||
# thereby reducing the size of the R class for that library
|
||||
android.nonTransitiveRClass=true
|
||||
|
||||
BIN
project/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
project/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
#Tue Jul 07 20:59:38 EEST 2020
|
||||
#Wed May 17 18:24:03 EEST 2023
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
|
||||
|
||||
308
project/gradlew
vendored
308
project/gradlew
vendored
@@ -1,78 +1,126 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
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
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
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=""
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
@@ -81,92 +129,120 @@ 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.
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "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, switch paths to Windows format before running java
|
||||
if $cygwin ; 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=$((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" ;;
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# 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, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# 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"
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
||||
56
project/gradlew.bat
vendored
56
project/gradlew.bat
vendored
@@ -1,4 +1,20 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@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
|
||||
@@ -9,19 +25,23 @@
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
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 init
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@@ -35,7 +55,7 @@ goto fail
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
@@ -45,38 +65,26 @@ echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
: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 %CMD_LINE_ARGS%
|
||||
"%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
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
@@ -53,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
|
||||
{
|
||||
@@ -171,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();
|
||||
@@ -187,8 +192,6 @@ class DataDownloader extends Thread
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Parent.getVideoLayout().setOnKeyListener(new BackKeyListener(Parent));
|
||||
|
||||
String [] downloadFiles = Globals.DataDownloadUrl;
|
||||
int total = 0;
|
||||
int count = 0;
|
||||
@@ -211,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;
|
||||
}
|
||||
}
|
||||
@@ -219,7 +231,6 @@ class DataDownloader extends Thread
|
||||
}
|
||||
}
|
||||
DownloadComplete = true;
|
||||
Parent.getVideoLayout().setOnKeyListener(null);
|
||||
initParent();
|
||||
}
|
||||
|
||||
@@ -263,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;
|
||||
@@ -306,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;
|
||||
@@ -331,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;
|
||||
@@ -424,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);
|
||||
@@ -515,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;
|
||||
@@ -783,7 +850,7 @@ class DataDownloader extends Thread
|
||||
public MainActivity Parent;
|
||||
public void run()
|
||||
{
|
||||
Parent.initSDL();
|
||||
Parent.downloadFinishedInitSDL();
|
||||
}
|
||||
}
|
||||
Callback cb = new Callback();
|
||||
@@ -801,59 +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 View.OnKeyListener
|
||||
{
|
||||
MainActivity p;
|
||||
public BackKeyListener(MainActivity _p)
|
||||
{
|
||||
p = _p;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event)
|
||||
{
|
||||
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();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public StatusWriter Status;
|
||||
public boolean DownloadComplete = false;
|
||||
public boolean DownloadFailed = false;
|
||||
public boolean DownloadCanBeResumed = false;
|
||||
private MainActivity Parent;
|
||||
private String outFilesDir = null;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -39,8 +39,7 @@ class Globals
|
||||
{ "expat", "expat-sdl" },
|
||||
{ "sqlite3", "sqlite3-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 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;
|
||||
@@ -91,6 +90,7 @@ 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;
|
||||
@@ -131,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];
|
||||
|
||||
@@ -13,7 +13,7 @@ freely, subject to the following restrictions:
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
@@ -40,9 +40,13 @@ import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.constraintlayout.widget.Guideline;
|
||||
import androidx.constraintlayout.widget.ConstraintSet;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.Color;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
@@ -117,12 +121,19 @@ public class MainActivity extends Activity
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
|
||||
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
|
||||
// We need to load Globals.DrawInDisplayCutout option to correctly set fullscreen mode, it can only be done from onCreate()
|
||||
Settings.LoadConfig(this);
|
||||
DimSystemStatusBar.dim(null, getWindow());
|
||||
|
||||
Log.i("SDL", "libSDL: Creating startup screen");
|
||||
_layout = new LinearLayout(this);
|
||||
_layout.setOrientation(LinearLayout.VERTICAL);
|
||||
_layout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
|
||||
Display display = getWindowManager().getDefaultDisplay();
|
||||
int height = display.getHeight();
|
||||
_layout = new ConstraintLayout(this);
|
||||
_layout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
|
||||
_layout2 = new LinearLayout(this);
|
||||
_layout2.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
_layout2.setId(View.generateViewId());
|
||||
_layout2.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0));
|
||||
loadingDialog = new ProgressDialog(this);
|
||||
loadingDialog.setMessage(getString(R.string.accessing_network));
|
||||
|
||||
@@ -132,7 +143,7 @@ public class MainActivity extends Activity
|
||||
{
|
||||
_btn = new Button(this);
|
||||
_btn.setEnabled(false);
|
||||
_btn.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
_btn.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
|
||||
_btn.setText(getResources().getString(R.string.device_change_cfg));
|
||||
class onClickListener implements View.OnClickListener
|
||||
{
|
||||
@@ -152,7 +163,6 @@ public class MainActivity extends Activity
|
||||
_layout2.addView(_btn);
|
||||
}
|
||||
|
||||
_layout.addView(_layout2);
|
||||
|
||||
ImageView img = new ImageView(this);
|
||||
|
||||
@@ -165,9 +175,23 @@ public class MainActivity extends Activity
|
||||
{
|
||||
img.setImageResource(R.drawable.publisherlogo);
|
||||
}
|
||||
img.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
|
||||
img.setId(View.generateViewId());
|
||||
img.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0));
|
||||
|
||||
_layout.addView(img);
|
||||
|
||||
_layout.addView(_layout2);
|
||||
|
||||
ConstraintSet set = new ConstraintSet();
|
||||
set.clone(_layout);
|
||||
|
||||
int[] chainIds = { img.getId(), _layout2.getId() }; // the ids you set on your views above
|
||||
float[] weights = { 8, 2 };
|
||||
set.createVerticalChain(ConstraintSet.PARENT_ID, ConstraintSet.TOP,
|
||||
ConstraintSet.PARENT_ID, ConstraintSet.BOTTOM,
|
||||
chainIds, weights, ConstraintSet.CHAIN_SPREAD);
|
||||
|
||||
set.applyTo(_layout);
|
||||
|
||||
_videoLayout = new FrameLayout(this);
|
||||
_videoLayout.addView(_layout);
|
||||
|
||||
@@ -177,11 +201,37 @@ public class MainActivity extends Activity
|
||||
_videoLayout.addView(_ad.getView());
|
||||
_ad.getView().setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.BOTTOM | Gravity.RIGHT));
|
||||
}
|
||||
|
||||
|
||||
setContentView(_videoLayout);
|
||||
_videoLayout.setFocusable(true);
|
||||
_videoLayout.setFocusableInTouchMode(true);
|
||||
_videoLayout.requestFocus();
|
||||
DimSystemStatusBar.dim(_videoLayout, getWindow());
|
||||
|
||||
//Log.i("SDL", "Checking for asset pack");
|
||||
try
|
||||
{
|
||||
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP )
|
||||
{
|
||||
ApplicationInfo info = this.getPackageManager().getApplicationInfo(this.getPackageName(), 0);
|
||||
if( info.splitSourceDirs != null )
|
||||
{
|
||||
for( String apk: info.splitSourceDirs )
|
||||
{
|
||||
Log.i("SDL", "Package apk: " + apk);
|
||||
if( apk.endsWith("assetpack.apk") )
|
||||
{
|
||||
this.assetPackPath = apk;
|
||||
Log.i("SDL", "Found asset pack: " + this.assetPackPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( Exception eee )
|
||||
{
|
||||
Log.i("SDL", "Asset pack exception: " + eee);
|
||||
}
|
||||
|
||||
class Callback implements Runnable
|
||||
{
|
||||
@@ -205,8 +255,9 @@ public class MainActivity extends Activity
|
||||
public MainActivity Parent;
|
||||
public void run()
|
||||
{
|
||||
Settings.Load(Parent);
|
||||
Settings.ProcessConfig(Parent);
|
||||
setScreenOrientation();
|
||||
DimSystemStatusBar.dim(_videoLayout, getWindow());
|
||||
loaded.release();
|
||||
loadedLibraries.release();
|
||||
if( _btn != null )
|
||||
@@ -270,7 +321,7 @@ public class MainActivity extends Activity
|
||||
}
|
||||
catch(Exception e) {}
|
||||
}
|
||||
|
||||
|
||||
public void setUpStatusLabel()
|
||||
{
|
||||
MainActivity Parent = this; // Too lazy to rename
|
||||
@@ -314,11 +365,11 @@ public class MainActivity extends Activity
|
||||
this.runOnUiThread(cb);
|
||||
}
|
||||
|
||||
public void initSDL()
|
||||
public void downloadFinishedInitSDL()
|
||||
{
|
||||
setScreenOrientation();
|
||||
updateScreenOrientation();
|
||||
DimSystemStatusBar.get().dim(_videoLayout);
|
||||
DimSystemStatusBar.dim(_videoLayout, getWindow());
|
||||
(new Thread(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
@@ -337,7 +388,7 @@ public class MainActivity extends Activity
|
||||
Log.i("SDL", "libSDL: Application paused, cancelling SDL initialization until it will be brought to foreground");
|
||||
return;
|
||||
}
|
||||
DimSystemStatusBar.get().dim(_videoLayout);
|
||||
DimSystemStatusBar.dim(_videoLayout, getWindow());
|
||||
}
|
||||
runOnUiThread(new Runnable()
|
||||
{
|
||||
@@ -351,7 +402,7 @@ public class MainActivity extends Activity
|
||||
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT && Globals.ImmersiveMode &&
|
||||
(_videoLayout.getHeight() != dm.widthPixels || _videoLayout.getWidth() != dm.heightPixels) )
|
||||
{
|
||||
DimSystemStatusBar.get().dim(_videoLayout);
|
||||
DimSystemStatusBar.dim(_videoLayout, getWindow());
|
||||
try {
|
||||
Thread.sleep(300);
|
||||
} catch( Exception e ) {}
|
||||
@@ -368,9 +419,9 @@ public class MainActivity extends Activity
|
||||
if(sdlInited)
|
||||
return;
|
||||
Log.i("SDL", "libSDL: Initializing video and SDL application");
|
||||
|
||||
|
||||
sdlInited = true;
|
||||
DimSystemStatusBar.get().dim(_videoLayout);
|
||||
DimSystemStatusBar.dim(_videoLayout, getWindow());
|
||||
_videoLayout.removeView(_layout);
|
||||
if( _ad.getView() != null )
|
||||
_videoLayout.removeView(_ad.getView());
|
||||
@@ -465,8 +516,8 @@ public class MainActivity extends Activity
|
||||
_videoLayout.addView(_ad.getView());
|
||||
_ad.getView().setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.TOP | Gravity.RIGHT));
|
||||
}
|
||||
DimSystemStatusBar.get().dim(_videoLayout);
|
||||
//DimSystemStatusBar.get().dim(mGLView);
|
||||
DimSystemStatusBar.dim(_videoLayout, getWindow());
|
||||
//DimSystemStatusBar.dim(mGLView, getWindow());
|
||||
|
||||
Rect r = new Rect();
|
||||
_videoLayout.getWindowVisibleDisplayFrame(r);
|
||||
@@ -476,15 +527,40 @@ public class MainActivity extends Activity
|
||||
public void onGlobalLayout()
|
||||
{
|
||||
final Rect r = new Rect();
|
||||
_videoLayout.getWindowVisibleDisplayFrame(r);
|
||||
//_videoLayout.getWindowVisibleDisplayFrame(r);
|
||||
final int xy[] = new int[] { 0, 0 };
|
||||
_videoLayout.getLocationInWindow(xy);
|
||||
r.left = xy[0];
|
||||
r.top = xy[1];
|
||||
r.right = r.left + _videoLayout.getWidth();
|
||||
r.bottom = r.top + _videoLayout.getHeight();
|
||||
//boolean cutoutLeft = false, cutoutTop = false;
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P && Globals.ImmersiveMode)
|
||||
{
|
||||
if (getWindow().getDecorView() != null && getWindow().getDecorView().getRootWindowInsets() != null &&
|
||||
getWindow().getDecorView().getRootWindowInsets().getDisplayCutout() != null)
|
||||
{
|
||||
android.view.DisplayCutout cutout = getWindow().getDecorView().getRootWindowInsets().getDisplayCutout();
|
||||
Log.v("SDL", "Detected display cutout");
|
||||
// TODO: do something with it
|
||||
//if (cutout.getBoundingRectLeft().width() > 0)
|
||||
// cutoutLeft = true;
|
||||
//if (cutout.getBoundingRectTop().height() > 0)
|
||||
// cutoutTop = true;
|
||||
}
|
||||
}
|
||||
final int heightDiff = _videoLayout.getRootView().getHeight() - _videoLayout.getHeight(); // Take system bar into consideration
|
||||
final int widthDiff = _videoLayout.getRootView().getWidth() - _videoLayout.getWidth(); // Nexus 5 has system bar at the right side
|
||||
Log.v("SDL", "Main window visible region changed: " + r.left + ":" + r.top + ":" + r.width() + ":" + r.height() );
|
||||
Log.v("SDL", "Main window visible region changed: " + r.left + ":" + r.top + ":" + r.width() + ":" + r.height() + " -> " +
|
||||
(r.left + widthDiff) + ":" + (r.top + heightDiff) + ":" + r.width() + ":" + r.height());
|
||||
Log.v("SDL", "videoLayout: " + _videoLayout.getLeft() + ":" + _videoLayout.getTop() + ":" + _videoLayout.getWidth() + ":" + _videoLayout.getHeight() +
|
||||
" videoLayout.getRootView() " + _videoLayout.getRootView().getLeft() + ":" + _videoLayout.getRootView().getTop() + ":" +
|
||||
_videoLayout.getRootView().getWidth() + ":" + _videoLayout.getRootView().getHeight());
|
||||
_videoLayout.postDelayed( new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
DimSystemStatusBar.get().dim(_videoLayout);
|
||||
DimSystemStatusBar.dim(_videoLayout, getWindow());
|
||||
mGLView.nativeScreenVisibleRect(r.left + widthDiff, r.top + heightDiff, r.width(), r.height());
|
||||
}
|
||||
}, 300 );
|
||||
@@ -492,7 +568,7 @@ public class MainActivity extends Activity
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
DimSystemStatusBar.get().dim(_videoLayout);
|
||||
DimSystemStatusBar.dim(_videoLayout, getWindow());
|
||||
mGLView.nativeScreenVisibleRect(r.left + widthDiff, r.top + heightDiff, r.width(), r.height());
|
||||
}
|
||||
}, 600 );
|
||||
@@ -522,8 +598,8 @@ public class MainActivity extends Activity
|
||||
super.onResume();
|
||||
if( mGLView != null )
|
||||
{
|
||||
DimSystemStatusBar.get().dim(_videoLayout);
|
||||
//DimSystemStatusBar.get().dim(mGLView);
|
||||
DimSystemStatusBar.dim(_videoLayout, getWindow());
|
||||
//DimSystemStatusBar.dim(mGLView, getWindow());
|
||||
mGLView.onResume();
|
||||
}
|
||||
else
|
||||
@@ -534,7 +610,7 @@ public class MainActivity extends Activity
|
||||
downloader.setStatusField(_tv);
|
||||
if( downloader.DownloadComplete )
|
||||
{
|
||||
initSDL();
|
||||
downloadFinishedInitSDL();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -560,7 +636,7 @@ public class MainActivity extends Activity
|
||||
onResume();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isPaused()
|
||||
{
|
||||
return _isPaused;
|
||||
@@ -800,8 +876,8 @@ public class MainActivity extends Activity
|
||||
}
|
||||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
|
||||
_inputManager.hideSoftInputFromWindow(mGLView.getWindowToken(), 0);
|
||||
DimSystemStatusBar.get().dim(_videoLayout);
|
||||
//DimSystemStatusBar.get().dim(mGLView);
|
||||
DimSystemStatusBar.dim(_videoLayout, getWindow());
|
||||
//DimSystemStatusBar.dim(mGLView, getWindow());
|
||||
mGLView.captureMouse(true);
|
||||
}
|
||||
});
|
||||
@@ -938,13 +1014,13 @@ public class MainActivity extends Activity
|
||||
_videoLayout.removeView(_screenKeyboard);
|
||||
_screenKeyboard = null;
|
||||
mGLView.captureMouse(true);
|
||||
DimSystemStatusBar.get().dim(_videoLayout);
|
||||
DimSystemStatusBar.dim(_videoLayout, getWindow());
|
||||
|
||||
_videoLayout.postDelayed( new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
DimSystemStatusBar.get().dim(_videoLayout);
|
||||
DimSystemStatusBar.dim(_videoLayout, getWindow());
|
||||
}
|
||||
}, 500 );
|
||||
};
|
||||
@@ -977,7 +1053,7 @@ public class MainActivity extends Activity
|
||||
|
||||
public void setAdvertisementPosition(int x, int y)
|
||||
{
|
||||
|
||||
|
||||
if( _ad.getView() != null )
|
||||
{
|
||||
final FrameLayout.LayoutParams layout = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
@@ -1102,7 +1178,7 @@ public class MainActivity extends Activity
|
||||
super.onNewIntent(i);
|
||||
setIntent(i);
|
||||
}
|
||||
|
||||
|
||||
public void LoadLibraries()
|
||||
{
|
||||
try
|
||||
@@ -1227,7 +1303,7 @@ public class MainActivity extends Activity
|
||||
libDir.mkdirs();
|
||||
}
|
||||
catch( SecurityException ee ) { };
|
||||
|
||||
|
||||
byte[] buf = new byte[16384];
|
||||
while(true)
|
||||
{
|
||||
@@ -1243,6 +1319,11 @@ public class MainActivity extends Activity
|
||||
if( entry.isDirectory() )
|
||||
{
|
||||
File outDir = new File( libDir.getAbsolutePath() + "/" + entry.getName() );
|
||||
if( !outDir.getCanonicalPath().startsWith(libDir.getAbsolutePath() + "/") )
|
||||
{
|
||||
Log.i("SDL", "Security exception: " + outDir.getCanonicalPath());
|
||||
return;
|
||||
}
|
||||
if( !(outDir.exists() && outDir.isDirectory()) )
|
||||
outDir.mkdirs();
|
||||
continue;
|
||||
@@ -1253,6 +1334,11 @@ public class MainActivity extends Activity
|
||||
try
|
||||
{
|
||||
File outDir = new File( path.substring(0, path.lastIndexOf("/") ));
|
||||
if( !outDir.getCanonicalPath().startsWith(libDir.getAbsolutePath() + "/") )
|
||||
{
|
||||
Log.i("SDL", "Security exception: " + outDir.getCanonicalPath());
|
||||
return;
|
||||
}
|
||||
if( !(outDir.exists() && outDir.isDirectory()) )
|
||||
outDir.mkdirs();
|
||||
}
|
||||
@@ -1274,6 +1360,11 @@ public class MainActivity extends Activity
|
||||
} catch( Exception eeeeee ) { }
|
||||
|
||||
Log.i("SDL", "Saving to file '" + path + "'");
|
||||
if( !(new File(path).getCanonicalPath().startsWith(libDir.getAbsolutePath() + "/")) )
|
||||
{
|
||||
Log.i("SDL", "Security exception: " + path);
|
||||
return;
|
||||
}
|
||||
|
||||
out = new FileOutputStream( path );
|
||||
int len = zip.read(buf);
|
||||
@@ -1420,6 +1511,11 @@ public class MainActivity extends Activity
|
||||
{
|
||||
Log.i("SDL", "libSDL: Record audio permission: " + (grantResults[0] == PackageManager.PERMISSION_GRANTED ? "GRANTED" : "DENIED"));
|
||||
}
|
||||
if (Manifest.permission.READ_EXTERNAL_STORAGE.equals(permissions[0]))
|
||||
{
|
||||
Log.i("SDL", "libSDL: Read external storage permission: " + (grantResults[0] == PackageManager.PERMISSION_GRANTED ? "GRANTED" : "DENIED"));
|
||||
readExternalStoragePermissionDialogAnswered = true;
|
||||
}
|
||||
if (Manifest.permission.WRITE_EXTERNAL_STORAGE.equals(permissions[0]))
|
||||
{
|
||||
Log.i("SDL", "libSDL: Write external storage permission: " + (grantResults[0] == PackageManager.PERMISSION_GRANTED ? "GRANTED" : "DENIED"));
|
||||
@@ -1443,7 +1539,7 @@ public class MainActivity extends Activity
|
||||
|
||||
private TextView _tv = null;
|
||||
private Button _btn = null;
|
||||
private LinearLayout _layout = null;
|
||||
private ConstraintLayout _layout = null;
|
||||
private LinearLayout _layout2 = null;
|
||||
private Advertisement _ad = null;
|
||||
public CloudSave cloudSave = null;
|
||||
@@ -1461,44 +1557,46 @@ public class MainActivity extends Activity
|
||||
|
||||
public LinkedList<Integer> textInput = new LinkedList<Integer> ();
|
||||
public static MainActivity instance = null;
|
||||
public boolean readExternalStoragePermissionDialogAnswered = false;
|
||||
public boolean writeExternalStoragePermissionDialogAnswered = false;
|
||||
|
||||
public String ObbMountPath = null;
|
||||
public String assetPackPath = null; // Not saved to the config file
|
||||
}
|
||||
|
||||
// *** HONEYCOMB / ICS FIX FOR FULLSCREEN MODE, by lmak ***
|
||||
abstract class DimSystemStatusBar
|
||||
class DimSystemStatusBar
|
||||
{
|
||||
public static DimSystemStatusBar get()
|
||||
public static void dim(final View view, final Window window)
|
||||
{
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB)
|
||||
return DimSystemStatusBarHoneycomb.Holder.sInstance;
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT && Globals.ImmersiveMode)
|
||||
{
|
||||
// Immersive mode, I already hear curses when system bar reappears mid-game from the slightest swipe at the bottom of the screen
|
||||
//Log.i("SDL", "libSDL: Enabling fullscreen, Android SDK " + android.os.Build.VERSION.SDK_INT + " VERSION_CODES.P " + android.os.Build.VERSION_CODES.P);
|
||||
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P )
|
||||
{
|
||||
//Log.i("SDL", "libSDL: Setting display cutout mode to SHORT_EDGES");
|
||||
if (Globals.DrawInDisplayCutout)
|
||||
window.getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
||||
else
|
||||
window.getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER;
|
||||
}
|
||||
if (view != null)
|
||||
{
|
||||
view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE
|
||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
|
||||
}
|
||||
}
|
||||
else
|
||||
return DimSystemStatusBarDummy.Holder.sInstance;
|
||||
}
|
||||
public abstract void dim(final View view);
|
||||
|
||||
private static class DimSystemStatusBarHoneycomb extends DimSystemStatusBar
|
||||
{
|
||||
private static class Holder
|
||||
{
|
||||
private static final DimSystemStatusBarHoneycomb sInstance = new DimSystemStatusBarHoneycomb();
|
||||
}
|
||||
public void dim(final View view)
|
||||
{
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT && Globals.ImmersiveMode)
|
||||
// Immersive mode, I already hear curses when system bar reappears mid-game from the slightest swipe at the bottom of the screen
|
||||
view.setSystemUiVisibility(android.view.View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | android.view.View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | android.view.View.SYSTEM_UI_FLAG_FULLSCREEN);
|
||||
else
|
||||
if (view != null)
|
||||
{
|
||||
view.setSystemUiVisibility(android.view.View.SYSTEM_UI_FLAG_LOW_PROFILE);
|
||||
}
|
||||
}
|
||||
private static class DimSystemStatusBarDummy extends DimSystemStatusBar
|
||||
{
|
||||
private static class Holder
|
||||
{
|
||||
private static final DimSystemStatusBarDummy sInstance = new DimSystemStatusBarDummy();
|
||||
}
|
||||
public void dim(final View view)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -278,7 +278,7 @@ class SDL_1_2_Keycodes
|
||||
|
||||
// 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
|
||||
class SDL_2_Keycodes
|
||||
{
|
||||
public static final int SDLK_UNKNOWN = 0;
|
||||
public static final int SDLK_A = 4;
|
||||
@@ -519,6 +519,10 @@ class SDL_1_3_Keycodes
|
||||
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;
|
||||
@@ -558,9 +562,9 @@ class SDL_Keys
|
||||
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 )
|
||||
if( Globals.UsingSDL2 )
|
||||
{
|
||||
fields = SDL_1_3_Keycodes.class.getDeclaredFields();
|
||||
fields = SDL_2_Keycodes.class.getDeclaredFields();
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -87,6 +87,7 @@ public class Settings
|
||||
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)
|
||||
{
|
||||
@@ -191,6 +192,7 @@ public class Settings
|
||||
out.writeBoolean(Globals.ForceHardwareMouse);
|
||||
convertButtonSizeFromOldSdlVersion = false;
|
||||
out.writeBoolean(convertButtonSizeFromOldSdlVersion);
|
||||
out.writeBoolean(Globals.DrawInDisplayCutout);
|
||||
|
||||
out.close();
|
||||
settingsLoaded = true;
|
||||
@@ -200,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++ )
|
||||
{
|
||||
@@ -228,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);
|
||||
@@ -276,131 +424,18 @@ public class Settings
|
||||
}
|
||||
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();
|
||||
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 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();
|
||||
convertButtonSizeFromOldSdlVersion = 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);
|
||||
}
|
||||
@@ -408,26 +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 (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 )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
@@ -608,7 +638,7 @@ public class Settings
|
||||
Globals.TouchscreenKeyboardTransparency,
|
||||
Globals.FloatingScreenJoystick ? 1 : 0,
|
||||
Globals.AppTouchscreenKeyboardKeysAmount );
|
||||
SetupTouchscreenKeyboardGraphics(p);
|
||||
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 )
|
||||
@@ -665,6 +695,14 @@ public class Settings
|
||||
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) {}
|
||||
@@ -707,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()
|
||||
@@ -972,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,
|
||||
@@ -983,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();
|
||||
@@ -993,7 +975,7 @@ public class Settings
|
||||
private static native void nativeSetVideoMultithreaded();
|
||||
private static native void nativeSetVideoForceSoftwareMode();
|
||||
public static native void nativeSetupScreenKeyboard(int size, int drawsize, int theme, int transparency, int floatingScreenJoystick, int buttonAmount);
|
||||
private static native void nativeSetupScreenKeyboardButtons(byte[] img);
|
||||
public static native void nativeSetupScreenKeyboardButtons(byte[] img);
|
||||
private static native void nativeInitKeymap();
|
||||
private static native int nativeGetKeymapKey(int key);
|
||||
private static native void nativeSetKeymapKey(int javakey, int key);
|
||||
@@ -1006,6 +988,7 @@ public class Settings
|
||||
private static native void nativeSetKeymapKeyMultitouchGesture(int keynum, int key);
|
||||
private static native void nativeSetMultitouchGestureSensitivity(int sensitivity);
|
||||
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);
|
||||
|
||||
@@ -386,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));
|
||||
@@ -445,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 )
|
||||
@@ -455,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;
|
||||
@@ -627,7 +634,7 @@ class SettingsMenuKeyboard extends SettingsMenu
|
||||
{
|
||||
p.setText(p.getResources().getString(R.string.screenkb_custom_layout_help));
|
||||
if (Globals.ImmersiveMode)
|
||||
DimSystemStatusBar.get().dim(p.getVideoLayout());
|
||||
DimSystemStatusBar.dim(p.getVideoLayout(), p.getWindow());
|
||||
p.getVideoLayout().getHandler().postDelayed(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
@@ -657,13 +664,25 @@ 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);
|
||||
@@ -686,6 +705,7 @@ class SettingsMenuKeyboard extends SettingsMenu
|
||||
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,
|
||||
@@ -780,6 +800,10 @@ 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);
|
||||
}
|
||||
|
||||
@@ -879,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;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
@@ -66,42 +68,9 @@ 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);
|
||||
@@ -775,7 +744,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
||||
|
||||
if(mGlContextLost) {
|
||||
mGlContextLost = false;
|
||||
Settings.SetupTouchscreenKeyboardGraphics(context); // Reload on-screen buttons graphics
|
||||
DemoGLSurfaceView.SetupTouchscreenKeyboardGraphics(context); // Reload on-screen buttons graphics
|
||||
super.SwapBuffers();
|
||||
}
|
||||
|
||||
@@ -1102,9 +1071,6 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
|
||||
if( nativeKey( keyCode, 0, event.getUnicodeChar(), DifferentTouchInput.processGamepadDeviceId(event.getDevice()) ) == 0 )
|
||||
return super.onKeyUp(keyCode, event);
|
||||
|
||||
//if( keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_MENU )
|
||||
// DimSystemStatusBar.get().dim(mParent._videoLayout);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1163,14 +1129,19 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
|
||||
if (DifferentTouchInput.capturedMouseY >= this.getHeight())
|
||||
DifferentTouchInput.capturedMouseY = this.getHeight() - 1;
|
||||
|
||||
//Log.v("SDL", "DemoGLSurfaceView::onCapturedPointerEvent(): X " + DifferentTouchInput.capturedMouseX + " Y " + DifferentTouchInput.capturedMouseY +
|
||||
//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);
|
||||
|
||||
//Log.v("SDL", "DemoGLSurfaceView::onCapturedPointerEvent(): XY " + event.getX() + " " + event.getY() + " action " + event.getAction());
|
||||
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);
|
||||
}
|
||||
@@ -1253,6 +1224,63 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
|
||||
@@ -264,7 +264,6 @@ public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
|
||||
|
||||
if (0 != (mRequestedClients & CLIENT_SNAPSHOT)) {
|
||||
builder.addScope(Drive.SCOPE_APPFOLDER);
|
||||
builder.addApi(Drive.API);
|
||||
}
|
||||
|
||||
mGoogleApiClientBuilder = builder;
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -160,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,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Java source code (C) 2009-2012 Sergii Pylypenko
|
||||
|
||||
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.
|
||||
@@ -9,7 +9,7 @@ arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
@@ -22,29 +22,27 @@ freely, subject to the following restrictions:
|
||||
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 android.os.Bundle;
|
||||
|
||||
class Advertisement
|
||||
{
|
||||
MainActivity parent;
|
||||
// Stubs for compatibility with SDL 1.2 code
|
||||
|
||||
public Advertisement(MainActivity p)
|
||||
{
|
||||
parent = p;
|
||||
}
|
||||
|
||||
public View getView()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void requestNewAd()
|
||||
{
|
||||
class SettingsMenu {
|
||||
public static void showConfig(final MainActivity p, final boolean firstStart) {
|
||||
}
|
||||
}
|
||||
|
||||
class RestartMainActivity extends Activity {
|
||||
// For compatibility with SDL 1.2 code
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
public static final String ACTIVITY_AUTODETECT_SCREEN_ORIENTATION = "libsdl.org.ACTIVITY_AUTODETECT_SCREEN_ORIENTATION";
|
||||
public static final String SDL_RESTART_PARAMS = "SDL_RESTART_PARAMS";
|
||||
}
|
||||
|
||||
class DemoGLSurfaceView {
|
||||
static void SetupTouchscreenKeyboardGraphics(Activity p) {
|
||||
}
|
||||
}
|
||||
@@ -1,846 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Java source code (C) 2009-2012 Sergii Pylypenko
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
package net.sourceforge.clonekeenplus;
|
||||
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
import javax.microedition.khronos.opengles.GL11;
|
||||
import javax.microedition.khronos.opengles.GL11Ext;
|
||||
|
||||
import javax.microedition.khronos.egl.EGL10;
|
||||
import javax.microedition.khronos.egl.EGL11;
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.egl.EGLContext;
|
||||
import javax.microedition.khronos.egl.EGLDisplay;
|
||||
import javax.microedition.khronos.egl.EGLSurface;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.InputDevice;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.os.Environment;
|
||||
import java.io.File;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.AssetManager;
|
||||
import android.widget.Toast;
|
||||
import android.util.Log;
|
||||
|
||||
import android.widget.TextView;
|
||||
import java.lang.Thread;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import android.os.Build;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
|
||||
class Mouse
|
||||
{
|
||||
public static final int LEFT_CLICK_NORMAL = 0;
|
||||
public static final int LEFT_CLICK_NEAR_CURSOR = 1;
|
||||
public static final int LEFT_CLICK_WITH_MULTITOUCH = 2;
|
||||
public static final int LEFT_CLICK_WITH_PRESSURE = 3;
|
||||
public static final int LEFT_CLICK_WITH_KEY = 4;
|
||||
public static final int LEFT_CLICK_WITH_TIMEOUT = 5;
|
||||
public static final int LEFT_CLICK_WITH_TAP = 6;
|
||||
public static final int LEFT_CLICK_WITH_TAP_OR_TIMEOUT = 7;
|
||||
|
||||
public static final int RIGHT_CLICK_NONE = 0;
|
||||
public static final int RIGHT_CLICK_WITH_MULTITOUCH = 1;
|
||||
public static final int RIGHT_CLICK_WITH_PRESSURE = 2;
|
||||
public static final int RIGHT_CLICK_WITH_KEY = 3;
|
||||
public static final int RIGHT_CLICK_WITH_TIMEOUT = 4;
|
||||
|
||||
public static final int SDL_FINGER_DOWN = 0;
|
||||
public static final int SDL_FINGER_UP = 1;
|
||||
public static final int SDL_FINGER_MOVE = 2;
|
||||
public static final int SDL_FINGER_HOVER = 3;
|
||||
|
||||
public static final int ZOOM_NONE = 0;
|
||||
public static final int ZOOM_MAGNIFIER = 1;
|
||||
public static final int ZOOM_SCREEN_TRANSFORM = 2;
|
||||
public static final int ZOOM_FULLSCREEN_MAGNIFIER = 3;
|
||||
}
|
||||
|
||||
abstract class DifferentTouchInput
|
||||
{
|
||||
public abstract void process(final MotionEvent event);
|
||||
public abstract void processGenericEvent(final MotionEvent event);
|
||||
|
||||
public static boolean ExternalMouseDetected = false;
|
||||
|
||||
public static DifferentTouchInput getInstance()
|
||||
{
|
||||
boolean multiTouchAvailable1 = false;
|
||||
boolean multiTouchAvailable2 = false;
|
||||
// Not checking for getX(int), getY(int) etc 'cause I'm lazy
|
||||
Method methods [] = MotionEvent.class.getDeclaredMethods();
|
||||
for(Method m: methods)
|
||||
{
|
||||
if( m.getName().equals("getPointerCount") )
|
||||
multiTouchAvailable1 = true;
|
||||
if( m.getName().equals("getPointerId") )
|
||||
multiTouchAvailable2 = true;
|
||||
}
|
||||
try {
|
||||
Log.i("SDL", "Device model: " + android.os.Build.MODEL);
|
||||
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH )
|
||||
{
|
||||
if( DetectCrappyDragonRiseDatexGamepad() )
|
||||
return CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad.Holder.sInstance;
|
||||
return IcsTouchInput.Holder.sInstance;
|
||||
}
|
||||
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD )
|
||||
return GingerbreadTouchInput.Holder.sInstance;
|
||||
if (multiTouchAvailable1 && multiTouchAvailable2)
|
||||
return MultiTouchInput.Holder.sInstance;
|
||||
else
|
||||
return SingleTouchInput.Holder.sInstance;
|
||||
} catch( Exception e ) {
|
||||
try {
|
||||
if (multiTouchAvailable1 && multiTouchAvailable2)
|
||||
return MultiTouchInput.Holder.sInstance;
|
||||
else
|
||||
return SingleTouchInput.Holder.sInstance;
|
||||
} catch( Exception ee ) {
|
||||
return SingleTouchInput.Holder.sInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
private static boolean DetectCrappyDragonRiseDatexGamepad()
|
||||
{
|
||||
if( CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad.Holder.sInstance == null )
|
||||
return false;
|
||||
return CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad.Holder.sInstance.detect();
|
||||
}
|
||||
|
||||
private static class SingleTouchInput extends DifferentTouchInput
|
||||
{
|
||||
private static class Holder
|
||||
{
|
||||
private static final SingleTouchInput sInstance = new SingleTouchInput();
|
||||
}
|
||||
@Override
|
||||
public void processGenericEvent(final MotionEvent event)
|
||||
{
|
||||
process(event);
|
||||
}
|
||||
public void process(final MotionEvent event)
|
||||
{
|
||||
int action = -1;
|
||||
if( event.getAction() == MotionEvent.ACTION_DOWN )
|
||||
action = Mouse.SDL_FINGER_DOWN;
|
||||
if( event.getAction() == MotionEvent.ACTION_UP )
|
||||
action = Mouse.SDL_FINGER_UP;
|
||||
if( event.getAction() == MotionEvent.ACTION_MOVE )
|
||||
action = Mouse.SDL_FINGER_MOVE;
|
||||
if ( action >= 0 )
|
||||
DemoGLSurfaceView.nativeMotionEvent( (int)event.getX(), (int)event.getY(), action, 0,
|
||||
(int)(event.getPressure() * 1000.0),
|
||||
(int)(event.getSize() * 1000.0) );
|
||||
}
|
||||
}
|
||||
private static class MultiTouchInput extends DifferentTouchInput
|
||||
{
|
||||
public static final int TOUCH_EVENTS_MAX = 16; // Max multitouch pointers
|
||||
|
||||
private class touchEvent
|
||||
{
|
||||
public boolean down = false;
|
||||
public int x = 0;
|
||||
public int y = 0;
|
||||
public int pressure = 0;
|
||||
public int size = 0;
|
||||
}
|
||||
|
||||
protected touchEvent touchEvents[];
|
||||
|
||||
MultiTouchInput()
|
||||
{
|
||||
touchEvents = new touchEvent[TOUCH_EVENTS_MAX];
|
||||
for( int i = 0; i < TOUCH_EVENTS_MAX; i++ )
|
||||
touchEvents[i] = new touchEvent();
|
||||
}
|
||||
|
||||
private static class Holder
|
||||
{
|
||||
private static final MultiTouchInput sInstance = new MultiTouchInput();
|
||||
}
|
||||
|
||||
public void processGenericEvent(final MotionEvent event)
|
||||
{
|
||||
process(event);
|
||||
}
|
||||
public void process(final MotionEvent event)
|
||||
{
|
||||
int action = -1;
|
||||
|
||||
//Log.i("SDL", "Got motion event, type " + (int)(event.getAction()) + " X " + (int)event.getX() + " Y " + (int)event.getY());
|
||||
if( (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_UP ||
|
||||
(event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_CANCEL )
|
||||
{
|
||||
action = Mouse.SDL_FINGER_UP;
|
||||
for( int i = 0; i < TOUCH_EVENTS_MAX; i++ )
|
||||
{
|
||||
if( touchEvents[i].down )
|
||||
{
|
||||
touchEvents[i].down = false;
|
||||
DemoGLSurfaceView.nativeMotionEvent( touchEvents[i].x, touchEvents[i].y, action, i, touchEvents[i].pressure, touchEvents[i].size );
|
||||
}
|
||||
}
|
||||
}
|
||||
if( (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_DOWN )
|
||||
{
|
||||
action = Mouse.SDL_FINGER_DOWN;
|
||||
for( int i = 0; i < event.getPointerCount(); i++ )
|
||||
{
|
||||
int id = event.getPointerId(i);
|
||||
if( id >= TOUCH_EVENTS_MAX )
|
||||
id = TOUCH_EVENTS_MAX - 1;
|
||||
touchEvents[id].down = true;
|
||||
touchEvents[id].x = (int)event.getX(i);
|
||||
touchEvents[id].y = (int)event.getY(i);
|
||||
touchEvents[id].pressure = (int)(event.getPressure(i) * 1000.0);
|
||||
touchEvents[id].size = (int)(event.getSize(i) * 1000.0);
|
||||
DemoGLSurfaceView.nativeMotionEvent( touchEvents[id].x, touchEvents[id].y, action, id, touchEvents[id].pressure, touchEvents[id].size );
|
||||
}
|
||||
}
|
||||
if( (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_MOVE ||
|
||||
(event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_DOWN ||
|
||||
(event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_UP )
|
||||
{
|
||||
/*
|
||||
String s = "MOVE: ptrs " + event.getPointerCount();
|
||||
for( int i = 0 ; i < event.getPointerCount(); i++ )
|
||||
{
|
||||
s += " p" + event.getPointerId(i) + "=" + (int)event.getX(i) + ":" + (int)event.getY(i);
|
||||
}
|
||||
Log.i("SDL", s);
|
||||
*/
|
||||
int pointerReleased = -1;
|
||||
if( (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_UP )
|
||||
pointerReleased = (event.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;
|
||||
|
||||
for( int id = 0; id < TOUCH_EVENTS_MAX; id++ )
|
||||
{
|
||||
int ii;
|
||||
for( ii = 0; ii < event.getPointerCount(); ii++ )
|
||||
{
|
||||
if( id == event.getPointerId(ii) )
|
||||
break;
|
||||
}
|
||||
if( ii >= event.getPointerCount() )
|
||||
{
|
||||
// Up event
|
||||
if( touchEvents[id].down )
|
||||
{
|
||||
action = Mouse.SDL_FINGER_UP;
|
||||
touchEvents[id].down = false;
|
||||
DemoGLSurfaceView.nativeMotionEvent( touchEvents[id].x, touchEvents[id].y, action, id, touchEvents[id].pressure, touchEvents[id].size );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( pointerReleased == id && touchEvents[pointerReleased].down )
|
||||
{
|
||||
action = Mouse.SDL_FINGER_UP;
|
||||
touchEvents[id].down = false;
|
||||
}
|
||||
else if( touchEvents[id].down )
|
||||
{
|
||||
action = Mouse.SDL_FINGER_MOVE;
|
||||
}
|
||||
else
|
||||
{
|
||||
action = Mouse.SDL_FINGER_DOWN;
|
||||
touchEvents[id].down = true;
|
||||
}
|
||||
touchEvents[id].x = (int)event.getX(ii);
|
||||
touchEvents[id].y = (int)event.getY(ii);
|
||||
touchEvents[id].pressure = (int)(event.getPressure(ii) * 1000.0);
|
||||
touchEvents[id].size = (int)(event.getSize(ii) * 1000.0);
|
||||
DemoGLSurfaceView.nativeMotionEvent( touchEvents[id].x, touchEvents[id].y, action, id, touchEvents[id].pressure, touchEvents[id].size );
|
||||
}
|
||||
}
|
||||
}
|
||||
if( (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_HOVER_MOVE ) // Support bluetooth/USB mouse - available since Android 3.1
|
||||
{
|
||||
// TODO: it is possible that multiple pointers return that event, but we're handling only pointer #0
|
||||
if( touchEvents[0].down )
|
||||
action = Mouse.SDL_FINGER_UP;
|
||||
else
|
||||
action = Mouse.SDL_FINGER_HOVER;
|
||||
touchEvents[0].down = false;
|
||||
touchEvents[0].x = (int)event.getX();
|
||||
touchEvents[0].y = (int)event.getY();
|
||||
touchEvents[0].pressure = 0;
|
||||
touchEvents[0].size = 0;
|
||||
DemoGLSurfaceView.nativeMotionEvent( touchEvents[0].x, touchEvents[0].y, action, 0, touchEvents[0].pressure, touchEvents[0].size );
|
||||
}
|
||||
}
|
||||
}
|
||||
private static class GingerbreadTouchInput extends MultiTouchInput
|
||||
{
|
||||
private static class Holder
|
||||
{
|
||||
private static final GingerbreadTouchInput sInstance = new GingerbreadTouchInput();
|
||||
}
|
||||
|
||||
GingerbreadTouchInput()
|
||||
{
|
||||
super();
|
||||
}
|
||||
public void process(final MotionEvent event)
|
||||
{
|
||||
boolean hwMouseEvent = ( (event.getSource() & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE ||
|
||||
(event.getSource() & InputDevice.SOURCE_STYLUS) == InputDevice.SOURCE_STYLUS ||
|
||||
(event.getMetaState() & KeyEvent.FLAG_TRACKING) != 0 ); // Hack to recognize Galaxy Note Gingerbread stylus
|
||||
if( ExternalMouseDetected != hwMouseEvent )
|
||||
{
|
||||
ExternalMouseDetected = hwMouseEvent;
|
||||
DemoGLSurfaceView.nativeHardwareMouseDetected(hwMouseEvent ? 1 : 0);
|
||||
}
|
||||
super.process(event);
|
||||
}
|
||||
public void processGenericEvent(final MotionEvent event)
|
||||
{
|
||||
process(event);
|
||||
}
|
||||
}
|
||||
private static class IcsTouchInput extends GingerbreadTouchInput
|
||||
{
|
||||
private static class Holder
|
||||
{
|
||||
private static final IcsTouchInput sInstance = new IcsTouchInput();
|
||||
}
|
||||
private int buttonState = 0;
|
||||
public void process(final MotionEvent event)
|
||||
{
|
||||
//Log.i("SDL", "Got motion event, type " + (int)(event.getAction()) + " X " + (int)event.getX() + " Y " + (int)event.getY() + " buttons " + buttonState + " source " + event.getSource());
|
||||
int buttonStateNew = event.getButtonState();
|
||||
if( buttonStateNew != buttonState )
|
||||
{
|
||||
for( int i = 1; i <= MotionEvent.BUTTON_FORWARD; i *= 2 )
|
||||
{
|
||||
if( (buttonStateNew & i) != (buttonState & i) )
|
||||
DemoGLSurfaceView.nativeMouseButtonsPressed(i, ((buttonStateNew & i) == 0) ? 0 : 1);
|
||||
}
|
||||
buttonState = buttonStateNew;
|
||||
}
|
||||
super.process(event); // Push mouse coordinate first
|
||||
}
|
||||
public void processGenericEvent(final MotionEvent event)
|
||||
{
|
||||
// Joysticks are supported since Honeycomb, but I don't care about it, because very little devices have it
|
||||
if( (event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == InputDevice.SOURCE_CLASS_JOYSTICK )
|
||||
{
|
||||
DemoGLSurfaceView.nativeGamepadAnalogJoystickInput(
|
||||
event.getAxisValue(MotionEvent.AXIS_X), event.getAxisValue(MotionEvent.AXIS_Y),
|
||||
event.getAxisValue(MotionEvent.AXIS_Z), event.getAxisValue(MotionEvent.AXIS_RZ),
|
||||
event.getAxisValue(MotionEvent.AXIS_RTRIGGER), event.getAxisValue(MotionEvent.AXIS_LTRIGGER) );
|
||||
return;
|
||||
}
|
||||
// Process mousewheel
|
||||
if( event.getAction() == MotionEvent.ACTION_SCROLL )
|
||||
{
|
||||
int scrollX = Math.round(event.getAxisValue(MotionEvent.AXIS_HSCROLL));
|
||||
int scrollY = Math.round(event.getAxisValue(MotionEvent.AXIS_VSCROLL));
|
||||
DemoGLSurfaceView.nativeMouseWheel(scrollX, scrollY);
|
||||
return;
|
||||
}
|
||||
super.processGenericEvent(event);
|
||||
}
|
||||
}
|
||||
private static class CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad extends IcsTouchInput
|
||||
{
|
||||
private static class Holder
|
||||
{
|
||||
private static final CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad sInstance = new CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad();
|
||||
}
|
||||
float hatX = 0.0f, hatY = 0.0f;
|
||||
public void processGenericEvent(final MotionEvent event)
|
||||
{
|
||||
// Joysticks are supported since Honeycomb, but I don't care about it, because very little devices have it
|
||||
if( (event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == InputDevice.SOURCE_CLASS_JOYSTICK )
|
||||
{
|
||||
// event.getAxisValue(AXIS_HAT_X) and event.getAxisValue(AXIS_HAT_Y) are joystick arrow keys, they also send keyboard events
|
||||
DemoGLSurfaceView.nativeGamepadAnalogJoystickInput(
|
||||
event.getAxisValue(MotionEvent.AXIS_X), event.getAxisValue(MotionEvent.AXIS_Y),
|
||||
event.getAxisValue(MotionEvent.AXIS_RX), event.getAxisValue(MotionEvent.AXIS_RZ),
|
||||
0, 0);
|
||||
if( event.getAxisValue(MotionEvent.AXIS_HAT_X) != hatX )
|
||||
{
|
||||
hatX = event.getAxisValue(MotionEvent.AXIS_HAT_X);
|
||||
if( hatX == 0.0f )
|
||||
{
|
||||
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_LEFT, 0);
|
||||
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_RIGHT, 0);
|
||||
}
|
||||
else
|
||||
DemoGLSurfaceView.nativeKey(hatX < 0.0f ? KeyEvent.KEYCODE_DPAD_LEFT : KeyEvent.KEYCODE_DPAD_RIGHT, 1);
|
||||
}
|
||||
if( event.getAxisValue(MotionEvent.AXIS_HAT_Y) != hatY )
|
||||
{
|
||||
hatY = event.getAxisValue(MotionEvent.AXIS_HAT_Y);
|
||||
if( hatY == 0.0f )
|
||||
{
|
||||
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_UP, 0);
|
||||
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_DOWN, 0);
|
||||
}
|
||||
else
|
||||
DemoGLSurfaceView.nativeKey(hatY < 0.0f ? KeyEvent.KEYCODE_DPAD_UP : KeyEvent.KEYCODE_DPAD_DOWN, 1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
super.processGenericEvent(event);
|
||||
}
|
||||
public boolean detect()
|
||||
{
|
||||
int[] devIds = InputDevice.getDeviceIds();
|
||||
for( int id : devIds )
|
||||
{
|
||||
InputDevice device = InputDevice.getDevice(id);
|
||||
if( device == null )
|
||||
continue;
|
||||
System.out.println("libSDL: input device ID " + id + " type " + device.getSources() + " name " + device.getName() );
|
||||
if( (device.getSources() & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD &&
|
||||
(device.getSources() & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK &&
|
||||
device.getName().indexOf("DragonRise Inc") == 0 )
|
||||
{
|
||||
System.out.println("libSDL: Detected crappy DragonRise gamepad, enabling special hack for it. Please press button labeled 'Analog', otherwise it won't work, because it's cheap and crappy");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
||||
{
|
||||
public DemoRenderer(MainActivity _context)
|
||||
{
|
||||
context = _context;
|
||||
}
|
||||
|
||||
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
|
||||
Log.i("SDL", "libSDL: DemoRenderer.onSurfaceCreated(): paused " + mPaused + " mFirstTimeStart " + mFirstTimeStart );
|
||||
mGlSurfaceCreated = true;
|
||||
mGl = gl;
|
||||
/*if( ! mPaused && ! mFirstTimeStart )
|
||||
nativeGlContextRecreated();*/
|
||||
mFirstTimeStart = false;
|
||||
}
|
||||
|
||||
public void onSurfaceChanged(GL10 gl, int w, int h) {
|
||||
Log.i("SDL", "libSDL: DemoRenderer.onSurfaceChanged(): paused " + mPaused + " mFirstTimeStart " + mFirstTimeStart + " w " + w + " h " + h);
|
||||
if( w < h && Globals.HorizontalOrientation )
|
||||
{
|
||||
// Sometimes when Android awakes from lockscreen, portrait orientation is kept
|
||||
int x = w;
|
||||
w = h;
|
||||
h = x;
|
||||
}
|
||||
mWidth = w;
|
||||
mHeight = h;
|
||||
mGl = gl;
|
||||
//nativeResize(w, h, Globals.KeepAspectRatio ? 1 : 0);
|
||||
}
|
||||
|
||||
public void onSurfaceDestroyed() {
|
||||
Log.i("SDL", "libSDL: DemoRenderer.onSurfaceDestroyed(): paused " + mPaused + " mFirstTimeStart " + mFirstTimeStart );
|
||||
mGlSurfaceCreated = false;
|
||||
mGlContextLost = true;
|
||||
//nativeGlContextLost();
|
||||
};
|
||||
|
||||
public void onDrawFrame(GL10 gl) {
|
||||
|
||||
mGl = gl;
|
||||
DrawLogo(mGl);
|
||||
SwapBuffers();
|
||||
|
||||
//nativeInitJavaCallbacks();
|
||||
|
||||
// Make main thread priority lower so audio thread won't get underrun
|
||||
// Thread.currentThread().setPriority((Thread.currentThread().getPriority() + Thread.MIN_PRIORITY)/2);
|
||||
|
||||
mGlContextLost = false;
|
||||
|
||||
if(Globals.CompatibilityHacksStaticInit)
|
||||
MainActivity.LoadApplicationLibrary(context);
|
||||
|
||||
Settings.Apply(context);
|
||||
accelerometer = new AccelerometerReader(context);
|
||||
// Tweak video thread priority, if user selected big audio buffer
|
||||
if(Globals.AudioBufferConfig >= 2)
|
||||
Thread.currentThread().setPriority( (Thread.NORM_PRIORITY + Thread.MIN_PRIORITY) / 2 ); // Lower than normal
|
||||
// Calls main() and never returns, hehe - we'll call eglSwapBuffers() from native code
|
||||
/*nativeInit( Globals.DataDir,
|
||||
Globals.CommandLine,
|
||||
( (Globals.SwVideoMode && Globals.MultiThreadedVideo) || Globals.CompatibilityHacksVideo ) ? 1 : 0,
|
||||
android.os.Debug.isDebuggerConnected() ? 1 : 0 );*/
|
||||
//System.exit(0); // The main() returns here - I don't bother with deinit stuff, just terminate process
|
||||
}
|
||||
|
||||
public int swapBuffers() // Called from native code
|
||||
{
|
||||
if( ! super.SwapBuffers() && Globals.NonBlockingSwapBuffers )
|
||||
{
|
||||
if(mRatelimitTouchEvents)
|
||||
{
|
||||
synchronized(this)
|
||||
{
|
||||
this.notify();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(mGlContextLost) {
|
||||
mGlContextLost = false;
|
||||
Settings.SetupTouchscreenKeyboardGraphics(context); // Reload on-screen buttons graphics
|
||||
DrawLogo(mGl);
|
||||
super.SwapBuffers();
|
||||
}
|
||||
|
||||
// Unblock event processing thread only after we've finished rendering
|
||||
if(mRatelimitTouchEvents)
|
||||
{
|
||||
synchronized(this)
|
||||
{
|
||||
this.notify();
|
||||
}
|
||||
}
|
||||
/*if( context.isScreenKeyboardShown() )
|
||||
{
|
||||
try {
|
||||
Thread.sleep(50); // Give some time to the keyboard input thread
|
||||
} catch(Exception e) { };
|
||||
}*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void showScreenKeyboardWithoutTextInputField() // Called from native code
|
||||
{
|
||||
class Callback implements Runnable
|
||||
{
|
||||
public MainActivity parent;
|
||||
public void run()
|
||||
{
|
||||
parent.showScreenKeyboardWithoutTextInputField();
|
||||
}
|
||||
}
|
||||
Callback cb = new Callback();
|
||||
cb.parent = context;
|
||||
context.runOnUiThread(cb);
|
||||
}
|
||||
|
||||
public void showScreenKeyboard(final String oldText, int sendBackspace) // Called from native code
|
||||
{
|
||||
class Callback implements Runnable
|
||||
{
|
||||
public MainActivity parent;
|
||||
public String oldText;
|
||||
public boolean sendBackspace;
|
||||
public void run()
|
||||
{
|
||||
parent.showScreenKeyboard(oldText, sendBackspace);
|
||||
}
|
||||
}
|
||||
Callback cb = new Callback();
|
||||
cb.parent = context;
|
||||
cb.oldText = oldText;
|
||||
cb.sendBackspace = (sendBackspace != 0);
|
||||
context.runOnUiThread(cb);
|
||||
}
|
||||
|
||||
public void hideScreenKeyboard() // Called from native code
|
||||
{
|
||||
class Callback implements Runnable
|
||||
{
|
||||
public MainActivity parent;
|
||||
public void run()
|
||||
{
|
||||
//parent.hideScreenKeyboard();
|
||||
}
|
||||
}
|
||||
Callback cb = new Callback();
|
||||
cb.parent = context;
|
||||
context.runOnUiThread(cb);
|
||||
}
|
||||
|
||||
public int isScreenKeyboardShown() // Called from native code
|
||||
{
|
||||
//return context.isScreenKeyboardShown() ? 1 : 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setScreenKeyboardHintMessage(String s)
|
||||
{
|
||||
//context.setScreenKeyboardHintMessage(s);
|
||||
}
|
||||
|
||||
public void startAccelerometerGyroscope(int started)
|
||||
{
|
||||
accelerometer.openedBySDL = (started != 0);
|
||||
if( accelerometer.openedBySDL && !mPaused )
|
||||
accelerometer.start();
|
||||
else
|
||||
accelerometer.stop();
|
||||
}
|
||||
|
||||
public void exitApp()
|
||||
{
|
||||
//nativeDone();
|
||||
}
|
||||
|
||||
public void getAdvertisementParams(int params[])
|
||||
{
|
||||
//context.getAdvertisementParams(params);
|
||||
}
|
||||
public void setAdvertisementVisible(int visible)
|
||||
{
|
||||
//context.setAdvertisementVisible(visible);
|
||||
}
|
||||
public void setAdvertisementPosition(int left, int top)
|
||||
{
|
||||
//context.setAdvertisementPosition(left, top);
|
||||
}
|
||||
public void requestNewAdvertisement()
|
||||
{
|
||||
//context.requestNewAdvertisement();
|
||||
}
|
||||
|
||||
private int PowerOf2(int i)
|
||||
{
|
||||
int value = 1;
|
||||
while (value < i)
|
||||
value <<= 1;
|
||||
return value;
|
||||
}
|
||||
public void DrawLogo(GL10 gl)
|
||||
{
|
||||
/*
|
||||
// TODO: this not quite works, as it seems
|
||||
BitmapDrawable bmp = null;
|
||||
try
|
||||
{
|
||||
bmp = new BitmapDrawable(context.getAssets().open("logo.png"));
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
bmp = new BitmapDrawable(context.getResources().openRawResource(R.drawable.publisherlogo));
|
||||
}
|
||||
int width = bmp.getBitmap().getWidth();
|
||||
int height = bmp.getBitmap().getHeight();
|
||||
ByteBuffer byteBuffer = ByteBuffer.allocateDirect(4 * width * height);
|
||||
//byteBuffer.order(ByteOrder.BIG_ENDIAN);
|
||||
bmp.getBitmap().copyPixelsToBuffer(byteBuffer);
|
||||
byteBuffer.position(0);
|
||||
|
||||
gl.glViewport(0, 0, mWidth, mHeight);
|
||||
gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT);
|
||||
gl.glColor4x(0x10000, 0x10000, 0x10000, 0x10000);
|
||||
gl.glPixelStorei(gl.GL_UNPACK_ALIGNMENT, 1);
|
||||
gl.glEnable(GL10.GL_TEXTURE_2D);
|
||||
int textureName = -1;
|
||||
int mTextureNameWorkspace[] = new int[1];
|
||||
int mCropWorkspace[] = new int[4];
|
||||
gl.glGenTextures(1, mTextureNameWorkspace, 0);
|
||||
textureName = mTextureNameWorkspace[0];
|
||||
gl.glBindTexture(GL10.GL_TEXTURE_2D, textureName);
|
||||
gl.glActiveTexture(textureName);
|
||||
gl.glClientActiveTexture(textureName);
|
||||
gl.glTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGBA,
|
||||
PowerOf2(width), PowerOf2(height), 0,
|
||||
GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, null);
|
||||
gl.glTexSubImage2D(GL10.GL_TEXTURE_2D, 0, 0, 0,
|
||||
width, height,
|
||||
GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, byteBuffer);
|
||||
mCropWorkspace[0] = 0; // u
|
||||
mCropWorkspace[1] = height; // v
|
||||
mCropWorkspace[2] = width;
|
||||
mCropWorkspace[3] = -height;
|
||||
((GL11) gl).glTexParameteriv(GL10.GL_TEXTURE_2D,
|
||||
GL11Ext.GL_TEXTURE_CROP_RECT_OES, mCropWorkspace, 0);
|
||||
((GL11Ext) gl).glDrawTexiOES(0, -mHeight, 0, mWidth, mHeight);
|
||||
gl.glActiveTexture(0);
|
||||
gl.glClientActiveTexture(0);
|
||||
gl.glBindTexture(GL10.GL_TEXTURE_2D, 0);
|
||||
gl.glDeleteTextures(1, mTextureNameWorkspace, 0);
|
||||
|
||||
gl.glFlush();
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
//private native void nativeInitJavaCallbacks();
|
||||
//private native void nativeInit(String CurrentPath, String CommandLine, int multiThreadedVideo, int isDebuggerConnected);
|
||||
//private native void nativeResize(int w, int h, int keepAspectRatio);
|
||||
//private native void nativeDone();
|
||||
//private native void nativeGlContextLost();
|
||||
//public native void nativeGlContextRecreated();
|
||||
//public native void nativeGlContextLostAsyncEvent();
|
||||
//public static native void nativeTextInput( int ascii, int unicode );
|
||||
//public static native void nativeTextInputFinished();
|
||||
|
||||
private MainActivity context = null;
|
||||
public AccelerometerReader accelerometer = null;
|
||||
|
||||
private GL10 mGl = null;
|
||||
private EGL10 mEgl = null;
|
||||
private EGLDisplay mEglDisplay = null;
|
||||
private EGLSurface mEglSurface = null;
|
||||
//private EGLContext mEglContext = null;
|
||||
private boolean mGlContextLost = false;
|
||||
public boolean mGlSurfaceCreated = false;
|
||||
public boolean mPaused = false;
|
||||
private boolean mFirstTimeStart = true;
|
||||
public int mWidth = 0;
|
||||
public int mHeight = 0;
|
||||
|
||||
public static final boolean mRatelimitTouchEvents = true; //(Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO);
|
||||
}
|
||||
|
||||
class DemoGLSurfaceView extends GLSurfaceView_SDL {
|
||||
public DemoGLSurfaceView(MainActivity context) {
|
||||
super(context);
|
||||
mParent = context;
|
||||
touchInput = DifferentTouchInput.getInstance();
|
||||
setEGLConfigChooser(Globals.VideoDepthBpp, Globals.NeedDepthBuffer, Globals.NeedStencilBuffer, Globals.NeedGles2);
|
||||
mRenderer = new DemoRenderer(context);
|
||||
setRenderer(mRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(final MotionEvent event)
|
||||
{
|
||||
touchInput.process(event);
|
||||
if( DemoRenderer.mRatelimitTouchEvents )
|
||||
{
|
||||
limitEventRate(event);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean onGenericMotionEvent (final MotionEvent event)
|
||||
{
|
||||
touchInput.processGenericEvent(event);
|
||||
if( DemoRenderer.mRatelimitTouchEvents )
|
||||
{
|
||||
limitEventRate(event);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void limitEventRate(final MotionEvent event)
|
||||
{
|
||||
// Wait a bit, and try to synchronize to app framerate, or event thread will eat all CPU and we'll lose FPS
|
||||
// With Froyo the rate of touch events seems to be limited by OS, but they are arriving faster then we're redrawing anyway
|
||||
if((event.getAction() == MotionEvent.ACTION_MOVE ||
|
||||
event.getAction() == MotionEvent.ACTION_HOVER_MOVE))
|
||||
{
|
||||
synchronized(mRenderer)
|
||||
{
|
||||
try
|
||||
{
|
||||
mRenderer.wait(300L); // And sometimes the app decides not to render at all, so this timeout should not be big.
|
||||
} catch (InterruptedException e) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void exitApp() {
|
||||
mRenderer.exitApp();
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
if(mRenderer.mPaused)
|
||||
return;
|
||||
mRenderer.mPaused = true;
|
||||
//mRenderer.nativeGlContextLostAsyncEvent();
|
||||
if( mRenderer.accelerometer != null ) // For some reason it crashes here often - are we getting this event before initialization?
|
||||
mRenderer.accelerometer.stop();
|
||||
super.onPause();
|
||||
};
|
||||
|
||||
public boolean isPaused() {
|
||||
return mRenderer.mPaused;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
if(!mRenderer.mPaused)
|
||||
return;
|
||||
mRenderer.mPaused = false;
|
||||
super.onResume();
|
||||
Log.i("SDL", "libSDL: DemoGLSurfaceView.onResume(): mRenderer.mGlSurfaceCreated " + mRenderer.mGlSurfaceCreated + " mRenderer.mPaused " + mRenderer.mPaused);
|
||||
/*if( mRenderer.mGlSurfaceCreated && ! mRenderer.mPaused || Globals.NonBlockingSwapBuffers )
|
||||
mRenderer.nativeGlContextRecreated();*/
|
||||
if( mRenderer.accelerometer != null && mRenderer.accelerometer.openedBySDL ) // For some reason it crashes here often - are we getting this event before initialization?
|
||||
mRenderer.accelerometer.start();
|
||||
};
|
||||
|
||||
// This seems like redundant code - it handled in MainActivity.java
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, final KeyEvent event) {
|
||||
//Log.i("SDL", "Got key down event, id " + keyCode + " meta " + event.getMetaState() + " event " + event.toString());
|
||||
if( nativeKey( keyCode, 1 ) == 0 )
|
||||
return super.onKeyDown(keyCode, event);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, final KeyEvent event) {
|
||||
//Log.i("SDL", "Got key up event, id " + keyCode + " meta " + event.getMetaState());
|
||||
if( nativeKey( keyCode, 0 ) == 0 )
|
||||
return super.onKeyUp(keyCode, event);
|
||||
return true;
|
||||
}
|
||||
|
||||
DemoRenderer mRenderer;
|
||||
MainActivity mParent;
|
||||
DifferentTouchInput touchInput = null;
|
||||
|
||||
public static native void nativeMotionEvent( int x, int y, int action, int pointerId, int pressure, int radius );
|
||||
public static native int nativeKey( int keyCode, int down );
|
||||
public static native void nativeTouchpad( int x, int y, int down, int multitouch );
|
||||
public static native void initJavaCallbacks();
|
||||
public static native void nativeHardwareMouseDetected( int detected );
|
||||
public static native void nativeMouseButtonsPressed( int buttonId, int pressedState );
|
||||
public static native void nativeMouseWheel( int scrollX, int scrollY );
|
||||
public static native void nativeGamepadAnalogJoystickInput( float stick1x, float stick1y, float stick2x, float stick2y, float rtrigger, float ltrigger );
|
||||
}
|
||||
|
||||
|
||||
1
project/javaSDL2/XZInputStream.java
Symbolic link
1
project/javaSDL2/XZInputStream.java
Symbolic link
@@ -0,0 +1 @@
|
||||
../java/XZInputStream.java
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Java source code (C) 2009-2012 Sergii Pylypenko
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
package net.sourceforge.clonekeenplus;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
import android.view.View;
|
||||
|
||||
import com.google.ads.*; // Copy GoogleAdMobAdsSdk.jar to the directory project/libs
|
||||
|
||||
class Advertisement
|
||||
{
|
||||
private AdView ad;
|
||||
MainActivity parent;
|
||||
|
||||
public Advertisement(MainActivity p)
|
||||
{
|
||||
parent = p;
|
||||
AdSize adSize = AdSize.BANNER;
|
||||
if( Globals.AdmobBannerSize.equals("BANNER") )
|
||||
adSize = AdSize.BANNER;
|
||||
else if( Globals.AdmobBannerSize.equals("IAB_BANNER") )
|
||||
adSize = AdSize.IAB_BANNER;
|
||||
else if( Globals.AdmobBannerSize.equals("IAB_LEADERBOARD") )
|
||||
adSize = AdSize.IAB_LEADERBOARD;
|
||||
else if( Globals.AdmobBannerSize.equals("IAB_MRECT") )
|
||||
adSize = AdSize.IAB_MRECT;
|
||||
else if( Globals.AdmobBannerSize.equals("IAB_WIDE_SKYSCRAPER") )
|
||||
adSize = AdSize.IAB_WIDE_SKYSCRAPER;
|
||||
else if( Globals.AdmobBannerSize.equals("SMART_BANNER") )
|
||||
adSize = AdSize.SMART_BANNER;
|
||||
ad = new AdView(parent, adSize, Globals.AdmobPublisherId);
|
||||
AdRequest adRequest = new AdRequest();
|
||||
adRequest.addTestDevice(AdRequest.TEST_EMULATOR); // Copy GoogleAdMobAdsSdk.jar to the directory project/libs
|
||||
adRequest.addTestDevice(Globals.AdmobTestDeviceId);
|
||||
ad.loadAd(adRequest);
|
||||
}
|
||||
|
||||
public View getView()
|
||||
{
|
||||
return ad;
|
||||
}
|
||||
|
||||
public void requestNewAd()
|
||||
{
|
||||
AdRequest adRequest = new AdRequest();
|
||||
adRequest.addTestDevice(AdRequest.TEST_EMULATOR); // Copy GoogleAdMobAdsSdk.jar to the directory project/libs
|
||||
adRequest.addTestDevice(Globals.AdmobTestDeviceId);
|
||||
ad.loadAd(adRequest);
|
||||
}
|
||||
}
|
||||
1
project/javaSDL2/translations
Symbolic link
1
project/javaSDL2/translations
Symbolic link
@@ -0,0 +1 @@
|
||||
../java/translations
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
grep '<string name=' values/strings.xml | while read str; do
|
||||
|
||||
var=`echo $str | sed 's/<string name=["]\([^"]*\).*/\1/'`
|
||||
text=`echo $str | sed 's/<string name=["][^"]*["]>\([^<]*\).*/\1/'`
|
||||
if [ "$var" = "app_name" ]; then
|
||||
continue
|
||||
fi
|
||||
PRINTEN=true
|
||||
echo
|
||||
for dir in values-*; do
|
||||
lang=`echo $dir | sed 's/[^-]*-\(..\).*/\1/'`
|
||||
trans=`grep "<string name=\"$var\">" $dir/strings.xml`
|
||||
transtext=`echo $trans | sed 's/<string name=["][^"]*["]>\([^<]*\).*/\1/'`
|
||||
if [ -z "$transtext" ] ; then
|
||||
#transtext=`./translate.py en $lang "$text"`
|
||||
#echo "$transtext" | grep 'Suspected Terms of Service Abuse' > /dev/null && transtext="$text"
|
||||
transtext="$text"
|
||||
grep -v "^[<]/resources[>]\$" $dir/strings.xml > $dir/strings.1.xml
|
||||
echo "<string name=\"$var\">$transtext</string>" >> $dir/strings.1.xml
|
||||
echo "</resources>" >> $dir/strings.1.xml
|
||||
mv -f $dir/strings.1.xml $dir/strings.xml
|
||||
if $PRINTEN ; then
|
||||
echo en: $var: $text
|
||||
PRINTEN=false
|
||||
fi
|
||||
echo $lang: $var: $transtext
|
||||
fi
|
||||
done
|
||||
done
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
from urllib2 import urlopen
|
||||
from urllib import urlencode
|
||||
import sys
|
||||
|
||||
# The google translate API can be found here:
|
||||
# http://code.google.com/apis/ajaxlanguage/documentation/#Examples
|
||||
|
||||
lang1=sys.argv[1]
|
||||
lang2=sys.argv[2]
|
||||
langpair='%s|%s'%(lang1,lang2)
|
||||
text=' '.join(sys.argv[3:])
|
||||
base_url='http://ajax.googleapis.com/ajax/services/language/translate?'
|
||||
params=urlencode( (('v',1.0),
|
||||
('q',text),
|
||||
('langpair',langpair),) )
|
||||
url=base_url+params
|
||||
content=urlopen(url).read()
|
||||
start_idx=content.find('"translatedText":"')+18
|
||||
translation=content[start_idx:]
|
||||
end_idx=translation.find('"}, "')
|
||||
translation=translation[:end_idx]
|
||||
print translation
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
I''ve tired of using Google Translate to create random gibberish in the languages I don't know,
|
||||
so from now on the only supported languages are English, Russian, Ukrainian, and French with some community support,
|
||||
If you wish to maintain a translation - contact me, but I will want a continuous support, not just one-time translation.
|
||||
@@ -1,137 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="init">Initialisiere</string>
|
||||
<string name="please_wait">Bitte warte, während die Dateien heruntergeladen werden.</string>
|
||||
|
||||
<string name="device_config">Gerätekonfiguration</string>
|
||||
<string name="device_change_cfg">Gerätekonfiguration bearbeiten</string>
|
||||
|
||||
<string name="download_unneeded">Download nicht nötig</string>
|
||||
<string name="connecting_to">Verbinde mit %s</string>
|
||||
<string name="failed_connecting_to">Verbindung mit %s fehlgeschlagen</string>
|
||||
<string name="error_connecting_to">Fehler beim Verbinden mit %s</string>
|
||||
<string name="dl_from">Lade Daten von %s</string>
|
||||
<string name="error_dl_from">Fehler beim Download von %s</string>
|
||||
<string name="error_write">Fehler beim schreiben auf %s</string>
|
||||
<string name="dl_progress">Zu %1$.0f%% abgeschlossen: Datei %2$s</string>
|
||||
<string name="dl_finished">Abgeschlossen</string>
|
||||
|
||||
<string name="storage_phone">Interner Speicher: %d MiB frei</string>
|
||||
<string name="storage_sd">SD Karte: %d MiB frei</string>
|
||||
<string name="storage_question">Wohin sollen die Dateien gespeichert werden</string>
|
||||
|
||||
<string name="controls_arrows">Pfeiltasten / Joystick / dpad</string>
|
||||
<string name="controls_trackball">Trackball</string>
|
||||
<string name="controls_accel">Accelerometer</string>
|
||||
<string name="controls_question">Welche Arten von Navigationstasten hat das Gerät?</string>
|
||||
|
||||
<string name="trackball_no_dampening">Keine Dämpfung</string>
|
||||
<string name="trackball_fast">Schnell</string>
|
||||
<string name="trackball_medium">Mittel</string>
|
||||
<string name="trackball_slow">Langsam</string>
|
||||
<string name="trackball_question">Dämpfung des Trackball</string>
|
||||
|
||||
<string name="accel_fast">Schnell</string>
|
||||
<string name="accel_medium">Mittel</string>
|
||||
<string name="accel_slow">Langsam</string>
|
||||
<string name="accel_question">Empfindlichkeit des Accelerometers</string>
|
||||
|
||||
<string name="audiobuf_small">Klein (für schnelle Geräte)</string>
|
||||
<string name="audiobuf_medium">Mittel</string>
|
||||
<string name="audiobuf_large">Groß (Wenn Ton "hängt")</string>
|
||||
<string name="audiobuf_question">Größe des Audiopuffers</string>
|
||||
<string name="optional_downloads">Optional Downloads</string>
|
||||
<string name="ok">OK</string>
|
||||
<string name="controls_touch">Touchscreen nur</string>
|
||||
<string name="controls_additional">Zusätzliche Kontrollen zu verwenden</string>
|
||||
<string name="controls_screenkb">On-Screen-Tastatur</string>
|
||||
<string name="controls_accelnav">Beschleunigungsmesser</string>
|
||||
<string name="controls_screenkb_size">On-Screen-Tastatur Größe</string>
|
||||
<string name="controls_screenkb_large">Große</string>
|
||||
<string name="controls_screenkb_medium">Medium</string>
|
||||
<string name="controls_screenkb_small">Kleine</string>
|
||||
<string name="controls_screenkb_tiny">Winzig</string>
|
||||
<string name="controls_screenkb_theme">On-Screen-Tastatur Thema</string>
|
||||
<string name="controls_screenkb_by">%1$s von %2$s</string>
|
||||
<string name="accel_floating">Schwimmend</string>
|
||||
<string name="accel_fixed_start">Feste, wenn die Anwendung startet</string>
|
||||
<string name="accel_fixed_horiz">Fixiert auf Tisch Schreibtisch Orientierung</string>
|
||||
<string name="accel_question_center">Beschleunigungsmesser Mittelstellung</string>
|
||||
<string name="audiobuf_verysmall">Sehr kleine (schnelle Geräte, weniger Verzögerung)</string>
|
||||
<string name="rightclick_question">Rechter Mausklick ausgelöst durch</string>
|
||||
<string name="rightclick_menu">Menütaste</string>
|
||||
<string name="rightclick_multitouch">Touch-Screen mit dem zweiten Finger</string>
|
||||
<string name="rightclick_pressure">Touchscreen mit Kraft</string>
|
||||
<string name="pointandclick_question">Erweiterte Funktionen</string>
|
||||
<string name="pointandclick_keepaspectratio">Halten 4:3-Bildschirm Seitenverhältnis</string>
|
||||
<string name="pointandclick_showcreenunderfinger">Show-Bildschirm unter dem Finger in einem separaten Fenster</string>
|
||||
<string name="measurepressure_touchplease">Bitte schieben Sie den Finger über den Bildschirm für zwei Sekunden</string>
|
||||
<string name="rightclick_none">Deaktivieren der rechten Maustaste</string>
|
||||
<string name="leftclick_question">Linke Maustaste</string>
|
||||
<string name="leftclick_normal">Normal</string>
|
||||
<string name="leftclick_near_cursor">Tippen Sie auf nahe Mauszeiger</string>
|
||||
<string name="leftclick_multitouch">Touch-Screen mit dem zweiten Finger</string>
|
||||
<string name="leftclick_pressure">Touchscreen mit Kraft</string>
|
||||
<string name="leftclick_dpadcenter">Trackball klicken Select-Taste</string>
|
||||
<string name="pointandclick_joystickmouse">Bewegen Sie die Maus mit Joystick oder Trackball</string>
|
||||
<string name="measurepressure_response">Pressure %1$03d Radius %2$03d</string>
|
||||
<string name="click_with_dpadcenter">Linker Mausklick mit Trackball / Joystick Zentrum</string>
|
||||
<string name="pointandclick_joystickmousespeed">Bewegen Sie die Maus mit Joystick-Geschwindigkeit</string>
|
||||
<string name="pointandclick_joystickmouseaccel">Bewegen Sie die Maus mit Joystick-Beschleunigung</string>
|
||||
<string name="none">Keine</string>
|
||||
<string name="controls_screenkb_transparency">On-Screen-Tastatur Transparenz</string>
|
||||
<string name="controls_screenkb_trans_0">Nicht sichtbar</string>
|
||||
<string name="controls_screenkb_trans_1">Fast unsichtbar</string>
|
||||
<string name="controls_screenkb_trans_2">Transparente</string>
|
||||
<string name="controls_screenkb_trans_3">Semi-transparent</string>
|
||||
<string name="controls_screenkb_trans_4">Non-transparent</string>
|
||||
<string name="mouse_emulation">Maus-Emulation</string>
|
||||
<string name="measurepressure">Kalibrieren Touchscreen Druck</string>
|
||||
<string name="remap_hwkeys">Remap physischen Tasten</string>
|
||||
<string name="remap_hwkeys_press">Drücken Sie eine beliebige Taste außer HOME und POWER, können Sie Lautstärke-Tasten</string>
|
||||
<string name="remap_hwkeys_select">Wählen Sie SDL Schlüsselcode</string>
|
||||
<string name="remap_screenkb">Remap On-Screen-Steuerung</string>
|
||||
<string name="remap_screenkb_joystick">On-Screen-Joystick</string>
|
||||
<string name="remap_screenkb_button">On-Screen-Taste</string>
|
||||
<string name="remap_screenkb_button_text">On-Screen-Texteingabe-Taste</string>
|
||||
<string name="remap_screenkb_button_zoomin">Zoom in Zwei-Finger-Geste</string>
|
||||
<string name="remap_screenkb_button_zoomout">Verkleinern Zwei-Finger-Geste</string>
|
||||
<string name="remap_screenkb_button_rotateleft">Nach links drehen Zwei-Finger-Geste</string>
|
||||
<string name="remap_screenkb_button_rotateright">Nach rechts drehen Zwei-Finger-Geste</string>
|
||||
<string name="remap_screenkb_button_gestures">Zwei-Finger-Gesten</string>
|
||||
<string name="accel_veryfast">Sehr schnell</string>
|
||||
<string name="remap_screenkb_button_gestures_sensitivity">Zwei-Finger-Gesten Bildschirm Empfindlichkeit</string>
|
||||
<string name="storage_custom">Geben Sie direkt</string>
|
||||
<string name="storage_commandline">Geben Kommandozeilenparameter</string>
|
||||
<string name="calibrate_touchscreen">Kalibrieren Touchscreen</string>
|
||||
<string name="calibrate_touchscreen_touch">Touch allen vier Rändern des Bildschirms, drücken Sie Menü, wenn Sie fertig</string>
|
||||
<string name="screenkb_custom_layout">Passen Sie auf dem Bildschirm Tastatur-Layout</string>
|
||||
<string name="screenkb_custom_layout_help">Slide-Bildschirm hinzufügen Taste, drücken Sie Menü zum letzten Knopf rückgängig machen</string>
|
||||
<string name="rightclick_key">Physikalische Schlüssel</string>
|
||||
<string name="pointandclick_showcreenunderfinger2">On-Screen-Lupe</string>
|
||||
<string name="video">Video-Einstellungen</string>
|
||||
<string name="video_smooth">Glatte Video</string>
|
||||
<string name="accel_veryslow">Sehr langsam</string>
|
||||
<string name="leftclick_timeout">Halten Sie an der gleichen Stelle</string>
|
||||
<string name="leftclick_tap">Tippen Sie auf</string>
|
||||
<string name="leftclick_tap_or_timeout">Tippen Sie auf oder halten</string>
|
||||
<string name="leftclick_timeout_time">Holding-Timeout</string>
|
||||
<string name="leftclick_timeout_time_0">0,3 Sek.</string>
|
||||
<string name="leftclick_timeout_time_1">0,5 Sek.</string>
|
||||
<string name="leftclick_timeout_time_2">0,7 Sek.</string>
|
||||
<string name="leftclick_timeout_time_3">1 Sek.</string>
|
||||
<string name="leftclick_timeout_time_4">1,5 Sek.</string>
|
||||
<string name="pointandclick_relative">Relative Bewegung der Maus (Laptop-Modus)</string>
|
||||
<string name="pointandclick_relative_speed">Relative Maus Bewegungsgeschwindigkeit</string>
|
||||
<string name="pointandclick_relative_accel">Relative Bewegung der Maus Beschleunigung</string>
|
||||
<string name="downloads">Downloads</string>
|
||||
<string name="video_separatethread">Separaten Thread für Video, FPS bei einigen Geräten zu erhöhen</string>
|
||||
<string name="text_edit_click_here">Tippen Sie auf der Eingabe beginnen, drücken Sie Zurück, wenn Sie fertig</string>
|
||||
<string name="display_size_mouse">Konfigurieren der Maus je nach Display-Größe</string>
|
||||
<string name="display_size">Wählen Sie Ihre Display-Größe</string>
|
||||
<string name="display_size_large">Groß (Tablette)</string>
|
||||
<string name="display_size_small">Klein (Telefon)</string>
|
||||
<string name="display_size_tiny">Uberklein (Xperia Mini)</string>
|
||||
<string name="show_more_options">Weitere Optionen</string>
|
||||
<string name="controls_screenkb_drawsize">Größe der Schaltfläche Bilder</string>
|
||||
</resources>
|
||||
@@ -1,137 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="init">Käynnistetään</string>
|
||||
<string name="please_wait">Odota kun tietoja ladataan</string>
|
||||
|
||||
<string name="device_config">Laiteasetukset</string>
|
||||
<string name="device_change_cfg">Muuta laiteasetuksia</string>
|
||||
|
||||
<string name="download_unneeded">Ei tarvitse ladata</string>
|
||||
<string name="connecting_to">Yhdistetään %s</string>
|
||||
<string name="failed_connecting_to">Yhdistäminen epäonnistui %s</string>
|
||||
<string name="error_connecting_to">Virhe yhdistettäessä %s</string>
|
||||
<string name="dl_from">Ladataan kohteesta %s</string>
|
||||
<string name="error_dl_from">Virhe ladattaessa kohteesta %s</string>
|
||||
<string name="error_write">Virhe kirjoittaessa %s</string>
|
||||
<string name="dl_progress">%1$.0f%% valmis: tiedosto %2$s</string>
|
||||
<string name="dl_finished">Valmis</string>
|
||||
|
||||
<string name="storage_phone">Sisäinen muisti - %d Mt vapaana</string>
|
||||
<string name="storage_sd">SD kortti - %d Mt vapaana</string>
|
||||
<string name="storage_question">Minne sovelluksen data ladataan</string>
|
||||
|
||||
<string name="controls_arrows">Nuolinapit / joystick / dpad</string>
|
||||
<string name="controls_trackball">Pallohiiri</string>
|
||||
<string name="controls_accel">Kiihtyvyysanturi</string>
|
||||
<string name="controls_question">Millaiset navigointinapit laittessasi on?</string>
|
||||
|
||||
<string name="trackball_no_dampening">Ei vaimennusta</string>
|
||||
<string name="trackball_fast">Nopea</string>
|
||||
<string name="trackball_medium">Kohtalainen</string>
|
||||
<string name="trackball_slow">Hidas</string>
|
||||
<string name="trackball_question">Pallohiiren vaimennus</string>
|
||||
|
||||
<string name="accel_fast">Nopea</string>
|
||||
<string name="accel_medium">Kohtalainen</string>
|
||||
<string name="accel_slow">Hidas</string>
|
||||
<string name="accel_question">Kiihtyvyysanturin herkkyys</string>
|
||||
|
||||
<string name="audiobuf_small">Pieni (nopeat laitteet)</string>
|
||||
<string name="audiobuf_medium">Keskisuuri</string>
|
||||
<string name="audiobuf_large">Suuri (jos ääni pätkii)</string>
|
||||
<string name="audiobuf_question">Äänipuskurin koko</string>
|
||||
<string name="optional_downloads">Vapaaehtoinen lataukset</string>
|
||||
<string name="ok">OK</string>
|
||||
<string name="controls_touch">Kosketusnäyttö vain</string>
|
||||
<string name="controls_additional">Muita ohjausobjekteja käyttää</string>
|
||||
<string name="controls_screenkb">Näyttönäppäimistöllä</string>
|
||||
<string name="controls_accelnav">Kiihtyvyysmittari</string>
|
||||
<string name="controls_screenkb_size">Näyttönäppäimistöllä koko</string>
|
||||
<string name="controls_screenkb_large">Suuri</string>
|
||||
<string name="controls_screenkb_medium">Medium</string>
|
||||
<string name="controls_screenkb_small">Pienet</string>
|
||||
<string name="controls_screenkb_tiny">Tiny</string>
|
||||
<string name="controls_screenkb_theme">Näyttönäppäimistöllä teema</string>
|
||||
<string name="controls_screenkb_by">%1$s %2$s</string>
|
||||
<string name="accel_floating">Kelluva</string>
|
||||
<string name="accel_fixed_start">Kiinteät kun sovellus käynnistyy</string>
|
||||
<string name="accel_fixed_horiz">Korjattu taulukko työpöytä suuntautumiseen</string>
|
||||
<string name="accel_question_center">Kiihtyvyysmittari keskiasentoon</string>
|
||||
<string name="audiobuf_verysmall">Hyvin pieni (nopea laitteita, vähemmän lag)</string>
|
||||
<string name="rightclick_question">Napsauta hiiren kakkospainikkeella alkunsa</string>
|
||||
<string name="rightclick_menu">Valikkonäppäin</string>
|
||||
<string name="rightclick_multitouch">Kosketusnäyttö on toinen sormi</string>
|
||||
<string name="rightclick_pressure">Kosketusnäyttö voimalla</string>
|
||||
<string name="pointandclick_question">Lisäominaisuudet</string>
|
||||
<string name="pointandclick_keepaspectratio">Pidä 04:03 kuvasuhde</string>
|
||||
<string name="pointandclick_showcreenunderfinger">Näytä näytön alle sormi erillisessä ikkunassa</string>
|
||||
<string name="measurepressure_touchplease">Ole hyvä ja liu\u0026#39;uttamalla sormea näytöllä kaksi sekuntia</string>
|
||||
<string name="rightclick_none">Poista oikealla hiiren klikkauksella</string>
|
||||
<string name="leftclick_question">Vasen hiiren nappi</string>
|
||||
<string name="leftclick_normal">Normaali</string>
|
||||
<string name="leftclick_near_cursor">Touch lähellä hiiren kursori</string>
|
||||
<string name="leftclick_multitouch">Kosketusnäyttö on toinen sormi</string>
|
||||
<string name="leftclick_pressure">Kosketusnäyttö voimalla</string>
|
||||
<string name="leftclick_dpadcenter">Trackball Valitse / Select-näppäintä</string>
|
||||
<string name="pointandclick_joystickmouse">Siirrä hiiren ohjaimella tai trackball</string>
|
||||
<string name="measurepressure_response">Paine %1$03d säde %2$03d</string>
|
||||
<string name="click_with_dpadcenter">Vasen hiiren klikkaus trackball-ohjaimella keskusta</string>
|
||||
<string name="pointandclick_joystickmousespeed">Siirrä hiiri ohjainta nopeasti</string>
|
||||
<string name="pointandclick_joystickmouseaccel">Siirrä hiiri ohjainta kiihtyvyys</string>
|
||||
<string name="none">Ei</string>
|
||||
<string name="controls_screenkb_transparency">Näyttönäppäimistöllä avoimuutta</string>
|
||||
<string name="controls_screenkb_trans_0">Näkymätön</string>
|
||||
<string name="controls_screenkb_trans_1">Lähes näkymätön</string>
|
||||
<string name="controls_screenkb_trans_2">Läpinäkyvä</string>
|
||||
<string name="controls_screenkb_trans_3">Semi-avoimet</string>
|
||||
<string name="controls_screenkb_trans_4">Ei-läpinäkyvä</string>
|
||||
<string name="mouse_emulation">Hiiren emulointi</string>
|
||||
<string name="measurepressure">Kalibroi kosketusnäyttö paine</string>
|
||||
<string name="remap_hwkeys">Remap fyysiset näppäimet</string>
|
||||
<string name="remap_hwkeys_press">Paina mitä tahansa näppäintä paitsi koti-ja POWER, voit käyttää äänenvoimakkuusnäppäimiä</string>
|
||||
<string name="remap_hwkeys_select">Valitse SDL näppäinkoodien</string>
|
||||
<string name="remap_screenkb">Remap näytön valvonnan</string>
|
||||
<string name="remap_screenkb_joystick">Näytöllä ohjainta</string>
|
||||
<string name="remap_screenkb_button">Ruutunäyttöpainike</string>
|
||||
<string name="remap_screenkb_button_text">Näytön tekstin tulopainiketta</string>
|
||||
<string name="remap_screenkb_button_zoomin">Suurenna kahden sormen elettä</string>
|
||||
<string name="remap_screenkb_button_zoomout">Pienennä kahden sormen elettä</string>
|
||||
<string name="remap_screenkb_button_rotateleft">Kierrä vasemmalle kahden sormen elettä</string>
|
||||
<string name="remap_screenkb_button_rotateright">Kierrä oikealle kahden sormen elettä</string>
|
||||
<string name="remap_screenkb_button_gestures">Kahden sormen eleitä</string>
|
||||
<string name="accel_veryfast">Erittäin nopea</string>
|
||||
<string name="remap_screenkb_button_gestures_sensitivity">Kahden sormen näytön eleet herkkyys</string>
|
||||
<string name="storage_custom">Määritä hakemisto</string>
|
||||
<string name="storage_commandline">Määritä komentoriviparametrit</string>
|
||||
<string name="calibrate_touchscreen">Kalibroi kosketusnäyttö</string>
|
||||
<string name="calibrate_touchscreen_touch">Touch kaikki neljä reunaa näytön, paina Valikko, kun olet valmis</string>
|
||||
<string name="screenkb_custom_layout">Mukauta-ruudun näppäimistö</string>
|
||||
<string name="screenkb_custom_layout_help">Työnnä näytön lisätä painikkeen, paina Menu kumota viimeksi painike</string>
|
||||
<string name="rightclick_key">Fyysinen avain</string>
|
||||
<string name="pointandclick_showcreenunderfinger2">Näytöllä suurennuslasi</string>
|
||||
<string name="video">Videon asetukset</string>
|
||||
<string name="video_smooth">Tasainen video</string>
|
||||
<string name="accel_veryslow">Erittäin hidas</string>
|
||||
<string name="leftclick_timeout">Pidä samalla paikalla</string>
|
||||
<string name="leftclick_tap">Hana</string>
|
||||
<string name="leftclick_tap_or_timeout">Napauta tai pidä</string>
|
||||
<string name="leftclick_timeout_time">Holding aikakatkaisu</string>
|
||||
<string name="leftclick_timeout_time_0">0,3 sekuntia</string>
|
||||
<string name="leftclick_timeout_time_1">0,5 sekuntia</string>
|
||||
<string name="leftclick_timeout_time_2">0,7 sekuntia</string>
|
||||
<string name="leftclick_timeout_time_3">1 sek</string>
|
||||
<string name="leftclick_timeout_time_4">1,5 sek</string>
|
||||
<string name="pointandclick_relative">Suhteellinen hiiren liikkeet (kannettavan tietokoneen tilassa)</string>
|
||||
<string name="pointandclick_relative_speed">Suhteellinen hiiren liikkeen nopeus</string>
|
||||
<string name="pointandclick_relative_accel">Suhteellinen hiiren liikkeen kiihtyvyys</string>
|
||||
<string name="downloads">Downloads</string>
|
||||
<string name="video_separatethread">Erillisessä säikeessä video, kasvaa FPS joissakin laitteissa</string>
|
||||
<string name="text_edit_click_here">Napauta aloittaa kirjoittamisen, paina Takaisin, kun olet valmis</string>
|
||||
<string name="display_size_mouse">Määritä hiiren riippuen näytön koosta</string>
|
||||
<string name="display_size">Valitse näytön koko</string>
|
||||
<string name="display_size_large">Suuri (tabletti)</string>
|
||||
<string name="display_size_small">Pieni (puhelin)</string>
|
||||
<string name="display_size_tiny">Tiny (Xperia Mini)</string>
|
||||
<string name="show_more_options">Näytä enemmän vaihtoehtoja</string>
|
||||
<string name="controls_screenkb_drawsize">Koko painike kuvia</string>
|
||||
</resources>
|
||||
@@ -1,176 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="init">Démarrage</string>
|
||||
<string name="please_wait">Veuillez patienter pendant que les données sont téléchargées</string>
|
||||
|
||||
<string name="device_config">Configuration de l\'appareil</string>
|
||||
<string name="device_change_cfg">Changer la configuration</string>
|
||||
|
||||
<string name="download_unneeded">Téléchargement non nécessaire</string>
|
||||
<string name="connecting_to">Connexion à %s</string>
|
||||
<string name="failed_connecting_to">Echec de la connexion à %s</string>
|
||||
<string name="error_connecting_to">Erreur durant la connexion à %s</string>
|
||||
<string name="dl_from">Téléchargement à partir de %s</string>
|
||||
<string name="error_dl_from">Erreur lors du téléchargement à partir de %s</string>
|
||||
<string name="error_write">Erreur d\'écriture dans %s</string>
|
||||
<string name="dl_progress">%1$.0f%% fait : fichier %2$s</string>
|
||||
<string name="dl_finished">Fini</string>
|
||||
|
||||
<string name="storage_phone">Stockage interne - %d Mo de libre</string>
|
||||
<string name="storage_sd">Carte SD - %d Mo de libre</string>
|
||||
<string name="storage_custom">Choisir le répertoire</string>
|
||||
<string name="storage_commandline">Choisir les paramètres de la ligne de commande</string>
|
||||
<string name="storage_question">Où télécharger les données</string>
|
||||
<string name="optional_downloads">Téléchargements</string>
|
||||
<string name="downloads">Téléchargements</string>
|
||||
<string name="ok">OK</string>
|
||||
|
||||
<string name="controls_arrows">Flèches / joystick / dpad</string>
|
||||
<string name="controls_trackball">Trackball</string>
|
||||
<string name="controls_accel">Accéléromètre</string>
|
||||
<string name="controls_touch">Ecran tactile seul</string>
|
||||
<string name="controls_question">Quel type de touches votre appareil a-t-il?</string>
|
||||
|
||||
<string name="controls_additional">Contrôles supplémentaires</string>
|
||||
<string name="controls_screenkb">Clavier à l\'écran</string>
|
||||
<string name="controls_accelnav">Accéléromètre</string>
|
||||
|
||||
<string name="controls_screenkb_size">Taille du clavier à l\'écran</string>
|
||||
<string name="controls_screenkb_drawsize">Taille des images des boutons</string>
|
||||
<string name="controls_screenkb_large">Grande</string>
|
||||
<string name="controls_screenkb_medium">Moyenne</string>
|
||||
<string name="controls_screenkb_small">Petite</string>
|
||||
<string name="controls_screenkb_tiny">Minuscule</string>
|
||||
<string name="controls_screenkb_theme">Thème du clavier à l\'écran</string>
|
||||
<string name="controls_screenkb_by">%1$s par %2$s</string>
|
||||
<string name="controls_screenkb_transparency">Transparence du clavier</string>
|
||||
<string name="controls_screenkb_trans_0">Invisible</string>
|
||||
<string name="controls_screenkb_trans_1">Presque invisible</string>
|
||||
<string name="controls_screenkb_trans_2">Transparent</string>
|
||||
<string name="controls_screenkb_trans_3">Semi-transparent</string>
|
||||
<string name="controls_screenkb_trans_4">Non-transparent</string>
|
||||
|
||||
<string name="trackball_no_dampening">Sans limite</string>
|
||||
<string name="trackball_fast">Rapide</string>
|
||||
<string name="trackball_medium">Moyenne</string>
|
||||
<string name="trackball_slow">Lente</string>
|
||||
<string name="trackball_question">Limitation du trackball</string>
|
||||
|
||||
<string name="accel_veryfast">Très rapide</string>
|
||||
<string name="accel_fast">Rapide</string>
|
||||
<string name="accel_medium">Moyenne</string>
|
||||
<string name="accel_slow">Lente</string>
|
||||
<string name="accel_veryslow">Très lente</string>
|
||||
<string name="accel_question">Sensibilité de l\'accéléromètre</string>
|
||||
|
||||
<string name="accel_floating">Flottante</string>
|
||||
<string name="accel_fixed_start">Déterminée au démarrage de l\'application</string>
|
||||
<string name="accel_fixed_horiz">Orientaton de la table</string>
|
||||
<string name="accel_question_center">Position du centre de l\'accéléromètre</string>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<string name="mouse_emulation">Emulation de la souris</string>
|
||||
<string name="rightclick_question">Clic droit de la souris</string>
|
||||
<string name="rightclick_menu">Touche Menu</string>
|
||||
<string name="rightclick_key">Touche Physique</string>
|
||||
<string name="rightclick_multitouch">Ecran tactile avec le deuxième doigt</string>
|
||||
<string name="rightclick_pressure">Ecran tactile avec force</string>
|
||||
<string name="rightclick_none">Désactiver le clic droit de la souris</string>
|
||||
|
||||
<string name="leftclick_question">Clic gauche de la souris</string>
|
||||
<string name="leftclick_normal">Normal</string>
|
||||
<string name="leftclick_near_cursor">Curseur de la souris près Touch</string>
|
||||
<string name="leftclick_multitouch">Ecran tactile avec le deuxième doigt</string>
|
||||
<string name="leftclick_pressure">Ecran tactile avec force</string>
|
||||
<string name="leftclick_dpadcenter">Trackball clic / Joystick au centre</string>
|
||||
<string name="leftclick_timeout">Tenir au même endroit</string>
|
||||
<string name="leftclick_tap">Appuyez sur</string>
|
||||
<string name="leftclick_tap_or_timeout">Appuyez sur, ou maintenez</string>
|
||||
<string name="leftclick_timeout_time">timeout Holding</string>
|
||||
<string name="leftclick_timeout_time_0">0,3 s</string>
|
||||
<string name="leftclick_timeout_time_1">0,5 sec</string>
|
||||
<string name="leftclick_timeout_time_2">0,7 sec</string>
|
||||
<string name="leftclick_timeout_time_3">1 sec</string>
|
||||
<string name="leftclick_timeout_time_4">1,5 sec</string>
|
||||
<string name="click_with_dpadcenter">Cliquez gauche de la souris avec le Trackball / centre du joystick </string>
|
||||
|
||||
<string name="pointandclick_question">Fonctionnalités avancées</string>
|
||||
<string name="pointandclick_keepaspectratio">Gardez le format 4:3 écran</string>
|
||||
<string name="pointandclick_showcreenunderfinger">Afficher l\'écran sous le doigt dans une fenêtre séparée</string>
|
||||
<string name="pointandclick_showcreenunderfinger2">Loupe à l\'écran</string>
|
||||
<string name="pointandclick_joystickmouse">Déplacez la souris avec un trackball ou le joystick</string>
|
||||
<string name="pointandclick_joystickmousespeed">Déplacez la souris avec la vitesse du joystick</string>
|
||||
<string name="pointandclick_joystickmouseaccel">Déplacez la souris avec l\'accélération du joystick</string>
|
||||
<string name="pointandclick_relative">Mouvement relatif de la souris (mode portable)</string>
|
||||
<string name="pointandclick_relative_speed">Vitesse relative de la souris</string>
|
||||
<string name="pointandclick_relative_accel">Accélération relative de la souris</string>
|
||||
|
||||
<string name="none">Aucun</string>
|
||||
|
||||
<string name="measurepressure">Calibrer la pression de l\'écran tactile</string>
|
||||
<string name="measurepressure_touchplease">Glisser les doigts sur l\'écran pendant deux secondes</string>
|
||||
<string name="measurepressure_response">Pression %1$03d rayon %2$03d</string>
|
||||
|
||||
<string name="audiobuf_verysmall">Très petite (appareils rapides, plus de réactivité)</string>
|
||||
<string name="audiobuf_small">Petite (appareils rapides)</string>
|
||||
<string name="audiobuf_medium">Moyenne</string>
|
||||
<string name="audiobuf_large">Grande (appareils anciens, si le son est saccadé)</string>
|
||||
<string name="audiobuf_question">Taille du tampon audio</string>
|
||||
|
||||
<string name="remap_hwkeys">Reconfigurer les touches physiques</string>
|
||||
<string name="remap_hwkeys_press">Appuyez sur n\'importe quelle touche sauf HOME et POWER, vous pouvez utiliser les touches de volume</string>
|
||||
<string name="remap_hwkeys_select">Sélectionnez le keycode SDL</string>
|
||||
|
||||
<string name="remap_screenkb">Reconfigurer les contrôles via l\'écran</string>
|
||||
<string name="remap_screenkb_joystick">Joystick à l\'écran</string>
|
||||
<string name="remap_screenkb_button">Bouton à l\'écran</string>
|
||||
<string name="remap_screenkb_button_text">Saisie de texte à l\'écran</string>
|
||||
<string name="remap_screenkb_button_gestures">Gestes avec deux doigts</string>
|
||||
<string name="remap_screenkb_button_gestures_sensitivity">Sensibilité des gestes</string>
|
||||
<string name="remap_screenkb_button_zoomin">Geste de +Zoom avec deux doigts</string>
|
||||
<string name="remap_screenkb_button_zoomout">Geste de -Zoom avec deux doigts</string>
|
||||
<string name="remap_screenkb_button_rotateleft">Geste de rotation à gauche avec deux doigts</string>
|
||||
<string name="remap_screenkb_button_rotateright">Geste de rotation à droite avec deux doigts</string>
|
||||
|
||||
<string name="screenkb_custom_layout">Personnalisation de la présentation du clavier à l\'écran</string>
|
||||
|
||||
<string name="calibrate_touchscreen">Calibrer l\'écran tactile</string>
|
||||
<string name="calibrate_touchscreen_touch">Touchez les bords de l\'écran, appuyez sur Retour/BACK lorsque vous avez terminé</string>
|
||||
|
||||
<string name="video">Paramètres vidéo</string>
|
||||
<string name="video_smooth">Fluidité de la vidéo</string>
|
||||
<string name="video_separatethread">Thread séparé pour la vidéo : permet paroifs d\'augmenter FPS</string>
|
||||
|
||||
<string name="text_edit_click_here">Appuyez pour commencer à taper, appuyez sur Retour/BACK lorsque vous avez terminé</string>
|
||||
|
||||
<string name="display_size_mouse">Mode d\'émulation de la souris</string>
|
||||
<string name="display_size">Sélectionnez votre taille d\'affichage</string>
|
||||
<string name="display_size_large">Large (tablet)</string>
|
||||
<string name="display_size_small">Petit (téléphone)</string>
|
||||
<string name="display_size_small_touchpad">Petit, mode touchpad</string>
|
||||
<string name="display_size_tiny">Très petit</string>
|
||||
<string name="display_size_tiny_touchpad">Très petit, mode touchpad</string>
|
||||
|
||||
<string name="show_more_options">Afficher plus d\'options</string>
|
||||
|
||||
<string name="hardware_mouse_detected">Hardware mouse detected, disabling mouse emulation</string>
|
||||
<string name="not_enough_ram">Not enough RAM</string>
|
||||
<string name="not_enough_ram_size">This app needs %1$d Mb RAM, your device has %2$d Mb</string>
|
||||
<string name="ignore">Ignore</string>
|
||||
<string name="calibrate_gyroscope">Calibrate gyroscope</string>
|
||||
<string name="calibrate_gyroscope_text">Put your phone on a flat surface</string>
|
||||
<string name="reset_config">Reset config to defaults</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="calibrate_gyroscope_not_supported">Your device does not have gyroscope</string>
|
||||
<string name="reset_config_ask">Reset all options to default values?</string>
|
||||
<string name="cancel_download">Cancel data downloading?</string>
|
||||
<string name="cancel_download_resume">You can resume it later, the data will not be downloaded twice.</string>
|
||||
<string name="yes">Yes</string>
|
||||
<string name="no">No</string>
|
||||
<string name="screenkb_custom_layout_help">Press BACK when done. Resize buttons by sliding on empty space.</string>
|
||||
<string name="controls_screenkb_custom">Custom</string>
|
||||
</resources>
|
||||
@@ -1,149 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="init">Инициализация</string>
|
||||
<string name="please_wait">Пожалуйста, подождите, пока данные загружаются</string>
|
||||
<string name="device_config">Конфигурация устройства</string>
|
||||
<string name="device_change_cfg">Изменение конфигурации устройства</string>
|
||||
<string name="download_unneeded">Нет необходимости скачивать</string>
|
||||
<string name="connecting_to">Подключение к %s</string>
|
||||
<string name="failed_connecting_to">Ошибка подключения к %s</string>
|
||||
<string name="error_connecting_to">Ошибка подключения к %s</string>
|
||||
<string name="dl_from">Загрузка данных с %s</string>
|
||||
<string name="error_dl_from">Ошибка при загрузке данных с %s</string>
|
||||
<string name="error_write">Ошибка записи в %s</string>
|
||||
<string name="dl_progress">%1$.0f%% готово: файл %2$s</string>
|
||||
<string name="dl_finished">Завершенный</string>
|
||||
<string name="storage_phone">Внутреннее хранение - %d Мб</string>
|
||||
<string name="storage_sd">SD карта - %d Мб</string>
|
||||
<string name="storage_question">Куда сохранять данные приложения</string>
|
||||
<string name="optional_downloads">Дополнительные загрузки</string>
|
||||
<string name="ok">Продолжить</string>
|
||||
<string name="controls_arrows">Стрелки / джойстик / Dpad</string>
|
||||
<string name="controls_trackball">Трекбол</string>
|
||||
<string name="controls_accel">Акселерометр</string>
|
||||
<string name="controls_touch">Только сенсорный экран</string>
|
||||
<string name="controls_question">Какие на телефоне клавиши навигации?</string>
|
||||
<string name="controls_additional">Дополнительные элементы управления</string>
|
||||
<string name="controls_screenkb">Экранная клавиатура</string>
|
||||
<string name="controls_accelnav">Акселерометр</string>
|
||||
<string name="controls_screenkb_size">Размер экранной клавиатуры</string>
|
||||
<string name="controls_screenkb_large">Большой</string>
|
||||
<string name="controls_screenkb_medium">Средний</string>
|
||||
<string name="controls_screenkb_small">Маленький</string>
|
||||
<string name="controls_screenkb_tiny">Крошечный</string>
|
||||
<string name="controls_screenkb_theme">Тема клавиатуры</string>
|
||||
<string name="controls_screenkb_by">%1$s от %2$s</string>
|
||||
<string name="trackball_no_dampening">Нет</string>
|
||||
<string name="trackball_fast">Быстрое</string>
|
||||
<string name="trackball_medium">Среднее</string>
|
||||
<string name="trackball_slow">Медленное</string>
|
||||
<string name="trackball_question">Замедление трекбола</string>
|
||||
<string name="accel_fast">Быстрая</string>
|
||||
<string name="accel_medium">Средний</string>
|
||||
<string name="accel_slow">Медленно</string>
|
||||
<string name="accel_question">Чувствительность акселерометра</string>
|
||||
<string name="rightclick_question">Правая кнопка мыши</string>
|
||||
<string name="rightclick_menu">Клавиша меню</string>
|
||||
<string name="rightclick_multitouch">Касание экрана вторым пальцем</string>
|
||||
<string name="rightclick_pressure">Нажатие на экран с силой</string>
|
||||
<string name="pointandclick_question">Расширенные функции</string>
|
||||
<string name="pointandclick_keepaspectratio">Сохранять соотношение сторон 4:3 на экране</string>
|
||||
<string name="pointandclick_showcreenunderfinger">Экранная лупа</string>
|
||||
<string name="measurepressure_touchplease">Пожалуйста, проведите пальцем по экрану в течение двух секунд</string>
|
||||
<string name="measurepressure_response">Давление %1$03d радиус %2$03d </string>
|
||||
<string name="audiobuf_verysmall">Очень мало (быстрые устройства)</string>
|
||||
<string name="audiobuf_small">Малый</string>
|
||||
<string name="audiobuf_medium">Средний</string>
|
||||
<string name="audiobuf_large">Большой (для старых устройств, если звук прерывается)</string>
|
||||
<string name="audiobuf_question">Размер буфера аудио</string>
|
||||
<string name="accel_floating">Плавающее</string>
|
||||
<string name="accel_fixed_start">Фиксировано при запуске приложения</string>
|
||||
<string name="accel_fixed_horiz">Фиксировано на горизонт</string>
|
||||
<string name="accel_question_center">Центральное положение акселерометра</string>
|
||||
<string name="rightclick_none">Правая кнопка мыши отключена</string>
|
||||
<string name="leftclick_question">Левая кнопка мыши</string>
|
||||
<string name="leftclick_normal">Нормальный</string>
|
||||
<string name="leftclick_near_cursor">Касание возле курсора мыши</string>
|
||||
<string name="leftclick_multitouch">Касание двумя пальцами</string>
|
||||
<string name="leftclick_pressure">Нажатие с силой</string>
|
||||
<string name="leftclick_dpadcenter">Нажатие на трекбол / центр джойстика</string>
|
||||
<string name="pointandclick_joystickmouse">Перемещение мыши при помощи джойстика или трекбола</string>
|
||||
<string name="click_with_dpadcenter">Левый клик мыши при помощи трекбола / центра джойстика</string>
|
||||
<string name="pointandclick_joystickmousespeed">Перемещение мыши джойстиком - скорость</string>
|
||||
<string name="pointandclick_joystickmouseaccel">Перемещение мыши джойстиком - ускорение</string>
|
||||
<string name="none">Нет</string>
|
||||
<string name="controls_screenkb_transparency">Прозрачность клавиатуры</string>
|
||||
<string name="controls_screenkb_trans_0">Невидимый</string>
|
||||
<string name="controls_screenkb_trans_1">Почти невидимый</string>
|
||||
<string name="controls_screenkb_trans_2">Прозрачный</string>
|
||||
<string name="controls_screenkb_trans_3">Полупрозрачные</string>
|
||||
<string name="controls_screenkb_trans_4">Непрозрачные</string>
|
||||
<string name="mouse_emulation">Эмуляции мыши</string>
|
||||
<string name="measurepressure">Калибровка сенсорного давления</string>
|
||||
<string name="remap_hwkeys">Переназначение физических клавиш</string>
|
||||
<string name="remap_hwkeys_press">Нажмите любую клавишу, кроме HOME и POWER, вы можете использовать клавиши регулировки громкости</string>
|
||||
<string name="remap_hwkeys_select">Выберите код кнопки SDL</string>
|
||||
<string name="remap_screenkb">Переназначение экранных кнопок</string>
|
||||
<string name="remap_screenkb_joystick">Экранный джойстик</string>
|
||||
<string name="remap_screenkb_button">Экранные кнопки</string>
|
||||
<string name="remap_screenkb_button_text">Экранная кнопка ввода текста</string>
|
||||
<string name="remap_screenkb_button_zoomin">Увеличить двумя пальцами</string>
|
||||
<string name="remap_screenkb_button_zoomout">Уменьшить двумя пальцами</string>
|
||||
<string name="remap_screenkb_button_rotateleft">Повернуть налево двумя пальцами</string>
|
||||
<string name="remap_screenkb_button_rotateright">Повернуть вправо двумя пальцами</string>
|
||||
<string name="remap_screenkb_button_gestures">Жест двумя пальцами по экрану</string>
|
||||
<string name="accel_veryfast">Очень быстро</string>
|
||||
<string name="remap_screenkb_button_gestures_sensitivity">Чувствительность жеста двумя пальцами по экрану</string>
|
||||
<string name="storage_custom">Укажите каталог</string>
|
||||
<string name="storage_commandline">Укажите параметры командной строки</string>
|
||||
<string name="calibrate_touchscreen">Калибровка сенсорного экрана</string>
|
||||
<string name="calibrate_touchscreen_touch">Дотроньтесь до всех краев экрана, потом нажмите Назад/BACK</string>
|
||||
<string name="screenkb_custom_layout">Настройка расположения кнопок</string>
|
||||
<string name="screenkb_custom_layout_help">Нажмите клавишу Назад/BACK для завершения. Проведите по пустому месту, чтобы изменить размер кнопки</string>
|
||||
<string name="rightclick_key">Физическая кнопка</string>
|
||||
<string name="pointandclick_showcreenunderfinger2">Наэкранная лупа</string>
|
||||
<string name="video">Настройки видео</string>
|
||||
<string name="video_smooth">Линейное сглаживание видео</string>
|
||||
<string name="accel_veryslow">Очень медленно</string>
|
||||
<string name="leftclick_timeout">Нажатие с задержкой</string>
|
||||
<string name="leftclick_tap">Быстрое нажатие</string>
|
||||
<string name="leftclick_tap_or_timeout">Быстрое нажатие либо с задержкой</string>
|
||||
<string name="leftclick_timeout_time">Время нажатия</string>
|
||||
<string name="leftclick_timeout_time_0">0,3 сек</string>
|
||||
<string name="leftclick_timeout_time_1">0,5 сек</string>
|
||||
<string name="leftclick_timeout_time_2">0,7 сек</string>
|
||||
<string name="leftclick_timeout_time_3">1 сек</string>
|
||||
<string name="leftclick_timeout_time_4">1,5 сек</string>
|
||||
<string name="pointandclick_relative">Относительное движение мыши (режим ноутбука)</string>
|
||||
<string name="pointandclick_relative_speed">Скорость движения мыши</string>
|
||||
<string name="pointandclick_relative_accel">Ускорение движения мыши</string>
|
||||
<string name="downloads">Загрузки</string>
|
||||
<string name="video_separatethread">Отдельный поток для видео, увеличит FPS на некоторых устройствах</string>
|
||||
<string name="text_edit_click_here">Нажмите, чтобы ввести текст, нажмите Назад, когда закончите</string>
|
||||
<string name="display_size_mouse">Настройка размера дисплея</string>
|
||||
<string name="display_size">Размер дисплея</string>
|
||||
<string name="display_size_large">Большой (таблетка)</string>
|
||||
<string name="display_size_small">Маленький (телефон)</string>
|
||||
<string name="display_size_tiny">Крохотный</string>
|
||||
<string name="show_more_options">Показать больше параметров</string>
|
||||
<string name="controls_screenkb_drawsize">Размер изображения кнопок</string>
|
||||
<string name="display_size_small_touchpad">Маленький, режим тачпада</string>
|
||||
<string name="display_size_tiny_touchpad">Крохотный, режим тачпада</string>
|
||||
<string name="hardware_mouse_detected">Обнаружена внешняя мышь, эмуляция мыши выключена</string>
|
||||
|
||||
<string name="not_enough_ram">Недостаточно оперативной памяти</string>
|
||||
<string name="not_enough_ram_size">Для запуска приложения нужно %1$d Мб оперативной памяти, на этом устройстве есть %2$d Мб</string>
|
||||
<string name="ignore">Игнорировать</string>
|
||||
|
||||
<string name="calibrate_gyroscope">Калибровать гироскоп</string>
|
||||
<string name="calibrate_gyroscope_text">Положите устройство на ровную поверхность</string>
|
||||
<string name="reset_config">Сбросить все настройки</string>
|
||||
<string name="cancel">Отменить</string>
|
||||
<string name="calibrate_gyroscope_not_supported">Гироскоп отсутствует</string>
|
||||
<string name="reset_config_ask">Сбросить все настройки в значения по умолчанию?</string>
|
||||
<string name="cancel_download">Остановить загрузку?</string>
|
||||
<string name="cancel_download_resume">Загрузка может быть продолжена позднее.</string>
|
||||
<string name="yes">Да</string>
|
||||
<string name="no">Нет</string>
|
||||
<string name="controls_screenkb_custom">Пользовательские настройки</string>
|
||||
</resources>
|
||||
@@ -1,148 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="init">Ініціалізація</string>
|
||||
<string name="please_wait">Будь-ласка, зачекайте, поки завантажуться дані</string>
|
||||
<string name="device_config">Конфігурація пристрою</string>
|
||||
<string name="device_change_cfg">Зміна конфігурації пристрою</string>
|
||||
<string name="download_unneeded">Немає необхідності викачувати</string>
|
||||
<string name="connecting_to">Підключенння до %s</string>
|
||||
<string name="failed_connecting_to">Помилка підключення до %s</string>
|
||||
<string name="error_connecting_to">помилка підключення до %s</string>
|
||||
<string name="dl_from">Завантаження даних з %s</string>
|
||||
<string name="error_dl_from">Помилка при завантаженні даних з %s</string>
|
||||
<string name="error_write">Помилка запису в %s</string>
|
||||
<string name="dl_progress">%1$.0f%% готово: файл %2$s</string>
|
||||
<string name="dl_finished">Завершений</string>
|
||||
<string name="storage_phone">Внутрішнє зберігання - %d Мб</string>
|
||||
<string name="storage_sd">SD карта - %d Мб</string>
|
||||
<string name="storage_question">Куди зберігати дані програми</string>
|
||||
<string name="optional_downloads">Додаткові завантаження</string>
|
||||
<string name="ok">ОК</string>
|
||||
<string name="controls_arrows">Стрілки / джойстік / Dpad</string>
|
||||
<string name="controls_trackball">Трекбол</string>
|
||||
<string name="controls_accel">Акселерометр</string>
|
||||
<string name="controls_touch">Тільки сенсорний екран</string>
|
||||
<string name="controls_question">Які на телефоні кнопки навігації?</string>
|
||||
<string name="controls_additional">Додаткові элементи керування</string>
|
||||
<string name="controls_screenkb">Наекранні кнопки</string>
|
||||
<string name="controls_accelnav">Акселерометр</string>
|
||||
<string name="controls_screenkb_size">Розмір наекранних кнопок</string>
|
||||
<string name="controls_screenkb_large">Великий</string>
|
||||
<string name="controls_screenkb_medium">Середній</string>
|
||||
<string name="controls_screenkb_small">Малий</string>
|
||||
<string name="controls_screenkb_tiny">Дрібний</string>
|
||||
<string name="controls_screenkb_theme">Тема кнопок</string>
|
||||
<string name="controls_screenkb_by">%1$s від %2$s</string>
|
||||
<string name="trackball_no_dampening">Немає</string>
|
||||
<string name="trackball_fast">Швидке</string>
|
||||
<string name="trackball_medium">Середнє</string>
|
||||
<string name="trackball_slow">Повільне</string>
|
||||
<string name="trackball_question">Сповільнення трекболу</string>
|
||||
<string name="accel_fast">Швидко</string>
|
||||
<string name="accel_medium">середньо</string>
|
||||
<string name="accel_slow">повільно</string>
|
||||
<string name="accel_question">Чутливість акселерометру</string>
|
||||
<string name="rightclick_question">Права кнопка миші</string>
|
||||
<string name="rightclick_menu">Кнопка меню</string>
|
||||
<string name="rightclick_multitouch">Торкання екрана другим пальцем</string>
|
||||
<string name="rightclick_pressure">Натиск на екран силою</string>
|
||||
<string name="pointandclick_question">Розширені функції</string>
|
||||
<string name="pointandclick_keepaspectratio">Зберігати співвідношення сторін 4:3 на екрані</string>
|
||||
<string name="pointandclick_showcreenunderfinger">Наекранна лупа</string>
|
||||
<string name="measurepressure_touchplease">Будь-ласка, проведіть пальцем по екрану на протязі двох секунд</string>
|
||||
<string name="measurepressure_response">Тиск %1$03d радіус %2$03d </string>
|
||||
<string name="audiobuf_verysmall">Дуже мало (швидкі пристрої)</string>
|
||||
<string name="audiobuf_small">Малий</string>
|
||||
<string name="audiobuf_medium">Середній</string>
|
||||
<string name="audiobuf_large">Великий (для старих пристроїв, якщо звук переривається)</string>
|
||||
<string name="audiobuf_question">Розмір буферу аудіо</string>
|
||||
<string name="accel_floating">Плаваюче</string>
|
||||
<string name="accel_fixed_start">Фiксоване під час запуску програми</string>
|
||||
<string name="accel_fixed_horiz">Фiксоване до горизонту</string>
|
||||
<string name="accel_question_center">Центральне положення акселерометра</string>
|
||||
<string name="rightclick_none">Вiдключена</string>
|
||||
<string name="leftclick_question">Ліва кнопка миші</string>
|
||||
<string name="leftclick_normal">Нормальна</string>
|
||||
<string name="leftclick_near_cursor">Дотик біля курсору миші</string>
|
||||
<string name="leftclick_multitouch">Натиск на екран другим пальцем</string>
|
||||
<string name="leftclick_pressure">>Натиск на екран з силою</string>
|
||||
<string name="leftclick_dpadcenter">Натиск на трекбол / центр джойстику</string>
|
||||
<string name="pointandclick_joystickmouse">Переміщення миші за допомогою джойстика або трекбола</string>
|
||||
<string name="click_with_dpadcenter">Лівий клік миші за допомогою трекбола / центра джойстика</string>
|
||||
<string name="pointandclick_joystickmousespeed">Переміщення миші джойстиком - швидкiсть</string>
|
||||
<string name="pointandclick_joystickmouseaccel">Переміщення миші джойстиком - прискорення</string>
|
||||
<string name="none">Немає</string>
|
||||
<string name="controls_screenkb_transparency">Прозорість клавіатури</string>
|
||||
<string name="controls_screenkb_trans_0">Невидимий</string>
|
||||
<string name="controls_screenkb_trans_1">Майже невидимий</string>
|
||||
<string name="controls_screenkb_trans_2">Прозорий</string>
|
||||
<string name="controls_screenkb_trans_3">Напівпрозорі</string>
|
||||
<string name="controls_screenkb_trans_4">Непрозорі</string>
|
||||
<string name="mouse_emulation">Емуляція миші</string>
|
||||
<string name="measurepressure">Калібрування сенсорного натискання</string>
|
||||
<string name="remap_hwkeys">Перепризначення фізичних кнопок</string>
|
||||
<string name="remap_hwkeys_press">Натисніть будь-яку клавішу, крім HOME і POWER, ви можете використовувати клавіші регулювання гучності</string>
|
||||
<string name="remap_hwkeys_select">Виберіть код кнопки SDL</string>
|
||||
<string name="remap_screenkb">Перепризначення наекранних кнопок</string>
|
||||
<string name="remap_screenkb_joystick">Наекранний джойстік</string>
|
||||
<string name="remap_screenkb_button">Наекранні кнопки</string>
|
||||
<string name="remap_screenkb_button_text">Наекранна кнопка вводу тексту</string>
|
||||
<string name="remap_screenkb_button_zoomin">Збільшити двома пальцями</string>
|
||||
<string name="remap_screenkb_button_zoomout">Зменшити двома пальцями</string>
|
||||
<string name="remap_screenkb_button_rotateleft">Повернути наліво двома пальцями</string>
|
||||
<string name="remap_screenkb_button_rotateright">Повернути праворуч двома пальцями</string>
|
||||
<string name="remap_screenkb_button_gestures">Жест двома пальцями по екрану</string>
|
||||
<string name="accel_veryfast">Дуже швидко</string>
|
||||
<string name="remap_screenkb_button_gestures_sensitivity">Чутливість жесту двома пальцями по екрану</string>
|
||||
<string name="storage_custom">Вкажіть каталог</string>
|
||||
<string name="storage_commandline">Вкажіть параметри командного рядка</string>
|
||||
<string name="calibrate_touchscreen">Калібрування сенсорного екрану</string>
|
||||
<string name="calibrate_touchscreen_touch">Доторкнiться до всіх країв екрану, потiм натисніть Назад/BACK</string>
|
||||
<string name="screenkb_custom_layout">Налаштування положення кнопок</string>
|
||||
<string name="screenkb_custom_layout_help">Натисніть Назад/BACK для завершення. Проведiть по екрану, щоб змінити розмір кнопки</string>
|
||||
<string name="rightclick_key">Фізична кнопка</string>
|
||||
<string name="pointandclick_showcreenunderfinger2">Наекранна лупа</string>
|
||||
<string name="video">Налаштування відео</string>
|
||||
<string name="video_smooth">Лінійне сглажування відео</string>
|
||||
<string name="accel_veryslow">Дуже повільно</string>
|
||||
<string name="leftclick_timeout">Натискання з затримкою</string>
|
||||
<string name="leftclick_tap">Швидке натискання</string>
|
||||
<string name="leftclick_tap_or_timeout">Швидке натискання або з затримкою</string>
|
||||
<string name="leftclick_timeout_time">Час натискання</string>
|
||||
<string name="leftclick_timeout_time_0">0,3 сек</string>
|
||||
<string name="leftclick_timeout_time_1">0,5 сек</string>
|
||||
<string name="leftclick_timeout_time_2">0,7 секунд</string>
|
||||
<string name="leftclick_timeout_time_3">1 сек</string>
|
||||
<string name="leftclick_timeout_time_4">1,5 сек</string>
|
||||
<string name="pointandclick_relative">Відносний рух миші (режим ноутбука)</string>
|
||||
<string name="pointandclick_relative_speed">Швидкість руху миші</string>
|
||||
<string name="pointandclick_relative_accel">Прискорення руху миші</string>
|
||||
<string name="downloads">Завантаження</string>
|
||||
<string name="video_separatethread">Окремий потік для відео, збільшить FPS на деяких пристроях</string>
|
||||
<string name="text_edit_click_here">Натисніть, щоб ввести текст, натисніть Назад, коли закiнчете</string>
|
||||
<string name="display_size_mouse">Налаштування розміру дисплея</string>
|
||||
<string name="display_size">Виберіть розмір дисплея</string>
|
||||
<string name="display_size_large">Великий (таблетка)</string>
|
||||
<string name="display_size_small">Маленький</string>
|
||||
<string name="display_size_tiny">Крихiтний</string>
|
||||
<string name="show_more_options">Показати більше параметрів</string>
|
||||
<string name="controls_screenkb_drawsize">Розмір зображення кнопок</string>
|
||||
<string name="display_size_small_touchpad">Маленький, режим тачпаду</string>
|
||||
<string name="display_size_tiny_touchpad">Крихiтний, режим тачпаду</string>
|
||||
<string name="hardware_mouse_detected">Виявлена зовнiшня миша, емуляція миші вимкнена</string>
|
||||
|
||||
<string name="not_enough_ram">Недостатньо пам’яті</string>
|
||||
<string name="not_enough_ram_size">Потрібно %1$d Mb пам’яті, доступно лише %2$d Mb</string>
|
||||
<string name="ignore">Ігнорувати</string>
|
||||
<string name="calibrate_gyroscope">Калібрувати гіроскоп</string>
|
||||
<string name="calibrate_gyroscope_text">Покладіть телефон на рівну поверхню</string>
|
||||
<string name="reset_config">Скинути всі налаштування</string>
|
||||
<string name="cancel">Відмінити</string>
|
||||
<string name="calibrate_gyroscope_not_supported">Гіроскоп відсутній</string>
|
||||
<string name="reset_config_ask">Скинути всі налаштування у значення за замовчуванням?</string>
|
||||
<string name="cancel_download">Припинити завантаження?</string>
|
||||
<string name="cancel_download_resume">Завантаження може бути відновлено пізніше.</string>
|
||||
<string name="yes">Так</string>
|
||||
<string name="no">Ні</string>
|
||||
<string name="controls_screenkb_custom">Налаштування користувача</string>
|
||||
</resources>
|
||||
@@ -1,181 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">Commander Genius</string>
|
||||
|
||||
|
||||
<string name="init">Initializing</string>
|
||||
<string name="please_wait">Please wait while data is being downloaded</string>
|
||||
|
||||
<string name="device_config">Device configuration</string>
|
||||
<string name="device_change_cfg">Change device configuration</string>
|
||||
|
||||
<string name="download_unneeded">No need to download</string>
|
||||
<string name="connecting_to">Connecting to %s</string>
|
||||
<string name="failed_connecting_to">Failed connecting to %s</string>
|
||||
<string name="error_connecting_to">Error connecting to %s</string>
|
||||
<string name="dl_from">Downloading data from %s</string>
|
||||
<string name="error_dl_from">Error downloading data from %s</string>
|
||||
<string name="error_write">Error writing to %s</string>
|
||||
<string name="dl_progress">%1$.0f%% done: file %2$s</string>
|
||||
<string name="dl_finished">Finished</string>
|
||||
|
||||
<string name="storage_phone">Internal storage - %d MB free</string>
|
||||
<string name="storage_sd">SD card storage - %d MB free</string>
|
||||
<string name="storage_custom">Specify directory</string>
|
||||
<string name="storage_commandline">Specify command line parameters</string>
|
||||
<string name="storage_question">Data installation location</string>
|
||||
<string name="optional_downloads">Downloads</string>
|
||||
<string name="downloads">Downloads</string>
|
||||
<string name="ok">OK</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
|
||||
<string name="controls_arrows">Arrows / joystick / dpad</string>
|
||||
<string name="controls_trackball">Trackball</string>
|
||||
<string name="controls_accel">Accelerometer</string>
|
||||
<string name="controls_touch">Touchscreen only</string>
|
||||
<string name="controls_question">What kind of navigation keys does your device have?</string>
|
||||
|
||||
<string name="controls_additional">Additional controls</string>
|
||||
<string name="controls_screenkb">On-screen keyboard</string>
|
||||
<string name="controls_accelnav">Accelerometer</string>
|
||||
|
||||
<string name="controls_screenkb_size">On-screen keyboard size</string>
|
||||
<string name="controls_screenkb_drawsize">Size of button images</string>
|
||||
<string name="controls_screenkb_large">Large</string>
|
||||
<string name="controls_screenkb_medium">Medium</string>
|
||||
<string name="controls_screenkb_small">Small</string>
|
||||
<string name="controls_screenkb_tiny">Tiny</string>
|
||||
<string name="controls_screenkb_custom">Custom</string>
|
||||
<string name="controls_screenkb_theme">On-screen keyboard theme</string>
|
||||
<string name="controls_screenkb_by">%1$s by %2$s</string>
|
||||
<string name="controls_screenkb_transparency">On-screen keyboard transparency</string>
|
||||
<string name="controls_screenkb_trans_0">Invisible</string>
|
||||
<string name="controls_screenkb_trans_1">Almost invisible</string>
|
||||
<string name="controls_screenkb_trans_2">Transparent</string>
|
||||
<string name="controls_screenkb_trans_3">Semi-transparent</string>
|
||||
<string name="controls_screenkb_trans_4">Non-transparent</string>
|
||||
|
||||
<string name="trackball_no_dampening">No dampening</string>
|
||||
<string name="trackball_fast">Fast</string>
|
||||
<string name="trackball_medium">Medium</string>
|
||||
<string name="trackball_slow">Slow</string>
|
||||
<string name="trackball_question">Trackball dampening</string>
|
||||
|
||||
<string name="accel_veryfast">Very fast</string>
|
||||
<string name="accel_fast">Fast</string>
|
||||
<string name="accel_medium">Medium</string>
|
||||
<string name="accel_slow">Slow</string>
|
||||
<string name="accel_veryslow">Very slow</string>
|
||||
<string name="accel_question">Accelerometer sensitivity</string>
|
||||
|
||||
<string name="accel_floating">Floating</string>
|
||||
<string name="accel_fixed_start">Fixed when application starts</string>
|
||||
<string name="accel_fixed_horiz">Fixed to table desk orientation</string>
|
||||
<string name="accel_question_center">Accelerometer center position</string>
|
||||
|
||||
<string name="mouse_emulation">Mouse emulation</string>
|
||||
<string name="rightclick_question">Right mouse click</string>
|
||||
<string name="rightclick_menu">Menu key</string>
|
||||
<string name="rightclick_key">Physical key</string>
|
||||
<string name="rightclick_multitouch">Touch screen with second finger</string>
|
||||
<string name="rightclick_pressure">Touch screen with force</string>
|
||||
<string name="rightclick_none">Disable right mouse click</string>
|
||||
|
||||
<string name="leftclick_question">Left mouse click</string>
|
||||
<string name="leftclick_normal">Normal</string>
|
||||
<string name="leftclick_near_cursor">Touch near mouse cursor</string>
|
||||
<string name="leftclick_multitouch">Touch screen with second finger</string>
|
||||
<string name="leftclick_pressure">Touch screen with force</string>
|
||||
<string name="leftclick_dpadcenter">Trackball click / joystick center</string>
|
||||
<string name="leftclick_timeout">Hold at the same spot</string>
|
||||
<string name="leftclick_tap">Tap</string>
|
||||
<string name="leftclick_tap_or_timeout">Tap or hold</string>
|
||||
<string name="leftclick_timeout_time">Holding timeout</string>
|
||||
<string name="leftclick_timeout_time_0">0.3 sec</string>
|
||||
<string name="leftclick_timeout_time_1">0.5 sec</string>
|
||||
<string name="leftclick_timeout_time_2">0.7 sec</string>
|
||||
<string name="leftclick_timeout_time_3">1 sec</string>
|
||||
<string name="leftclick_timeout_time_4">1.5 sec</string>
|
||||
<string name="click_with_dpadcenter">Left mouse click with trackball / joystick center</string>
|
||||
|
||||
<string name="pointandclick_question">Advanced features</string>
|
||||
<string name="pointandclick_keepaspectratio">Keep 4:3 screen aspect ratio</string>
|
||||
<string name="pointandclick_showcreenunderfinger">Show screen under finger in separate window</string>
|
||||
<string name="pointandclick_showcreenunderfinger2">On-screen magnifying glass</string>
|
||||
<string name="pointandclick_joystickmouse">Move mouse with joystick or trackball</string>
|
||||
<string name="pointandclick_joystickmousespeed">Move mouse with joystick speed</string>
|
||||
<string name="pointandclick_joystickmouseaccel">Move mouse with joystick acceleration</string>
|
||||
<string name="pointandclick_relative">Relative mouse movement (laptop mode)</string>
|
||||
<string name="pointandclick_relative_speed">Relative mouse movement speed</string>
|
||||
<string name="pointandclick_relative_accel">Relative mouse movement acceleration</string>
|
||||
|
||||
<string name="none">None</string>
|
||||
|
||||
<string name="measurepressure">Calibrate touchscreen pressure</string>
|
||||
<string name="measurepressure_touchplease">Please slide finger across the screen for two seconds</string>
|
||||
<string name="measurepressure_response">Pressure %1$03d radius %2$03d</string>
|
||||
|
||||
<string name="audiobuf_verysmall">Very small (fast devices, less lag)</string>
|
||||
<string name="audiobuf_small">Small</string>
|
||||
<string name="audiobuf_medium">Medium</string>
|
||||
<string name="audiobuf_large">Large (older devices, if sound is choppy)</string>
|
||||
<string name="audiobuf_question">Size of audio buffer</string>
|
||||
|
||||
<string name="remap_hwkeys">Remap physical keys</string>
|
||||
<string name="remap_hwkeys_press">Press any key except HOME and POWER, you may use volume keys</string>
|
||||
<string name="remap_hwkeys_select">Select SDL keycode</string>
|
||||
<string name="remap_hwkeys_select_simple">Select action</string>
|
||||
<string name="remap_hwkeys_select_more_keys">Show all keycodes</string>
|
||||
|
||||
<string name="remap_screenkb">Remap on-screen controls</string>
|
||||
<string name="remap_screenkb_joystick">Joystick</string>
|
||||
<string name="remap_screenkb_button">Button</string>
|
||||
<string name="remap_screenkb_button_text">Text input button</string>
|
||||
<string name="remap_screenkb_button_gestures">Two-finger screen gestures</string>
|
||||
<string name="remap_screenkb_button_gestures_sensitivity">Two-finger screen gestures sensitivity</string>
|
||||
<string name="remap_screenkb_button_zoomin">Zoom in two-finger gesture</string>
|
||||
<string name="remap_screenkb_button_zoomout">Zoom out two-finger gesture</string>
|
||||
<string name="remap_screenkb_button_rotateleft">Rotate left two-finger gesture</string>
|
||||
<string name="remap_screenkb_button_rotateright">Rotate right two-finger gesture</string>
|
||||
|
||||
<string name="screenkb_custom_layout">Customize on-screen keyboard layout</string>
|
||||
<string name="screenkb_custom_layout_help">Press BACK when done. Resize buttons by sliding on empty space.</string>
|
||||
|
||||
<string name="calibrate_touchscreen">Calibrate touchscreen</string>
|
||||
<string name="calibrate_touchscreen_touch">Touch all edges of the screen, press BACK when done</string>
|
||||
|
||||
<string name="video">Video settings</string>
|
||||
<string name="video_smooth">Linear video filtering</string>
|
||||
<string name="video_separatethread">Separate thread for video, will increase FPS on some devices</string>
|
||||
|
||||
<string name="text_edit_click_here">Tap to start typing, press Back when done</string>
|
||||
|
||||
<string name="display_size_mouse">Mouse emulation mode</string>
|
||||
<string name="display_size">Display size for mouse emulation</string>
|
||||
<string name="display_size_large">Large (tablets)</string>
|
||||
<string name="display_size_small">Small, magnifying glass</string>
|
||||
<string name="display_size_small_touchpad">Small, touchpad mode</string>
|
||||
<string name="display_size_tiny">Tiny</string>
|
||||
<string name="display_size_tiny_touchpad">Tiny, touchpad mode</string>
|
||||
|
||||
<string name="show_more_options">Show more options</string>
|
||||
|
||||
<string name="hardware_mouse_detected">Hardware mouse detected, disabling mouse emulation</string>
|
||||
|
||||
<string name="not_enough_ram">Not enough RAM</string>
|
||||
<string name="not_enough_ram_size">This app needs %1$d Mb RAM, your device has %2$d Mb</string>
|
||||
<string name="ignore">Ignore</string>
|
||||
|
||||
<string name="calibrate_gyroscope">Calibrate gyroscope</string>
|
||||
<string name="calibrate_gyroscope_text">Put your device on a flat surface</string>
|
||||
<string name="calibrate_gyroscope_not_supported">Your device does not have gyroscope</string>
|
||||
|
||||
<string name="reset_config">Reset config to defaults</string>
|
||||
<string name="reset_config_ask">Reset all options to default values?</string>
|
||||
|
||||
<string name="cancel_download">Cancel data downloading?</string>
|
||||
<string name="cancel_download_resume">You can resume it later, the data will not be downloaded twice.</string>
|
||||
<string name="yes">Yes</string>
|
||||
<string name="no">No</string>
|
||||
|
||||
</resources>
|
||||
@@ -4,12 +4,22 @@ ifneq ($(strip $(filter mad, $(COMPILED_LIBRARIES))),)
|
||||
SDL_MIXER_USE_LIBMAD := 1
|
||||
endif
|
||||
|
||||
# Disable timidity library inside sdl2_mixer, we have our own version of timidity used by OpenTTD
|
||||
SUPPORT_MID_TIMIDITY := 0
|
||||
# Enable png and jpeg modules inside sdl2_image
|
||||
SUPPORT_JPG := true
|
||||
SUPPORT_PNG := true
|
||||
|
||||
NDK_VERSION := $(strip $(patsubst android-ndk-%,%,$(filter android-ndk-%, $(subst /, ,$(dir $(TARGET_CC))))))
|
||||
#$(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 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)
|
||||
|
||||
@@ -1,44 +1,17 @@
|
||||
# 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-v7a x86
|
||||
ARCHES64 := arm64-v8a x86_64
|
||||
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) $(ARCHES64), 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 := icudata icui18n icuio icutest icutu icuuc iculx icu-le-hb harfbuzz
|
||||
ICU := $(foreach ARCH, $(ARCHES32) $(ARCHES64), $(foreach NAME, $(ICU_LIBS), icuuc/lib/$(ARCH)/lib$(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)
|
||||
|
||||
LIBS := $(ICONV) $(ICU) $(OPENSSL)
|
||||
|
||||
.PHONY: all boost openssl icu
|
||||
all: $(LIBS)
|
||||
|
||||
openssl: $(OPENSSL)
|
||||
|
||||
icu: $(ICONV) $(ICU)
|
||||
|
||||
#.NOTPARALLEL: $(LIBS) $(BOOST)
|
||||
|
||||
$(ICONV) $(ICU): iconv/src/build.sh
|
||||
cd iconv/src && \
|
||||
./build.sh && \
|
||||
for ARCH in $(ARCHES32) $(ARCHES64); do \
|
||||
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/unicode ../../icuuc/include/layout ; \
|
||||
cp -f $$ARCH/libicu*.a $$ARCH/libharfbuzz.a ../../icuuc/lib/$$ARCH/ ; \
|
||||
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 && \
|
||||
git clean -f -d -x
|
||||
|
||||
$(OPENSSL): openssl/compile.sh
|
||||
cd openssl && ./compile.sh
|
||||
OPENSSL := $(foreach ARCH, $(ARCH_LIST), openssl/lib/$(ARCH)/libcrypto.so.sdl.1.so openssl/lib/$(ARCH)/libssl.so.sdl.1.so)
|
||||
|
||||
BOOST_LIBS := \
|
||||
atomic \
|
||||
@@ -49,10 +22,10 @@ BOOST_LIBS := \
|
||||
coroutine \
|
||||
date_time \
|
||||
exception \
|
||||
fiber \
|
||||
filesystem \
|
||||
graph \
|
||||
iostreams \
|
||||
json \
|
||||
locale \
|
||||
log \
|
||||
log_setup \
|
||||
@@ -62,13 +35,12 @@ BOOST_LIBS := \
|
||||
math_tr1 \
|
||||
math_tr1f \
|
||||
math_tr1l \
|
||||
nowide \
|
||||
prg_exec_monitor \
|
||||
program_options \
|
||||
random \
|
||||
regex \
|
||||
serialization \
|
||||
stacktrace_basic \
|
||||
stacktrace_noop \
|
||||
system \
|
||||
test_exec_monitor \
|
||||
thread \
|
||||
@@ -79,22 +51,70 @@ BOOST_LIBS := \
|
||||
wserialization \
|
||||
|
||||
|
||||
BOOST := $(foreach ARCH, $(ARCHES32) $(ARCHES64), $(foreach NAME, $(BOOST_LIBS), boost/lib/$(ARCH)/libboost_$(NAME).a))
|
||||
BOOST := $(foreach ARCH, $(ARCH_LIST), $(foreach NAME, $(strip $(BOOST_LIBS)), boost/lib/$(ARCH)/libboost_$(NAME).a))
|
||||
|
||||
.PHONY: all boost icu openssl
|
||||
|
||||
all: $(ICONV) $(ICU) $(OPENSSL) $(BOOST)
|
||||
|
||||
boost: $(BOOST) $(foreach NAME, $(strip $(BOOST_LIBS)), boost_$(NAME))
|
||||
|
||||
icu: $(ICONV) $(ICU)
|
||||
|
||||
openssl: $(OPENSSL)
|
||||
|
||||
$(ICONV) $(ICU): iconv/src/build.sh
|
||||
cd iconv/src && \
|
||||
for ARCH in $(ARCH_LIST); do \
|
||||
$(shell echo "#=Compiling iconv for $$ARCH") \
|
||||
env ARCHS=$$ARCH PATH=$(PATH):${ANDROID_NDK_HOME} ./build.sh && \
|
||||
mkdir -p ../lib/$$ARCH ../include ; \
|
||||
cp -f $$ARCH/libiconv.so $$ARCH/libcharset.so ../lib/$$ARCH/ ; \
|
||||
cp -f $$ARCH/include/*.h ../include/ ; \
|
||||
mkdir -p ../../icuuc/lib/$$ARCH ../../icuuc/include/unicode ../../icuuc/include/layout ; \
|
||||
cp -f $$ARCH/libicu*.a ../../icuuc/lib/$$ARCH/ ; \
|
||||
[ -d ../../icuuc/share ] || cp -rf $$ARCH/share ../../icuuc/ ; \
|
||||
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): openssl/compile.sh
|
||||
cd openssl && env ARCH_LIST="$(ARCH_LIST)" ./compile.sh
|
||||
|
||||
$(BOOST): boost/src/build-android.sh
|
||||
rm -rf boost/include boost/lib ; \
|
||||
cd boost/src && \
|
||||
./build-android.sh --boost=1.69.0 --with-iconv --arch=$(shell echo $(foreach ARCH, $(ARCHES32) $(ARCHES64),$(ARCH),) | tr -d ' ') && \
|
||||
for ARCH in $(ARCHES32) $(ARCHES64); do \
|
||||
./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, $(BOOST_LIBS), cp -f build/out/$$ARCH/lib/libboost_$(NAME)-clang-mt-*.a ../lib/$$ARCH/libboost_$(NAME).a || exit 1 ;) \
|
||||
$(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 ; \
|
||||
git clean -f -d -x ; \
|
||||
$(foreach NAME, $(BOOST_LIBS), ln -sf boost ../../boost_$(NAME) ;)
|
||||
done || exit 1
|
||||
|
||||
boost: $(BOOST)
|
||||
$(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,18 +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_atomic boost_chrono boost_container boost_context boost_coroutine boost_date_time boost_exception boost_filesystem \
|
||||
boost_graph boost_iostreams boost_locale boost_log boost_log_setup boost_prg_exec_monitor boost_program_options boost_random \
|
||||
boost_regex boost_serialization boost_signals boost_stacktrace_basic boost_stacktrace_noop \
|
||||
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
|
||||
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
|
||||
# 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_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-v7a
|
||||
APP_ABI := arm64-v8a armeabi-v7a x86 x86_64
|
||||
endif
|
||||
|
||||
# The namespace in Java file, with dots replaced with underscores
|
||||
@@ -20,12 +26,12 @@ SDL_JAVA_PACKAGE_PATH := net_sourceforge_clonekeenplus
|
||||
|
||||
# Path to files with application data - they should be downloaded from Internet on first app run inside
|
||||
# Java sources, or unpacked from resources (TODO)
|
||||
# Typically /sdcard/alienblaster
|
||||
# Typically /sdcard/alienblaster
|
||||
# Or /data/data/de.schwardtnet.alienblaster/files if you're planning to unpack data in application private folder
|
||||
# Your application will just set current directory there
|
||||
SDL_CURDIR_PATH := net.sourceforge.clonekeenplus
|
||||
|
||||
# Android Dev Phone G1 has trackball instead of cursor keys, and
|
||||
# Android Dev Phone G1 has trackball instead of cursor keys, and
|
||||
# sends trackball movement events as rapid KeyDown/KeyUp events,
|
||||
# this will make Up/Down/Left/Right key up events with X frames delay,
|
||||
# so if application expects you to press and hold button it will process the event correctly.
|
||||
@@ -50,16 +56,14 @@ APPLICATION_OVERLAPS_SYSTEM_HEADERS := n
|
||||
|
||||
APPLICATION_SUBDIRS_BUILD := src/*
|
||||
|
||||
APPLICATION_BUILD_EXCLUDE :=
|
||||
APPLICATION_BUILD_EXCLUDE :=
|
||||
|
||||
APPLICATION_CUSTOM_BUILD_SCRIPT :=
|
||||
APPLICATION_CUSTOM_BUILD_SCRIPT :=
|
||||
|
||||
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
|
||||
|
||||
NDK_TOOLCHAIN_VERSION := clang
|
||||
|
||||
APP_PLATFORM := android-16
|
||||
APP_PLATFORM := android-24
|
||||
|
||||
@@ -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,73 +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))
|
||||
|
||||
LOCAL_LDLIBS := $(APPLICATION_GLES_LIBRARY) -ldl -llog -lz
|
||||
|
||||
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
|
||||
obj/local/$(TARGET_ARCH_ABI)/libexpat.so: obj/local/$(TARGET_ARCH_ABI)/libexpat-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-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/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
|
||||
@@ -1,523 +0,0 @@
|
||||
/* REminiscence - Flashback interpreter
|
||||
* Copyright (C) 2005-2007 Gregory Montoir
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "game.h"
|
||||
#include "resource.h"
|
||||
|
||||
|
||||
void Game::col_prepareRoomState() {
|
||||
memset(_col_activeCollisionSlots, 0xFF, sizeof(_col_activeCollisionSlots));
|
||||
_col_currentLeftRoom = _res._ctData[CT_LEFT_ROOM + _currentRoom];
|
||||
_col_currentRightRoom = _res._ctData[CT_RIGHT_ROOM + _currentRoom];
|
||||
for (int i = 0; i != _col_curPos; ++i) {
|
||||
CollisionSlot *_di = _col_slotsTable[i];
|
||||
uint8 room = _di->ct_pos / 64;
|
||||
if (room == _currentRoom) {
|
||||
_col_activeCollisionSlots[0x30 + (_di->ct_pos & 0x3F)] = i;
|
||||
} else if (room == _col_currentLeftRoom) {
|
||||
_col_activeCollisionSlots[0x00 + (_di->ct_pos & 0x3F)] = i;
|
||||
} else if (room == _col_currentRightRoom) {
|
||||
_col_activeCollisionSlots[0x60 + (_di->ct_pos & 0x3F)] = i;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG_COLLISION
|
||||
printf("---\n");
|
||||
for (int y = 0; y < 7; ++y) {
|
||||
for (int x = 0; x < 16; ++x) {
|
||||
printf("%d", _res._ctData[0x100 + _currentRoom * 0x70 + y * 16 + x]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Game::col_clearState() {
|
||||
_col_curPos = 0;
|
||||
_col_curSlot = _col_slots;
|
||||
}
|
||||
|
||||
void Game::col_preparePiegeState(LivePGE *pge) {
|
||||
debug(DBG_COL, "Game::col_preparePiegeState() pge_num=%d", pge - &_pgeLive[0]);
|
||||
CollisionSlot *ct_slot1, *ct_slot2;
|
||||
if (pge->init_PGE->unk1C == 0) {
|
||||
pge->collision_slot = 0xFF;
|
||||
return;
|
||||
}
|
||||
int i = 0;
|
||||
ct_slot1 = 0;
|
||||
for (int c = 0; c < pge->init_PGE->unk1C; ++c) {
|
||||
ct_slot2 = _col_curSlot;
|
||||
if (ct_slot2 + 1 > &_col_slots[255])
|
||||
return;
|
||||
_col_curSlot = ct_slot2 + 1;
|
||||
int16 pos = col_getGridPos(pge, i);
|
||||
if (pos < 0) {
|
||||
if (ct_slot1 == 0) {
|
||||
pge->collision_slot = 0xFF;
|
||||
} else {
|
||||
ct_slot1->index = 0xFFFF;
|
||||
}
|
||||
return;
|
||||
}
|
||||
ct_slot2->ct_pos = pos;
|
||||
ct_slot2->live_pge = pge;
|
||||
ct_slot2->index = 0xFFFF;
|
||||
int16 _ax = col_findSlot(pos);
|
||||
if (_ax >= 0) {
|
||||
ct_slot2->prev_slot = _col_slotsTable[_ax];
|
||||
_col_slotsTable[_ax] = ct_slot2;
|
||||
if (ct_slot1 == 0) {
|
||||
pge->collision_slot = _ax;
|
||||
} else {
|
||||
ct_slot1->index = _ax;
|
||||
}
|
||||
LivePGE *temp_pge = ct_slot2->live_pge;
|
||||
if (temp_pge->flags & 0x80) {
|
||||
_pge_liveTable2[temp_pge->index] = temp_pge;
|
||||
temp_pge->flags |= 4;
|
||||
}
|
||||
if (ct_slot2->prev_slot) {
|
||||
temp_pge = ct_slot2->prev_slot->live_pge;
|
||||
if (temp_pge->flags & 0x80) {
|
||||
_pge_liveTable2[temp_pge->index] = temp_pge;
|
||||
temp_pge->flags |= 4;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ct_slot2->prev_slot = 0;
|
||||
_col_slotsTable[_col_curPos] = ct_slot2;
|
||||
if (ct_slot1 == 0) {
|
||||
pge->collision_slot = _col_curPos;
|
||||
} else {
|
||||
ct_slot1->index = _col_curPos;
|
||||
}
|
||||
_col_curPos++;
|
||||
}
|
||||
ct_slot1 = ct_slot2;
|
||||
i += 0x10;
|
||||
}
|
||||
}
|
||||
|
||||
uint16 Game::col_getGridPos(LivePGE *pge, int16 dx) {
|
||||
int16 x = pge->pos_x + dx;
|
||||
int16 y = pge->pos_y;
|
||||
|
||||
int8 c = pge->room_location;
|
||||
if (c < 0) return 0xFFFF;
|
||||
|
||||
if (x < 0) {
|
||||
c = _res._ctData[CT_LEFT_ROOM + c];
|
||||
if (c < 0) return 0xFFFF;
|
||||
x += 256;
|
||||
} else if (x >= 256) {
|
||||
c = _res._ctData[CT_RIGHT_ROOM + c];
|
||||
if (c < 0) return 0xFFFF;
|
||||
x -= 256;
|
||||
} else if (y < 0) {
|
||||
c = _res._ctData[CT_UP_ROOM + c];
|
||||
if (c < 0) return 0xFFFF;
|
||||
y += 216;
|
||||
} else if (y >= 216) {
|
||||
c = _res._ctData[CT_DOWN_ROOM + c];
|
||||
if (c < 0) return 0xFFFF;
|
||||
y -= 216;
|
||||
}
|
||||
|
||||
x = (x + 8) >> 4;
|
||||
y = (y - 8) / 72;
|
||||
if (x < 0 || x > 15 || y < 0 || y > 2) {
|
||||
return 0xFFFF;
|
||||
} else {
|
||||
return y * 16 + x + c * 64;
|
||||
}
|
||||
}
|
||||
|
||||
int16 Game::col_findSlot(int16 pos) {
|
||||
for (uint16 i = 0; i < _col_curPos; ++i) {
|
||||
if (_col_slotsTable[i]->ct_pos == pos)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int16 Game::col_getGridData(LivePGE *pge, int16 dy, int16 dx) {
|
||||
if (_pge_currentPiegeFacingDir) {
|
||||
dx = -dx;
|
||||
}
|
||||
const int16 pge_grid_y = _col_currentPiegeGridPosY + dy;
|
||||
const int16 pge_grid_x = _col_currentPiegeGridPosX + dx;
|
||||
const int8 *room_ct_data;
|
||||
int8 next_room;
|
||||
if (pge_grid_x < 0) {
|
||||
room_ct_data = &_res._ctData[CT_LEFT_ROOM];
|
||||
next_room = room_ct_data[pge->room_location];
|
||||
if (next_room < 0) return 1;
|
||||
room_ct_data += pge_grid_x + 16 + pge_grid_y * 16 + next_room * 0x70;
|
||||
return (int16)room_ct_data[0x40];
|
||||
} else if (pge_grid_x >= 16) {
|
||||
room_ct_data = &_res._ctData[CT_RIGHT_ROOM];
|
||||
next_room = room_ct_data[pge->room_location];
|
||||
if (next_room < 0) return 1;
|
||||
room_ct_data += pge_grid_x - 16 + pge_grid_y * 16 + next_room * 0x70;
|
||||
return (int16)room_ct_data[0x80];
|
||||
} else if (pge_grid_y < 1) {
|
||||
room_ct_data = &_res._ctData[CT_UP_ROOM];
|
||||
next_room = room_ct_data[pge->room_location];
|
||||
if (next_room < 0) return 1;
|
||||
room_ct_data += pge_grid_x + (pge_grid_y + 6) * 16 + next_room * 0x70;
|
||||
return (int16)room_ct_data[0x100];
|
||||
} else if (pge_grid_y >= 7) {
|
||||
room_ct_data = &_res._ctData[CT_DOWN_ROOM];
|
||||
next_room = room_ct_data[pge->room_location];
|
||||
if (next_room < 0) return 1;
|
||||
room_ct_data += pge_grid_x + (pge_grid_y - 6) * 16 + next_room * 0x70;
|
||||
return (int16)room_ct_data[0xC0];
|
||||
} else {
|
||||
room_ct_data = &_res._ctData[0x100];
|
||||
room_ct_data += pge_grid_x + pge_grid_y * 16 + pge->room_location * 0x70;
|
||||
return (int16)room_ct_data[0];
|
||||
}
|
||||
}
|
||||
|
||||
LivePGE *Game::col_findPiege(LivePGE *pge, uint16 arg2) {
|
||||
if (pge->collision_slot != 0xFF) {
|
||||
CollisionSlot *slot = _col_slotsTable[pge->collision_slot];
|
||||
while (slot) {
|
||||
if (slot->live_pge == pge) {
|
||||
slot = slot->prev_slot;
|
||||
} else {
|
||||
if (arg2 == 0xFFFF || arg2 == slot->live_pge->init_PGE->object_type) {
|
||||
return slot->live_pge;
|
||||
} else {
|
||||
slot = slot->prev_slot;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8 Game::col_findCurrentCollidingObject(LivePGE *pge, uint8 n1, uint8 n2, uint8 n3, LivePGE **pge_out) {
|
||||
if (pge_out) {
|
||||
*pge_out = pge;
|
||||
}
|
||||
if (pge->collision_slot != 0xFF) {
|
||||
CollisionSlot *cs = _col_slotsTable[pge->collision_slot];
|
||||
while (cs) {
|
||||
LivePGE *col_pge = cs->live_pge;
|
||||
if (pge_out) {
|
||||
*pge_out = col_pge;
|
||||
}
|
||||
if (col_pge->init_PGE->object_type == n1 ||
|
||||
col_pge->init_PGE->object_type == n2 ||
|
||||
col_pge->init_PGE->object_type == n3) {
|
||||
return col_pge->init_PGE->colliding_icon_num;
|
||||
} else {
|
||||
cs = cs->prev_slot;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int16 Game::col_detectHit(LivePGE *pge, int16 arg2, int16 arg4, col_Callback1 callback1, col_Callback2 callback2, int16 argA, int16 argC) {
|
||||
debug(DBG_COL, "col_detectHit()");
|
||||
int16 pos_dx, pos_dy, var8, varA;
|
||||
int16 collision_score = 0;
|
||||
int8 pge_room = pge->room_location;
|
||||
if (pge_room < 0 || pge_room >= 0x40) {
|
||||
return 0;
|
||||
}
|
||||
int16 thr = pge->init_PGE->counter_values[0];
|
||||
if (thr > 0) {
|
||||
pos_dx = -1;
|
||||
pos_dy = -1;
|
||||
} else {
|
||||
pos_dx = 1;
|
||||
pos_dy = 1;
|
||||
thr = -thr;
|
||||
}
|
||||
if (_pge_currentPiegeFacingDir) {
|
||||
pos_dx = -pos_dx;
|
||||
}
|
||||
int16 grid_pos_x = (pge->pos_x + 8) >> 4;
|
||||
int16 grid_pos_y = (pge->pos_y / 72);
|
||||
if (grid_pos_y >= 0 && grid_pos_y <= 2) {
|
||||
grid_pos_y *= 16;
|
||||
collision_score = 0;
|
||||
var8 = 0;
|
||||
varA = 0;
|
||||
if (argA != 0) {
|
||||
var8 = pos_dy;
|
||||
grid_pos_x += pos_dx;
|
||||
varA = 1;
|
||||
}
|
||||
while (varA <= thr) {
|
||||
if (grid_pos_x < 0) {
|
||||
pge_room = _res._ctData[CT_LEFT_ROOM + pge_room];
|
||||
if (pge_room < 0) break;
|
||||
grid_pos_x += 16;
|
||||
}
|
||||
if (grid_pos_x >= 16) {
|
||||
pge_room = _res._ctData[CT_RIGHT_ROOM + pge_room];
|
||||
if (pge_room < 0) break;
|
||||
grid_pos_x -= 16;
|
||||
}
|
||||
int16 slot = col_findSlot(grid_pos_y + grid_pos_x + pge_room * 64);
|
||||
if (slot >= 0) {
|
||||
CollisionSlot *cs = _col_slotsTable[slot];
|
||||
while (cs) {
|
||||
collision_score += (this->*callback1)(cs->live_pge, pge, arg2, arg4);
|
||||
cs = cs->prev_slot;
|
||||
}
|
||||
}
|
||||
if ((this->*callback2)(pge, var8, varA, arg2) != 0) {
|
||||
break;
|
||||
}
|
||||
grid_pos_x += pos_dx;
|
||||
++varA;
|
||||
var8 += pos_dy;
|
||||
}
|
||||
}
|
||||
if (argC == -1) {
|
||||
return collision_score;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int Game::col_detectHitCallback1(LivePGE *pge, int16 dy, int16 unk1, int16 unk2) {
|
||||
if (col_getGridData(pge, 1, dy) != 0) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int Game::col_detectHitCallback6(LivePGE *pge, int16 dy, int16 unk1, int16 unk2) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Game::col_detectHitCallback2(LivePGE *pge1, LivePGE *pge2, int16 unk1, int16 unk2) {
|
||||
if (pge1 != pge2 && (pge1->flags & 4)) {
|
||||
if (pge1->init_PGE->object_type == unk2) {
|
||||
if ((pge1->flags & 1) == (pge2->flags & 1)) {
|
||||
if (col_detectHitCallbackHelper(pge1, unk1) == 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Game::col_detectHitCallback3(LivePGE *pge1, LivePGE *pge2, int16 unk1, int16 unk2) {
|
||||
if (pge1 != pge2 && (pge1->flags & 4)) {
|
||||
if (pge1->init_PGE->object_type == unk2) {
|
||||
if ((pge1->flags & 1) != (pge2->flags & 1)) {
|
||||
if (col_detectHitCallbackHelper(pge1, unk1) == 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Game::col_detectHitCallback4(LivePGE *pge1, LivePGE *pge2, int16 unk1, int16 unk2) {
|
||||
if (pge1 != pge2 && (pge1->flags & 4)) {
|
||||
if (pge1->init_PGE->object_type == unk2) {
|
||||
if ((pge1->flags & 1) != (pge2->flags & 1)) {
|
||||
if (col_detectHitCallbackHelper(pge1, unk1) == 0) {
|
||||
pge_updateGroup(pge2->index, pge1->index, unk1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Game::col_detectHitCallback5(LivePGE *pge1, LivePGE *pge2, int16 unk1, int16 unk2) {
|
||||
if (pge1 != pge2 && (pge1->flags & 4)) {
|
||||
if (pge1->init_PGE->object_type == unk2) {
|
||||
if ((pge1->flags & 1) == (pge2->flags & 1)) {
|
||||
if (col_detectHitCallbackHelper(pge1, unk1) == 0) {
|
||||
pge_updateGroup(pge2->index, pge1->index, unk1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Game::col_detectHitCallbackHelper(LivePGE *pge, int16 groupId) {
|
||||
InitPGE *init_pge = pge->init_PGE;
|
||||
assert(init_pge->obj_node_number < _res._numObjectNodes);
|
||||
ObjectNode *on = _res._objectNodesMap[init_pge->obj_node_number];
|
||||
Object *obj = &on->objects[pge->first_obj_number];
|
||||
int i = pge->first_obj_number;
|
||||
while (pge->obj_type == obj->type && on->last_obj_number > i) {
|
||||
if (obj->opcode2 == 0x6B) { // pge_op_isInGroupSlice
|
||||
if (obj->opcode_arg2 == 0) {
|
||||
if (groupId == 1 || groupId == 2) return 0xFFFF;
|
||||
}
|
||||
if (obj->opcode_arg2 == 1) {
|
||||
if (groupId == 3 || groupId == 4) return 0xFFFF;
|
||||
}
|
||||
} else if (obj->opcode2 == 0x22) { // pge_op_isInGroup
|
||||
if (obj->opcode_arg2 == groupId) return 0xFFFF;
|
||||
}
|
||||
|
||||
if (obj->opcode1 == 0x6B) { // pge_op_isInGroupSlice
|
||||
if (obj->opcode_arg1 == 0) {
|
||||
if (groupId == 1 || groupId == 2) return 0xFFFF;
|
||||
}
|
||||
if (obj->opcode_arg1 == 1) {
|
||||
if (groupId == 3 || groupId == 4) return 0xFFFF;
|
||||
}
|
||||
} else if (obj->opcode1 == 0x22) { // pge_op_isInGroup
|
||||
if (obj->opcode_arg1 == groupId) return 0xFFFF;
|
||||
}
|
||||
++obj;
|
||||
++i;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Game::col_detectGunHitCallback1(LivePGE *pge, int16 arg2, int16 arg4, int16 arg6) {
|
||||
int16 _ax = col_getGridData(pge, 1, arg2);
|
||||
if (_ax != 0) {
|
||||
if (!(_ax & 2) || (arg6 != 1)) {
|
||||
return _ax;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Game::col_detectGunHitCallback2(LivePGE *pge1, LivePGE *pge2, int16 arg4, int16) {
|
||||
if (pge1 != pge2 && (pge1->flags & 4)) {
|
||||
if (pge1->init_PGE->object_type == 1 || pge1->init_PGE->object_type == 10) {
|
||||
uint8 id;
|
||||
if ((pge1->flags & 1) != (pge2->flags & 1)) {
|
||||
id = 4;
|
||||
if (arg4 == 0) {
|
||||
id = 3;
|
||||
}
|
||||
} else {
|
||||
id = 2;
|
||||
if (arg4 == 0) {
|
||||
id = 1;
|
||||
}
|
||||
}
|
||||
if (col_detectHitCallbackHelper(pge1, id) != 0) {
|
||||
pge_updateGroup(pge2->index, pge1->index, id);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Game::col_detectGunHitCallback3(LivePGE *pge1, LivePGE *pge2, int16 arg4, int16) {
|
||||
if (pge1 != pge2 && (pge1->flags & 4)) {
|
||||
if (pge1->init_PGE->object_type == 1 || pge1->init_PGE->object_type == 12 || pge1->init_PGE->object_type == 10) {
|
||||
uint8 id;
|
||||
if ((pge1->flags & 1) != (pge2->flags & 1)) {
|
||||
id = 4;
|
||||
if (arg4 == 0) {
|
||||
id = 3;
|
||||
}
|
||||
} else {
|
||||
id = 2;
|
||||
if (arg4 == 0) {
|
||||
id = 1;
|
||||
}
|
||||
}
|
||||
if (col_detectHitCallbackHelper(pge1, id) != 0) {
|
||||
pge_updateGroup(pge2->index, pge1->index, id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Game::col_detectGunHit(LivePGE *pge, int16 arg2, int16 arg4, col_Callback1 callback1, col_Callback2 callback2, int16 argA, int16 argC) {
|
||||
int8 pge_room = pge->room_location;
|
||||
if (pge_room < 0 || pge_room >= 0x40) return 0;
|
||||
int16 thr, pos_dx, pos_dy;
|
||||
if (argC == -1) {
|
||||
thr = pge->init_PGE->counter_values[0];
|
||||
} else {
|
||||
thr = pge->init_PGE->counter_values[3];
|
||||
}
|
||||
if (thr > 0) {
|
||||
pos_dx = -1;
|
||||
pos_dy = -1;
|
||||
} else {
|
||||
pos_dx = 1;
|
||||
pos_dy = 1;
|
||||
thr = -thr;
|
||||
}
|
||||
if (_pge_currentPiegeFacingDir) {
|
||||
pos_dx = -pos_dx;
|
||||
}
|
||||
int16 grid_pos_x = (pge->pos_x + 8) >> 4;
|
||||
int16 grid_pos_y = (pge->pos_y - 8) / 72;
|
||||
if (grid_pos_y >= 0 && grid_pos_y <= 2) {
|
||||
grid_pos_y *= 16;
|
||||
int16 var8 = 0;
|
||||
int16 varA = 0;
|
||||
if (argA != 0) {
|
||||
var8 = pos_dy;
|
||||
grid_pos_x += pos_dx;
|
||||
varA = 1;
|
||||
}
|
||||
while (varA <= thr) {
|
||||
if (grid_pos_x < 0) {
|
||||
pge_room = _res._ctData[CT_LEFT_ROOM + pge_room];
|
||||
if (pge_room < 0) return 0;
|
||||
grid_pos_x += 0x10;
|
||||
}
|
||||
if (grid_pos_x >= 0x10) {
|
||||
pge_room = _res._ctData[CT_RIGHT_ROOM + pge_room];
|
||||
if (pge_room < 0) return 0;
|
||||
grid_pos_x -= 0x10;
|
||||
}
|
||||
int16 slot = col_findSlot(pge_room * 64 + grid_pos_x + grid_pos_y);
|
||||
if (slot >= 0) {
|
||||
CollisionSlot *cs = _col_slotsTable[slot];
|
||||
while (cs) {
|
||||
int r = (this->*callback1)(cs->live_pge, pge, arg2, arg4);
|
||||
if (r != 0) return r;
|
||||
cs = cs->prev_slot;
|
||||
}
|
||||
}
|
||||
if ((this->*callback2)(pge, var8, varA, arg2) != 0) {
|
||||
break;
|
||||
}
|
||||
grid_pos_x += pos_dx;
|
||||
++varA;
|
||||
var8 += pos_dy;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,138 +0,0 @@
|
||||
/* REminiscence - Flashback interpreter
|
||||
* Copyright (C) 2005-2007 Gregory Montoir
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __CUTSCENE_H__
|
||||
#define __CUTSCENE_H__
|
||||
|
||||
#include "intern.h"
|
||||
#include "graphics.h"
|
||||
|
||||
struct ModPlayer;
|
||||
struct Resource;
|
||||
struct SystemStub;
|
||||
struct Video;
|
||||
|
||||
struct Cutscene {
|
||||
typedef void (Cutscene::*OpcodeStub)();
|
||||
|
||||
enum {
|
||||
NUM_OPCODES = 15,
|
||||
TIMER_SLICE = 15
|
||||
};
|
||||
|
||||
static const OpcodeStub _opcodeTable[];
|
||||
static const char *_namesTable[];
|
||||
static const uint16 _offsetsTable[];
|
||||
static const uint16 _cosTable[];
|
||||
static const uint16 _sinTable[];
|
||||
static const uint8 _creditsData[];
|
||||
static const uint16 _creditsCutSeq[];
|
||||
static const uint8 _musicTable[];
|
||||
static const uint8 _protectionShapeData[];
|
||||
|
||||
Graphics _gfx;
|
||||
ModPlayer *_ply;
|
||||
Resource *_res;
|
||||
SystemStub *_stub;
|
||||
Video *_vid;
|
||||
Version _ver;
|
||||
|
||||
uint16 _id;
|
||||
uint16 _deathCutsceneId;
|
||||
bool _interrupted;
|
||||
bool _stop;
|
||||
uint8 *_polPtr;
|
||||
uint8 *_cmdPtr;
|
||||
uint8 *_cmdPtrBak;
|
||||
uint32 _tstamp;
|
||||
uint8 _frameDelay;
|
||||
bool _newPal;
|
||||
uint8 _palBuf[0x20 * 2];
|
||||
uint16 _startOffset;
|
||||
bool _creditsSequence;
|
||||
uint32 _rotData[4];
|
||||
uint8 _primitiveColor;
|
||||
uint8 _clearScreen;
|
||||
Point _vertices[0x80];
|
||||
bool _hasAlphaColor;
|
||||
uint8 _varText;
|
||||
uint8 _varKey;
|
||||
int16 _shape_ix;
|
||||
int16 _shape_iy;
|
||||
int16 _shape_ox;
|
||||
int16 _shape_oy;
|
||||
int16 _shape_cur_x;
|
||||
int16 _shape_cur_y;
|
||||
int16 _shape_prev_x;
|
||||
int16 _shape_prev_y;
|
||||
uint16 _shape_count;
|
||||
uint32 _shape_cur_x16;
|
||||
uint32 _shape_cur_y16;
|
||||
uint32 _shape_prev_x16;
|
||||
uint32 _shape_prev_y16;
|
||||
uint8 _textSep[0x14];
|
||||
uint8 _textBuf[500];
|
||||
const uint8 *_textCurPtr;
|
||||
uint8 *_textCurBuf;
|
||||
uint8 _textUnk2;
|
||||
uint8 _creditsTextPosX;
|
||||
uint8 _creditsTextPosY;
|
||||
int16 _creditsTextCounter;
|
||||
uint8 *_page0, *_page1, *_pageC;
|
||||
|
||||
Cutscene(ModPlayer *player, Resource *res, SystemStub *stub, Video *vid, Version ver);
|
||||
|
||||
void sync();
|
||||
void copyPalette(const uint8 *pal, uint16 num);
|
||||
void updatePalette();
|
||||
void setPalette();
|
||||
void initRotationData(uint16 a, uint16 b, uint16 c);
|
||||
uint16 findTextSeparators(const uint8 *p);
|
||||
void drawText(int16 x, int16 y, const uint8 *p, uint16 color, uint8 *page, uint8 n);
|
||||
void swapLayers();
|
||||
void drawCreditsText();
|
||||
void drawProtectionShape(uint8 shapeNum, int16 zoom);
|
||||
void drawShape(const uint8 *data, int16 x, int16 y);
|
||||
void drawShapeScale(const uint8 *data, int16 zoom, int16 b, int16 c, int16 d, int16 e, int16 f, int16 g);
|
||||
void drawShapeScaleRotate(const uint8 *data, int16 zoom, int16 b, int16 c, int16 d, int16 e, int16 f, int16 g);
|
||||
|
||||
void op_markCurPos();
|
||||
void op_refreshScreen();
|
||||
void op_waitForSync();
|
||||
void op_drawShape();
|
||||
void op_setPalette();
|
||||
void op_drawStringAtBottom();
|
||||
void op_nop();
|
||||
void op_skip3();
|
||||
void op_refreshAll();
|
||||
void op_drawShapeScale();
|
||||
void op_drawShapeScaleRotate();
|
||||
void op_drawCreditsText();
|
||||
void op_drawStringAtPos();
|
||||
void op_handleKeys();
|
||||
|
||||
uint8 fetchNextCmdByte();
|
||||
uint16 fetchNextCmdWord();
|
||||
void mainLoop(uint16 offset);
|
||||
void load(uint16 cutName);
|
||||
void prepare();
|
||||
void startCredits();
|
||||
void play();
|
||||
};
|
||||
|
||||
#endif // __CUTSCENE_H__
|
||||
@@ -1,222 +0,0 @@
|
||||
/* REminiscence - Flashback interpreter
|
||||
* Copyright (C) 2005-2007 Gregory Montoir
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "zlib.h"
|
||||
#include "file.h"
|
||||
|
||||
|
||||
struct File_impl {
|
||||
bool _ioErr;
|
||||
File_impl() : _ioErr(false) {}
|
||||
virtual bool open(const char *path, const char *mode) = 0;
|
||||
virtual void close() = 0;
|
||||
virtual uint32 size() = 0;
|
||||
virtual void seek(int32 off) = 0;
|
||||
virtual void read(void *ptr, uint32 len) = 0;
|
||||
virtual void write(void *ptr, uint32 len) = 0;
|
||||
};
|
||||
|
||||
struct stdFile : File_impl {
|
||||
FILE *_fp;
|
||||
stdFile() : _fp(0) {}
|
||||
bool open(const char *path, const char *mode) {
|
||||
_ioErr = false;
|
||||
_fp = fopen(path, mode);
|
||||
return (_fp != 0);
|
||||
}
|
||||
void close() {
|
||||
if (_fp) {
|
||||
fclose(_fp);
|
||||
_fp = 0;
|
||||
}
|
||||
}
|
||||
uint32 size() {
|
||||
uint32 sz = 0;
|
||||
if (_fp) {
|
||||
int pos = ftell(_fp);
|
||||
fseek(_fp, 0, SEEK_END);
|
||||
sz = ftell(_fp);
|
||||
fseek(_fp, pos, SEEK_SET);
|
||||
}
|
||||
return sz;
|
||||
}
|
||||
void seek(int32 off) {
|
||||
if (_fp) {
|
||||
fseek(_fp, off, SEEK_SET);
|
||||
}
|
||||
}
|
||||
void read(void *ptr, uint32 len) {
|
||||
if (_fp) {
|
||||
uint32 r = fread(ptr, 1, len, _fp);
|
||||
if (r != len) {
|
||||
_ioErr = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
void write(void *ptr, uint32 len) {
|
||||
if (_fp) {
|
||||
uint32 r = fwrite(ptr, 1, len, _fp);
|
||||
if (r != len) {
|
||||
_ioErr = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct zlibFile : File_impl {
|
||||
gzFile _fp;
|
||||
zlibFile() : _fp(0) {}
|
||||
bool open(const char *path, const char *mode) {
|
||||
_ioErr = false;
|
||||
_fp = gzopen(path, mode);
|
||||
return (_fp != 0);
|
||||
}
|
||||
void close() {
|
||||
if (_fp) {
|
||||
gzclose(_fp);
|
||||
_fp = 0;
|
||||
}
|
||||
}
|
||||
uint32 size() {
|
||||
uint32 sz = 0;
|
||||
if (_fp) {
|
||||
int pos = gztell(_fp);
|
||||
gzseek(_fp, 0, SEEK_END);
|
||||
sz = gztell(_fp);
|
||||
gzseek(_fp, pos, SEEK_SET);
|
||||
}
|
||||
return sz;
|
||||
}
|
||||
void seek(int32 off) {
|
||||
if (_fp) {
|
||||
gzseek(_fp, off, SEEK_SET);
|
||||
}
|
||||
}
|
||||
void read(void *ptr, uint32 len) {
|
||||
if (_fp) {
|
||||
uint32 r = gzread(_fp, ptr, len);
|
||||
if (r != len) {
|
||||
_ioErr = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
void write(void *ptr, uint32 len) {
|
||||
if (_fp) {
|
||||
uint32 r = gzwrite(_fp, ptr, len);
|
||||
if (r != len) {
|
||||
_ioErr = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
File::File(bool gzipped) {
|
||||
if (gzipped) {
|
||||
_impl = new zlibFile;
|
||||
} else {
|
||||
_impl = new stdFile;
|
||||
}
|
||||
}
|
||||
|
||||
File::~File() {
|
||||
_impl->close();
|
||||
delete _impl;
|
||||
}
|
||||
|
||||
bool File::open(const char *filename, const char *directory, const char *mode) {
|
||||
_impl->close();
|
||||
char buf[512];
|
||||
sprintf(buf, "%s/%s", directory, filename);
|
||||
char *p = buf + strlen(directory) + 1;
|
||||
string_lower(p);
|
||||
bool opened = _impl->open(buf, mode);
|
||||
if (!opened) { // let's try uppercase
|
||||
string_upper(p);
|
||||
opened = _impl->open(buf, mode);
|
||||
}
|
||||
return opened;
|
||||
}
|
||||
|
||||
void File::close() {
|
||||
_impl->close();
|
||||
}
|
||||
|
||||
bool File::ioErr() const {
|
||||
return _impl->_ioErr;
|
||||
}
|
||||
|
||||
uint32 File::size() {
|
||||
return _impl->size();
|
||||
}
|
||||
|
||||
void File::seek(int32 off) {
|
||||
_impl->seek(off);
|
||||
}
|
||||
|
||||
void File::read(void *ptr, uint32 len) {
|
||||
_impl->read(ptr, len);
|
||||
}
|
||||
|
||||
uint8 File::readByte() {
|
||||
uint8 b;
|
||||
read(&b, 1);
|
||||
return b;
|
||||
}
|
||||
|
||||
uint16 File::readUint16LE() {
|
||||
uint8 lo = readByte();
|
||||
uint8 hi = readByte();
|
||||
return (hi << 8) | lo;
|
||||
}
|
||||
|
||||
uint32 File::readUint32LE() {
|
||||
uint16 lo = readUint16LE();
|
||||
uint16 hi = readUint16LE();
|
||||
return (hi << 16) | lo;
|
||||
}
|
||||
|
||||
uint16 File::readUint16BE() {
|
||||
uint8 hi = readByte();
|
||||
uint8 lo = readByte();
|
||||
return (hi << 8) | lo;
|
||||
}
|
||||
|
||||
uint32 File::readUint32BE() {
|
||||
uint16 hi = readUint16BE();
|
||||
uint16 lo = readUint16BE();
|
||||
return (hi << 16) | lo;
|
||||
}
|
||||
|
||||
void File::write(void *ptr, uint32 len) {
|
||||
_impl->write(ptr, len);
|
||||
}
|
||||
|
||||
void File::writeByte(uint8 b) {
|
||||
write(&b, 1);
|
||||
}
|
||||
|
||||
void File::writeUint16BE(uint16 n) {
|
||||
writeByte(n >> 8);
|
||||
writeByte(n & 0xFF);
|
||||
}
|
||||
|
||||
void File::writeUint32BE(uint32 n) {
|
||||
writeUint16BE(n >> 16);
|
||||
writeUint16BE(n & 0xFFFF);
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/* REminiscence - Flashback interpreter
|
||||
* Copyright (C) 2005-2007 Gregory Montoir
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __FILE_H__
|
||||
#define __FILE_H__
|
||||
|
||||
#include "intern.h"
|
||||
|
||||
struct File_impl;
|
||||
|
||||
struct File {
|
||||
File(bool gzipped = false);
|
||||
~File();
|
||||
|
||||
File_impl *_impl;
|
||||
|
||||
bool open(const char *filename, const char *directory, const char *mode);
|
||||
void close();
|
||||
bool ioErr() const;
|
||||
uint32 size();
|
||||
void seek(int32 off);
|
||||
void read(void *ptr, uint32 len);
|
||||
uint8 readByte();
|
||||
uint16 readUint16LE();
|
||||
uint32 readUint32LE();
|
||||
uint16 readUint16BE();
|
||||
uint32 readUint32BE();
|
||||
void write(void *ptr, uint32 size);
|
||||
void writeByte(uint8 b);
|
||||
void writeUint16BE(uint16 n);
|
||||
void writeUint32BE(uint32 n);
|
||||
};
|
||||
|
||||
#endif // __FILE_H__
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,391 +0,0 @@
|
||||
/* REminiscence - Flashback interpreter
|
||||
* Copyright (C) 2005-2007 Gregory Montoir
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __GAME_H__
|
||||
#define __GAME_H__
|
||||
|
||||
#include "intern.h"
|
||||
#include "cutscene.h"
|
||||
#include "menu.h"
|
||||
#include "mixer.h"
|
||||
#include "mod_player.h"
|
||||
#include "resource.h"
|
||||
#include "sfx_player.h"
|
||||
#include "video.h"
|
||||
|
||||
struct File;
|
||||
struct SystemStub;
|
||||
|
||||
struct Game {
|
||||
typedef int (Game::*pge_OpcodeProc)(ObjectOpcodeArgs *args);
|
||||
typedef int (Game::*pge_ZOrderCallback)(LivePGE *, LivePGE *, uint8, uint8);
|
||||
typedef int (Game::*col_Callback1)(LivePGE *, LivePGE *, int16, int16);
|
||||
typedef int (Game::*col_Callback2)(LivePGE *, int16, int16, int16);
|
||||
|
||||
enum {
|
||||
CT_UP_ROOM = 0x00,
|
||||
CT_DOWN_ROOM = 0x40,
|
||||
CT_RIGHT_ROOM = 0x80,
|
||||
CT_LEFT_ROOM = 0xC0
|
||||
};
|
||||
|
||||
static const Level _gameLevels[];
|
||||
static const uint16 _scoreTable[];
|
||||
static const uint8 _monsterListLevel1[];
|
||||
static const uint8 _monsterListLevel2[];
|
||||
static const uint8 _monsterListLevel3[];
|
||||
static const uint8 _monsterListLevel4_1[];
|
||||
static const uint8 _monsterListLevel4_2[];
|
||||
static const uint8 _monsterListLevel5_1[];
|
||||
static const uint8 _monsterListLevel5_2[];
|
||||
static const uint8 *_monsterListLevels[];
|
||||
static const uint8 _monsterPals[4][32];
|
||||
static const char *_monsterNames[];
|
||||
static const pge_OpcodeProc _pge_opcodeTable[];
|
||||
static const uint8 _pge_modKeysTable[];
|
||||
static const uint8 _protectionCodeData[];
|
||||
static const uint8 _protectionPal[];
|
||||
|
||||
Cutscene _cut;
|
||||
Menu _menu;
|
||||
Mixer _mix;
|
||||
ModPlayer _modPly;
|
||||
Resource _res;
|
||||
SfxPlayer _sfxPly;
|
||||
Video _vid;
|
||||
SystemStub *_stub;
|
||||
const char *_savePath;
|
||||
|
||||
const uint8 *_stringsTable;
|
||||
const char **_textsTable;
|
||||
uint8 _currentLevel;
|
||||
uint8 _skillLevel;
|
||||
uint32 _score;
|
||||
uint8 _currentRoom;
|
||||
uint8 _currentIcon;
|
||||
bool _loadMap;
|
||||
uint8 _printLevelCodeCounter;
|
||||
uint32 _randSeed;
|
||||
uint16 _currentInventoryIconNum;
|
||||
uint16 _curMonsterFrame;
|
||||
uint16 _curMonsterNum;
|
||||
uint8 _blinkingConradCounter;
|
||||
uint16 _textToDisplay;
|
||||
bool _eraseBackground;
|
||||
AnimBufferState _animBuffer0State[41];
|
||||
AnimBufferState _animBuffer1State[6]; // Conrad
|
||||
AnimBufferState _animBuffer2State[42];
|
||||
AnimBufferState _animBuffer3State[12];
|
||||
AnimBuffers _animBuffers;
|
||||
uint8 _bankData[0x7000];
|
||||
uint8 *_firstBankData;
|
||||
uint8 *_lastBankData;
|
||||
BankSlot _bankSlots[49];
|
||||
BankSlot *_curBankSlot;
|
||||
const uint8 *_bankDataPtrs;
|
||||
uint16 _deathCutsceneCounter;
|
||||
bool _saveStateCompleted;
|
||||
|
||||
Game(SystemStub *, const char *dataPath, const char *savePath, Version ver);
|
||||
|
||||
void run();
|
||||
void resetGameState();
|
||||
void mainLoop();
|
||||
void updateTiming();
|
||||
void playCutscene(int id = -1);
|
||||
void loadLevelMap();
|
||||
void loadLevelData();
|
||||
void start();
|
||||
void drawIcon(uint8 iconNum, int16 x, int16 y, uint8 colMask);
|
||||
void drawCurrentInventoryItem();
|
||||
void printLevelCode();
|
||||
void showFinalScore();
|
||||
bool handleConfigPanel();
|
||||
bool handleContinueAbort();
|
||||
bool handleProtectionScreen();
|
||||
void printSaveStateCompleted();
|
||||
void drawLevelTexts();
|
||||
void drawStoryTexts();
|
||||
void prepareAnims();
|
||||
void prepareAnimsHelper(LivePGE *pge, int16 dx, int16 dy);
|
||||
void drawAnims();
|
||||
void drawAnimBuffer(uint8 stateNum, AnimBufferState *state);
|
||||
void drawObject(const uint8 *dataPtr, int16 x, int16 y, uint8 flags);
|
||||
void drawObjectFrame(const uint8 *dataPtr, int16 x, int16 y, uint8 flags);
|
||||
void decodeCharacterFrame(const uint8 *dataPtr, uint8 *dstPtr);
|
||||
void drawCharacter(const uint8 *dataPtr, int16 x, int16 y, uint8 a, uint8 b, uint8 flags);
|
||||
uint8 *loadBankData(uint16 MbkEntryNum);
|
||||
int loadMonsterSprites(LivePGE *pge);
|
||||
void playSound(uint8 sfxId, uint8 softVol);
|
||||
uint16 getRandomNumber();
|
||||
void changeLevel();
|
||||
uint16 getLineLength(const uint8 *str) const;
|
||||
void handleInventory();
|
||||
uint8 *findBankData(uint16 entryNum);
|
||||
|
||||
|
||||
// pieges
|
||||
bool _pge_playAnimSound;
|
||||
GroupPGE _pge_groups[256];
|
||||
GroupPGE *_pge_groupsTable[256];
|
||||
GroupPGE *_pge_nextFreeGroup;
|
||||
LivePGE *_pge_liveTable2[256]; // active pieges list (index = pge number)
|
||||
LivePGE *_pge_liveTable1[256]; // pieges list by room (index = room)
|
||||
LivePGE _pgeLive[256];
|
||||
uint8 _pge_currentPiegeRoom;
|
||||
bool _pge_currentPiegeFacingDir; // (false == left)
|
||||
bool _pge_processOBJ;
|
||||
uint8 _pge_inpKeysMask;
|
||||
uint16 _pge_opTempVar1;
|
||||
uint16 _pge_opTempVar2;
|
||||
uint16 _pge_compareVar1;
|
||||
uint16 _pge_compareVar2;
|
||||
|
||||
void pge_resetGroups();
|
||||
void pge_removeFromGroup(uint8 idx);
|
||||
int pge_isInGroup(LivePGE *pge_dst, uint16 group_id, uint16 counter);
|
||||
void pge_loadForCurrentLevel(uint16 idx);
|
||||
void pge_process(LivePGE *pge);
|
||||
void pge_setupNextAnimFrame(LivePGE *pge, GroupPGE *le);
|
||||
void pge_playAnimSound(LivePGE *pge, uint16 arg2);
|
||||
void pge_setupAnim(LivePGE *pge);
|
||||
int pge_execute(LivePGE *live_pge, InitPGE *init_pge, const Object *obj);
|
||||
void pge_prepare();
|
||||
void pge_setupDefaultAnim(LivePGE *pge);
|
||||
uint16 pge_processOBJ(LivePGE *pge);
|
||||
void pge_setupOtherPieges(LivePGE *pge, InitPGE *init_pge);
|
||||
void pge_addToCurrentRoomList(LivePGE *pge, uint8 room);
|
||||
void pge_getInput();
|
||||
int pge_op_isInpUp(ObjectOpcodeArgs *args);
|
||||
int pge_op_isInpBackward(ObjectOpcodeArgs *args);
|
||||
int pge_op_isInpDown(ObjectOpcodeArgs *args);
|
||||
int pge_op_isInpForward(ObjectOpcodeArgs *args);
|
||||
int pge_op_isInpUpMod(ObjectOpcodeArgs *args);
|
||||
int pge_op_isInpBackwardMod(ObjectOpcodeArgs *args);
|
||||
int pge_op_isInpDownMod(ObjectOpcodeArgs *args);
|
||||
int pge_op_isInpForwardMod(ObjectOpcodeArgs *args);
|
||||
int pge_op_isInpIdle(ObjectOpcodeArgs *args);
|
||||
int pge_op_isInpNoMod(ObjectOpcodeArgs *args);
|
||||
int pge_op_getCollision0u(ObjectOpcodeArgs *args);
|
||||
int pge_op_getCollision00(ObjectOpcodeArgs *args);
|
||||
int pge_op_getCollision0d(ObjectOpcodeArgs *args);
|
||||
int pge_op_getCollision1u(ObjectOpcodeArgs *args);
|
||||
int pge_op_getCollision10(ObjectOpcodeArgs *args);
|
||||
int pge_op_getCollision1d(ObjectOpcodeArgs *args);
|
||||
int pge_op_getCollision2u(ObjectOpcodeArgs *args);
|
||||
int pge_op_getCollision20(ObjectOpcodeArgs *args);
|
||||
int pge_op_getCollision2d(ObjectOpcodeArgs *args);
|
||||
int pge_op_doesNotCollide0u(ObjectOpcodeArgs *args);
|
||||
int pge_op_doesNotCollide00(ObjectOpcodeArgs *args);
|
||||
int pge_op_doesNotCollide0d(ObjectOpcodeArgs *args);
|
||||
int pge_op_doesNotCollide1u(ObjectOpcodeArgs *args);
|
||||
int pge_op_doesNotCollide10(ObjectOpcodeArgs *args);
|
||||
int pge_op_doesNotCollide1d(ObjectOpcodeArgs *args);
|
||||
int pge_op_doesNotCollide2u(ObjectOpcodeArgs *args);
|
||||
int pge_op_doesNotCollide20(ObjectOpcodeArgs *args);
|
||||
int pge_op_doesNotCollide2d(ObjectOpcodeArgs *args);
|
||||
int pge_op_collides0o0d(ObjectOpcodeArgs *args);
|
||||
int pge_op_collides2o2d(ObjectOpcodeArgs *args);
|
||||
int pge_op_collides0o0u(ObjectOpcodeArgs *args);
|
||||
int pge_op_collides2o2u(ObjectOpcodeArgs *args);
|
||||
int pge_op_collides2u2o(ObjectOpcodeArgs *args);
|
||||
int pge_op_isInGroup(ObjectOpcodeArgs *args);
|
||||
int pge_op_updateGroup0(ObjectOpcodeArgs *args);
|
||||
int pge_op_updateGroup1(ObjectOpcodeArgs *args);
|
||||
int pge_op_updateGroup2(ObjectOpcodeArgs *args);
|
||||
int pge_op_updateGroup3(ObjectOpcodeArgs *args);
|
||||
int pge_op_isPiegeDead(ObjectOpcodeArgs *args);
|
||||
int pge_op_collides1u2o(ObjectOpcodeArgs *args);
|
||||
int pge_op_collides1u1o(ObjectOpcodeArgs *args);
|
||||
int pge_op_collides1o1u(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x2B(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x2C(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x2D(ObjectOpcodeArgs *args);
|
||||
int pge_op_nop(ObjectOpcodeArgs *args);
|
||||
int pge_op_pickupObject(ObjectOpcodeArgs *args);
|
||||
int pge_op_addItemToInventory(ObjectOpcodeArgs *args);
|
||||
int pge_op_copyPiege(ObjectOpcodeArgs *args);
|
||||
int pge_op_canUseCurrentInventoryItem(ObjectOpcodeArgs *args);
|
||||
int pge_op_removeItemFromInventory(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x34(ObjectOpcodeArgs *args);
|
||||
int pge_op_isInpMod(ObjectOpcodeArgs *args);
|
||||
int pge_op_setCollisionState1(ObjectOpcodeArgs *args);
|
||||
int pge_op_setCollisionState0(ObjectOpcodeArgs *args);
|
||||
int pge_op_isInGroup1(ObjectOpcodeArgs *args);
|
||||
int pge_op_isInGroup2(ObjectOpcodeArgs *args);
|
||||
int pge_op_isInGroup3(ObjectOpcodeArgs *args);
|
||||
int pge_op_isInGroup4(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x3C(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x3D(ObjectOpcodeArgs *args);
|
||||
int pge_op_setPiegeCounter(ObjectOpcodeArgs *args);
|
||||
int pge_op_decPiegeCounter(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x40(ObjectOpcodeArgs *args);
|
||||
int pge_op_wakeUpPiege(ObjectOpcodeArgs *args);
|
||||
int pge_op_removePiege(ObjectOpcodeArgs *args);
|
||||
int pge_op_removePiegeIfNotNear(ObjectOpcodeArgs *args);
|
||||
int pge_op_loadPiegeCounter(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x45(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x46(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x47(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x48(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x49(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x4A(ObjectOpcodeArgs *args);
|
||||
int pge_op_killPiege(ObjectOpcodeArgs *args);
|
||||
int pge_op_isInCurrentRoom(ObjectOpcodeArgs *args);
|
||||
int pge_op_isNotInCurrentRoom(ObjectOpcodeArgs *args);
|
||||
int pge_op_scrollPosY(ObjectOpcodeArgs *args);
|
||||
int pge_op_playDefaultDeathCutscene(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x50(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x52(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x53(ObjectOpcodeArgs *args);
|
||||
int pge_op_isPiegeNear(ObjectOpcodeArgs *args);
|
||||
int pge_op_setLife(ObjectOpcodeArgs *args);
|
||||
int pge_op_incLife(ObjectOpcodeArgs *args);
|
||||
int pge_op_setPiegeDefaultAnim(ObjectOpcodeArgs *args);
|
||||
int pge_op_setLifeCounter(ObjectOpcodeArgs *args);
|
||||
int pge_op_decLifeCounter(ObjectOpcodeArgs *args);
|
||||
int pge_op_playCutscene(ObjectOpcodeArgs *args);
|
||||
int pge_op_isTempVar2Set(ObjectOpcodeArgs *args);
|
||||
int pge_op_playDeathCutscene(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x5D(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x5E(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x5F(ObjectOpcodeArgs *args);
|
||||
int pge_op_findAndCopyPiege(ObjectOpcodeArgs *args);
|
||||
int pge_op_isInRandomRange(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x62(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x63(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x64(ObjectOpcodeArgs *args);
|
||||
int pge_op_addToCredits(ObjectOpcodeArgs *args);
|
||||
int pge_op_subFromCredits(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x67(ObjectOpcodeArgs *args);
|
||||
int pge_op_setCollisionState2(ObjectOpcodeArgs *args);
|
||||
int pge_op_saveState(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x6A(ObjectOpcodeArgs *args);
|
||||
int pge_op_isInGroupSlice(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x6C(ObjectOpcodeArgs *args);
|
||||
int pge_op_isCollidingObject(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x6E(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x6F(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x70(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x71(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x72(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x73(ObjectOpcodeArgs *args);
|
||||
int pge_op_collides4u(ObjectOpcodeArgs *args);
|
||||
int pge_op_doesNotCollide4u(ObjectOpcodeArgs *args);
|
||||
int pge_op_isBelowConrad(ObjectOpcodeArgs *args);
|
||||
int pge_op_isAboveConrad(ObjectOpcodeArgs *args);
|
||||
int pge_op_isNotFacingConrad(ObjectOpcodeArgs *args);
|
||||
int pge_op_isFacingConrad(ObjectOpcodeArgs *args);
|
||||
int pge_op_collides2u1u(ObjectOpcodeArgs *args);
|
||||
int pge_op_displayText(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x7C(ObjectOpcodeArgs *args);
|
||||
int pge_op_playSound(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x7E(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x7F(ObjectOpcodeArgs *args);
|
||||
int pge_op_setPiegePosX(ObjectOpcodeArgs *args);
|
||||
int pge_op_setPiegePosModX(ObjectOpcodeArgs *args);
|
||||
int pge_op_changeRoom(ObjectOpcodeArgs *args);
|
||||
int pge_op_hasInventoryItem(ObjectOpcodeArgs *args);
|
||||
int pge_op_changeLevel(ObjectOpcodeArgs *args);
|
||||
int pge_op_shakeScreen(ObjectOpcodeArgs *args);
|
||||
int pge_o_unk0x86(ObjectOpcodeArgs *args);
|
||||
int pge_op_playSoundGroup(ObjectOpcodeArgs *args);
|
||||
int pge_op_adjustPos(ObjectOpcodeArgs *args);
|
||||
int pge_op_setTempVar1(ObjectOpcodeArgs *args);
|
||||
int pge_op_isTempVar1Set(ObjectOpcodeArgs *args);
|
||||
int pge_setCurrentInventoryObject(LivePGE *pge);
|
||||
void pge_updateInventory(LivePGE *pge1, LivePGE *pge2);
|
||||
void pge_reorderInventory(LivePGE *pge);
|
||||
LivePGE *pge_getInventoryItemBefore(LivePGE *pge, LivePGE *last_pge);
|
||||
void pge_addToInventory(LivePGE *pge1, LivePGE *pge2, LivePGE *pge3);
|
||||
int pge_updateCollisionState(LivePGE *pge, int16 pge_dy, uint8 var8);
|
||||
int pge_ZOrder(LivePGE *pge, int16 num, pge_ZOrderCallback compare, uint16 unk);
|
||||
void pge_updateGroup(uint8 idx, uint8 unk1, int16 unk2);
|
||||
void pge_removeFromInventory(LivePGE *pge1, LivePGE *pge2, LivePGE *pge3);
|
||||
int pge_ZOrderByAnimY(LivePGE *pge1, LivePGE *pge2, uint8 comp, uint8 comp2);
|
||||
int pge_ZOrderByAnimYIfType(LivePGE *pge1, LivePGE *pge2, uint8 comp, uint8 comp2);
|
||||
int pge_ZOrderIfIndex(LivePGE *pge1, LivePGE *pge2, uint8 comp, uint8 comp2);
|
||||
int pge_ZOrderByIndex(LivePGE *pge1, LivePGE *pge2, uint8 comp, uint8 comp2);
|
||||
int pge_ZOrderByObj(LivePGE *pge1, LivePGE *pge2, uint8 comp, uint8 comp2);
|
||||
int pge_ZOrderIfDifferentDirection(LivePGE *pge1, LivePGE *pge2, uint8 comp, uint8 comp2);
|
||||
int pge_ZOrderIfSameDirection(LivePGE *pge1, LivePGE *pge2, uint8 comp, uint8 comp2);
|
||||
int pge_ZOrderIfTypeAndSameDirection(LivePGE *pge1, LivePGE *pge2, uint8 comp, uint8 comp2);
|
||||
int pge_ZOrderIfTypeAndDifferentDirection(LivePGE *pge1, LivePGE *pge2, uint8 comp, uint8 comp2);
|
||||
int pge_ZOrderByNumber(LivePGE *pge1, LivePGE *pge2, uint8 comp, uint8 comp2);
|
||||
|
||||
|
||||
// collision
|
||||
CollisionSlot _col_slots[256];
|
||||
uint8 _col_curPos;
|
||||
CollisionSlot *_col_slotsTable[256];
|
||||
CollisionSlot *_col_curSlot;
|
||||
CollisionSlot2 _col_slots2[256];
|
||||
CollisionSlot2 *_col_slots2Cur;
|
||||
CollisionSlot2 *_col_slots2Next;
|
||||
uint8 _col_activeCollisionSlots[0x30 * 3]; // left, current, right
|
||||
uint8 _col_currentLeftRoom;
|
||||
uint8 _col_currentRightRoom;
|
||||
int16 _col_currentPiegeGridPosX;
|
||||
int16 _col_currentPiegeGridPosY;
|
||||
|
||||
void col_prepareRoomState();
|
||||
void col_clearState();
|
||||
LivePGE *col_findPiege(LivePGE *pge, uint16 arg2);
|
||||
int16 col_findSlot(int16 pos);
|
||||
void col_preparePiegeState(LivePGE *dst_pge);
|
||||
uint16 col_getGridPos(LivePGE *pge, int16 dx);
|
||||
int16 col_getGridData(LivePGE *pge, int16 dy, int16 dx);
|
||||
uint8 col_findCurrentCollidingObject(LivePGE *pge, uint8 n1, uint8 n2, uint8 n3, LivePGE **pge_out);
|
||||
int16 col_detectHit(LivePGE *pge, int16 arg2, int16 arg4, col_Callback1 callback1, col_Callback2 callback2, int16 argA, int16 argC);
|
||||
int col_detectHitCallback2(LivePGE *pge1, LivePGE *pge2, int16 unk1, int16 unk2);
|
||||
int col_detectHitCallback3(LivePGE *pge1, LivePGE *pge2, int16 unk1, int16 unk2);
|
||||
int col_detectHitCallback4(LivePGE *pge1, LivePGE *pge2, int16 unk1, int16 unk2);
|
||||
int col_detectHitCallback5(LivePGE *pge1, LivePGE *pge2, int16 unk1, int16 unk2);
|
||||
int col_detectHitCallback1(LivePGE *pge, int16 dy, int16 unk1, int16 unk2);
|
||||
int col_detectHitCallback6(LivePGE *pge, int16 dy, int16 unk1, int16 unk2);
|
||||
int col_detectHitCallbackHelper(LivePGE *pge, int16 unk1);
|
||||
int col_detectGunHitCallback1(LivePGE *pge, int16 arg2, int16 arg4, int16 arg6);
|
||||
int col_detectGunHitCallback2(LivePGE *pge1, LivePGE *pge2, int16 arg4, int16);
|
||||
int col_detectGunHitCallback3(LivePGE *pge1, LivePGE *pge2, int16 arg4, int16);
|
||||
int col_detectGunHit(LivePGE *pge, int16 arg2, int16 arg4, col_Callback1 callback1, col_Callback2 callback2, int16 argA, int16 argC);
|
||||
|
||||
|
||||
// input
|
||||
uint8 _inp_lastKeysHit;
|
||||
uint8 _inp_lastKeysHitLeftRight;
|
||||
bool _inp_replay;
|
||||
bool _inp_record;
|
||||
File *_inp_demo;
|
||||
|
||||
void inp_handleSpecialKeys();
|
||||
void inp_update();
|
||||
|
||||
|
||||
// save/load state
|
||||
uint8 _stateSlot;
|
||||
bool _validSaveState;
|
||||
|
||||
void makeGameDemoName(char *buf);
|
||||
void makeGameStateName(uint8 slot, char *buf);
|
||||
bool saveGameState(uint8 slot);
|
||||
bool loadGameState(uint8 slot);
|
||||
void saveState(File *f);
|
||||
void loadState(File *f);
|
||||
};
|
||||
|
||||
#endif // __GAME_H__
|
||||
@@ -1,718 +0,0 @@
|
||||
/* REminiscence - Flashback interpreter
|
||||
* Copyright (C) 2005-2007 Gregory Montoir
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "graphics.h"
|
||||
|
||||
|
||||
void Graphics::setClippingRect(int16 rx, int16 ry, int16 rw, int16 rh) {
|
||||
debug(DBG_VIDEO, "Graphics::setClippingRect(%d, %d, %d, %d)", rx, ry, rw, rh);
|
||||
_crx = rx;
|
||||
_cry = ry;
|
||||
_crw = rw;
|
||||
_crh = rh;
|
||||
}
|
||||
|
||||
void Graphics::drawPoint(uint8 color, const Point *pt) {
|
||||
debug(DBG_VIDEO, "Graphics::drawPoint() col=0x%X x=%d, y=%d", color, pt->x, pt->y);
|
||||
if (pt->x >= 0 && pt->x < _crw && pt->y >= 0 && pt->y < _crh) {
|
||||
*(_layer + (pt->y + _cry) * 256 + pt->x + _crx) = color;
|
||||
}
|
||||
}
|
||||
|
||||
void Graphics::drawLine(uint8 color, const Point *pt1, const Point *pt2) {
|
||||
debug(DBG_VIDEO, "Graphics::drawLine()");
|
||||
int16 dxincr1 = 1;
|
||||
int16 dyincr1 = 1;
|
||||
int16 dx = pt2->x - pt1->x;
|
||||
if (dx < 0) {
|
||||
dxincr1 = -1;
|
||||
dx = -dx;
|
||||
}
|
||||
int16 dy = pt2->y - pt1->y;
|
||||
if (dy < 0) {
|
||||
dyincr1 = -1;
|
||||
dy = -dy;
|
||||
}
|
||||
int16 dxincr2, dyincr2, delta1, delta2;
|
||||
if (dx < dy) {
|
||||
dxincr2 = 0;
|
||||
dyincr2 = 1;
|
||||
delta1 = dx;
|
||||
delta2 = dy;
|
||||
if (dyincr1 < 0) {
|
||||
dyincr2 = -1;
|
||||
}
|
||||
} else {
|
||||
dxincr2 = 1;
|
||||
dyincr2 = 0;
|
||||
delta1 = dy;
|
||||
delta2 = dx;
|
||||
if (dxincr1 < 0) {
|
||||
dxincr2 = -1;
|
||||
}
|
||||
}
|
||||
Point pt;
|
||||
pt.x = pt1->x;
|
||||
pt.y = pt1->y;
|
||||
int16 octincr1 = delta1 * 2 - delta2 * 2;
|
||||
int16 octincr2 = delta1 * 2;
|
||||
int16 oct = delta1 * 2 - delta2;
|
||||
if (delta2 >= 0) {
|
||||
drawPoint(color, &pt);
|
||||
while (--delta2 >= 0) {
|
||||
if (oct >= 0) {
|
||||
pt.x += dxincr1;
|
||||
pt.y += dyincr1;
|
||||
oct += octincr1;
|
||||
} else {
|
||||
pt.x += dxincr2;
|
||||
pt.y += dyincr2;
|
||||
oct += octincr2;
|
||||
}
|
||||
drawPoint(color, &pt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Graphics::addEllipseRadius(int16 y, int16 x1, int16 x2) {
|
||||
debug(DBG_VIDEO, "Graphics::addEllipseRadius()");
|
||||
if (y >= 0 && y <= _crh) {
|
||||
y = (y - _areaPoints[0]) * 2;
|
||||
if (x1 < 0) {
|
||||
x1 = 0;
|
||||
}
|
||||
if (x2 >= _crw) {
|
||||
x2 = _crw - 1;
|
||||
}
|
||||
_areaPoints[y + 1] = x1;
|
||||
_areaPoints[y + 2] = x2;
|
||||
}
|
||||
}
|
||||
|
||||
void Graphics::drawEllipse(uint8 color, bool hasAlpha, const Point *pt, int16 rx, int16 ry) {
|
||||
debug(DBG_VIDEO, "Graphics::drawEllipse()");
|
||||
bool flag = false;
|
||||
int16 y = pt->y - ry;
|
||||
if (y < 0) {
|
||||
y = 0;
|
||||
}
|
||||
if (y < _crh) {
|
||||
if (pt->y + ry >= 0) {
|
||||
_areaPoints[0] = y;
|
||||
int32 dy = 0;
|
||||
int32 rxsq = rx * rx;
|
||||
int32 rxsq2 = rx * rx * 2;
|
||||
int32 rxsq4 = rx * rx * 4;
|
||||
int32 rysq = ry * ry;
|
||||
int32 rysq2 = ry * ry * 2;
|
||||
int32 rysq4 = ry * ry * 4;
|
||||
|
||||
int32 dx = 0;
|
||||
int32 b = rx * ((rysq2 & 0xFFFF) + (rysq2 >> 16));
|
||||
int32 a = 2 * b;
|
||||
|
||||
int32 ny1, ny2, nx1, nx2;
|
||||
ny1 = ny2 = rysq4 / 2 - a + rxsq;
|
||||
nx1 = nx2 = rxsq2 - b + rysq;
|
||||
|
||||
while (ny2 < 0) {
|
||||
int16 x2 = pt->x + rx;
|
||||
int16 x1 = pt->x - rx;
|
||||
int16 by = pt->y + dy;
|
||||
int16 ty = pt->y - dy;
|
||||
if (x1 != x2) {
|
||||
addEllipseRadius(by, x1, x2);
|
||||
if (ty < by) {
|
||||
addEllipseRadius(ty, x1, x2);
|
||||
}
|
||||
}
|
||||
dy += 1;
|
||||
dx += rxsq4;
|
||||
nx1 = dx;
|
||||
if (nx2 < 0) {
|
||||
nx2 += nx1 + rxsq2;
|
||||
ny2 += nx1;
|
||||
} else {
|
||||
--rx;
|
||||
a -= rysq4;
|
||||
ny1 = a;
|
||||
nx2 += nx1 + rxsq2 - ny1;
|
||||
ny2 += nx1 + rysq2 - ny1;
|
||||
}
|
||||
}
|
||||
|
||||
while (rx >= 0) {
|
||||
bool flag2 = false;
|
||||
int16 x2 = pt->x + rx;
|
||||
int16 x1 = pt->x - rx;
|
||||
int16 by = pt->y + dy;
|
||||
int16 ty = pt->y - dy;
|
||||
if (!flag && x1 != x2) {
|
||||
flag2 = true;
|
||||
addEllipseRadius(by, x1, x2);
|
||||
if (ty < by) {
|
||||
addEllipseRadius(ty, x1, x2);
|
||||
}
|
||||
}
|
||||
if (flag2) {
|
||||
flag = true;
|
||||
}
|
||||
--rx;
|
||||
a -= rysq4;
|
||||
nx1 = a;
|
||||
if (ny2 < 0) {
|
||||
++dy;
|
||||
flag = false;
|
||||
dx += rxsq4;
|
||||
ny2 += dx - nx1 + rysq2;
|
||||
ny1 = dx - nx1 + rysq2;
|
||||
} else {
|
||||
ny2 += rysq2 - nx1;
|
||||
ny1 = rysq2 - nx1;
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
++dy;
|
||||
}
|
||||
|
||||
while (dy <= ry) {
|
||||
int16 ty = pt->y - dy;
|
||||
int16 by = pt->y + dy;
|
||||
if (ty < by) {
|
||||
addEllipseRadius(ty, pt->x, pt->x);
|
||||
}
|
||||
addEllipseRadius(by, pt->x, pt->x);
|
||||
++dy;
|
||||
}
|
||||
y = pt->y + ry + 1;
|
||||
if (y > _crh) {
|
||||
y = _crh;
|
||||
}
|
||||
y = (y - _areaPoints[0]) * 2;
|
||||
_areaPoints[y + 1] = -1;
|
||||
fillArea(color, hasAlpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Graphics::fillArea(uint8 color, bool hasAlpha) {
|
||||
debug(DBG_VIDEO, "Graphics::fillArea()");
|
||||
int16 *pts = _areaPoints;
|
||||
uint8 *dst = _layer + (_cry + *pts++) * 256 + _crx;
|
||||
int16 x1 = *pts++;
|
||||
if (x1 >= 0) {
|
||||
if (hasAlpha && color > 0xC7) {
|
||||
do {
|
||||
int16 x2 = *pts++;
|
||||
if (x2 < _crw && x2 >= x1) {
|
||||
int len = x2 - x1 + 1;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
*(dst + x1 + i) |= color & 8; // XXX 0x88
|
||||
}
|
||||
}
|
||||
dst += 256;
|
||||
x1 = *pts++;
|
||||
} while (x1 >= 0);
|
||||
} else {
|
||||
do {
|
||||
int16 x2 = *pts++;
|
||||
if (x2 < _crw && x2 >= x1) {
|
||||
int len = x2 - x1 + 1;
|
||||
memset(dst + x1, color, len);
|
||||
}
|
||||
dst += 256;
|
||||
x1 = *pts++;
|
||||
} while (x1 >= 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Graphics::drawSegment(uint8 color, bool hasAlpha, int16 ys, const Point *pts, uint8 numPts) {
|
||||
debug(DBG_VIDEO, "Graphics::drawSegment()");
|
||||
int16 xmin, xmax, ymin, ymax;
|
||||
xmin = xmax = pts[0].x;
|
||||
ymin = ymax = pts[0].y;
|
||||
for (int i = 1; i < numPts; ++i) {
|
||||
int16 x = pts[i].x;
|
||||
int16 y = pts[i].y;
|
||||
if ((xmin << 16) + ymin > (x << 16) + y) {
|
||||
xmin = x;
|
||||
ymin = y;
|
||||
}
|
||||
if ((xmax << 16) + ymax < (x << 16) + y) {
|
||||
xmax = x;
|
||||
ymax = y;
|
||||
}
|
||||
}
|
||||
if (xmin < 0) {
|
||||
xmin = 0;
|
||||
}
|
||||
if (xmax >= _crw) {
|
||||
xmax = _crw - 1;
|
||||
}
|
||||
_areaPoints[0] = ys;
|
||||
_areaPoints[1] = xmin;
|
||||
_areaPoints[2] = xmax;
|
||||
_areaPoints[3] = -1;
|
||||
fillArea(color, hasAlpha);
|
||||
}
|
||||
|
||||
void Graphics::drawPolygonOutline(uint8 color, const Point *pts, uint8 numPts) {
|
||||
debug(DBG_VIDEO, "Graphics::drawPolygonOutline()");
|
||||
assert(numPts >= 2);
|
||||
int i;
|
||||
for (i = 0; i < numPts - 1; ++i) {
|
||||
drawLine(color, &pts[i], &pts[i + 1]);
|
||||
}
|
||||
drawLine(color, &pts[i], &pts[0]);
|
||||
}
|
||||
|
||||
static int32 calcPolyStep1(int16 dx, int16 dy) {
|
||||
debug(DBG_VIDEO, "Graphics::calcPolyStep1()");
|
||||
assert(dy != 0);
|
||||
int32 a = dx * 256;
|
||||
if ((a >> 16) < dy) {
|
||||
a = ((int16)(a / dy)) * 256;
|
||||
} else {
|
||||
a = ((a / 256) / dy) & 0xFFFF0000;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
static int32 calcPolyStep2(int16 dx, int16 dy) {
|
||||
debug(DBG_VIDEO, "Graphics::calcPolyStep2()");
|
||||
assert(dy != 0);
|
||||
int32 a = dx * 256;
|
||||
if ((a >> 16) < dy) {
|
||||
a = ((int16)(a / dy)) * 256;
|
||||
} else {
|
||||
a = ((a / 256) / dy) << 16;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
static void drawPolygonHelper1(int32 &x, int16 &y, int32 &step, int16 *&pts, int16 *&start) {
|
||||
bool first = true;
|
||||
x = pts[0];
|
||||
y = pts[1];
|
||||
int16 dy, dx;
|
||||
do {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
x = *pts;
|
||||
}
|
||||
--pts;
|
||||
dy = *pts - y;
|
||||
--pts;
|
||||
dx = *pts - x;
|
||||
} while (dy <= 0 && start < pts);
|
||||
x <<= 16;
|
||||
if (dy > 0) {
|
||||
step = calcPolyStep1(dx, dy);
|
||||
}
|
||||
}
|
||||
|
||||
static void drawPolygonHelper2(int32 &x, int16 &y, int32 &step, int16 *&pts, int16 *&start) {
|
||||
bool first = true;
|
||||
x = *start++;
|
||||
y = *start++;
|
||||
int16 dy, dx;
|
||||
do {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
x = *start;
|
||||
start += 2;
|
||||
}
|
||||
dy = start[1] - y;
|
||||
dx = start[0] - x;
|
||||
} while (dy <= 0 && start < pts);
|
||||
x <<= 16;
|
||||
if (dy > 0) {
|
||||
step = calcPolyStep2(dx, dy);
|
||||
}
|
||||
}
|
||||
|
||||
void Graphics::drawPolygon(uint8 color, bool hasAlpha, const Point *pts, uint8 numPts) {
|
||||
debug(DBG_VIDEO, "Graphics::drawPolygon()");
|
||||
assert(numPts * 4 < 0x100);
|
||||
|
||||
int16 *apts1 = &_areaPoints[0x100];
|
||||
int16 *apts2 = &_areaPoints[0x100 + numPts * 2];
|
||||
|
||||
int16 xmin, xmax, ymin, ymax;
|
||||
xmin = xmax = pts[0].x;
|
||||
ymin = ymax = pts[0].y;
|
||||
|
||||
int16 *spts = apts1;
|
||||
*apts1++ = *apts2++ = pts[0].x;
|
||||
*apts1++ = *apts2++ = pts[0].y;
|
||||
|
||||
for (int p = 1; p < numPts; ++p) {
|
||||
int16 x = pts[p].x;
|
||||
int16 y = pts[p].y;
|
||||
if (ymin > y) {
|
||||
ymin = y;
|
||||
spts = apts1;
|
||||
}
|
||||
if (ymax < y) {
|
||||
ymax = y;
|
||||
}
|
||||
*apts1++ = *apts2++ = x;
|
||||
*apts1++ = *apts2++ = y;
|
||||
|
||||
if (xmin > x) {
|
||||
xmin = x;
|
||||
}
|
||||
if (xmax < x) {
|
||||
xmax = x;
|
||||
}
|
||||
}
|
||||
int16 *rpts = _areaPoints;
|
||||
if (xmax < 0 || xmin >= _crw || ymax < 0 || ymin >= _crh) {
|
||||
return;
|
||||
}
|
||||
if (numPts == 2) {
|
||||
drawLine(color, &pts[0], &pts[1]);
|
||||
return;
|
||||
}
|
||||
if (ymax == ymin) {
|
||||
drawSegment(color, hasAlpha, ymax, pts, numPts);
|
||||
return;
|
||||
}
|
||||
int16 x, dx, y, dy;
|
||||
int32 a, b, d, f;
|
||||
int32 xstep1 = 0;
|
||||
int32 xstep2 = 0;
|
||||
|
||||
apts1 = &spts[numPts * 2];
|
||||
xmax = _crw - 1;
|
||||
ymax = _crh - 1;
|
||||
int32 l1 = 65536;
|
||||
int32 l2 = -65536;
|
||||
if (ymin < 0) {
|
||||
int16 x0, y0;
|
||||
do {
|
||||
--apts1;
|
||||
y0 = *apts1;
|
||||
--apts1;
|
||||
x0 = *apts1;
|
||||
} while (y0 < 0);
|
||||
x = apts1[2];
|
||||
y = apts1[3];
|
||||
dy = y0 - y;
|
||||
dx = x0 - x;
|
||||
xstep1 = (dy << 16) | dx;
|
||||
assert(dy != 0);
|
||||
a = y * dx / dy;
|
||||
b = (x - a) << 16;
|
||||
d = xstep1 = calcPolyStep1(dx, dy);
|
||||
if (d < 0) {
|
||||
d = -d;
|
||||
}
|
||||
if (d < l1) {
|
||||
d = l2;
|
||||
}
|
||||
d /= 2;
|
||||
b -= d;
|
||||
|
||||
do {
|
||||
x0 = *spts++;
|
||||
y0 = *spts++;
|
||||
} while (*(spts + 1) < 0);
|
||||
dy = spts[1] - y0;
|
||||
dx = spts[0] - x0;
|
||||
xstep2 = (dy << 16) | dx;
|
||||
assert(dy != 0);
|
||||
a = y0 * dx / dy;
|
||||
f = (x0 - a) << 16;
|
||||
d = xstep2 = calcPolyStep2(dx, dy);
|
||||
if (d < 0) {
|
||||
d = -d;
|
||||
}
|
||||
if (d < l1) {
|
||||
d = l1;
|
||||
}
|
||||
d /= 2;
|
||||
f += d;
|
||||
ymin = 0;
|
||||
*rpts++ = 0;
|
||||
goto gfx_startLine;
|
||||
}
|
||||
|
||||
*rpts++ = ymin;
|
||||
|
||||
gfx_startNewLine:
|
||||
drawPolygonHelper2(f, ymin, xstep2, apts1, spts);
|
||||
if (spts >= apts1) {
|
||||
b = apts1[0] << 16;
|
||||
dy = apts1[1];
|
||||
if (dy <= ymax) goto gfx_endLine;
|
||||
goto gfx_fillArea;
|
||||
}
|
||||
drawPolygonHelper1(b, ymin, xstep1, apts1, spts);
|
||||
d = xstep1;
|
||||
if (d < 0) {
|
||||
if (d >= l2) {
|
||||
d = l1;
|
||||
}
|
||||
d /= 2;
|
||||
b += d;
|
||||
}
|
||||
d = xstep2;
|
||||
if (d >= 0) {
|
||||
if (d <= l1) {
|
||||
d = l1;
|
||||
}
|
||||
d /= 2;
|
||||
f += d;
|
||||
}
|
||||
d = b;
|
||||
if (d < 0) {
|
||||
d = 0;
|
||||
}
|
||||
x = f >> 16;
|
||||
if (x > xmax) {
|
||||
x = xmax;
|
||||
}
|
||||
*rpts++ = d >> 16;
|
||||
*rpts++ = x;
|
||||
++ymin;
|
||||
d = xstep1;
|
||||
if (d >= 0) {
|
||||
if (d <= l1) {
|
||||
d = l1;
|
||||
}
|
||||
d /= 2;
|
||||
}
|
||||
b += d;
|
||||
d = xstep2;
|
||||
if (d < 0) {
|
||||
if (d >= l2) {
|
||||
d = l1;
|
||||
}
|
||||
d /= 2;
|
||||
}
|
||||
f += d;
|
||||
|
||||
gfx_startLine:
|
||||
while (1) {
|
||||
dy = apts1[1];
|
||||
if (spts >= apts1) {
|
||||
break;
|
||||
} else if (dy > spts[1]) {
|
||||
dy = spts[1];
|
||||
if (dy > ymax) {
|
||||
goto gfx_drawPolygonEnd;
|
||||
}
|
||||
dy -= ymin;
|
||||
if (dy > 0) {
|
||||
--dy;
|
||||
do {
|
||||
a = b;
|
||||
if (a < 0) {
|
||||
a = 0;
|
||||
}
|
||||
x = f >> 16;
|
||||
if (x > xmax) {
|
||||
x = xmax;
|
||||
}
|
||||
*rpts++ = a >> 16;
|
||||
*rpts++ = x;
|
||||
b += xstep1;
|
||||
f += xstep2;
|
||||
--dy;
|
||||
} while (dy >= 0);
|
||||
}
|
||||
drawPolygonHelper2(f, ymin, xstep2, apts1, spts);
|
||||
d = xstep2;
|
||||
if (d >= 0) {
|
||||
if (d <= l1) {
|
||||
d = l1;
|
||||
}
|
||||
d /= 2;
|
||||
f += d;
|
||||
} else {
|
||||
d = b;
|
||||
if (d < 0) {
|
||||
d = 0;
|
||||
}
|
||||
x = f >> 16;
|
||||
if (x > xmax) {
|
||||
x = xmax;
|
||||
}
|
||||
*rpts++ = d >> 16;
|
||||
*rpts++ = x;
|
||||
++ymin;
|
||||
d = xstep2;
|
||||
if (d >= l2) {
|
||||
d = l1;
|
||||
}
|
||||
d /= 2;
|
||||
f += d;
|
||||
b += xstep1;
|
||||
}
|
||||
} else if (dy == spts[1]) {
|
||||
if (dy > ymax) goto gfx_drawPolygonEnd;
|
||||
dy -= ymin;
|
||||
if (dy > 0) {
|
||||
--dy;
|
||||
do {
|
||||
a = b;
|
||||
if (a < 0) {
|
||||
a = 0;
|
||||
}
|
||||
x = f >> 16;
|
||||
if (x > xmax) {
|
||||
x = xmax;
|
||||
}
|
||||
*rpts++ = a >> 16;
|
||||
*rpts++ = x;
|
||||
b += xstep1;
|
||||
f += xstep2;
|
||||
--dy;
|
||||
} while (dy >= 0);
|
||||
}
|
||||
goto gfx_startNewLine;
|
||||
} else if (dy > ymax) {
|
||||
goto gfx_drawPolygonEnd;
|
||||
} else {
|
||||
dy -= ymin;
|
||||
if (dy > 0) {
|
||||
--dy;
|
||||
do {
|
||||
a = b;
|
||||
if (a < 0) {
|
||||
a = 0;
|
||||
}
|
||||
x = f >> 16;
|
||||
if (x > xmax) {
|
||||
x = xmax;
|
||||
}
|
||||
*rpts++ = a >> 16;
|
||||
*rpts++ = x;
|
||||
b += xstep1;
|
||||
f += xstep2;
|
||||
--dy;
|
||||
} while (dy >= 0);
|
||||
}
|
||||
drawPolygonHelper1(b, ymin, xstep1, apts1, spts);
|
||||
d = xstep1;
|
||||
if (d < 0) {
|
||||
if (d >= l2) {
|
||||
d = l1;
|
||||
}
|
||||
d /= 2;
|
||||
b += d;
|
||||
} else {
|
||||
d = b;
|
||||
if (d < 0) {
|
||||
d = 0;
|
||||
}
|
||||
x = f >> 16;
|
||||
if (x > xmax) {
|
||||
x = xmax;
|
||||
}
|
||||
*rpts++ = d >> 16;
|
||||
*rpts++ = x;
|
||||
++ymin;
|
||||
d = xstep1;
|
||||
if (d <= l1) {
|
||||
d = l1;
|
||||
}
|
||||
d /= 2;
|
||||
b += d;
|
||||
f += xstep2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dy > ymax) goto gfx_drawPolygonEnd;
|
||||
dy -= ymin;
|
||||
if (dy < 0) goto gfx_fillArea;
|
||||
if (dy > 0) {
|
||||
--dy;
|
||||
do {
|
||||
a = b;
|
||||
if (a < 0) {
|
||||
a = 0;
|
||||
}
|
||||
x = f >> 16;
|
||||
if (x > xmax) {
|
||||
x = xmax;
|
||||
}
|
||||
*rpts++ = a >> 16;
|
||||
*rpts++ = x;
|
||||
b += xstep1;
|
||||
f += xstep2;
|
||||
--dy;
|
||||
} while (dy >= 0);
|
||||
}
|
||||
|
||||
b = f = (apts1[0] << 16) | apts1[1];
|
||||
|
||||
gfx_endLine:
|
||||
d = xstep1;
|
||||
if (d >= 0) {
|
||||
if (d >= l1) {
|
||||
d /= 2;
|
||||
b -= d;
|
||||
}
|
||||
}
|
||||
d = xstep2;
|
||||
if (d < 0) {
|
||||
d /= 2;
|
||||
f -= d;
|
||||
}
|
||||
a = b;
|
||||
if (a < 0) {
|
||||
a = 0;
|
||||
}
|
||||
x = f >> 16;
|
||||
if (x > xmax) {
|
||||
x = xmax;
|
||||
}
|
||||
*rpts++ = a >> 16;
|
||||
*rpts++ = x;
|
||||
goto gfx_fillArea;
|
||||
|
||||
gfx_drawPolygonEnd:
|
||||
dy = ymax - ymin;
|
||||
if (dy >= 0) {
|
||||
do {
|
||||
a = b;
|
||||
if (a < 0) {
|
||||
a = 0;
|
||||
}
|
||||
x = f >> 16;
|
||||
if (x > xmax) {
|
||||
x = xmax;
|
||||
}
|
||||
*rpts++ = a >> 16;
|
||||
*rpts++ = x;
|
||||
b += xstep1;
|
||||
f += xstep2;
|
||||
--dy;
|
||||
} while (dy >= 0);
|
||||
}
|
||||
|
||||
gfx_fillArea:
|
||||
*rpts++ = -1;
|
||||
fillArea(color, hasAlpha);
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/* REminiscence - Flashback interpreter
|
||||
* Copyright (C) 2005-2007 Gregory Montoir
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __GRAPHICS_H__
|
||||
#define __GRAPHICS_H__
|
||||
|
||||
#include "intern.h"
|
||||
|
||||
struct Graphics {
|
||||
uint8 *_layer;
|
||||
int16 _areaPoints[0x200];
|
||||
int16 _crx, _cry, _crw, _crh;
|
||||
|
||||
void setClippingRect(int16 vx, int16 vy, int16 vw, int16 vh);
|
||||
void drawPoint(uint8 color, const Point *pt);
|
||||
void drawLine(uint8 color, const Point *pt1, const Point *pt2);
|
||||
void addEllipseRadius(int16 y, int16 x1, int16 x2);
|
||||
void drawEllipse(uint8 color, bool hasAlpha, const Point *pt, int16 rx, int16 ry);
|
||||
void fillArea(uint8 color, bool hasAlpha);
|
||||
void drawSegment(uint8 color, bool hasAlpha, int16 ys, const Point *pts, uint8 numPts);
|
||||
void drawPolygonOutline(uint8 color, const Point *pts, uint8 numPts);
|
||||
void drawPolygon(uint8 color, bool hasAlpha, const Point *pts, uint8 numPts);
|
||||
};
|
||||
|
||||
#endif // __GRAPHICS_H__
|
||||
@@ -1,193 +0,0 @@
|
||||
/* REminiscence - Flashback interpreter
|
||||
* Copyright (C) 2005-2007 Gregory Montoir
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __INTERN_H__
|
||||
#define __INTERN_H__
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
#include "sys.h"
|
||||
#include "util.h"
|
||||
|
||||
#define MAX(x,y) ((x)>(y)?(x):(y))
|
||||
#define MIN(x,y) ((x)<(y)?(x):(y))
|
||||
#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
template<typename T>
|
||||
inline void SWAP(T &a, T &b) {
|
||||
T tmp = a;
|
||||
a = b;
|
||||
b = tmp;
|
||||
}
|
||||
|
||||
enum Version {
|
||||
VER_FR,
|
||||
VER_EN,
|
||||
VER_DE,
|
||||
VER_SP
|
||||
};
|
||||
|
||||
struct Color {
|
||||
uint8 r;
|
||||
uint8 g;
|
||||
uint8 b;
|
||||
};
|
||||
|
||||
struct Point {
|
||||
int16 x;
|
||||
int16 y;
|
||||
};
|
||||
|
||||
struct Level {
|
||||
const char *name;
|
||||
const char *name2;
|
||||
uint16 cutscene_id;
|
||||
};
|
||||
|
||||
struct InitPGE {
|
||||
uint16 type;
|
||||
int16 pos_x;
|
||||
int16 pos_y;
|
||||
uint16 obj_node_number;
|
||||
uint16 life;
|
||||
int16 counter_values[4];
|
||||
uint8 object_type;
|
||||
uint8 init_room;
|
||||
uint8 room_location;
|
||||
uint8 init_flags;
|
||||
uint8 colliding_icon_num;
|
||||
uint8 icon_num;
|
||||
uint8 object_id;
|
||||
uint8 skill;
|
||||
uint8 mirror_x;
|
||||
uint8 flags;
|
||||
uint8 unk1C; // collidable, collision_data_len
|
||||
uint8 text_num;
|
||||
};
|
||||
|
||||
struct LivePGE {
|
||||
uint16 obj_type;
|
||||
int16 pos_x;
|
||||
int16 pos_y;
|
||||
uint8 anim_seq;
|
||||
uint8 room_location;
|
||||
int16 life;
|
||||
int16 counter_value;
|
||||
uint8 collision_slot;
|
||||
uint8 next_inventory_PGE;
|
||||
uint8 current_inventory_PGE;
|
||||
uint8 unkF; // unk_inventory_PGE
|
||||
uint16 anim_number;
|
||||
uint8 flags;
|
||||
uint8 index;
|
||||
uint16 first_obj_number;
|
||||
LivePGE *next_PGE_in_room;
|
||||
InitPGE *init_PGE;
|
||||
};
|
||||
|
||||
struct GroupPGE {
|
||||
GroupPGE *next_entry;
|
||||
uint16 index;
|
||||
uint16 group_id;
|
||||
};
|
||||
|
||||
struct Object {
|
||||
uint16 type;
|
||||
int8 dx;
|
||||
int8 dy;
|
||||
uint16 init_obj_type;
|
||||
uint8 opcode2;
|
||||
uint8 opcode1;
|
||||
uint8 flags;
|
||||
uint8 opcode3;
|
||||
uint16 init_obj_number;
|
||||
int16 opcode_arg1;
|
||||
int16 opcode_arg2;
|
||||
int16 opcode_arg3;
|
||||
};
|
||||
|
||||
struct ObjectNode {
|
||||
uint16 last_obj_number;
|
||||
Object *objects;
|
||||
uint16 num_objects;
|
||||
};
|
||||
|
||||
struct ObjectOpcodeArgs {
|
||||
LivePGE *pge; // arg0
|
||||
int16 a; // arg2
|
||||
int16 b; // arg4
|
||||
};
|
||||
|
||||
struct AnimBufferState {
|
||||
int16 x;
|
||||
int16 y;
|
||||
const uint8 *dataPtr;
|
||||
LivePGE *pge;
|
||||
};
|
||||
|
||||
struct AnimBuffers {
|
||||
AnimBufferState *_states[4];
|
||||
uint8 _curPos[4];
|
||||
|
||||
void addState(uint8 stateNum, int16 x, int16 y, const uint8 *dataPtr, LivePGE *pge);
|
||||
};
|
||||
|
||||
struct CollisionSlot {
|
||||
int16 ct_pos;
|
||||
CollisionSlot *prev_slot;
|
||||
LivePGE *live_pge;
|
||||
uint16 index;
|
||||
};
|
||||
|
||||
struct MbkEntry {
|
||||
uint16 offset;
|
||||
uint16 len;
|
||||
};
|
||||
|
||||
struct BankSlot {
|
||||
uint16 entryNum;
|
||||
uint8 *ptr;
|
||||
};
|
||||
|
||||
struct CollisionSlot2 {
|
||||
CollisionSlot2 *next_slot;
|
||||
int8 *unk2;
|
||||
uint8 data_size;
|
||||
uint8 data_buf[0x10]; // XXX check size
|
||||
};
|
||||
|
||||
struct InventoryItem {
|
||||
uint8 icon_num;
|
||||
InitPGE *init_pge;
|
||||
LivePGE *live_pge;
|
||||
};
|
||||
|
||||
struct SoundFx {
|
||||
uint32 offset;
|
||||
uint16 len;
|
||||
uint8 *data;
|
||||
};
|
||||
|
||||
#endif // __INTERN_H__
|
||||
@@ -1,50 +0,0 @@
|
||||
/* REminiscence - Flashback interpreter
|
||||
* Copyright (C) 2005-2006 Gregory Montoir
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "locale.h"
|
||||
|
||||
|
||||
Locale::Locale(Version ver)
|
||||
: _ver(ver) {
|
||||
switch (_ver) {
|
||||
case VER_FR:
|
||||
_stringsTable = _stringsTableFR;
|
||||
_textsTable = _textsTableFR;
|
||||
break;
|
||||
case VER_EN:
|
||||
_stringsTable = _stringsTableEN;
|
||||
_textsTable = _textsTableEN;
|
||||
break;
|
||||
case VER_DE:
|
||||
_stringsTable = _stringsTableDE;
|
||||
_textsTable = _textsTableDE;
|
||||
break;
|
||||
case VER_SP:
|
||||
_stringsTable = _stringsTableSP;
|
||||
_textsTable = _textsTableSP;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const char *Locale::get(int id) const {
|
||||
const char *text = 0;
|
||||
if (id >= 0 && id < LI_NUM) {
|
||||
text = _textsTable[id];
|
||||
}
|
||||
return text;
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/* REminiscence - Flashback interpreter
|
||||
* Copyright (C) 2005-2006 Gregory Montoir
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __LOCALE_H__
|
||||
#define __LOCALE_H__
|
||||
|
||||
#include "intern.h"
|
||||
|
||||
struct Locale {
|
||||
enum Id {
|
||||
LI_01_CONTINUE_OR_ABORT = 0,
|
||||
LI_02_TIME,
|
||||
LI_03_CONTINUE,
|
||||
LI_04_ABORT,
|
||||
LI_05_COMPLETED,
|
||||
LI_06_LEVEL,
|
||||
LI_07_START,
|
||||
LI_08_SKILL,
|
||||
LI_09_PASSWORD,
|
||||
LI_10_INFO,
|
||||
LI_11_QUIT,
|
||||
LI_12_SKILL_LEVEL,
|
||||
LI_13_EASY,
|
||||
LI_14_NORMAL,
|
||||
LI_15_EXPERT,
|
||||
LI_16_ENTER_PASSWORD1,
|
||||
LI_17_ENTER_PASSWORD2,
|
||||
LI_18_RESUME_GAME,
|
||||
LI_19_ABORT_GAME,
|
||||
LI_20_LOAD_GAME,
|
||||
LI_21_SAVE_GAME,
|
||||
LI_22_SAVE_SLOT,
|
||||
|
||||
LI_NUM
|
||||
};
|
||||
|
||||
static const char *_textsTableFR[];
|
||||
static const char *_textsTableEN[];
|
||||
static const char *_textsTableDE[];
|
||||
static const char *_textsTableSP[];
|
||||
static const uint8 _stringsTableFR[];
|
||||
static const uint8 _stringsTableEN[];
|
||||
static const uint8 _stringsTableDE[];
|
||||
static const uint8 _stringsTableSP[];
|
||||
|
||||
Version _ver;
|
||||
const char **_textsTable;
|
||||
const uint8 *_stringsTable;
|
||||
|
||||
Locale(Version ver);
|
||||
const char *get(int id) const;
|
||||
};
|
||||
|
||||
#endif // __LOCALE_H__
|
||||
@@ -1,85 +0,0 @@
|
||||
/* REminiscence - Flashback interpreter
|
||||
* Copyright (C) 2005-2007 Gregory Montoir
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "file.h"
|
||||
#include "game.h"
|
||||
#include "systemstub.h"
|
||||
|
||||
static const char *USAGE =
|
||||
"REminiscence - Flashback Interpreter\n"
|
||||
"Usage: rs [OPTIONS]...\n"
|
||||
" --datapath=PATH Path to data files (default 'DATA')\n"
|
||||
" --savepath=PATH Path to save files (default '.')";
|
||||
|
||||
static bool parseOption(const char *arg, const char *longCmd, const char **opt) {
|
||||
bool handled = false;
|
||||
if (arg[0] == '-' && arg[1] == '-') {
|
||||
if (strncmp(arg + 2, longCmd, strlen(longCmd)) == 0) {
|
||||
*opt = arg + 2 + strlen(longCmd);
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
return handled;
|
||||
}
|
||||
|
||||
static Version detectVersion(const char *dataPath) {
|
||||
static struct {
|
||||
const char *filename;
|
||||
Version ver;
|
||||
} checkTable[] = {
|
||||
{ "ENGCINE.BIN", VER_EN },
|
||||
{ "FR_CINE.BIN", VER_FR },
|
||||
{ "GERCINE.BIN", VER_DE },
|
||||
{ "SPACINE.BIN", VER_SP }
|
||||
};
|
||||
for (uint8 i = 0; i < ARRAYSIZE(checkTable); ++i) {
|
||||
File f;
|
||||
if (f.open(checkTable[i].filename, dataPath, "rb")) {
|
||||
return checkTable[i].ver;
|
||||
}
|
||||
}
|
||||
error("Unable to find data files, check that all required files are present");
|
||||
return VER_EN;
|
||||
}
|
||||
|
||||
#undef main
|
||||
|
||||
#include <SDL.h>
|
||||
int main(int argc, char *argv[]) {
|
||||
const char *dataPath = "DATA";
|
||||
const char *savePath = ".";
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
bool opt = false;
|
||||
if (strlen(argv[i]) >= 2) {
|
||||
opt |= parseOption(argv[i], "datapath=", &dataPath);
|
||||
opt |= parseOption(argv[i], "savepath=", &savePath);
|
||||
}
|
||||
if (!opt) {
|
||||
printf(USAGE);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Version ver = detectVersion(dataPath);
|
||||
g_debugMask = DBG_INFO; // DBG_CUT | DBG_VIDEO | DBG_RES | DBG_MENU | DBG_PGE | DBG_GAME | DBG_UNPACK | DBG_COL | DBG_MOD | DBG_SFX;
|
||||
SystemStub *stub = SystemStub_SDL_create();
|
||||
Game *g = new Game(stub, dataPath, savePath, ver);
|
||||
g->run();
|
||||
delete g;
|
||||
delete stub;
|
||||
return 0;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user