22 Commits

Author SHA1 Message Date
Gerhard Stein
338c3e73b6 Commander Genius update 2017-02-25 12:22:12 +01:00
Gerhard Stein
e2e742da0a python3 updates 2017-02-25 12:21:25 +01:00
Gerhard Stein
19c3445715 Merge branch 'sdl_android' of github.com:pelya/commandergenius into python3_testing 2017-02-10 19:56:47 +01:00
Gerhard Stein
892a4f01c3 enabled for x86 2017-02-09 17:11:15 +01:00
Gerhard Stein
00ed556dd4 fixed include issue 2017-02-08 17:54:17 +01:00
Gerhard Stein
e256f76b48 automatic creation of env 2017-02-05 16:52:37 +01:00
Gerhard Stein
700f6329bf Merge branch 'sdl_android' into python3_testing 2017-02-05 15:19:18 +01:00
Gerhard Stein
f708fe930b python3 support for x86 arch added. There are still bugs though. With arms it works fine 2017-01-28 13:06:28 +01:00
Gerhard Stein
3e49726ddc Updated Commander Genius 2017-01-25 20:15:20 +01:00
Gerhard Stein
214a70495b Updated Commander Genius 2017-01-25 19:46:03 +01:00
Gerhard Stein
df8388ac16 Python3 improvementso 2017-01-25 19:30:37 +01:00
Gerhard Stein
5ad5a3fd38 Further automatizations 2017-01-22 13:43:24 +01:00
Gerhard Stein
bff9883181 Merge branch 'sdl_android' into python3_testing 2017-01-21 11:11:45 +01:00
Gerhard Stein
e8861109ed Python3 as submodule 2017-01-01 13:45:31 +01:00
Gerhard Stein
1757a3e3a9 Merge branch 'sdl_android' into python3_testing 2017-01-01 11:28:23 +01:00
Gerhard Stein
58ab8b2618 Commander Genius Update 2017-01-01 11:01:25 +01:00
Gerhard Stein
304bffa18a Merge branch 'sdl_android' of github.com:pelya/commandergenius into python3_testing 2016-12-31 13:57:07 +01:00
Gerhard Stein
82b7b33327 added some include for the apps 2016-12-27 21:53:55 +01:00
Gerhard Stein
73d920684c python3 updates 2016-12-27 21:45:29 +01:00
Gerhard Stein
fdb5f2572a Merge branch 'sdl_android' into python3_testing 2016-12-27 14:57:54 +01:00
Gerhard Stein
616a69a5c5 Fixes and improvements 2016-12-03 14:18:33 +01:00
Gerhard Stein
1194788eb9 Added Python3. (Still testing integration) 2016-12-03 11:31:30 +01:00
13888 changed files with 2933578 additions and 366657 deletions

4
.gitignore vendored
View File

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

79
.gitmodules vendored
View File

@@ -1,86 +1,81 @@
[submodule "project/jni/application/NewRAW"]
path = project/jni/application/NewRAW
url = https://github.com/usineur/android-newraw.git
url = git@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
url = git@github.com:pelya/Boost-for-Android.git
branch = master2
update = merge
[submodule "project/jni/application/commandergenius/commandergenius"]
path = project/jni/application/commandergenius/commandergenius
url = https://github.com/gerstrong/Commander-Genius.git
url = git@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
url = git@github.com:pelya/openarena-engine.git
[submodule "project/jni/application/scummvm/scummvm"]
path = project/jni/application/scummvm/scummvm
url = git@github.com:scummvm/scummvm.git
[submodule "project/jni/application/openarena/vm"]
path = project/jni/application/openarena/vm
url = https://github.com/pelya/openarena-vm
url = git@github.com:pelya/openarena-vm
[submodule "project/jni/application/teeworlds/src"]
path = project/jni/application/teeworlds/src
url = https://github.com/pelya/teeworlds.git
url = git@github.com:pelya/teeworlds.git
[submodule "project/jni/application/c-dogs/src"]
path = project/jni/application/c-dogs/src
url = git@github.com:cxong/cdogs-sdl.git
[submodule "project/jni/application/xserver/xserver"]
path = project/jni/application/xserver/xserver
url = https://github.com/pelya/xserver.git
branch = xsdl-1.20
url = git@github.com:pelya/xserver.git
branch = xsdl2
update = merge
[submodule "android-shmem"]
path = project/jni/shmem
url = https://github.com/pelya/android-shmem.git
url = git@github.com:pelya/android-shmem.git
branch = master
update = merge
[submodule "project/jni/application/hid-pc-keyboard/src"]
path = project/jni/application/hid-pc-keyboard/src
url = https://github.com/pelya/android-keyboard-gadget.git
url = git@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
branch = master
update = merge
url = git@github.com:pelya/libiconv-libicu-android.git
[submodule "project/jni/icuuc/src"]
path = project/jni/icuuc/src
url = git@github.com:pelya/libiconv-libicu-android.git
[submodule "project/jni/application/openttd/src"]
path = project/jni/application/openttd/src
url = https://github.com/pelya/openttd-android.git
branch = 1.10
url = git@github.com:pelya/openttd-android.git
[submodule "project/jni/application/uae4all2"]
path = project/jni/application/uae4all2
url = https://github.com/lubomyr/uae4all2.git
url = git@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
url = git@github.com:pelya/BasiliskII-android.git
[submodule "project/jni/vncserver/src"]
path = project/jni/vncserver/src
url = https://github.com/LibVNC/libvncserver.git
url = git@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
url = git@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
url = git@github.com:pelya/pulseaudio-android.git
[submodule "project/jni/application/bochs/bochs"]
path = project/jni/application/bochs/bochs
url = git@github.com:lubomyr/bochs.git
[submodule "project/jni/application/supertux/supertux"]
path = project/jni/application/supertux/supertux
url = https://github.com/pelya/supertux.git
url = git@github.com:pelya/supertux.git
[submodule "project/jni/application/fheroes2/fheroes2"]
path = project/jni/application/fheroes2/fheroes2
url = https://github.com/gerstrong/fheroes2plus.git
url = http://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
branch = master
url = git@github.com:pelya/Ninslash.git
[submodule "project/jni/python3/python3-android"]
path = project/jni/python3/python3-android
url = http://github.com/gerstrong/python3-android.git

107
aar2jar.py Executable file
View File

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

35
app2sd.sh Executable file
View File

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

View File

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

View File

@@ -79,14 +79,23 @@ NDK_TOOLCHAIN_VERSION=$GCCVER
# 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
if ( grep "package $AppFullName;" project/src/Globals.java > /dev/null 2>&1 && \
[ "`readlink AndroidAppSettings.cfg`" -ot "project/src/Globals.java" ] && \
[ -z "`find project/java/* project/AndroidManifestTemplate.xml -cnewer project/src/Globals.java`" ] ) ; then true ; else
./changeAppSettings.sh -a || exit 1
sleep 1
touch project/src/Globals.java
fi
if $build_release ; then
sed -i 's/android:debuggable="true"/android:debuggable="false"/g' project/AndroidManifest.xml
else
sed -i 's/android:debuggable="false"/android:debuggable="true"/g' project/AndroidManifest.xml
fi
[ -e project/local.properties ] || {
android update project -p project -t android-23 || exit 1
rm -f project/src/Globals.java
}
MYARCH=linux-x86_64
if [ -z "$NCPU" ]; then
@@ -111,6 +120,12 @@ $quick_rebuild || rm -r -f project/bin/* # New Android SDK introduced some lame-
}
strip_libs() {
grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
echo Stripping libapplication-armeabi.so by hand && \
rm obj/local/armeabi/libapplication.so && \
cp jni/application/src/libapplication-armeabi.so obj/local/armeabi/libapplication.so && \
cp jni/application/src/libapplication-armeabi.so libs/armeabi/libapplication.so && \
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-${NDK_TOOLCHAIN_VERSION}/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi/libapplication.so
grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
grep "MultiABI=" ../AndroidAppSettings.cfg | grep "y\\|all\\|armeabi-v7a" > /dev/null && \
echo Stripping libapplication-armeabi-v7a.so by hand && \
@@ -118,6 +133,13 @@ strip_libs() {
cp jni/application/src/libapplication-armeabi-v7a.so obj/local/armeabi-v7a/libapplication.so && \
cp jni/application/src/libapplication-armeabi-v7a.so libs/armeabi-v7a/libapplication.so && \
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-${NDK_TOOLCHAIN_VERSION}/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi-v7a/libapplication.so
grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
grep "MultiABI=" ../AndroidAppSettings.cfg | grep "all\\|mips" > /dev/null && \
echo Stripping libapplication-mips.so by hand && \
rm obj/local/mips/libapplication.so && \
cp jni/application/src/libapplication-mips.so obj/local/mips/libapplication.so && \
cp jni/application/src/libapplication-mips.so libs/mips/libapplication.so && \
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/mipsel-linux-android-${NDK_TOOLCHAIN_VERSION}/prebuilt/$MYARCH/bin/mipsel-linux-android-strip --strip-unneeded libs/mips/libapplication.so
grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
grep "MultiABI=" ../AndroidAppSettings.cfg | grep "all\\|x86" > /dev/null && \
echo Stripping libapplication-x86.so by hand && \
@@ -139,53 +161,48 @@ strip_libs() {
cp jni/application/src/libapplication-arm64-v8a.so obj/local/arm64-v8a/libapplication.so && \
cp jni/application/src/libapplication-arm64-v8a.so libs/arm64-v8a/libapplication.so && \
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/aarch64-linux-android-${NDK_TOOLCHAIN_VERSION}/prebuilt/$MYARCH/bin/aarch64-linux-android-strip --strip-unneeded libs/arm64-v8a/libapplication.so
grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
grep "MultiABI=" ../AndroidAppSettings.cfg | grep "all\\|mips64" > /dev/null && \
echo Stripping libapplication-mips64.so by hand && \
rm obj/local/mips64/libapplication.so && \
cp jni/application/src/libapplication-mips64.so obj/local/mips64/libapplication.so && \
cp jni/application/src/libapplication-mips64.so libs/mips64/libapplication.so && \
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/mips64el-linux-android-${NDK_TOOLCHAIN_VERSION}/prebuilt/$MYARCH/bin/mips64el-linux-android-strip --strip-unneeded libs/mips64/libapplication.so
return 0
}
# Fix Gradle compilation error
[ -z "$ANDROID_NDK_HOME" ] && export ANDROID_NDK_HOME="`which ndk-build | sed 's@/ndk-build@@'`"
cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU ndk-build -j$NCPU V=1 $QUICK_REBUILD_ARGS && \
cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU nice -n19 ndk-build -j$NCPU V=1 $QUICK_REBUILD_ARGS && \
strip_libs && \
cd .. && ./copyAssets.sh && cd project && \
{ if $build_release ; then \
$quick_rebuild && { \
zip -u -r app/build/outputs/apk/release/app-release-unsigned.apk lib assets || exit 1 ; \
} || ./gradlew assembleRelease || exit 1 ; \
ln -s -f libs lib ; \
zip -u -r bin/MainActivity-release-unsigned.apk lib assets || exit 1 ; \
} || ant release || exit 1 ; \
[ '!' -x jni/application/src/AndroidPostBuild.sh ] || {
cd jni/application/src ; \
./AndroidPostBuild.sh `pwd`/../../../app/build/outputs/apk/release/app-release-unsigned.apk || exit 1 ; \
./AndroidPostBuild.sh `pwd`/../../../bin/MainActivity-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 ; \
jarsigner -verbose -keystore ~/.android/debug.keystore -storepass android -sigalg MD5withRSA -digestalg SHA1 bin/MainActivity-release-unsigned.apk androiddebugkey || exit 1 ; \
rm -f bin/MainActivity-debug.apk ; \
zipalign 4 bin/MainActivity-release-unsigned.apk bin/MainActivity-debug.apk || exit 1 ; \
else \
./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 ; \
$quick_rebuild && { \
ln -s -f libs lib ; \
zip -u -r bin/MainActivity-debug-unaligned.apk lib assets || exit 1 ; \
jarsigner -verbose -keystore ~/.android/debug.keystore -storepass android -sigalg MD5withRSA -digestalg SHA1 bin/MainActivity-debug-unaligned.apk androiddebugkey || exit 1 ; \
rm -f bin/MainActivity-debug.apk ; \
zipalign 4 bin/MainActivity-debug-unaligned.apk bin/MainActivity-debug.apk || exit 1 ; \
} || ant debug || exit 1 ; \
fi ; } && \
{ if $sign_apk; then cd .. && ./sign.sh && cd project ; else true ; fi ; } && \
{ $install_apk && [ -n "`adb devices | tail -n +2`" ] && \
{ 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 ; } ; \
{ cd bin && adb install -r MainActivity-debug.apk | grep 'Failure' && \
adb uninstall `grep AppFullName ../../AndroidAppSettings.cfg | sed 's/.*=//'` && adb install -r MainActivity-debug.apk ; } ; \
true ; } && \
{ $run_apk && { \
ActivityName="`grep AppFullName ../AndroidAppSettings.cfg | sed 's/.*=//'`/.MainActivity" ; \
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" ; \

1320
build/envsetup.sh Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -81,7 +81,7 @@ if [ -z "$CompatibilityHacksForceScreenUpdate" ]; then
fi
if [ -z "$CompatibilityHacksForceScreenUpdateMouseClick" ]; then
CompatibilityHacksForceScreenUpdateMouseClick=n
CompatibilityHacksForceScreenUpdateMouseClick=y
fi
if [ -z "$TouchscreenKeysTheme" ]; then
@@ -146,13 +146,11 @@ echo "# Application user-visible version name (string)" >> AndroidAppSettings.cf
echo AppVersionName=\"$AppVersionName\" >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
echo "# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'" >> AndroidAppSettings.cfg
echo "# If you'll start Description with '!' symbol it will be enabled by default, '!!' will also hide the entry from the menu, so it cannot be disabled" >> AndroidAppSettings.cfg
echo "# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu" >> AndroidAppSettings.cfg
echo "# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped" >> AndroidAppSettings.cfg
echo "# If the URL does not contain 'http://' or 'https://', it is treated as file from 'project/jni/application/src/AndroidData' dir -" >> AndroidAppSettings.cfg
echo "# these files are put inside .apk package by the build system" >> AndroidAppSettings.cfg
echo "# You can specify Google Play expansion files in the form 'obb:main.12345' or 'obb:patch.12345' where 12345 is the app version for obb file" >> AndroidAppSettings.cfg
echo "# You can use .zip.xz archives for better compression, but you need to add 'lzma' to CompiledLibraries" >> AndroidAppSettings.cfg
echo "# Generate .zip.xz files like this: zip -0 -r data.zip your-data/* ; xz -8 data.zip" >> AndroidAppSettings.cfg
echo "# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir -" >> AndroidAppSettings.cfg
echo "# these files are put inside .apk package by build system" >> AndroidAppSettings.cfg
echo "# You can specify Google Play expansion files in the form 'obb:main.12345' or 'obb:patch.12345' where 12345 is the app version, first associated with the file" >> AndroidAppSettings.cfg
echo AppDataDownloadUrl=\"$AppDataDownloadUrl\" >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
echo "# Reset SDL config when updating application to the new version (y) / (n)" >> AndroidAppSettings.cfg
@@ -312,21 +310,15 @@ echo "# API is defined in file SDL_android.h: int SDL_ANDROID_OpenAudioRecording
echo "# This option will add additional permission to Android manifest (y)/(n)" >> AndroidAppSettings.cfg
echo AppRecordsAudio=$AppRecordsAudio >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
echo "# Application needs read/write access SD card. Always disable it, unless you want to access user photos and downloads. (y) / (n)" >> AndroidAppSettings.cfg
echo "# Application needs to access SD card. Always disable it, unless you want to access user photos and downloads. (y) / (n)" >> AndroidAppSettings.cfg
echo AccessSdCard=$AccessSdCard >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
echo "# Application needs to read it's own OBB file. Enable this if you are using Play Store expansion files. (y) / (n)" >> AndroidAppSettings.cfg
echo ReadObbFile=$ReadObbFile >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
echo "# Application needs Internet access. If you disable it, you'll have to bundle all your data files inside .apk (y) / (n)" >> AndroidAppSettings.cfg
echo AccessInternet=$AccessInternet >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
echo "# Immersive mode - Android will hide on-screen Home/Back keys. Looks bad if you invoke Android keyboard. (y) / (n)" >> AndroidAppSettings.cfg
echo ImmersiveMode=$ImmersiveMode >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
echo "# Hide Android system mouse cursor image when USB mouse is attached (y) or (n) - the app must draw it's own mouse cursor" >> AndroidAppSettings.cfg
echo HideSystemMousePointer=$HideSystemMousePointer >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
echo "# Application implements Android-specific routines to put to background, and will not draw anything to screen" >> AndroidAppSettings.cfg
echo "# between SDL_ACTIVEEVENT lost / gained notifications - you should check for them" >> AndroidAppSettings.cfg
echo "# rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n)" >> AndroidAppSettings.cfg
@@ -363,18 +355,9 @@ echo "# 9 = Nintendo64 from RetroArch" >> AndroidAppSettings.cfg
echo TouchscreenKeysTheme=$TouchscreenKeysTheme >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
echo "# Redefine gamepad keys to SDL keysyms, button order is:" >> AndroidAppSettings.cfg
echo "# A B X Y L1 R1 L2 R2 LThumb RThumb Start Select Up Down Left Right LThumbUp LThumbDown LThumbLeft LThumbRight RThumbUp RThumbDown RThumbLeft RThumbRight" >> AndroidAppSettings.cfg
echo "# A B X Y L1 R1 L2 R2 LThumb RThumb" >> AndroidAppSettings.cfg
echo RedefinedKeysGamepad=\"$RedefinedKeysGamepad\" >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
echo "# Redefine keys for the second gamepad, same as the first gamepad if not set:" >> AndroidAppSettings.cfg
echo RedefinedKeysSecondGamepad=\"$RedefinedKeysSecondGamepad\" >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
echo "# Redefine keys for the third gamepad, same as the first gamepad if not set:" >> AndroidAppSettings.cfg
echo RedefinedKeysThirdGamepad=\"$RedefinedKeysThirdGamepad\" >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
echo "# Redefine keys for the fourth gamepad, same as the first gamepad if not set:" >> AndroidAppSettings.cfg
echo RedefinedKeysFourthGamepad=\"$RedefinedKeysFourthGamepad\" >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
echo "# How long to show startup menu button, in msec, 0 to disable startup menu" >> AndroidAppSettings.cfg
echo StartupMenuButtonTimeout=$StartupMenuButtonTimeout >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
@@ -395,17 +378,17 @@ echo "# GCC version, or 'clang' for CLANG" >> AndroidAppSettings.cfg
echo NDK_TOOLCHAIN_VERSION=$NDK_TOOLCHAIN_VERSION >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
echo "# Android platform version." >> AndroidAppSettings.cfg
echo "# android-16 = Android 4.1, the earliest supported version in NDK r18." >> AndroidAppSettings.cfg
echo "# android-9 = Android 2.3, the earliest supported version." >> AndroidAppSettings.cfg
echo "# android-18 = Android 4.3, the first version supporting GLES3." >> AndroidAppSettings.cfg
echo "# android-21 = Android 5.1, the first version with SO_REUSEPORT defined." >> AndroidAppSettings.cfg
echo APP_PLATFORM=$APP_PLATFORM >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
echo "# Specify architectures to compile, 'all' or 'y' to compile for all architectures." >> AndroidAppSettings.cfg
echo "# Available architectures: armeabi-v7a arm64-v8a x86 x86_64" >> AndroidAppSettings.cfg
echo "# Available architectures: armeabi armeabi-v7a x86 mips arm64-v8a" >> AndroidAppSettings.cfg
echo MultiABI=\'$MultiABI\' >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
echo "# Optional shared libraries to compile - removing some of them will save space" >> AndroidAppSettings.cfg
echo "# MP3 patents are expired, but libmad license is GPL, not LGPL" >> AndroidAppSettings.cfg
echo "# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed" >> AndroidAppSettings.cfg
grep 'Available' project/jni/SettingsTemplate.mk >> AndroidAppSettings.cfg
echo CompiledLibraries=\"$CompiledLibraries\" >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
@@ -449,9 +432,6 @@ echo >> AndroidAppSettings.cfg
echo "# Google Play Game Services application ID, required for cloud saves to work" >> AndroidAppSettings.cfg
echo GooglePlayGameServicesId=$GooglePlayGameServicesId >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
echo "# The app will open files with following extension, file path will be added to commandline params" >> AndroidAppSettings.cfg
echo AppOpenFileExtension=\'$AppOpenFileExtension\' >> AndroidAppSettings.cfg
echo >> AndroidAppSettings.cfg
fi
AppShortName=`echo $AppName | sed 's/ //g'`
@@ -496,6 +476,12 @@ else
InhibitSuspend=false
fi
if [ "$CreateService" = "y" ] ; then
CreateService=true
else
CreateService=false
fi
if [ "$NeedDepthBuffer" = "y" ] ; then
NeedDepthBuffer=true
else
@@ -713,46 +699,24 @@ done
KEY2=0
for KEY in $RedefinedKeysGamepad; do
RedefinedKeycodesGamepad="$RedefinedKeycodesGamepad -DSDL_ANDROID_GAMEPAD_0_KEYCODE_$KEY2=$KEY"
KEY2=`expr $KEY2 '+' 1`
done
KEY2=0
for KEY in $RedefinedKeysSecondGamepad; do
RedefinedKeycodesGamepad="$RedefinedKeycodesGamepad -DSDL_ANDROID_GAMEPAD_1_KEYCODE_$KEY2=$KEY"
KEY2=`expr $KEY2 '+' 1`
done
KEY2=0
for KEY in $RedefinedKeysThirdGamepad; do
RedefinedKeycodesGamepad="$RedefinedKeycodesGamepad -DSDL_ANDROID_GAMEPAD_2_KEYCODE_$KEY2=$KEY"
KEY2=`expr $KEY2 '+' 1`
done
KEY2=0
for KEY in $RedefinedKeysFourthGamepad; do
RedefinedKeycodesGamepad="$RedefinedKeycodesGamepad -DSDL_ANDROID_GAMEPAD_3_KEYCODE_$KEY2=$KEY"
RedefinedKeycodesGamepad="$RedefinedKeycodesGamepad -DSDL_ANDROID_GAMEPAD_KEYCODE_$KEY2=$KEY"
KEY2=`expr $KEY2 '+' 1`
done
if [ "$APP_PLATFORM" = "" ]; then
APP_PLATFORM=android-16
APP_PLATFORM=android-18
fi
if [ "$MultiABI" = "y" ] ; then
MultiABI="all"
elif [ "$MultiABI" = "n" ] ; then
MultiABI="armeabi-v7a"
MultiABI="armeabi"
else
MultiABI="$MultiABI"
fi
LibrariesToLoad="\\\"sdl_native_helpers\\\", \\\"sdl-$LibSdlVersion\\\""
StaticLibraries="`echo '
include project/jni/SettingsTemplate.mk
all:
@echo $(APP_AVAILABLE_STATIC_LIBS)
.PHONY: all' | make -s -f -`"
StaticLibraries=`grep 'APP_AVAILABLE_STATIC_LIBS' project/jni/SettingsTemplate.mk | sed 's/.*=\(.*\)/\1/'`
for lib in $CompiledLibraries; do
process=true
for lib1 in $StaticLibraries; do
@@ -839,10 +803,6 @@ else
cat $F | sed "s/^package .*;/package $AppFullName;/" >> project/src/Advertisement.java
fi
cat project/app/build-template.gradle | \
sed 's/applicationId .*/applicationId "'"$AppFullName"'"/' > \
project/app/build.gradle
echo "-keep class $AppFullName.** { *; }" > project/proguard-local.cfg
if [ "$AppRecordsAudio" = "n" -o -z "$AppRecordsAudio" ] ; then
@@ -866,47 +826,20 @@ esac
if [ "$AccessSdCard" = "y" ]; then
$SEDI "/==NOT_EXTERNAL_STORAGE==/ d" project/AndroidManifest.xml
$SEDI "/==READ_OBB==/ d" project/AndroidManifest.xml
else
if [ "$ReadObbFile" = "y" ]; then
$SEDI "/==EXTERNAL_STORAGE==/ d" project/AndroidManifest.xml # Disabled by default
$SEDI "/==NOT_EXTERNAL_STORAGE==/ d" project/AndroidManifest.xml
else
$SEDI "/==EXTERNAL_STORAGE==/ d" project/AndroidManifest.xml # Disabled by default
$SEDI "/==READ_OBB==/ d" project/AndroidManifest.xml
fi
$SEDI "/==EXTERNAL_STORAGE==/ d" project/AndroidManifest.xml # Disabled by default
fi
if [ "$AccessInternet" = "n" ]; then
$SEDI "/==INTERNET==/ d" project/AndroidManifest.xml
fi
if [ -z "$AppOpenFileExtension" ]; then
$SEDI "/==OPENFILE==/ d" project/AndroidManifest.xml
else
EXTS="`for EXT in $AppOpenFileExtension; do echo -n '\\\\1'$EXT'\\\\2' ; done`"
$SEDI "s/\(.*\)==OPENFILE-EXT==\(.*\)/$EXTS/g" project/AndroidManifest.xml
fi
if [ "$ImmersiveMode" = "n" ]; then
ImmersiveMode=false
else
ImmersiveMode=true
fi
if [ "$HideSystemMousePointer" = "n" ]; then
HideSystemMousePointer=false
else
HideSystemMousePointer=true
fi
if [ "$CreateService" = "y" ] ; then
CreateService=true
else
CreateService=false
$SEDI "/==FOREGROUND_SERVICE==/ d" project/AndroidManifest.xml
fi
GLESLib=-lGLESv1_CM
GLESVersion=-DSDL_VIDEO_OPENGL_ES_VERSION=1
@@ -928,7 +861,6 @@ else
$SEDI "/==GLES3==/ d" project/AndroidManifest.xml
fi
echo Patching project/src/Globals.java
$SEDI "s/public static String ApplicationName = .*;/public static String ApplicationName = \"$AppShortName\";/" project/src/Globals.java
$SEDI "s/public static final boolean Using_SDL_1_3 = .*;/public static final boolean Using_SDL_1_3 = $UsingSdl13;/" project/src/Globals.java
@@ -977,7 +909,6 @@ $SEDI "s/public static boolean AppUsesMultitouch = .*;/public static boolean App
$SEDI "s/public static boolean NonBlockingSwapBuffers = .*;/public static boolean NonBlockingSwapBuffers = $NonBlockingSwapBuffers;/" project/src/Globals.java
$SEDI "s/public static boolean ResetSdlConfigForThisVersion = .*;/public static boolean ResetSdlConfigForThisVersion = $ResetSdlConfigForThisVersion;/" project/src/Globals.java
$SEDI "s/public static boolean ImmersiveMode = .*;/public static boolean ImmersiveMode = $ImmersiveMode;/" project/src/Globals.java
$SEDI "s/public static boolean HideSystemMousePointer = .*;/public static boolean HideSystemMousePointer = $HideSystemMousePointer;/" project/src/Globals.java
$SEDI "s|public static String DeleteFilesOnUpgrade = .*;|public static String DeleteFilesOnUpgrade = \"$DeleteFilesOnUpgrade\";|" project/src/Globals.java
$SEDI "s/public static int AppTouchscreenKeyboardKeysAmount = .*;/public static int AppTouchscreenKeyboardKeysAmount = $AppTouchscreenKeyboardKeysAmount;/" project/src/Globals.java
$SEDI "s@public static String\\[\\] AppTouchscreenKeyboardKeysNames = .*;@public static String[] AppTouchscreenKeyboardKeysNames = \"$RedefinedKeysScreenKbNames\".split(\" \");@" project/src/Globals.java
@@ -1042,15 +973,15 @@ done
cd ../../..
SDK_DIR=`grep '^sdk.dir' project/local.properties | sed 's/.*=//'`
[ -z "$SDK_DIR" ] && SDK_DIR=`which android | sed 's@/tools/android$@@'`
mkdir -p project/libs
echo "sdk.dir=$SDK_DIR" > project/local.properties
echo 'proguard.config=proguard.cfg;proguard-local.cfg' >> project/local.properties
if [ "$GooglePlayGameServicesId" = "n" -o -z "$GooglePlayGameServicesId" ] ; then
$SEDI "/==GOOGLEPLAYGAMESERVICES==/ d" project/AndroidManifest.xml
$SEDI "/==GOOGLEPLAYGAMESERVICES==/ d" project/app/build.gradle
GooglePlayGameServicesId=""
grep '=play-services' project/local.properties > /dev/null && {
$SEDI 's/.*=play-services.*//g' project/local.properties
rm -f project/libs/android-support-v4.jar
}
else
for F in $JAVA_SRC_PATH/googleplaygameservices/*.java; do
OUT=`echo $F | sed 's@.*/@@'` # basename tool is not available everywhere
@@ -1059,43 +990,76 @@ else
cat $F | sed "s/^package .*;/package $AppFullName;/" >> project/src/$OUT
done
$SEDI "s/==GOOGLEPLAYGAMESERVICES_APP_ID==/$GooglePlayGameServicesId/g" project/res/values/strings.xml
PLAY_SERVICES_VER=9.4.0
rm -rf project/play-services
PROGUARD=`which android`
[ -z "$PROGUARD" ] && PROGUARD=$ANDROID_SDK_ROOT/tools/android
PROGUARD=`dirname $PROGUARD`/proguard/lib/proguard.jar
java -jar $PROGUARD | grep 'ProGuard, version 5.3' || {
echo "Error: ProGuard is too old"
echo "You need to update ProGuard. Download it here:"
echo "https://sourceforge.net/projects/proguard/files/proguard/5.3/proguard5.3.3.zip"
echo "Unpack it, then place file proguard.jar to $PROGUARD"
exit 1
CURDIR=`pwd`
cd $SDK_DIR/extras/google/m2repository/com/google/android/gms/play-services-games/$PLAY_SERVICES_VER || exit 1
$CURDIR/aar2jar.py -o $CURDIR/project/play-services/games -i play-services-games-$PLAY_SERVICES_VER || exit 1
cd $SDK_DIR/extras/google/m2repository/com/google/android/gms/play-services-drive/$PLAY_SERVICES_VER || exit 1
$CURDIR/aar2jar.py -o $CURDIR/project/play-services/drive -i play-services-drive-$PLAY_SERVICES_VER || exit 1
cd $SDK_DIR/extras/google/m2repository/com/google/android/gms/play-services-base/$PLAY_SERVICES_VER || exit 1
$CURDIR/aar2jar.py -o $CURDIR/project/play-services/base -i play-services-base-$PLAY_SERVICES_VER || exit 1
cd $SDK_DIR/extras/google/m2repository/com/google/android/gms/play-services-tasks/$PLAY_SERVICES_VER || exit 1
$CURDIR/aar2jar.py -o $CURDIR/project/play-services/tasks -i play-services-tasks-$PLAY_SERVICES_VER || exit 1
cd $SDK_DIR/extras/google/m2repository/com/google/android/gms/play-services-basement/$PLAY_SERVICES_VER || exit 1
$CURDIR/aar2jar.py -o $CURDIR/project/play-services/basement -i play-services-basement-$PLAY_SERVICES_VER || exit 1
cd $CURDIR
$SEDI "s/==GOOGLEPLAYGAMESERVICES_APP_ID==/$GooglePlayGameServicesId/g" project/res/values/strings.xml
grep 'play-services' project/local.properties > /dev/null || {
PROGUARD=`which android`
PROGUARD=`dirname $PROGUARD`/proguard/lib/proguard.jar
java -jar $PROGUARD | grep 'ProGuard, version 5.3.2' || {
echo "Error: ProGuard is too old"
echo "You need to update ProGuard. Download it here:"
echo "https://sourceforge.net/projects/proguard/files/proguard/5.3/proguard5.3.2.tar.gz"
echo "Unpack it, then place file proguard.jar to $PROGUARD"
exit 1
}
# Ant is way too smart, and adds current project path in front of the ${sdk.dir}
echo "android.library.reference.1=play-services/games/play-services-games-$PLAY_SERVICES_VER" >> project/local.properties
echo "android.library.reference.2=play-services/drive/play-services-drive-$PLAY_SERVICES_VER" >> project/local.properties
echo "android.library.reference.3=play-services/base/play-services-base-$PLAY_SERVICES_VER" >> project/local.properties
echo "android.library.reference.4=play-services/tasks/play-services-tasks-$PLAY_SERVICES_VER" >> project/local.properties
echo "android.library.reference.5=play-services/basement/play-services-basement-$PLAY_SERVICES_VER" >> project/local.properties
#echo 'android.library.reference.6=../../../../../../../../../../../../../../${sdk.dir}/extras/android/compatibility/v7/mediarouter' >> project/local.properties
#echo 'android.library.reference.7=../../../../../../../../../../../../../../${sdk.dir}/extras/android/compatibility/v7/appcompat' >> project/local.properties
#echo 'android.library.reference.8=../../../../../../../../../../../../../../${sdk.dir}/extras/android/compatibility/v7/palette' >> project/local.properties
echo 'proguard.config=proguard.cfg;proguard-local.cfg' >> project/local.properties
ln -s -f $SDK_DIR/extras/android/compatibility/v4/android-support-v4.jar project/libs
}
fi
if [ -e project/jni/application/src/project.patch ]; then patch -p1 --dry-run -f -R < project/jni/application/src/project.patch > /dev/null 2>&1 || patch -p1 --no-backup-if-mismatch < project/jni/application/src/project.patch || exit 1 ; fi
rm -f project/lib
ln -s -f libs project/lib
echo Cleaning up dependencies
rm -rf project/libs/*/* project/gen
rm -rf project/obj/local/*/objs*/sdl_main/* project/$OUT/local/*/libsdl_main.so
rm -rf project/obj/local/*/libsdl-*.so
rm -rf project/obj/local/*/libsdl_*.so
rm -rf project/obj/local/*/objs*/sdl-*/src/*/android
rm -rf project/obj/local/*/objs*/sdl-*/src/video/SDL_video.o
rm -rf project/obj/local/*/objs*/sdl-*/SDL_renderer_gles.o
rm -rf project/obj/local/*/objs*/sdl_*
for OUT in obj; do
rm -rf project/$OUT/local/*/objs*/sdl_main/* project/$OUT/local/*/libsdl_main.so
rm -rf project/$OUT/local/*/libsdl-*.so
rm -rf project/$OUT/local/*/libsdl_*.so
rm -rf project/$OUT/local/*/objs*/sdl-*/src/*/android
rm -rf project/$OUT/local/*/objs*/sdl-*/src/video/SDL_video.o
rm -rf project/$OUT/local/*/objs*/sdl-*/SDL_renderer_gles.o
rm -rf project/$OUT/local/*/objs*/sdl_*
rm -rf project/obj/local/*/objs*/lzma/src/XZInputStream.o
rm -rf project/obj/local/*/objs*/liblzma.so
rm -rf project/jni/application/src/AndroidData/lib
# Do not rebuild several huge libraries that do not depend on SDL version
for LIB in freetype intl jpeg png lua mad tremor xerces xml2 curl lua mikmod \
boost boost_signals boost_thread boost_filesystem boost_date_time boost_system boost_regex boost_iostreams boost_program_options \
ffmpeg swscale avcodec avdevice avresample avutil avfilter swresample avformat; do
for ARCH in armeabi armeabi-v7a; do
if [ -e "project/$OUT/local/$ARCH/objs*/$LIB" ] ; then
find project/$OUT/local/$ARCH/objs*/$LIB -name "*.o" | xargs touch -c
fi
done
done
done
rm -rf project/bin/classes
rm -rf project/bin/res
rm -rf project/app/build
# Generate OUYA icon, for that one user who still got an OUYA in his living room and won't throw it away just because someone else decides that it's dead
rm -rf project/res/drawable-xhdpi/ouya_icon.png
@@ -1109,6 +1073,8 @@ fi
./copyAssets.sh || exit 1
rm -rf project/jni/android-support
echo "$NDK_TOOLCHAIN_VERSION" | grep 'clang' > /dev/null || \
ln -s "`which ndk-build | sed 's@/ndk-build@@'`/sources/android/support" project/jni/android-support
rm -rf project/res/drawable/banner.png
if [ -e project/jni/application/src/banner.png ]; then
@@ -1123,16 +1089,6 @@ fi
echo Compiling prebuilt libraries
if echo "$CompiledLibraries" | grep -E 'crypto|ssl' > /dev/null; then
make -C project/jni -f Makefile.prebuilt openssl
fi
if echo "$CompiledLibraries" | grep -E 'iconv|charset|icu|harfbuzz' > /dev/null; then
make -C project/jni -f Makefile.prebuilt icu
fi
if echo "$CompiledLibraries" | grep 'boost_' > /dev/null; then
make -C project/jni -f Makefile.prebuilt boost
fi
make -C project/jni -f Makefile.prebuilt
echo Done

View File

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

View File

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

3
project/.gitignore vendored
View File

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

View File

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

View File

@@ -1,26 +0,0 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "30.0.0"
defaultConfig {
applicationId "net.olofson.ballfield"
minSdkVersion 16 // Must match version numbers in project/AndroidManifestTemplate.xml
targetSdkVersion 29
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), '../proguard-local.cfg', '../proguard.cfg'
}
}
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==
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0'
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,25 +0,0 @@
// 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
}

92
project/build.xml Normal file
View File

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

View File

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

Binary file not shown.

View File

@@ -1,6 +0,0 @@
#Tue Jul 07 20:59:38 EEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

172
project/gradlew vendored
View File

@@ -1,172 +0,0 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, 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" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# 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")"
fi
exec "$JAVACMD" "$@"

84
project/gradlew.bat vendored
View File

@@ -1,84 +0,0 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem 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=
@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
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
: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%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -29,7 +29,6 @@ import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.os.Environment;
import android.view.View;
import android.widget.TextView;
import java.net.URLConnection;
@@ -187,8 +186,7 @@ class DataDownloader extends Thread
@Override
public void run()
{
Parent.getVideoLayout().setOnKeyListener(new BackKeyListener(Parent));
Parent.keyListener = new BackKeyListener(Parent);
String [] downloadFiles = Globals.DataDownloadUrl;
int total = 0;
int count = 0;
@@ -219,7 +217,7 @@ class DataDownloader extends Thread
}
}
DownloadComplete = true;
Parent.getVideoLayout().setOnKeyListener(null);
Parent.keyListener = null;
initParent();
}
@@ -289,7 +287,7 @@ class DataDownloader extends Thread
Log.i("SDL", "Downloading data to: '" + outFilesDir + "'");
try {
File outDir = new File( outFilesDir );
if( !outDir.exists() )
if( !(outDir.exists() && outDir.isDirectory()) )
outDir.mkdirs();
OutputStream out = new FileOutputStream( getOutFilePath(".nomedia") );
out.flush();
@@ -805,7 +803,7 @@ class DataDownloader extends Thread
Parent.getPackageName() + "/" + url.substring("obb:".length()) + "." + Parent.getPackageName() + ".obb";
}
public class BackKeyListener implements View.OnKeyListener
public class BackKeyListener implements MainActivity.KeyEventsListener
{
MainActivity p;
public BackKeyListener(MainActivity _p)
@@ -813,8 +811,7 @@ class DataDownloader extends Thread
p = _p;
}
@Override
public boolean onKey(View v, int keyCode, KeyEvent event)
public void onKeyEvent(final int keyCode)
{
if( DownloadFailed )
System.exit(1);
@@ -847,7 +844,6 @@ class DataDownloader extends Thread
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
return true;
}
}

View File

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

View File

@@ -1015,7 +1015,7 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
mRenderMode = RENDERMODE_CONTINUOUSLY;
mRenderer = renderer;
mRenderer.setSwapBuffersCallback(this);
setName("SDLVideoThread");
setName("GLThread");
}
@Override

View File

@@ -32,13 +32,7 @@ class Globals
public static String ApplicationName = "CommanderGenius";
public static String AppLibraries[] = { "sdl-1.2", };
public static String AppMainLibraries[] = { "application", "sdl_main" };
public static String LibraryNamesMap[][] = {
{ "crypto", "crypto.so.sdl.1" },
{ "ssl", "ssl.so.sdl.1" },
{ "curl", "curl-sdl" },
{ "expat", "expat-sdl" },
{ "sqlite3", "sqlite3-sdl" },
}; // Because some libraries are named differently to not clash with system libs
public static String LibraryNamesMap[][] = { { "crypto", "crypto.so.sdl.1" }, { "ssl", "ssl.so.sdl.1" }, { "curl", "curl-sdl" } }; // Because some libraries are named differently to not clash with system libs
public static final boolean Using_SDL_1_3 = false;
public static final boolean Using_SDL_2_0 = false;
public static String[] 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" };
@@ -48,7 +42,7 @@ class Globals
public static boolean NeedGles2 = false;
public static boolean NeedGles3 = false;
public static boolean CompatibilityHacksVideo = false;
public static boolean CompatibilityHacksForceScreenUpdateMouseClick = false;
public static boolean CompatibilityHacksForceScreenUpdateMouseClick = true;
public static boolean CompatibilityHacksStaticInit = false;
public static boolean CompatibilityHacksTextInputEmulatesHwKeyboard = false;
public static int TextInputKeyboard = 0;
@@ -91,14 +85,13 @@ class Globals
public static boolean HorizontalOrientation = true;
public static boolean AutoDetectOrientation = false;
public static boolean ImmersiveMode = true;
public static boolean HideSystemMousePointer = false;
public static boolean DownloadToSdcard = true;
public static boolean PhoneHasArrowKeys = false;
public static boolean UseAccelerometerAsArrowKeys = false;
public static boolean UseTouchscreenKeyboard = true;
public static int TouchscreenKeyboardSize = 1;
public static final int TOUCHSCREEN_KEYBOARD_CUSTOM = 4;
public static int TouchscreenKeyboardDrawSize = 2;
public static int TouchscreenKeyboardDrawSize = 1;
public static int TouchscreenKeyboardTheme = 2;
public static int TouchscreenKeyboardTransparency = 2;
public static boolean FloatingScreenJoystick = false;

View File

@@ -97,8 +97,6 @@ import android.app.UiModeManager;
import android.Manifest;
import android.content.pm.PermissionInfo;
import java.util.Arrays;
import java.util.zip.ZipFile;
import java.util.ArrayList;
public class MainActivity extends Activity
@@ -179,9 +177,6 @@ public class MainActivity extends Activity
}
setContentView(_videoLayout);
_videoLayout.setFocusable(true);
_videoLayout.setFocusableInTouchMode(true);
_videoLayout.requestFocus();
class Callback implements Runnable
{
@@ -210,12 +205,7 @@ public class MainActivity extends Activity
loaded.release();
loadedLibraries.release();
if( _btn != null )
{
_btn.setEnabled(true);
_btn.setFocusable(true);
_btn.setFocusableInTouchMode(true);
_btn.requestFocus();
}
}
}
Callback2 cb = new Callback2();
@@ -402,7 +392,7 @@ public class MainActivity extends Activity
layout.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
layout.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
ImageView borderLeft = new ImageView(this);
borderLeft.setId(R.id.left); // Any random ID
borderLeft.setId(R.drawable.b1); // Any random ID
borderLeft.setImageResource(R.drawable.tv_border_left);
borderLeft.setScaleType(ImageView.ScaleType.FIT_XY);
view.addView(borderLeft, layout);
@@ -411,7 +401,7 @@ public class MainActivity extends Activity
layout.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
layout.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
ImageView borderRight = new ImageView(this);
borderRight.setId(R.id.right);
borderRight.setId(R.drawable.b2);
borderRight.setImageResource(R.drawable.tv_border_left);
borderRight.setScaleType(ImageView.ScaleType.FIT_XY);
borderRight.setScaleX(-1f);
@@ -422,7 +412,7 @@ public class MainActivity extends Activity
layout.addRule(RelativeLayout.RIGHT_OF, borderLeft.getId());
layout.addRule(RelativeLayout.LEFT_OF, borderRight.getId());
ImageView borderTop = new ImageView(this);
borderTop.setId(R.id.top);
borderTop.setId(R.drawable.b3);
borderTop.setImageResource(R.drawable.tv_border_top);
borderTop.setScaleType(ImageView.ScaleType.FIT_XY);
view.addView(borderTop, layout);
@@ -432,7 +422,7 @@ public class MainActivity extends Activity
layout.addRule(RelativeLayout.RIGHT_OF, borderLeft.getId());
layout.addRule(RelativeLayout.LEFT_OF, borderRight.getId());
ImageView borderBottom = new ImageView(this);
borderBottom.setId(R.id.bottom);
borderBottom.setId(R.drawable.b4);
borderBottom.setImageResource(R.drawable.tv_border_top);
borderBottom.setScaleType(ImageView.ScaleType.FIT_XY);
borderBottom.setScaleY(-1f);
@@ -453,11 +443,9 @@ public class MainActivity extends Activity
{
_videoLayout.addView(mGLView, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
}
mGLView.captureMouse(true);
if( Globals.HideSystemMousePointer && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N )
{
mGLView.setPointerIcon(android.view.PointerIcon.getSystemIcon(this, android.view.PointerIcon.TYPE_NULL));
}
mGLView.setFocusableInTouchMode(true);
mGLView.setFocusable(true);
mGLView.requestFocus();
if( _ad.getView() != null )
@@ -552,13 +540,9 @@ public class MainActivity extends Activity
super.onWindowFocusChanged(hasFocus);
Log.i("SDL", "libSDL: onWindowFocusChanged: " + hasFocus + " - sending onPause/onResume");
if (hasFocus == false)
{
onPause();
}
else
{
onResume();
}
}
public boolean isPaused()
@@ -601,7 +585,6 @@ public class MainActivity extends Activity
public void onActivityResult(int request, int response, Intent data) {
super.onActivityResult(request, response, data);
cloudSave.onActivityResult(request, response, data);
SettingsMenuMisc.StorageAccessConfig.onActivityResult(this, request, response, data);
}
private int TextInputKeyboardList[][] =
@@ -621,7 +604,6 @@ public class MainActivity extends Activity
{
public void run()
{
mGLView.captureMouse(false);
if (keyboard == 0)
{
_inputManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
@@ -696,9 +678,9 @@ public class MainActivity extends Activity
if (key > 100000)
{
key -= 100000;
mGLView.onKeyDown(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT));
MainActivity.this.onKeyDown(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT));
}
mGLView.onKeyDown(key, new KeyEvent(KeyEvent.ACTION_DOWN, key));
MainActivity.this.onKeyDown(key, new KeyEvent(KeyEvent.ACTION_DOWN, key));
}
public void onRelease(int key)
{
@@ -712,9 +694,9 @@ public class MainActivity extends Activity
{
builtinKeyboard.shift = ! builtinKeyboard.shift;
if (builtinKeyboard.shift && !builtinKeyboard.alt)
mGLView.onKeyDown(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT));
MainActivity.this.onKeyDown(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT));
else
mGLView.onKeyUp(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SHIFT_LEFT));
MainActivity.this.onKeyUp(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SHIFT_LEFT));
builtinKeyboard.ChangeKeyboard();
return;
}
@@ -722,7 +704,7 @@ public class MainActivity extends Activity
{
builtinKeyboard.alt = ! builtinKeyboard.alt;
if (builtinKeyboard.alt)
mGLView.onKeyUp(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SHIFT_LEFT));
MainActivity.this.onKeyUp(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SHIFT_LEFT));
else
builtinKeyboard.shift = false;
builtinKeyboard.ChangeKeyboard();
@@ -737,12 +719,12 @@ public class MainActivity extends Activity
if (k.on)
{
builtinKeyboard.stickyKeys.add(key);
mGLView.onKeyDown(key, new KeyEvent(KeyEvent.ACTION_DOWN, key));
MainActivity.this.onKeyDown(key, new KeyEvent(KeyEvent.ACTION_DOWN, key));
}
else
{
builtinKeyboard.stickyKeys.remove(key);
mGLView.onKeyUp(key, new KeyEvent(KeyEvent.ACTION_UP, key));
MainActivity.this.onKeyUp(key, new KeyEvent(KeyEvent.ACTION_UP, key));
}
return;
}
@@ -755,11 +737,11 @@ public class MainActivity extends Activity
shifted = true;
}
mGLView.onKeyUp(key, new KeyEvent(KeyEvent.ACTION_UP, key));
MainActivity.this.onKeyUp(key, new KeyEvent(KeyEvent.ACTION_UP, key));
if (shifted)
{
mGLView.onKeyUp(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SHIFT_LEFT));
MainActivity.this.onKeyUp(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SHIFT_LEFT));
builtinKeyboard.stickyKeys.remove(KeyEvent.KEYCODE_SHIFT_LEFT);
for (Keyboard.Key k: builtinKeyboard.getKeyboard().getKeys())
{
@@ -781,7 +763,6 @@ public class MainActivity extends Activity
_screenKeyboard = builtinKeyboard;
FrameLayout.LayoutParams layout = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.BOTTOM);
_videoLayout.addView(_screenKeyboard, layout);
_videoLayout.bringChildToFront(_screenKeyboard);
}
}
});
@@ -802,7 +783,6 @@ public class MainActivity extends Activity
_inputManager.hideSoftInputFromWindow(mGLView.getWindowToken(), 0);
DimSystemStatusBar.get().dim(_videoLayout);
//DimSystemStatusBar.get().dim(mGLView);
mGLView.captureMouse(true);
}
});
}
@@ -814,7 +794,6 @@ public class MainActivity extends Activity
if(Globals.CompatibilityHacksTextInputEmulatesHwKeyboard)
{
showScreenKeyboardWithoutTextInputField(Globals.TextInputKeyboard);
mGLView.captureMouse(false);
return;
}
if(_screenKeyboard != null)
@@ -841,7 +820,6 @@ public class MainActivity extends Activity
_parent.hideScreenKeyboard();
return true;
}
/*
if (keyCode == KeyEvent.KEYCODE_DEL || keyCode == KeyEvent.KEYCODE_CLEAR)
{
// EditText deletes two characters at a time, here's a hacky fix
@@ -864,33 +842,41 @@ public class MainActivity extends Activity
return true;
}
}
*/
//Log.i("SDL", "Key " + keyCode + " flags " + event.getFlags() + " action " + event.getAction());
return false;
}
};
EditText screenKeyboard = new EditText(this, null,
android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP ? android.R.style.TextAppearance_Material_Widget_EditText : android.R.style.TextAppearance_Widget_EditText);
EditText screenKeyboard = new EditText(this);
// This code does not work
/*
screenKeyboard.setMaxLines(100);
ViewGroup.LayoutParams layout = _screenKeyboard.getLayoutParams();
if( layout != null )
{
layout.width = ViewGroup.LayoutParams.FILL_PARENT;
layout.height = ViewGroup.LayoutParams.FILL_PARENT;
screenKeyboard.setLayoutParams(layout);
}
screenKeyboard.setGravity(android.view.Gravity.BOTTOM | android.view.Gravity.LEFT);
*/
String hint = _screenKeyboardHintMessage;
screenKeyboard.setHint(hint != null ? hint : getString(R.string.text_edit_click_here));
screenKeyboard.setText(oldText);
screenKeyboard.setSelection(screenKeyboard.getText().length());
screenKeyboard.setOnKeyListener(new simpleKeyListener(this));
screenKeyboard.setBackgroundColor(this.getResources().getColor(android.R.color.primary_text_light));
screenKeyboard.setTextColor(this.getResources().getColor(android.R.color.background_light));
screenKeyboard.setBackgroundColor(Color.BLACK); // Full opaque - do not show semi-transparent edit box, it's confusing
screenKeyboard.setTextColor(Color.WHITE); // Just to be sure about gamma
if( isRunningOnOUYA() && Globals.TvBorders )
screenKeyboard.setPadding(100, 100, 100, 100); // Bad bad HDMI TVs all have cropped borders
else
screenKeyboard.setPadding(20, 20, 20, 20); // Account for rounded screen corners
_screenKeyboard = screenKeyboard;
_videoLayout.addView(_screenKeyboard);
//_screenKeyboard.setKeyListener(new TextKeyListener(TextKeyListener.Capitalize.NONE, false));
screenKeyboard.setInputType(InputType.TYPE_CLASS_TEXT);
screenKeyboard.setFocusableInTouchMode(true);
screenKeyboard.setFocusable(true);
mGLView.captureMouse(false);
//_inputManager.showSoftInput(screenKeyboard, InputMethodManager.SHOW_IMPLICIT);
//getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
screenKeyboard.requestFocus();
_inputManager.showSoftInput(screenKeyboard, InputMethodManager.SHOW_IMPLICIT);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
// Hack to try to force on-screen keyboard
final EditText keyboard = screenKeyboard;
keyboard.postDelayed( new Runnable()
@@ -898,7 +884,8 @@ public class MainActivity extends Activity
public void run()
{
keyboard.requestFocus();
//_inputManager.showSoftInput(keyboard, InputMethodManager.SHOW_FORCED);
//_inputManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
_inputManager.showSoftInput(keyboard, InputMethodManager.SHOW_FORCED);
// Hack from Stackoverflow, to force text input on Ouya
keyboard.dispatchTouchEvent(MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_DOWN , 0, 0, 0));
keyboard.dispatchTouchEvent(MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_UP , 0, 0, 0));
@@ -906,21 +893,17 @@ public class MainActivity extends Activity
{
public void run()
{
keyboard.requestFocus();
keyboard.setSelection(keyboard.getText().length());
}
}, 100 );
}
}, 300 );
}, 500 );
};
public void hideScreenKeyboard()
{
if( keyboardWithoutTextInputShown )
{
showScreenKeyboardWithoutTextInputField(Globals.TextInputKeyboard);
mGLView.captureMouse(true);
}
if(_screenKeyboard == null || ! (_screenKeyboard instanceof EditText))
return;
@@ -937,7 +920,9 @@ public class MainActivity extends Activity
_inputManager.hideSoftInputFromWindow(_screenKeyboard.getWindowToken(), 0);
_videoLayout.removeView(_screenKeyboard);
_screenKeyboard = null;
mGLView.captureMouse(true);
mGLView.setFocusableInTouchMode(true);
mGLView.setFocusable(true);
mGLView.requestFocus();
DimSystemStatusBar.get().dim(_videoLayout);
_videoLayout.postDelayed( new Runnable()
@@ -953,7 +938,7 @@ public class MainActivity extends Activity
{
return _screenKeyboard != null;
};
public void setScreenKeyboardHintMessage(String s)
{
_screenKeyboardHintMessage = s;
@@ -1059,12 +1044,169 @@ public class MainActivity extends Activity
}
}
@Override
public boolean onKeyDown(int keyCode, final KeyEvent event)
{
if( keyCode == KeyEvent.KEYCODE_BACK )
{
if( (event.getSource() & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE )
{
// Stupid Samsung and stupid Acer remaps right mouse button to BACK key
DemoGLSurfaceView.nativeMouseButtonsPressed(2, 1);
return true;
}
else if( keyboardWithoutTextInputShown )
{
return true;
}
}
if( _screenKeyboard != null && _screenKeyboard.onKeyDown(keyCode, event) )
return true;
if( mGLView != null )
{
if( mGLView.nativeKey( keyCode, 1, event.getUnicodeChar() ) == 0 )
return super.onKeyDown(keyCode, event);
}
else
if( keyListener != null )
{
keyListener.onKeyEvent(keyCode);
}
else
if( _btn != null )
return _btn.onKeyDown(keyCode, event);
return true;
}
@Override
public boolean onKeyUp(int keyCode, final KeyEvent event)
{
if( keyCode == KeyEvent.KEYCODE_BACK )
{
if( (event.getSource() & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE )
{
// Stupid Samsung and stupid Acer remaps right mouse button to BACK key
DemoGLSurfaceView.nativeMouseButtonsPressed(2, 0);
return true;
}
else if( keyboardWithoutTextInputShown )
{
showScreenKeyboardWithoutTextInputField(0); // Hide keyboard
return true;
}
}
if( _screenKeyboard != null && _screenKeyboard.onKeyUp(keyCode, event) )
return true;
if( mGLView != null )
{
if( mGLView.nativeKey( keyCode, 0, event.getUnicodeChar() ) == 0 )
return super.onKeyUp(keyCode, event);
if( keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_MENU )
{
DimSystemStatusBar.get().dim(_videoLayout);
//DimSystemStatusBar.get().dim(mGLView);
}
}
else
if( _btn != null )
return _btn.onKeyUp(keyCode, event);
return true;
}
@Override
public boolean onKeyMultiple(int keyCode, int repeatCount, final KeyEvent event)
{
if( _screenKeyboard != null )
{
_screenKeyboard.onKeyMultiple(keyCode, repeatCount, event);
return true;
}
else if( mGLView != null && event.getCharacters() != null )
{
// International text input
for(int i = 0; i < event.getCharacters().length(); i++ )
{
mGLView.nativeKey( event.getKeyCode(), 1, event.getCharacters().codePointAt(i) );
mGLView.nativeKey( event.getKeyCode(), 0, event.getCharacters().codePointAt(i) );
}
return true;
}
return false;
}
@Override
public boolean onKeyLongPress (int keyCode, KeyEvent event)
{
if( _screenKeyboard != null )
{
_screenKeyboard.onKeyLongPress(keyCode, event);
return true;
}
return false;
}
@Override
public boolean dispatchTouchEvent(final MotionEvent ev)
{
//Log.i("SDL", "dispatchTouchEvent: " + ev.getAction() + " coords " + ev.getX() + ":" + ev.getY() );
if(_screenKeyboard != null && _screenKeyboard.dispatchTouchEvent(ev))
return true;
if( _ad.getView() != null && // User clicked the advertisement, ignore when user moved finger from game screen to advertisement or touches screen with several fingers
((ev.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_DOWN ||
(ev.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_UP) &&
_ad.getView().getLeft() <= (int)ev.getX() &&
_ad.getView().getRight() > (int)ev.getX() &&
_ad.getView().getTop() <= (int)ev.getY() &&
_ad.getView().getBottom() > (int)ev.getY() )
return super.dispatchTouchEvent(ev);
else
if(mGLView != null)
mGLView.onTouchEvent(ev);
else
if( _btn != null )
return _btn.dispatchTouchEvent(ev);
else
if( touchListener != null )
touchListener.onTouchEvent(ev);
return true;
}
@Override
public boolean dispatchGenericMotionEvent (MotionEvent ev)
{
//Log.i("SDL", "dispatchGenericMotionEvent: " + ev.getAction() + " coords " + ev.getX() + ":" + ev.getY() );
// This code fails to run for Android 1.6, so there will be no generic motion event for Andorid screen keyboard
/*
if(_screenKeyboard != null)
_screenKeyboard.dispatchGenericMotionEvent(ev);
else
*/
if(mGLView != null)
mGLView.onGenericMotionEvent(ev);
return true;
}
//private Configuration oldConfig = null;
@Override
public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
updateScreenOrientation();
/*
if (oldConfig != null)
{
int diff = newConfig.diff(oldConfig);
Log.i("SDL", "onConfigurationChanged(): " + " diff " + diff +
((diff & ActivityInfo.CONFIG_ORIENTATION) == ActivityInfo.CONFIG_ORIENTATION ? " orientation" : "") +
((diff & ActivityInfo.CONFIG_SCREEN_SIZE) == ActivityInfo.CONFIG_SCREEN_SIZE ? " screen size" : "") +
((diff & ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE) == ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE ? " smallest screen size" : "") +
" " + newConfig.toString());
}
oldConfig = new Configuration(newConfig);
*/
}
public void updateScreenOrientation()
@@ -1123,15 +1265,6 @@ public class MainActivity extends Activity
Log.i("SDL", "libSDL: Cannot load GLESv3 or GLESv2 lib");
}
String [] SupportedAbis = { android.os.Build.CPU_ABI };
if (android.os.Build.CPU_ABI2 != null && !android.os.Build.CPU_ABI2.equals(""))
{
SupportedAbis = new String [] { android.os.Build.CPU_ABI, android.os.Build.CPU_ABI2 };
}
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP)
{
SupportedAbis = android.os.Build.SUPPORTED_ABIS;
}
// Load all libraries
try
{
@@ -1142,99 +1275,166 @@ public class MainActivity extends Activity
{
String libname = System.mapLibraryName(l);
File libpath = new File(getFilesDir().getAbsolutePath() + "/../lib/" + libname);
//Log.i("SDL", "libSDL: loading lib " + libpath.getAbsolutePath());
Log.i("SDL", "libSDL: loading lib " + libpath.getAbsolutePath());
System.load(libpath.getPath());
Log.i("SDL", "libSDL: loaded lib " + libpath.getAbsolutePath());
}
catch( UnsatisfiedLinkError e )
{
//Log.i("SDL", "libSDL: error loading lib " + l + ": " + e.toString());
Log.i("SDL", "libSDL: error loading lib " + l + ": " + e.toString());
try
{
String libname = System.mapLibraryName(l);
File libpath = new File(getFilesDir().getAbsolutePath() + "/" + libname);
//Log.i("SDL", "libSDL: loading lib " + libpath.getAbsolutePath());
Log.i("SDL", "libSDL: loading lib " + libpath.getAbsolutePath());
System.load(libpath.getPath());
Log.i("SDL", "libSDL: loaded lib " + libpath.getAbsolutePath());
}
catch( UnsatisfiedLinkError ee )
{
//Log.i("SDL", "libSDL: error loading lib " + l + ": " + ee.toString());
Log.i("SDL", "libSDL: error loading lib " + l + ": " + ee.toString());
System.loadLibrary(l);
Log.i("SDL", "libSDL: loaded lib " + l + " from System.loadLibrary(l)");
}
}
}
}
catch ( UnsatisfiedLinkError e )
{
Log.i("SDL", "libSDL: Error: " + e.toString());
}
ZipFile myApk = null;
try
{
myApk = new ZipFile(getPackageResourcePath());
}
catch( IOException eeeeeeeee ) {}
ArrayList<String> a = new ArrayList<String>();
for( String arch: SupportedAbis )
{
a.add("binaries-" + arch + ".zip");
}
a.add("binaries.zip");
String [] binaryZipNames = a.toArray(new String[0]);
for( String binaryZip: binaryZipNames )
{
try {
Log.i("SDL", "libSDL: Extracting APP2SD-ed libs");
InputStream in = null;
try
{
//Log.i("SDL", "libSDL: Trying to extract binaries from assets/" + binaryZip);
if( in == null )
in = getAssets().open(binaryZip);
Log.i("SDL", "libSDL: Found binaries at assets/" + binaryZip);
}
catch( Exception eee ) {}
if( binaryZip.equals("binaries.zip") )
{
for( String arch: SupportedAbis )
for( int i = 0; ; i++ )
{
try
{
if( in == null && myApk != null )
{
//Log.i("SDL", "libSDL: Trying to extract binaries from lib/" + arch + "/" + binaryZip);
in = myApk.getInputStream(myApk.getEntry("lib/" + arch + "/" + binaryZip));
Log.i("SDL", "libSDL: Found binaries at lib/" + arch + "/" + binaryZip);
}
}
catch( Exception eeee ) {}
InputStream in2 = getAssets().open("bindata" + String.valueOf(i));
if( in == null )
in = in2;
else
in = new SequenceInputStream( in, in2 );
}
}
catch( IOException ee ) { }
if( in == null )
throw new RuntimeException("libSDL: Extracting binaries failed");
throw new RuntimeException("libSDL: Extracting APP2SD-ed libs failed, the .apk file packaged incorrectly");
ZipInputStream zip = new ZipInputStream(in);
File libDir = getFilesDir();
try
{
try {
libDir.mkdirs();
}
catch( SecurityException ee ) { };
} catch( SecurityException ee ) { };
byte[] buf = new byte[16384];
while(true)
{
ZipEntry entry = null;
entry = zip.getNextEntry();
//if( entry != null )
// Log.i("SDL", "Extracting binary " + entry.getName());
/*
if( entry != null )
Log.i("SDL", "Extracting lib " + entry.getName());
*/
if( entry == null )
{
Log.i("SDL", "Extracting libs finished");
break;
}
if( entry.isDirectory() )
{
File outDir = new File( libDir.getAbsolutePath() + "/" + entry.getName() );
if( !(outDir.exists() && outDir.isDirectory()) )
outDir.mkdirs();
continue;
}
OutputStream out = null;
String path = libDir.getAbsolutePath() + "/" + entry.getName();
try {
File outDir = new File( path.substring(0, path.lastIndexOf("/") ));
if( !(outDir.exists() && outDir.isDirectory()) )
outDir.mkdirs();
} catch( SecurityException eeeee ) { };
Log.i("SDL", "Saving to file '" + path + "'");
out = new FileOutputStream( path );
int len = zip.read(buf);
while (len >= 0)
{
if(len > 0)
out.write(buf, 0, len);
len = zip.read(buf);
}
out.flush();
out.close();
}
for(String l_unmapped : Globals.AppLibraries)
{
String l = GetMappedLibraryName(l_unmapped);
String libname = System.mapLibraryName(l);
File libpath = new File(libDir, libname);
Log.i("SDL", "libSDL: loading lib " + libpath.getPath());
System.load(libpath.getPath());
libpath.delete();
}
}
catch ( Exception ee )
{
Log.i("SDL", "libSDL: Error: " + ee.toString());
}
}
String [] binaryZipNames = { "binaries-" + android.os.Build.CPU_ABI + ".zip", "binaries-" + android.os.Build.CPU_ABI2 + ".zip", "binaries.zip" };
if ( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN )
binaryZipNames = new String[] { "binaries-" + android.os.Build.CPU_ABI + "-pie.zip", "binaries-" + android.os.Build.CPU_ABI2 + "-pie.zip", "binaries-" + android.os.Build.CPU_ABI + ".zip", "binaries-" + android.os.Build.CPU_ABI2 + ".zip", "binaries.zip" };
for(String binaryZip: binaryZipNames)
{
try {
Log.i("SDL", "libSDL: Trying to extract binaries from assets " + binaryZip);
InputStream in = null;
try
{
for( int i = 0; ; i++ )
{
InputStream in2 = getAssets().open(binaryZip + String.format("%02d", i));
if( in == null )
in = in2;
else
in = new SequenceInputStream( in, in2 );
}
}
catch( IOException ee )
{
try
{
if( in == null )
in = getAssets().open(binaryZip);
}
catch( IOException eee ) {}
}
if( in == null )
throw new RuntimeException("libSDL: Extracting binaries failed, the .apk file packaged incorrectly");
ZipInputStream zip = new ZipInputStream(in);
File libDir = getFilesDir();
try {
libDir.mkdirs();
} catch( SecurityException ee ) { };
byte[] buf = new byte[16384];
while(true)
{
ZipEntry entry = null;
entry = zip.getNextEntry();
/*
if( entry != null )
Log.i("SDL", "Extracting lib " + entry.getName());
*/
if( entry == null )
{
Log.i("SDL", "Extracting binaries finished");
@@ -1250,16 +1450,13 @@ public class MainActivity extends Activity
OutputStream out = null;
String path = libDir.getAbsolutePath() + "/" + entry.getName();
try
{
try {
File outDir = new File( path.substring(0, path.lastIndexOf("/") ));
if( !(outDir.exists() && outDir.isDirectory()) )
outDir.mkdirs();
}
catch( SecurityException eeeeeee ) { };
} catch( SecurityException eeeeeee ) { };
try
{
try {
CheckedInputStream check = new CheckedInputStream( new FileInputStream(path), new CRC32() );
while( check.read(buf, 0, buf.length) > 0 ) {};
check.close();
@@ -1297,12 +1494,6 @@ public class MainActivity extends Activity
//Log.i("SDL", "libSDL: Error: " + eee.toString());
}
}
try
{
if (myApk != null)
myApk.close();
}
catch( IOException eeeeeeeeee ) {}
};
public static String GetMappedLibraryName(final String s)
@@ -1320,31 +1511,27 @@ public class MainActivity extends Activity
Settings.nativeChdir(Globals.DataDir);
for(String l: Globals.AppMainLibraries)
{
Log.i("SDL", "libSDL: loading library " + l);
try
{
String libname = System.mapLibraryName(l);
File libpath = new File(context.getFilesDir().getAbsolutePath() + "/../lib/" + libname);
//Log.i("SDL", "libSDL: loading lib " + libpath.getAbsolutePath());
Log.i("SDL", "libSDL: loading lib " + libpath.getAbsolutePath());
System.load(libpath.getPath());
Log.i("SDL", "libSDL: loaded library " + libpath.getPath());
}
catch( UnsatisfiedLinkError e )
{
//Log.i("SDL", "libSDL: error loading lib " + l + ": " + e.toString());
Log.i("SDL", "libSDL: error loading lib " + l + ": " + e.toString());
try
{
String libname = System.mapLibraryName(l);
File libpath = new File(context.getFilesDir().getAbsolutePath() + "/" + libname);
//Log.i("SDL", "libSDL: loading lib " + libpath.getAbsolutePath());
Log.i("SDL", "libSDL: loading lib " + libpath.getAbsolutePath());
System.load(libpath.getPath());
Log.i("SDL", "libSDL: loaded library " + libpath.getPath());
}
catch( UnsatisfiedLinkError ee )
{
//Log.i("SDL", "libSDL: error loading lib " + l + ": " + ee.toString());
Log.i("SDL", "libSDL: error loading lib " + l + ": " + ee.toString());
System.loadLibrary(l);
Log.i("SDL", "libSDL: loaded library " + l);
}
}
}
@@ -1427,14 +1614,6 @@ public class MainActivity extends Activity
}
}
public void setSystemMousePointerVisible(int visible)
{
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N)
{
mGLView.setPointerIcon(android.view.PointerIcon.getSystemIcon(this, (visible == 0) ? android.view.PointerIcon.TYPE_NULL : android.view.PointerIcon.TYPE_DEFAULT));
}
}
public FrameLayout getVideoLayout() { return _videoLayout; }
DemoGLSurfaceView mGLView = null;
@@ -1450,12 +1629,24 @@ public class MainActivity extends Activity
public ProgressDialog loadingDialog = null;
FrameLayout _videoLayout = null;
public View _screenKeyboard = null;
private View _screenKeyboard = null;
private String _screenKeyboardHintMessage = null;
static boolean keyboardWithoutTextInputShown = false;
private boolean sdlInited = false;
public static boolean ApplicationLibraryLoaded = false;
public interface TouchEventsListener
{
public void onTouchEvent(final MotionEvent ev);
}
public interface KeyEventsListener
{
public void onKeyEvent(final int keyCode);
}
public TouchEventsListener touchListener = null;
public KeyEventsListener keyListener = null;
boolean _isPaused = false;
private InputMethodManager _inputManager = null;

View File

@@ -75,7 +75,6 @@ import android.widget.Toast;
import android.content.pm.PackageManager;
import android.os.Build;
import android.content.Intent;
import android.content.pm.PackageInfo;
// TODO: too much code here, split into multiple files, possibly auto-generated menus?
@@ -86,7 +85,6 @@ public class Settings
static boolean settingsLoaded = false;
static boolean settingsChanged = false;
static final int SETTINGS_FILE_VERSION = 5;
static boolean convertButtonSizeFromOldSdlVersion = false;
static void Save(final MainActivity p)
{
@@ -189,8 +187,6 @@ public class Settings
out.writeBoolean(Globals.AutoDetectOrientation);
out.writeBoolean(Globals.TvBorders);
out.writeBoolean(Globals.ForceHardwareMouse);
convertButtonSizeFromOldSdlVersion = false;
out.writeBoolean(convertButtonSizeFromOldSdlVersion);
out.close();
settingsLoaded = true;
@@ -274,7 +270,6 @@ public class Settings
// ICS update sends events in a proper way
Globals.RemapHwKeycode[112] = SDL_1_2_Keycodes.SDLK_UNKNOWN;
}
convertButtonSizeFromOldSdlVersion = false;
try {
ObjectInputStream settingsFile = new ObjectInputStream(new FileInputStream( p.getFilesDir().getAbsolutePath() + "/" + SettingsFileName ));
@@ -286,7 +281,6 @@ public class Settings
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();
@@ -387,7 +381,6 @@ public class Settings
Globals.AutoDetectOrientation = settingsFile.readBoolean();
Globals.TvBorders = settingsFile.readBoolean();
Globals.ForceHardwareMouse = settingsFile.readBoolean();
convertButtonSizeFromOldSdlVersion = settingsFile.readBoolean();
settingsLoaded = true;
@@ -410,18 +403,12 @@ public class Settings
return;
} catch( FileNotFoundException e ) {
Log.i("SDL", "libSDL: settings file not found: " + 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);
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");
@@ -606,8 +593,7 @@ public class Settings
Globals.TouchscreenKeyboardDrawSize,
Globals.TouchscreenKeyboardTheme,
Globals.TouchscreenKeyboardTransparency,
Globals.FloatingScreenJoystick ? 1 : 0,
Globals.AppTouchscreenKeyboardKeysAmount );
Globals.FloatingScreenJoystick ? 1 : 0 );
SetupTouchscreenKeyboardGraphics(p);
for( int i = 0; i < Globals.RemapScreenKbKeycode.length; i++ )
nativeSetKeymapKeyScreenKb(i, SDL_Keys.values[Globals.RemapScreenKbKeycode[i]]);
@@ -643,10 +629,9 @@ public class Settings
Log.i("SDL", "libSDL: setting envvar LANGUAGE to '" + lang + "'");
nativeSetEnv( "LANG", lang );
nativeSetEnv( "LANGUAGE", lang );
nativeSetEnv( "ARCH", android.os.Build.CPU_ABI );
// 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( "LIBDIR", p.getApplicationInfo().nativeLibraryDir );
nativeSetEnv( "DATADIR", Globals.DataDir );
nativeSetEnv( "UNSECURE_STORAGE_DIR", Globals.DataDir );
SdcardAppPath.get().setEnv(p);
@@ -661,19 +646,9 @@ public class Settings
nativeSetEnv( "ANDROID_PACKAGE_NAME", p.getPackageName() );
nativeSetEnv( "ANDROID_PACKAGE_PATH", p.getPackageCodePath() );
nativeSetEnv( "ANDROID_MY_OWN_APP_FILE", p.getPackageResourcePath() ); // This may be different from p.getPackageCodePath() on multi-user systems, but should still be the same .apk file
nativeSetEnv( "ANDROID_OBB_DIR", Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/obb/" + p.getPackageName() );
try {
nativeSetEnv( "ANDROID_OBB_DIR", p.getObbDir().getAbsolutePath() );
} catch (Exception eeeeeee) {}
try {
nativeSetEnv( "ANDROID_APP_NAME", p.getString(p.getApplicationInfo().labelRes) );
} catch (Exception eeeeee) {}
try {
PackageInfo pInfo = p.getPackageManager().getPackageInfo(p.getPackageName(), 0);
nativeSetEnv( "ANDROID_PACKAGE_VERSION_NAME", pInfo.versionName );
nativeSetEnv( "ANDROID_PACKAGE_VERSION_CODE", String.valueOf(pInfo.versionCode) );
} catch (PackageManager.NameNotFoundException eeeeeeee) {
}
Log.d("SDL", "libSDL: Is running on OUYA: " + p.isRunningOnOUYA());
if( p.isRunningOnOUYA() )
{
@@ -992,7 +967,7 @@ public class Settings
private static native void nativeSetCompatibilityHacks();
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 nativeSetupScreenKeyboard(int size, int drawsize, int theme, int transparency, int floatingScreenJoystick);
private static native void nativeSetupScreenKeyboardButtons(byte[] img);
private static native void nativeInitKeymap();
private static native int nativeGetKeymapKey(int key);
@@ -1001,11 +976,10 @@ public class Settings
private static native void nativeSetKeymapKeyScreenKb(int keynum, int key);
private static native void nativeSetScreenKbKeyUsed(int keynum, int used);
private static native void nativeSetScreenKbKeyLayout(int keynum, int x1, int y1, int x2, int y2);
public static native int nativeGetScreenKeyboardButtonLayout(int button, int coord);
private static native int nativeGetKeymapKeyMultitouchGesture(int keynum);
private static native void nativeSetKeymapKeyMultitouchGesture(int keynum, int key);
private static native void nativeSetMultitouchGestureSensitivity(int sensitivity);
public static native void nativeSetTouchscreenCalibration(int x1, int y1, int x2, int y2);
private static native void nativeSetTouchscreenCalibration(int x1, int y1, int x2, int y2);
public static native void nativeSetEnv(final String name, final String value);
public static native int nativeChmod(final String name, int mode);
public static native void nativeChdir(final String dir);

View File

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

View File

@@ -57,7 +57,6 @@ import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.Button;
import android.view.View;
import android.view.Gravity;
import android.widget.LinearLayout;
import android.text.Editable;
import android.text.SpannedString;
@@ -277,10 +276,10 @@ class SettingsMenuKeyboard extends SettingsMenu
void run (final MainActivity p)
{
p.setText(p.getResources().getString(R.string.remap_hwkeys_press));
p.getVideoLayout().setOnKeyListener(new KeyRemapTool(p));
p.keyListener = new KeyRemapTool(p);
}
public static class KeyRemapTool implements View.OnKeyListener
public static class KeyRemapTool implements MainActivity.KeyEventsListener
{
MainActivity p;
public KeyRemapTool(MainActivity _p)
@@ -288,10 +287,9 @@ class SettingsMenuKeyboard extends SettingsMenu
p = _p;
}
@Override
public boolean onKey(View v, int keyCode, KeyEvent event)
public void onKeyEvent(final int keyCode)
{
p.getVideoLayout().setOnKeyListener(null);
p.keyListener = null;
int keyIndex = keyCode;
if( keyIndex < 0 )
keyIndex = 0;
@@ -338,7 +336,6 @@ class SettingsMenuKeyboard extends SettingsMenu
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
return true;
}
public void ShowAllKeys(final int KeyIndex)
{
@@ -626,19 +623,13 @@ class SettingsMenuKeyboard extends SettingsMenu
void run (final MainActivity p)
{
p.setText(p.getResources().getString(R.string.screenkb_custom_layout_help));
if (Globals.ImmersiveMode)
DimSystemStatusBar.get().dim(p.getVideoLayout());
p.getVideoLayout().getHandler().postDelayed(new Runnable()
{
public void run()
{
CustomizeScreenKbLayoutTool tool = new CustomizeScreenKbLayoutTool(p);
Globals.TouchscreenKeyboardSize = Globals.TOUCHSCREEN_KEYBOARD_CUSTOM;
}
}, 200);
CustomizeScreenKbLayoutTool tool = new CustomizeScreenKbLayoutTool(p);
p.touchListener = tool;
p.keyListener = tool;
Globals.TouchscreenKeyboardSize = Globals.TOUCHSCREEN_KEYBOARD_CUSTOM;
}
static class CustomizeScreenKbLayoutTool implements View.OnTouchListener, View.OnKeyListener
static class CustomizeScreenKbLayoutTool implements MainActivity.TouchEventsListener, MainActivity.KeyEventsListener
{
MainActivity p;
FrameLayout layout = null;
@@ -667,11 +658,6 @@ class SettingsMenuKeyboard extends SettingsMenu
p = _p;
layout = new FrameLayout(p);
p.getVideoLayout().addView(layout);
layout.setFocusable(true);
layout.setFocusableInTouchMode(true);
layout.requestFocus();
layout.setOnTouchListener(this);
layout.setOnKeyListener(this);
boundary = new ImageView(p);
boundary.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
boundary.setScaleType(ImageView.ScaleType.MATRIX);
@@ -679,35 +665,68 @@ class SettingsMenuKeyboard extends SettingsMenu
boundary.setImageBitmap(boundaryBmp);
layout.addView(boundary);
currentButton = -1;
final int displayX = p.getVideoLayout().getWidth();
final int displayY = p.getVideoLayout().getHeight();
if( Globals.TouchscreenKeyboardSize != Globals.TOUCHSCREEN_KEYBOARD_CUSTOM )
if( Globals.TouchscreenKeyboardTheme == 2 )
{
DemoRenderer.nativeResize(displayX, displayY, 0);
Settings.nativeSetupScreenKeyboard( Globals.TouchscreenKeyboardSize,
Globals.TouchscreenKeyboardDrawSize,
Globals.TouchscreenKeyboardTheme,
Globals.TouchscreenKeyboardTransparency,
Globals.FloatingScreenJoystick ? 1 : 0,
Globals.AppTouchscreenKeyboardKeysAmount );
for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ )
{
Globals.ScreenKbControlsLayout[i][0] = Settings.nativeGetScreenKeyboardButtonLayout(i, 0);
Globals.ScreenKbControlsLayout[i][1] = Settings.nativeGetScreenKeyboardButtonLayout(i, 1);
Globals.ScreenKbControlsLayout[i][2] = Settings.nativeGetScreenKeyboardButtonLayout(i, 2);
Globals.ScreenKbControlsLayout[i][3] = Settings.nativeGetScreenKeyboardButtonLayout(i, 3);
}
buttons = new int[] {
R.drawable.sun_dpad,
R.drawable.sun_keyboard,
R.drawable.sun_b1,
R.drawable.sun_b2,
R.drawable.sun_b3,
R.drawable.sun_b4,
R.drawable.sun_b5,
R.drawable.sun_b6,
R.drawable.sun_dpad,
R.drawable.sun_dpad
};
}
int displayX = 800;
int displayY = 480;
try {
DisplayMetrics dm = new DisplayMetrics();
p.getWindowManager().getDefaultDisplay().getMetrics(dm);
displayX = dm.widthPixels;
displayY = dm.heightPixels;
} catch (Exception eeeee) {}
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] );
//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));
@@ -725,34 +744,9 @@ class SettingsMenuKeyboard extends SettingsMenu
}
boundary.bringToFront();
if( currentButton == -1 )
onKey( null, KeyEvent.KEYCODE_BACK, null ); // All buttons disabled - do not show anything
onKeyEvent( KeyEvent.KEYCODE_BACK ); // All buttons disabled - do not show anything
else
setupButton(currentButton);
final Button backButton = new Button(p);
backButton.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
backButton.setText(android.R.string.ok);
//backButton.setTop(displayY / 30);
//backButton.setLeft(displayX / 2);
backButton.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
p.getVideoLayout().removeView(layout);
layout = null;
goBack(p);
}
});
layout.addView(backButton, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT,
Gravity.TOP | Gravity.CENTER_HORIZONTAL));
layout.getHandler().postDelayed(new Runnable()
{
public void run()
{
//backButton.setLeft(displayX / 2 - backButton.getWidth() / 2);
//backButton.setLeft(displayX / 2);
}
}, 200);
}
void setupButton(int i)
@@ -783,8 +777,7 @@ class SettingsMenuKeyboard extends SettingsMenu
p.setText(p.getResources().getString(R.string.screenkb_custom_layout_help) + "\n" + buttonText);
}
@Override
public boolean onTouch(View v, MotionEvent ev)
public void onTouchEvent(final MotionEvent ev)
{
if( ev.getAction() == MotionEvent.ACTION_DOWN )
{
@@ -849,19 +842,18 @@ class SettingsMenuKeyboard extends SettingsMenu
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
boundary.setImageMatrix(m);
}
return true;
}
@Override
public boolean onKey(View v, int keyCode, KeyEvent event)
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);
}
return true;
}
}
}

View File

@@ -437,7 +437,7 @@ class SettingsMenuMisc extends SettingsMenu
String readmes[] = Globals.ReadmeText.split("\\^");
String lang = new String(Locale.getDefault().getLanguage()) + ":";
if( p.isRunningOnOUYA() )
lang = "tv:";
lang = "ouya:";
String readme = readmes[0];
String buttonName = "", buttonUrl = "";
for( String r: readmes )
@@ -469,14 +469,10 @@ class SettingsMenuMisc extends SettingsMenu
text.setPadding(0, 5, 0, 20);
text.setTextSize(20.0f);
text.setGravity(Gravity.CENTER);
text.setFocusable(false);
text.setFocusableInTouchMode(false);
AlertDialog.Builder builder = new AlertDialog.Builder(p);
ScrollView scroll = new ScrollView(p);
scroll.setFocusable(false);
scroll.setFocusableInTouchMode(false);
scroll.addView(text, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
final Button ok = new Button(p);
Button ok = new Button(p);
final AlertDialog alertDismiss[] = new AlertDialog[1];
ok.setOnClickListener(new View.OnClickListener()
{
@@ -489,6 +485,7 @@ class SettingsMenuMisc extends SettingsMenu
LinearLayout layout = new LinearLayout(p);
layout.setOrientation(LinearLayout.VERTICAL);
layout.addView(scroll);
//layout.addView(text);
layout.addView(ok);
if( buttonName.length() > 0 )
{
@@ -542,42 +539,6 @@ class SettingsMenuMisc extends SettingsMenu
}
}
public static class StorageAccessConfig extends Menu
{
public static int REQUEST_STORAGE_ID = 42;
public static void onActivityResult(final MainActivity p, final int requestCode, final int resultCode, final Intent resultData)
{
if (requestCode == REQUEST_STORAGE_ID)
{
if (resultCode == Activity.RESULT_OK)
{
Uri treeUri = resultData.getData();
p.getContentResolver().takePersistableUriPermission(treeUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
Log.i("SDL", "Storage write permission granted to path " + treeUri.toString());
}
else
{
Log.i("SDL", "Storage write permission rejected");
}
}
}
String title(final MainActivity p)
{
return p.getResources().getString(R.string.storage_access);
}
void run (final MainActivity p)
{
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP)
{
p.startActivityForResult(new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE), REQUEST_STORAGE_ID);
}
goBack(p);
}
}
static class CommandlineConfig extends Menu
{
String title(final MainActivity p)
@@ -593,10 +554,12 @@ class SettingsMenuMisc extends SettingsMenu
edit.setFocusableInTouchMode(true);
edit.setFocusable(true);
if (Globals.CommandLine.length() == 0)
Globals.CommandLine = "App";
edit.setText(Globals.CommandLine.replace(" ", "\n").replace(" ", " "));
Globals.CommandLine = "SDL_app";
if (Globals.CommandLine.indexOf(" ") == -1)
Globals.CommandLine += " ";
edit.setText(Globals.CommandLine.substring(Globals.CommandLine.indexOf(" ")).replace(" ", "\n").replace(" ", " "));
edit.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
edit.setMinLines(1);
edit.setMinLines(2);
//edit.setMaxLines(100);
builder.setView(edit);
@@ -604,22 +567,17 @@ class SettingsMenuMisc extends SettingsMenu
{
public void onClick(DialogInterface dialog, int item)
{
Globals.CommandLine = "";
Globals.CommandLine = "SDL_app";
String args[] = edit.getText().toString().split("\n");
if( args.length == 1 )
boolean firstArg = true;
for( String arg: args )
{
Globals.CommandLine = args[0];
}
else
{
boolean firstArg = true;
for( String arg: args )
{
if( !firstArg )
Globals.CommandLine += " ";
Globals.CommandLine += " ";
if( firstArg )
Globals.CommandLine += arg;
else
Globals.CommandLine += arg.replace(" ", " ");
firstArg = false;
}
firstArg = false;
}
dialog.dismiss();
goBack(p);

View File

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

View File

@@ -65,7 +65,6 @@ import android.view.Display;
import android.net.Uri;
import android.Manifest;
import android.content.pm.PackageManager;
import android.hardware.input.InputManager;
class Mouse
@@ -108,10 +107,6 @@ abstract class DifferentTouchInput
public abstract void processGenericEvent(final MotionEvent event);
public static int ExternalMouseDetected = Mouse.MOUSE_HW_INPUT_FINGER;
public static int buttonState = 0;
public static float capturedMouseX = 0;
public static float capturedMouseY = 0;
public static DifferentTouchInput touchInput = getInstance();
@@ -323,12 +318,6 @@ abstract class DifferentTouchInput
int hwMouseEvent = ((event.getSource() & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE || Globals.ForceHardwareMouse) ? Mouse.MOUSE_HW_INPUT_MOUSE :
((event.getSource() & InputDevice.SOURCE_STYLUS) == InputDevice.SOURCE_STYLUS) ? Mouse.MOUSE_HW_INPUT_STYLUS :
Mouse.MOUSE_HW_INPUT_FINGER;
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O )
{
if( (event.getSource() & InputDevice.SOURCE_MOUSE_RELATIVE) == InputDevice.SOURCE_MOUSE_RELATIVE )
hwMouseEvent = Mouse.MOUSE_HW_INPUT_MOUSE;
}
if( ExternalMouseDetected != hwMouseEvent )
{
ExternalMouseDetected = hwMouseEvent;
@@ -372,10 +361,12 @@ abstract class DifferentTouchInput
}
private static class IcsTouchInput extends GingerbreadTouchInput
{
float hatX = 0.0f, hatY = 0.0f;
private static class Holder
{
private static final IcsTouchInput sInstance = new IcsTouchInput();
}
private int buttonState = 0;
public void process(final MotionEvent event)
{
//Log.i("SDL", "Got motion event, type " + (int)(event.getAction()) + " X " + (int)event.getX() + " Y " + (int)event.getY() + " buttons " + buttonState + " source " + event.getSource());
@@ -397,16 +388,37 @@ abstract class DifferentTouchInput
}
public void processGenericEvent(final MotionEvent event)
{
// Joysticks are supported since Honeycomb, but I don't care about it, because very few devices have it
// 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, on Nvidia Shield and some other joysticks
if( event.getAxisValue(MotionEvent.AXIS_HAT_X) != hatX )
{
hatX = event.getAxisValue(MotionEvent.AXIS_HAT_X);
if( hatX == 0.0f )
{
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_LEFT, 0, 0);
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_RIGHT, 0, 0);
}
else
DemoGLSurfaceView.nativeKey(hatX < 0.0f ? KeyEvent.KEYCODE_DPAD_LEFT : KeyEvent.KEYCODE_DPAD_RIGHT, 1, 0);
}
if( event.getAxisValue(MotionEvent.AXIS_HAT_Y) != hatY )
{
hatY = event.getAxisValue(MotionEvent.AXIS_HAT_Y);
if( hatY == 0.0f )
{
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_UP, 0, 0);
DemoGLSurfaceView.nativeKey(KeyEvent.KEYCODE_DPAD_DOWN, 0, 0);
}
else
DemoGLSurfaceView.nativeKey(hatY < 0.0f ? KeyEvent.KEYCODE_DPAD_UP : KeyEvent.KEYCODE_DPAD_DOWN, 1, 0);
}
DemoGLSurfaceView.nativeGamepadAnalogJoystickInput(
event.getAxisValue(MotionEvent.AXIS_X), event.getAxisValue(MotionEvent.AXIS_Y),
event.getAxisValue(MotionEvent.AXIS_Z), event.getAxisValue(MotionEvent.AXIS_RZ),
event.getAxisValue(MotionEvent.AXIS_LTRIGGER), event.getAxisValue(MotionEvent.AXIS_RTRIGGER),
event.getAxisValue(MotionEvent.AXIS_HAT_X), event.getAxisValue(MotionEvent.AXIS_HAT_Y),
processGamepadDeviceId(event.getDevice()) );
event.getAxisValue(MotionEvent.AXIS_LTRIGGER), event.getAxisValue(MotionEvent.AXIS_RTRIGGER),
(hatX == 0.0f && hatY == 0.0f) ? 0 : 1 );
return;
}
// Process mousewheel
@@ -561,78 +573,6 @@ abstract class DifferentTouchInput
}
}
}
private static int gamepadIds[] = new int[4]; // Maximum 4 gamepads at the moment
public static int processGamepadDeviceId(InputDevice device)
{
if( device == null )
return 0;
int source = device.getSources();
if( (source & InputDevice.SOURCE_CLASS_JOYSTICK) != InputDevice.SOURCE_CLASS_JOYSTICK &&
(source & InputDevice.SOURCE_GAMEPAD) != InputDevice.SOURCE_GAMEPAD )
{
return 0;
}
int deviceId = device.getId();
for( int i = 0; i < gamepadIds.length; i++ )
{
if (gamepadIds[i] == deviceId)
return i + 1;
}
for( int i = 0; i < gamepadIds.length; i++ )
{
if (gamepadIds[i] == 0)
{
Log.i("SDL", "libSDL: gamepad added: deviceId " + deviceId + " gamepadId " + (i + 1));
gamepadIds[i] = deviceId;
return i + 1;
}
}
return 0;
}
public static void registerInputManagerCallbacks(Context context)
{
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN )
{
JellyBeanInputManager.Holder.sInstance.register(context);
}
}
private static class JellyBeanInputManager
{
private static class Holder
{
private static final JellyBeanInputManager sInstance = new JellyBeanInputManager();
}
private static class Listener implements InputManager.InputDeviceListener
{
public void onInputDeviceAdded(int deviceId)
{
}
public void onInputDeviceChanged(int deviceId)
{
onInputDeviceRemoved(deviceId);
}
public void onInputDeviceRemoved(int deviceId)
{
for( int i = 0; i < gamepadIds.length; i++ )
{
if (gamepadIds[i] == deviceId)
{
Log.i("SDL", "libSDL: gamepad removed: deviceId " + deviceId + " gamepadId "+ (i + 1));
gamepadIds[i] = 0;
}
}
}
}
public void register(Context context)
{
InputManager manager = (InputManager) context.getSystemService(Context.INPUT_SERVICE);
manager.registerInputDeviceListener(new Listener(), null);
}
}
}
class DemoRenderer extends GLSurfaceView_SDL.Renderer
@@ -673,9 +613,6 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
mHeight = h - h % 2;
mGl = gl;
nativeResize(mWidth, mHeight, Globals.KeepAspectRatio ? 1 : 0);
if( Globals.TouchscreenCalibration[2] > Globals.TouchscreenCalibration[0] )
Settings.nativeSetTouchscreenCalibration(Globals.TouchscreenCalibration[0], Globals.TouchscreenCalibration[1],
Globals.TouchscreenCalibration[2], Globals.TouchscreenCalibration[3]);
}
int mLastPendingResize = 0;
@@ -707,8 +644,30 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
if (mWidth != 0 && mHeight != 0 && (mWidth != ww || mHeight != hh))
{
Log.i("SDL", "libSDL: DemoRenderer.onWindowResize(): screen size changed from " + mWidth + "x" + mHeight + " to " + ww + "x" + hh);
DemoRenderer.super.ResetVideoSurface();
DemoRenderer.super.onWindowResize(ww, hh);
if (Globals.SwVideoMode &&
(Math.abs(display.getWidth() - ww) > display.getWidth() / 10 ||
Math.abs(display.getHeight() - hh) > display.getHeight() / 10))
{
Log.i("SDL", "Multiwindow detected - enabling screen orientation autodetection");
Globals.AutoDetectOrientation = true;
context.setScreenOrientation();
DemoRenderer.super.ResetVideoSurface();
DemoRenderer.super.onWindowResize(ww, hh);
}
else
{
Log.i("SDL", "System button bar hidden - re-init video to avoid black bar at the top");
DemoRenderer.super.ResetVideoSurface();
DemoRenderer.super.onWindowResize(ww, hh);
}
}
if (mWidth == 0 && mHeight == 0)
{
if ((ww > hh) != (display.getWidth() > display.getHeight()))
{
Log.i("SDL", "Multiwindow detected - app window size " + ww + "x" + hh + " but display dimensions are " + display.getWidth() + "x" + display.getHeight());
Globals.AutoDetectOrientation = true;
}
}
if (Globals.AutoDetectOrientation && (ww > hh) != (mWidth > mHeight))
Globals.HorizontalOrientation = (ww > hh);
@@ -751,16 +710,9 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
// Tweak video thread priority, if user selected big audio buffer
if( Globals.AudioBufferConfig >= 2 )
Thread.currentThread().setPriority( (Thread.NORM_PRIORITY + Thread.MIN_PRIORITY) / 2 ); // Lower than normal
// Calls main() and never returns, hehe - we'll call eglSwapBuffers() from native code
String commandline = Globals.CommandLine;
if( context.getIntent() != null && context.getIntent().getScheme() != null &&
context.getIntent().getScheme().compareTo(android.content.ContentResolver.SCHEME_FILE) == 0 &&
context.getIntent().getData() != null && context.getIntent().getData().getPath() != null )
{
commandline += " " + context.getIntent().getData().getPath();
}
// Calls main() and never returns, hehe - we'll call eglSwapBuffers() from native code
nativeInit( Globals.DataDir,
commandline,
Globals.CommandLine,
( (Globals.SwVideoMode && Globals.MultiThreadedVideo) || Globals.CompatibilityHacksVideo ) ? 1 : 0,
0 );
System.exit(0); // The main() returns here - I don't bother with deinit stuff, just terminate process
@@ -770,6 +722,13 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
{
if( ! super.SwapBuffers() && Globals.NonBlockingSwapBuffers )
{
if(mRatelimitTouchEvents)
{
synchronized(this)
{
this.notify();
}
}
return 0;
}
@@ -780,6 +739,13 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
}
// Unblock event processing thread only after we've finished rendering
if(mRatelimitTouchEvents)
{
synchronized(this)
{
this.notify();
}
}
if( context.isScreenKeyboardShown() && !context.keyboardWithoutTextInputShown )
{
try {
@@ -870,12 +836,6 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
Clipboard.get().set(context, s);
}
public void setCapturedMousePosition(int x, int y) // Called from native code
{
DifferentTouchInput.capturedMouseX = x;
DifferentTouchInput.capturedMouseY = y;
}
public void exitApp()
{
nativeDone();
@@ -976,11 +936,6 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
}
}
public void setSystemMousePointerVisible(int visible)
{
context.setSystemMousePointerVisible(visible);
}
public void restartMyself(String restartParams)
{
Intent intent = new Intent(context, RestartMainActivity.class);
@@ -1004,7 +959,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
private native void nativeInitJavaCallbacks();
private native void nativeInit(String CurrentPath, String CommandLine, int multiThreadedVideo, int unused);
public static native void nativeResize(int w, int h, int keepAspectRatio);
private native void nativeResize(int w, int h, int keepAspectRatio);
private native void nativeDone();
private native void nativeGlContextLost();
public native void nativeGlContextRecreated();
@@ -1028,117 +983,32 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
public int mWidth = 0;
public int mHeight = 0;
int mOrientationFrameHackyCounter = 0;
public static final boolean mRatelimitTouchEvents = true; //(Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO);
}
class DemoGLSurfaceView extends GLSurfaceView_SDL {
public DemoGLSurfaceView(MainActivity context) {
super(context);
mParent = context;
setEGLConfigChooser(Globals.VideoDepthBpp, Globals.NeedDepthBuffer, Globals.NeedStencilBuffer, Globals.NeedGles2, Globals.NeedGles3);
mRenderer = new DemoRenderer(context);
setRenderer(mRenderer);
DifferentTouchInput.registerInputManagerCallbacks(context);
}
@Override
public boolean onKeyDown(int keyCode, final KeyEvent event)
public boolean onTouchEvent(final MotionEvent event)
{
//Log.v("SDL", "DemoGLSurfaceView::onKeyDown(): keyCode " + keyCode + " event.getSource() " + event.getSource());
if( keyCode == KeyEvent.KEYCODE_BACK )
{
boolean mouseInput = false;
if( (event.getSource() & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE )
mouseInput = true;
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O )
{
if( (event.getSource() & InputDevice.SOURCE_MOUSE_RELATIVE) == InputDevice.SOURCE_MOUSE_RELATIVE )
mouseInput = true;
}
if( mouseInput )
{
// Stupid Samsung and stupid Acer remaps right mouse button to BACK key
nativeMouseButtonsPressed(2, 1);
return true;
}
else if( mParent.keyboardWithoutTextInputShown )
{
return true;
}
}
if( nativeKey( keyCode, 1, event.getUnicodeChar(), DifferentTouchInput.processGamepadDeviceId(event.getDevice()) ) == 0 )
return super.onKeyDown(keyCode, event);
return true;
}
@Override
public boolean onKeyUp(int keyCode, final KeyEvent event)
{
if( keyCode == KeyEvent.KEYCODE_BACK )
{
boolean mouseInput = false;
if( (event.getSource() & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE )
mouseInput = true;
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O )
{
if( (event.getSource() & InputDevice.SOURCE_MOUSE_RELATIVE) == InputDevice.SOURCE_MOUSE_RELATIVE )
mouseInput = true;
}
if( mouseInput )
{
// Stupid Samsung and stupid Acer remaps right mouse button to BACK key
nativeMouseButtonsPressed(2, 0);
return true;
}
else if( mParent.keyboardWithoutTextInputShown )
{
mParent.showScreenKeyboardWithoutTextInputField(0); // Hide keyboard
return true;
}
}
if( nativeKey( keyCode, 0, event.getUnicodeChar(), DifferentTouchInput.processGamepadDeviceId(event.getDevice()) ) == 0 )
return super.onKeyUp(keyCode, event);
//if( keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_MENU )
// DimSystemStatusBar.get().dim(mParent._videoLayout);
return true;
}
@Override
public boolean onKeyMultiple(int keyCode, int repeatCount, final KeyEvent event)
{
if( event.getCharacters() != null )
{
// Non-English text input
for( int i = 0; i < event.getCharacters().length(); i++ )
{
nativeKey( event.getKeyCode(), 1, event.getCharacters().codePointAt(i), 0 );
nativeKey( event.getKeyCode(), 0, event.getCharacters().codePointAt(i), 0 );
}
}
return true;
}
@Override
public boolean onTouchEvent(final MotionEvent event)
{
if( mParent.keyboardWithoutTextInputShown && mParent._screenKeyboard != null &&
mParent._screenKeyboard.getY() <= event.getY() )
{
event.offsetLocation(-mParent._screenKeyboard.getX(), -mParent._screenKeyboard.getY());
mParent._screenKeyboard.onTouchEvent(event);
return true;
}
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH )
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH)
{
if (getX() != 0)
event.offsetLocation(-getX(), -getY());
}
DifferentTouchInput.touchInput.process(event);
if( DemoRenderer.mRatelimitTouchEvents )
{
limitEventRate(event);
}
return true;
};
@@ -1146,42 +1016,33 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
public boolean onGenericMotionEvent (final MotionEvent event)
{
DifferentTouchInput.touchInput.processGenericEvent(event);
if( DemoRenderer.mRatelimitTouchEvents )
{
limitEventRate(event);
}
return true;
}
@Override
public boolean onCapturedPointerEvent (final MotionEvent event)
public void limitEventRate(final MotionEvent event)
{
DifferentTouchInput.capturedMouseX += event.getX();
DifferentTouchInput.capturedMouseY += event.getY();
if (DifferentTouchInput.capturedMouseX < 0)
DifferentTouchInput.capturedMouseX = 0;
if (DifferentTouchInput.capturedMouseY < 0)
DifferentTouchInput.capturedMouseY = 0;
if (DifferentTouchInput.capturedMouseX >= this.getWidth())
DifferentTouchInput.capturedMouseX = this.getWidth() - 1;
if (DifferentTouchInput.capturedMouseY >= this.getHeight())
DifferentTouchInput.capturedMouseY = this.getHeight() - 1;
//Log.v("SDL", "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());
return this.onTouchEvent(event);
}
@Override
public void onPointerCaptureChange (boolean hasCapture)
{
Log.v("SDL", "DemoGLSurfaceView::onPointerCaptureChange(): " + hasCapture);
super.onPointerCaptureChange(hasCapture);
DifferentTouchInput.capturedMouseX = this.getWidth() / 2;
DifferentTouchInput.capturedMouseY = this.getHeight() / 2;
// Wait a bit, and try to synchronize to app framerate, or event thread will eat all CPU and we'll lose FPS
// With Froyo the rate of touch events seems to be limited by OS, but they are arriving faster then we're redrawing anyway
if((event.getAction() == MotionEvent.ACTION_MOVE ||
event.getAction() == MotionEvent.ACTION_HOVER_MOVE))
{
synchronized(mRenderer)
{
try
{
mRenderer.wait(300L); // And sometimes the app decides not to render at all, so this timeout should not be big.
}
catch (InterruptedException e)
{
Log.v("SDL", "DemoGLSurfaceView::limitEventRate(): Who dared to interrupt my slumber?");
Thread.interrupted();
}
}
}
}
public void exitApp() {
@@ -1215,53 +1076,17 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
mRenderer.nativeGlContextRecreated();
if( mRenderer.accelerometer != null && mRenderer.accelerometer.openedBySDL ) // For some reason it crashes here often - are we getting this event before initialization?
mRenderer.accelerometer.start();
captureMouse(true);
};
public void captureMouse(boolean capture)
{
if( capture )
{
setFocusableInTouchMode(true);
setFocusable(true);
requestFocus();
if( Globals.HideSystemMousePointer && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O )
{
postDelayed( new Runnable()
{
public void run()
{
Log.v("SDL", "captureMouse::requestPointerCapture() delayed");
requestPointerCapture();
}
}, 50 );
}
}
else
{
if( Globals.HideSystemMousePointer && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O )
{
postDelayed( new Runnable()
{
public void run()
{
Log.v("SDL", "captureMouse::releasePointerCapture()");
releasePointerCapture();
}
}, 50 );
}
}
}
DemoRenderer mRenderer;
MainActivity mParent;
public static native void nativeMotionEvent( int x, int y, int action, int pointerId, int pressure, int radius );
public static native int nativeKey( int keyCode, int down, int unicode, int gamepadId );
public static native int nativeKey( int keyCode, int down, int unicode );
public static native void nativeHardwareMouseDetected( int detected );
public static native void nativeMouseButtonsPressed( int buttonId, int pressedState );
public static native void nativeMouseWheel( int scrollX, int scrollY );
public static native void nativeGamepadAnalogJoystickInput( float stick1x, float stick1y, float stick2x, float stick2y, float ltrigger, float rtrigger, float dpadx, float dpady, int gamepadId );
public static native void nativeGamepadAnalogJoystickInput( float stick1x, float stick1y, float stick2x, float stick2y, float ltrigger, float rtrigger, int usingHat );
public static native void nativeScreenVisibleRect( int x, int y, int w, int h );
public static native void nativeScreenKeyboardShown( int shown );
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingTranslation">
<resources>
<string name="app_name">Commander Genius</string>
@@ -26,7 +24,6 @@
<string name="storage_custom">Specify directory</string>
<string name="storage_commandline">Command line parameters, one argument per line</string>
<string name="storage_question">Data installation location</string>
<string name="storage_access">Permission to write to SD card</string>
<string name="optional_downloads">Downloads</string>
<string name="downloads">Downloads</string>
<string name="ok">OK</string>

View File

@@ -7,7 +7,7 @@ endif
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)
$(error Your NDK $(NDK_VERSION) is too old, please download NDK r4b, r5c or r6 from http://developer.android.com)
endif
NDK_PATH := $(shell dirname $(shell which ndk-build))

View File

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

View File

@@ -1,100 +1,39 @@
# Makefile to build precompiled libraries, which cannot be built using standard NDK makefiles
# TODO: libboost, libffmpeg, libpython (used only in GemRB)
ARCHES32 := armeabi-v7a x86
ARCHES64 := arm64-v8a x86_64
ARCHES32 := armeabi armeabi-v7a x86 mips
ARCHES64 := arm64-v8a
ICONV := $(foreach ARCH, $(ARCHES32) $(ARCHES64), iconv/lib/$(ARCH)/libiconv.so iconv/lib/$(ARCH)/libcharset.so)
ICONV := $(foreach ARCH, $(ARCHES32), 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 := data i18n io le lx test tu uc
ICU := $(foreach ARCH, $(ARCHES32), $(foreach NAME, $(ICU_LIBS), icuuc/lib/$(ARCH)/libicu$(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)
PYTHON3 := $(foreach ARCH, $(ARCHES32) $(ARCHES64), python3/lib-$(ARCH)/libcrypto.so.sdl.1.so python3/lib-$(ARCH)/libssl.so.sdl.1.so)
.PHONY: all boost openssl icu
all: $(LIBS)
LIBS := $(ICONV) $(ICU) $(OPENSSL) $(PYTHON3)
openssl: $(OPENSSL)
prebuilt-libraries: $(LIBS)
icu: $(ICONV) $(ICU)
.NOTPARALLEL: $(LIBS)
#.NOTPARALLEL: $(LIBS) $(BOOST)
$(ICONV) $(ICU): iconv/src/build.sh
$(ICONV) $(ICU):
cd iconv/src && \
./build.sh && \
for ARCH in $(ARCHES32) $(ARCHES64); do \
mkdir -p ../lib/$$ARCH ../include ; \
for ARCH in $(ARCHES32); do \
mkdir -p ../lib/$$ARCH ; \
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/ ; \
mkdir -p ../../icuuc/lib/$$ARCH ../../icuuc/include/layout ../../icuuc/include/unicode ; \
cp -f $$ARCH/libicu*.a ../../icuuc/lib/$$ARCH/ ; \
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
cp -f $$ARCH/include/unicode/*.h ../../icuuc/include/unicode/ ; \
done
$(OPENSSL): openssl/compile.sh
$(OPENSSL):
cd openssl && ./compile.sh
BOOST_LIBS := \
atomic \
chrono \
container \
context \
contract \
coroutine \
date_time \
exception \
fiber \
filesystem \
graph \
iostreams \
locale \
log \
log_setup \
math_c99 \
math_c99f \
math_c99l \
math_tr1 \
math_tr1f \
math_tr1l \
prg_exec_monitor \
program_options \
random \
regex \
serialization \
stacktrace_basic \
stacktrace_noop \
system \
test_exec_monitor \
thread \
timer \
type_erasure \
unit_test_framework \
wave \
wserialization \
BOOST := $(foreach ARCH, $(ARCHES32) $(ARCHES64), $(foreach NAME, $(BOOST_LIBS), boost/lib/$(ARCH)/libboost_$(NAME).a))
$(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 \
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 ;) \
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) ;)
boost: $(BOOST)
iconv/src/build.sh boost/src/build-android.sh:
git submodule update --init --recursive
$(PYTHON3):
cd python3 && ./compile.sh

View File

@@ -1,18 +1,12 @@
# 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 \
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
APP_AVAILABLE_STATIC_LIBS := jpeg png freetype fontconfig xerces ogg vorbis flac boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread boost_locale glu icudata icutest icui18n icuio icule iculx icutu icuuc sdl_savepng android_support gl4es nanogl
# 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
ifeq ($(APP_ABI),)
APP_ABI := armeabi-v7a
APP_ABI := armeabi
endif
# The namespace in Java file, with dots replaced with underscores
@@ -60,6 +54,11 @@ SDL_ADDITIONAL_CFLAGS := -DSDL_ANDROID_KEYCODE_MOUSE=UNKNOWN -DSDL_ANDROID_KEYCO
SDL_VERSION := 1.2
# Link-time optimization enabled for optimization junkies. -O999 etc
#APP_CFLAGS := -flto
#APP_CXXFLAGS := -flto
#APP_LDFLAGS := -flto
# Latest GCC got better LTO support
NDK_TOOLCHAIN_VERSION := clang
APP_PLATFORM := android-16
APP_PLATFORM := android-18

View File

@@ -49,7 +49,9 @@ LOCAL_SHARED_LIBRARIES := sdl-$(SDL_VERSION) $(filter-out $(APP_AVAILABLE_STATIC
LOCAL_STATIC_LIBRARIES := $(filter $(APP_AVAILABLE_STATIC_LIBS), $(COMPILED_LIBRARIES))
LOCAL_LDLIBS := $(APPLICATION_GLES_LIBRARY) -ldl -llog -lz
APP_STL := gnustl_static
LOCAL_LDLIBS := $(APPLICATION_GLES_LIBRARY) -ldl -llog -lz # -lgnustl_static
LOCAL_LDFLAGS := -Lobj/local/$(TARGET_ARCH_ABI)
@@ -65,7 +67,6 @@ SDL_APP_LIB_DEPENDS-$(TARGET_ARCH_ABI) += $(foreach LIB, $(LOCAL_STATIC_LIBRARIE
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)
@@ -86,12 +87,31 @@ LOCAL_PATH_SDL_APPLICATION := $(LOCAL_PATH)
$(shell cd $(LOCAL_PATH_SDL_APPLICATION)/src && $(PARALLEL_UNLOCK))
obj/local/armeabi/libapplication.so: $(LOCAL_PATH)/src/libapplication-armeabi.so
$(LOCAL_PATH)/src/libapplication-armeabi.so: $(SDL_APP_LIB_DEPENDS-armeabi) OVERRIDE_CUSTOM_LIB
cd $(LOCAL_PATH_SDL_APPLICATION)/src && $(PARALLEL_LOCK) && \
./AndroidBuild.sh armeabi arm-linux-androideabi && $(PARALLEL_UNLOCK) && \
{ [ -e libapplication.so ] && ln -s libapplication.so libapplication-armeabi.so || true ; }
obj/local/armeabi-v7a/libapplication.so: $(LOCAL_PATH)/src/libapplication-armeabi-v7a.so
$(LOCAL_PATH)/src/libapplication-armeabi-v7a.so: $(SDL_APP_LIB_DEPENDS-armeabi-v7a) OVERRIDE_CUSTOM_LIB
cd $(LOCAL_PATH_SDL_APPLICATION)/src && $(PARALLEL_LOCK) && \
./AndroidBuild.sh armeabi-v7a arm-linux-androideabi && $(PARALLEL_UNLOCK)
obj/local/armeabi-v7a-hard/libapplication.so: $(LOCAL_PATH)/src/libapplication-armeabi-v7a-hard.so
$(LOCAL_PATH)/src/libapplication-armeabi-v7a-hard.so: $(SDL_APP_LIB_DEPENDS-armeabi-v7a-hard) OVERRIDE_CUSTOM_LIB
cd $(LOCAL_PATH_SDL_APPLICATION)/src && $(PARALLEL_LOCK) && \
./AndroidBuild.sh armeabi-v7a-hard arm-linux-androideabi && $(PARALLEL_UNLOCK)
obj/local/mips/libapplication.so: $(LOCAL_PATH)/src/libapplication-mips.so
$(LOCAL_PATH)/src/libapplication-mips.so: $(SDL_APP_LIB_DEPENDS-mips) OVERRIDE_CUSTOM_LIB
cd $(LOCAL_PATH_SDL_APPLICATION)/src && $(PARALLEL_LOCK) && \
./AndroidBuild.sh mips mipsel-linux-android && $(PARALLEL_UNLOCK)
obj/local/x86/libapplication.so: $(LOCAL_PATH)/src/libapplication-x86.so
$(LOCAL_PATH)/src/libapplication-x86.so: $(SDL_APP_LIB_DEPENDS-x86) OVERRIDE_CUSTOM_LIB

View File

@@ -13,13 +13,11 @@ AppVersionCode=101
AppVersionName="1.01"
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, '!!' will also hide the entry from the menu, so it cannot be disabled
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu
# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped
# If the URL does not contain 'http://' or 'https://', it is treated as file from 'project/jni/application/src/AndroidData' dir -
# these files are put inside .apk package by the build system
# You can specify Google Play expansion files in the form 'obb:main.12345' or 'obb:patch.12345' where 12345 is the app version for obb file
# You can use .zip.xz archives for better compression, but you need to add 'lzma' to CompiledLibraries
# Generate .zip.xz files like this: zip -0 -r data.zip your-data/* ; xz -8 data.zip
# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir -
# these files are put inside .apk package by build system
# You can specify Google Play expansion files in the form 'obb:main.12345' or 'obb:patch.12345' where 12345 is the app version, first associated with the file
AppDataDownloadUrl="!!Game data is 1 Mb|ballfield3.zip"
# Reset SDL config when updating application to the new version (y) / (n)
@@ -48,16 +46,12 @@ NeedDepthBuffer=n
# Enable OpenGL stencil buffer (needed only for 3-d applications, small speed decrease) (y) or (n)
NeedStencilBuffer=n
# Use GLES 2.x context
# Try to use GLES 2.x context - will revert to GLES 1.X if unsupported by device
# you need this option only if you're developing 3-d app (y) or (n)
NeedGles2=n
# Use GLES 3.x context
# you need this option only if you're developing 3-d app (y) or (n)
NeedGles3=n
# Use gl4es library for provide OpenGL 1.x functionality to OpenGL ES accelerated cards (y) or (n)
UseGl4es=
# Use glshim library for provide OpenGL 1.x functionality to OpenGL ES accelerated cards (y) or (n)
UseGlshim=
# Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL,
# this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n)
@@ -70,10 +64,10 @@ SdlVideoResize=y
SdlVideoResizeKeepAspect=n
# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer
InhibitSuspend=y
InhibitSuspend=n
# Create Android service, so the app is less likely to be killed while in background
CreateService=n
CreateService=y
# Application does not call SDL_Flip() or SDL_UpdateRects() appropriately, or draws from non-main thread -
# enabling the compatibility mode will force screen update every 100 milliseconds, which is laggy and inefficient (y) or (n)
@@ -81,7 +75,7 @@ CompatibilityHacksForceScreenUpdate=n
# Application does not call SDL_Flip() or SDL_UpdateRects() after mouse click (ScummVM and all Amiga emulators do that) -
# force screen update by moving mouse cursor a little after each click (y) or (n)
CompatibilityHacksForceScreenUpdateMouseClick=n
CompatibilityHacksForceScreenUpdateMouseClick=y
# Application initializes SDL audio/video inside static constructors (which is bad, you won't be able to run ndk-gdb) (y)/(n)
CompatibilityHacksStaticInit=n
@@ -125,13 +119,13 @@ AppNeedsTwoButtonMouse=y
# Right mouse button can do long-press/drag&drop action, necessary for some games (y) or (n)
# If you disable it, swiping with two fingers will send mouse wheel events
RightMouseButtonLongPress=n
RightMouseButtonLongPress=
# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n)
ShowMouseCursor=n
# Screen follows mouse cursor, when it's covered by soft keyboard, this works only in software video mode (y) or (n)
ScreenFollowsMouse=n
ScreenFollowsMouse=
# Generate more touch events, by default SDL generates one event per one video frame, this is useful for drawing apps (y) or (n)
GenerateSubframeTouchEvents=n
@@ -151,7 +145,7 @@ AppNeedsTextInput=y
# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1
# This will disable AppNeedsArrowKeys option
AppUsesJoystick=y
AppUsesJoystick=n
# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n)
AppUsesSecondJoystick=n
@@ -169,7 +163,7 @@ AppUsesGyroscope=y
AppUsesOrientationSensor=
# Use gyroscope to move mouse cursor (y) or (n), it eats battery, and can be disabled in settings, do not use with AppUsesGyroscope setting
MoveMouseWithGyroscope=n
MoveMouseWithGyroscope=
# Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0
AppUsesMultitouch=y
@@ -179,11 +173,8 @@ AppUsesMultitouch=y
# This option will add additional permission to Android manifest (y)/(n)
AppRecordsAudio=n
# Application needs read/write access SD card. Always disable it, unless you want to access user photos and downloads. (y) / (n)
AccessSdCard=n
# Application needs to read it's own OBB file. Enable this if you are using Play Store expansion files. (y) / (n)
ReadObbFile=
# Application needs to access SD card. Always disable it, unless you want to access user photos and downloads. (y) / (n)
AccessSdCard=y
# Application needs Internet access. If you disable it, you'll have to bundle all your data files inside .apk (y) / (n)
AccessInternet=
@@ -191,9 +182,6 @@ AccessInternet=
# Immersive mode - Android will hide on-screen Home/Back keys. Looks bad if you invoke Android keyboard. (y) / (n)
ImmersiveMode=y
# Hide Android system mouse cursor image when USB mouse is attached (y) or (n) - the app must draw it's own mouse cursor
HideSystemMousePointer=
# Application implements Android-specific routines to put to background, and will not draw anything to screen
# between SDL_ACTIVEEVENT lost / gained notifications - you should check for them
# rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n)
@@ -227,33 +215,24 @@ RedefinedKeysScreenKbNames="0 1 2 3 4 5 6 7 8 9"
# 7 = SuperNintendo from RetroArch
# 8 = DualShock from RetroArch
# 9 = Nintendo64 from RetroArch
TouchscreenKeysTheme=1
TouchscreenKeysTheme=4
# Redefine gamepad keys to SDL keysyms, button order is:
# A B X Y L1 R1 L2 R2 LThumb RThumb Start Select Up Down Left Right LThumbUp LThumbDown LThumbLeft LThumbRight RThumbUp RThumbDown RThumbLeft RThumbRight
RedefinedKeysGamepad="0 1 2 3 4 5 6 7 8 9 j k UP DOWN LEFT RIGHT PAGEUP PAGEDOWN HOME END PLUS MINUS LEFTBRACKET RIGHTBRACKET"
# Redefine keys for the second gamepad, same as the first gamepad if not set:
RedefinedKeysSecondGamepad="q w e r t y u i o p a s d f g h z x c v b n m COMMA"
# Redefine keys for the third gamepad, same as the first gamepad if not set:
RedefinedKeysThirdGamepad="F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 PRINT"
# Redefine keys for the fourth gamepad, same as the first gamepad if not set:
RedefinedKeysFourthGamepad="KP0 KP1 KP2 KP3 KP4 KP5 KP6 KP7 KP8 KP9 KP_PERIOD KP_DIVIDE KP_MULTIPLY KP_MINUS KP_PLUS KP_ENTER"
# A B X Y L1 R1 L2 R2 LThumb RThumb
RedefinedKeysGamepad="0 1 2 3 4 5 6 7 8 9"
# How long to show startup menu button, in msec, 0 to disable startup menu
StartupMenuButtonTimeout=1000
StartupMenuButtonTimeout=3000
# Menu items to hide from startup menu, available menu items:
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.StorageAccessConfig SettingsMenuMisc.CommandlineConfig SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout SettingsMenuKeyboard.ScreenKeyboardAdvanced
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.CommandlineConfig SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout SettingsMenuKeyboard.ScreenKeyboardAdvanced
HiddenMenuOptions=''
# Menu items to show at startup - this is Java code snippet, leave empty for default
# new SettingsMenuMisc.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new SettingsMenuMouse.DisplaySizeConfig(true) : new SettingsMenu.DummyMenu()), new SettingsMenuMisc.OptionalDownloadConfig(true), new SettingsMenuMisc.GyroscopeCalibration()
# Available menu items:
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.StorageAccessConfig SettingsMenuMisc.CommandlineConfig SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout SettingsMenuKeyboard.ScreenKeyboardAdvanced
FirstStartMenuOptions=''
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.CommandlineConfig SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout SettingsMenuKeyboard.ScreenKeyboardAdvanced
FirstStartMenuOptions='SettingsMenu.DummyMenu'
# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower
AppMinimumRAM=0
@@ -261,26 +240,20 @@ AppMinimumRAM=0
# GCC version, or 'clang' for CLANG
NDK_TOOLCHAIN_VERSION=clang
# Android platform version.
# android-16 = Android 4.1, the earliest supported version in NDK r18.
# android-18 = Android 4.3, the first version supporting GLES3.
# android-21 = Android 5.1, the first version with SO_REUSEPORT defined.
APP_PLATFORM=
# Specify architectures to compile, 'all' or 'y' to compile for all architectures.
# Available architectures: armeabi-v7a arm64-v8a x86 x86_64
MultiABI='arm64-v8a'
# Available architectures: armeabi armeabi-v7a x86 mips arm64-v8a
MultiABI='armeabi-v7a x86 arm64-v8a'
# Optional shared libraries to compile - removing some of them will save space
# MP3 patents are expired, but libmad license is GPL, not LGPL
# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed
# 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
CompiledLibraries="sdl_image c++_shared"
CompiledLibraries="sdl_image"
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
CustomBuildScript=n
# Aditional CFLAGS for application
AppCflags=''
AppCflags='-O2 -finline-functions'
# Aditional C++-specific compiler flags for application, added after AppCflags
AppCppflags=''
@@ -298,7 +271,7 @@ AppSubdirsBuild=''
AppBuildExclude=''
# Application command line parameters, including app name as 0-th param
AppCmdline='ballfield'
AppCmdline=''
# Screen size is used by Google Play to prevent an app to be installed on devices with smaller screens
# Minimum screen size that application supports: (s)mall / (m)edium / (l)arge
@@ -316,6 +289,3 @@ AdmobBannerSize=
# Google Play Game Services application ID, required for cloud saves to work
GooglePlayGameServicesId=
# The app will open files with following extension, file path will be added to commandline params
AppOpenFileExtension='png PNG jpg JPG jpeg JPEG gif GIF'

View File

@@ -1,796 +0,0 @@
/*
* "Ballfield"
*
* (C) David Olofson <david@olofson.net>, 2002, 2003
*
* This software is released under the terms of the GPL.
*
* Contact author for permission if you want to use this
* software, or work derived from it, under other terms.
*/
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <android/log.h>
#include <wchar.h>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <SDL/SDL_screenkeyboard.h>
#include <SDL/SDL_android.h>
#define fprintf(X, ...) __android_log_print(ANDROID_LOG_INFO, "Ballfield", __VA_ARGS__)
#define printf(...) __android_log_print(ANDROID_LOG_INFO, "Ballfield", __VA_ARGS__)
extern int create_server_socket(int portno);
/*----------------------------------------------------------
Definitions...
----------------------------------------------------------*/
#define SCREEN_W 640
#define SCREEN_H 540
#define BALLS 300
#define COLORS 2
typedef struct
{
Sint32 x, y, z; /* Position */
Uint32 c; /* Color */
} point_t;
/*
* Ballfield
*/
typedef struct
{
point_t points[BALLS];
SDL_Rect *frames;
SDL_Surface *gfx[COLORS];
int use_alpha;
} ballfield_t;
/*
* Size of the biggest ball image in pixels
*
* Balls are scaled down and *packed*, one pixel
* smaller for each frame down to 1x1. The actual
* image width is (obviously...) the same as the
* width of the first frame.
*/
#define BALL_W 32
#define BALL_H 32
/*----------------------------------------------------------
General tool functions
----------------------------------------------------------*/
/*
* Bump areas of low and high alpha to 0% or 100%
* respectively, just in case the graphics contains
* "alpha noise".
*/
SDL_Surface *clean_alpha(SDL_Surface *s)
{
SDL_Surface *work;
SDL_Rect r;
Uint32 *pixels;
int pp;
int x, y;
work = SDL_CreateRGBSurface(SDL_SWSURFACE, s->w, s->h,
32, 0xff000000, 0x00ff0000, 0x0000ff00,
0x000000ff);
if(!work)
return NULL;
r.x = r.y = 0;
r.w = s->w;
r.h = s->h;
if(SDL_BlitSurface(s, &r, work, NULL) < 0)
{
SDL_FreeSurface(work);
return NULL;
}
SDL_LockSurface(work);
pixels = (Uint32 *)work->pixels;
pp = work->pitch / sizeof(Uint32);
for(y = 0; y < work->h; ++y)
for(x = 0; x < work->w; ++x)
{
Uint32 pix = pixels[y*pp + x];
switch((pix & 0xff) >> 4)
{
case 0:
pix = 0x00000000;
break;
default:
break;
case 15:
pix |= 0xff;
break;
}
pixels[y*pp + x] = pix;
}
SDL_UnlockSurface(work);
return work;
}
/*
* Load and convert an antialiazed, zoomed set of sprites.
*/
SDL_Surface *load_zoomed(const char *name, int alpha)
{
SDL_Surface *sprites;
SDL_Surface *temp = IMG_Load(name);
if(!temp)
return NULL;
/*
sprites = temp;
SDL_SetAlpha(sprites, 0, 255);
temp = clean_alpha(sprites);
SDL_FreeSurface(sprites);
*/
if(!temp)
{
fprintf(stderr, "Could not clean alpha!\n");
return NULL;
}
if(alpha)
{
SDL_SetAlpha(temp, 0, SDL_ALPHA_OPAQUE);
sprites = SDL_DisplayFormatAlpha(temp);
}
else
{
SDL_SetColorKey(temp, SDL_SRCCOLORKEY,
SDL_MapRGB(temp->format, 0, 0, 0));
sprites = SDL_DisplayFormat(temp);
}
SDL_FreeSurface(temp);
return sprites;
}
void print_num(SDL_Surface *dst, SDL_Surface *font, int x, int y, float value)
{
char buf[16];
int val = (int)(value * 10.0);
int pos, p = 0;
SDL_Rect from;
/* Sign */
if(val < 0)
{
buf[p++] = 10;
val = -val;
}
/* Integer part */
pos = 10000000;
while(pos > 1)
{
int num = val / pos;
val -= num * pos;
pos /= 10;
if(p || num)
buf[p++] = num;
}
/* Decimals */
if(val / pos)
{
buf[p++] = 11;
while(pos > 0)
{
int num = val / pos;
val -= num * pos;
pos /= 10;
buf[p++] = num;
}
}
/* Render! */
from.y = 0;
from.w = 7;
from.h = 10;
for(pos = 0; pos < p; ++pos)
{
SDL_Rect to;
to.x = x + pos * 7;
to.y = y;
from.x = buf[pos] * 7;
SDL_BlitSurface(font, &from, dst, &to);
}
}
void print_num_hex(SDL_Surface *dst, SDL_Surface *font, int x, int y, unsigned val)
{
char buf[8];
int pos, p = 0;
SDL_Rect from;
//val = htonl(val); // Big-endian
/* Render! */
from.y = 0;
from.w = 7;
from.h = 10;
for(pos = 0; pos < 8; ++pos)
{
SDL_Rect to;
to.x = 8 * 7 - (x + pos * 7); // Little-endian number wrapped backwards
to.y = y;
from.x = ( ( val >> (pos * 4) ) & 0xf ) * 7;
SDL_BlitSurface(font, &from, dst, &to);
}
}
/*----------------------------------------------------------
ballfield_t functions
----------------------------------------------------------*/
ballfield_t *ballfield_init(void)
{
int i;
ballfield_t *bf = (ballfield_t *)calloc(sizeof(ballfield_t), 1);
if(!bf)
return NULL;
for(i = 0; i < BALLS; ++i)
{
bf->points[i].x = rand() % 0x20000;
bf->points[i].y = rand() % 0x20000;
bf->points[i].z = 0x20000 * i / BALLS;
if(rand() % 100 > 80)
bf->points[i].c = 1;
else
bf->points[i].c = 0;
}
return bf;
}
void ballfield_free(ballfield_t *bf)
{
int i;
for(i = 0; i < COLORS; ++i)
SDL_FreeSurface(bf->gfx[i]);
}
static int ballfield_init_frames(ballfield_t *bf)
{
int i, j;
/*
* Set up source rects for all frames
*/
bf->frames = (SDL_Rect *)calloc(sizeof(SDL_Rect), bf->gfx[0]->w);
if(!bf->frames)
{
fprintf(stderr, "No memory for frame rects!\n");
return -1;
}
for(j = 0, i = 0; i < bf->gfx[0]->w; ++i)
{
bf->frames[i].x = 0;
bf->frames[i].y = j;
bf->frames[i].w = bf->gfx[0]->w - i;
bf->frames[i].h = bf->gfx[0]->w - i;
j += bf->gfx[0]->w - i;
}
return 0;
}
int ballfield_load_gfx(ballfield_t *bf, const char *name, unsigned int color)
{
if(color >= COLORS)
return -1;
bf->gfx[color] = load_zoomed(name, bf->use_alpha);
if(!bf->gfx[color])
return -2;
if(!bf->frames)
return ballfield_init_frames(bf);
return 0;
}
void ballfield_move(ballfield_t *bf, Sint32 dx, Sint32 dy, Sint32 dz)
{
int i;
for(i = 0; i < BALLS; ++i)
{
bf->points[i].x += dx;
bf->points[i].x &= 0x1ffff;
bf->points[i].y += dy;
bf->points[i].y &= 0x1ffff;
bf->points[i].z += dz;
bf->points[i].z &= 0x1ffff;
}
}
void ballfield_render(ballfield_t *bf, SDL_Surface *screen)
{
int i, j, z;
/*
* Find the ball with the highest Z.
*/
z = 0;
j = 0;
for(i = 0; i < BALLS; ++i)
{
if(bf->points[i].z > z)
{
j = i;
z = bf->points[i].z;
}
}
/*
* Render all balls in back->front order.
*/
for(i = 0; i < BALLS; ++i)
{
SDL_Rect r;
int f;
z = bf->points[j].z;
z += 50;
f = ((bf->frames[0].w << 12) + 100000) / z;
f = bf->frames[0].w - f;
if(f < 0)
f = 0;
else if(f > bf->frames[0].w - 1)
f = bf->frames[0].w - 1;
z >>= 7;
z += 1;
r.x = (bf->points[j].x - 0x10000) / z;
r.y = (bf->points[j].y - 0x10000) / z;
r.x += (screen->w - bf->frames[f].w) >> 1;
r.y += (screen->h - bf->frames[f].h) >> 1;
SDL_BlitSurface(bf->gfx[bf->points[j].c],
&bf->frames[f], screen, &r);
if(--j < 0)
j = BALLS - 1;
}
}
/*----------------------------------------------------------
Other rendering functions
----------------------------------------------------------*/
/*
* Draw tiled background image with offset.
*/
void tiled_back(SDL_Surface *back, SDL_Surface *screen, int xo, int yo)
{
/*
int x, y;
SDL_Rect r;
if(xo < 0)
xo += back->w*(-xo/back->w + 1);
if(yo < 0)
yo += back->h*(-yo/back->h + 1);
xo %= back->w;
yo %= back->h;
for(y = -yo; y < screen->h; y += back->h)
for(x = -xo; x < screen->w; x += back->w)
{
r.x = x;
r.y = y;
SDL_BlitSurface(back, NULL, screen, &r);
}
*/
SDL_Rect r;
xo %= back->w/8;
yo %= back->h/8;
r.x = xo - back->w/2 + screen->w/2;
r.y = yo - back->h/2 + screen->h/2;
r.w = back->w;
r.h = back->h;
SDL_BlitSurface(back, NULL, screen, &r);
}
/*----------------------------------------------------------
main()
----------------------------------------------------------*/
int main(int argc, char* argv[])
{
ballfield_t *balls;
SDL_Surface *screen;
SDL_Surface *temp_image;
SDL_Surface *back, *logo, *font, *font_hex;
SDL_Event event;
int bpp = 16,
flags = SDL_HWSURFACE,
alpha = 1;
int x_offs = 0, y_offs = 0;
long tick,
last_tick,
last_avg_tick;
double t = 0;
float dt;
int i;
float fps = 0.0;
int fps_count = 0;
int fps_start = 0;
float x_speed, y_speed, z_speed;
enum { MAX_POINTERS = 16 };
// some random colors
int colors[MAX_POINTERS] = { 0xaaaaaa, 0xffffff, 0x888888, 0xcccccc, 0x666666, 0x999999, 0xdddddd, 0xeeeeee, 0xaaaaaa, 0xffffff, 0x888888, 0xcccccc, 0x666666, 0x999999, 0xdddddd, 0xeeeeee };
struct TouchPointer_t { int x; int y; int pressure; int pressed; } touchPointers[MAX_POINTERS];
int accel[5], screenjoy[4], gamepads[4][8];
SDL_Surface *mouse[4];
int screenKeyboardShown = 0;
char asyncTextInputBuf[256];
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
SDL_EnableUNICODE(1);
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
SDL_Joystick * joysticks[6];
for( i = 0; i < 6; i++ )
joysticks[i] = SDL_JoystickOpen(i);
atexit(SDL_Quit);
screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, bpp, flags);
if(!screen)
{
fprintf(stderr, "Failed to open screen!\n");
exit(-1);
}
SDL_WM_SetCaption("Ballfield", "Ballfield");
if(flags & SDL_FULLSCREEN)
SDL_ShowCursor(0);
balls = ballfield_init();
if(!balls)
{
fprintf(stderr, "Failed to create ballfield!\n");
exit(-1);
}
/*
* Load and prepare balls...
*/
balls->use_alpha = alpha;
if( ballfield_load_gfx(balls, "blueball.png", 0)
||
ballfield_load_gfx(balls, "redball.png", 1) )
{
fprintf(stderr, "Could not load balls!\n");
exit(-1);
}
/*
* Load background image
*/
temp_image = IMG_Load(argc > 1 ? argv[1] : "sun.gif");
if(!temp_image)
{
fprintf(stderr, "Could not load background!\n");
exit(-1);
}
back = SDL_DisplayFormat(temp_image);
SDL_FreeSurface(temp_image);
/*
* Load logo
*/
temp_image = SDL_LoadBMP("logo.bmp");
if(!temp_image)
{
fprintf(stderr, "Could not load logo!\n");
exit(-1);
}
SDL_SetColorKey(temp_image, SDL_SRCCOLORKEY,
SDL_MapRGB(temp_image->format, 255, 0, 255));
logo = SDL_DisplayFormat(temp_image);
SDL_FreeSurface(temp_image);
/*
* Load font
*/
temp_image = SDL_LoadBMP("font7x10.bmp");
if(!temp_image)
{
fprintf(stderr, "Could not load font!\n");
exit(-1);
}
SDL_SetColorKey(temp_image, SDL_SRCCOLORKEY,
SDL_MapRGB(temp_image->format, 255, 0, 255));
font = SDL_DisplayFormat(temp_image);
SDL_FreeSurface(temp_image);
temp_image = SDL_LoadBMP("font7x10-hex.bmp");
if(!temp_image)
{
fprintf(stderr, "Could not load hex font!\n");
exit(-1);
}
SDL_SetColorKey(temp_image, SDL_SRCCOLORKEY,
SDL_MapRGB(temp_image->format, 255, 0, 255));
font_hex = SDL_DisplayFormat(temp_image);
SDL_FreeSurface(temp_image);
for(i = 0; i < 4; i++)
{
char name[32];
sprintf(name, "mouse%d.png", i);
temp_image = IMG_Load(name);
if(!temp_image)
{
fprintf(stderr, "Could not load %s!\n", name);
exit(-1);
}
//mouse[i] = SDL_DisplayFormat(temp_image);
//SDL_FreeSurface(temp_image);
mouse[i] = temp_image; // Keep alpha
}
last_avg_tick = last_tick = SDL_GetTicks();
memset(touchPointers, 0, sizeof(touchPointers));
memset(accel, 0, sizeof(accel));
memset(screenjoy, 0, sizeof(screenjoy));
memset(gamepads, 0, sizeof(gamepads));
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "sizeof(int) %d long %d long long %d size_t %d", sizeof(int), sizeof(long), sizeof(long long), sizeof(size_t));
/*
wchar_t ss[256];
const wchar_t *ss2 = L"String 2 ЕНГ ---";
swprintf(ss, 256, L"String ЙЦУК --- %ls", ss2);
char ss3[512] = "";
char ss4[512] = "";
for(i = 0; i < wcslen(ss); i++)
{
char tmp[16];
sprintf(tmp, "%04X ", (int)ss[i]);
strcat(ss3, tmp);
sprintf(ss4, "%ls", ss);
}
__android_log_print(ANDROID_LOG_VERBOSE, "Ballfield", "swprintf: len %d data %s: %s", wcslen(ss), ss3, ss4);
*/
__android_log_print(ANDROID_LOG_VERBOSE, "Ballfield", "On-screen buttons:");
for(i = 0; i < SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM; i++)
{
SDL_Rect r;
SDL_ANDROID_GetScreenKeyboardButtonPos(i, &r);
__android_log_print(ANDROID_LOG_VERBOSE, "Ballfield", "{ %d, %d, %d, %d },", r.x, r.y, r.x+r.h, r.y+r.w);
}
//SDL_ANDROID_SetScreenKeyboardButtonGenerateTouchEvents(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, 1);
//SDL_ANDROID_SetScreenKeyboardButtonGenerateTouchEvents(SDL_ANDROID_SCREENKEYBOARD_BUTTON_3, 1);
while(1)
{
SDL_Rect r;
/* Timing */
tick = SDL_GetTicks();
dt = (tick - last_tick) * 0.001f;
last_tick = tick;
if( bpp == 32 )
SDL_FillRect(screen, NULL, 0); // Clear alpha channel
/* Background image */
tiled_back(back, screen, x_offs>>11, y_offs>>11);
/* Ballfield */
ballfield_render(balls, screen);
/* Logo */
r.x = 2;
r.y = 2;
SDL_BlitSurface(logo, NULL, screen, &r);
/* FPS counter */
if(tick > fps_start + 1000)
{
fps = (float)fps_count * 1000.0 / (tick - fps_start);
fps_count = 0;
fps_start = tick;
}
print_num(screen, font, screen->w-37, screen->h-12, fps);
++fps_count;
for(i=0; i<MAX_POINTERS; i++)
{
if( !touchPointers[i].pressed )
continue;
r.x = touchPointers[i].x;
r.y = touchPointers[i].y;
r.w = 50;// + touchPointers[i].pressure / 5;
r.h = 50;// + touchPointers[i].pressure / 5;
r.x -= r.w/2;
r.y -= r.h/2;
SDL_FillRect(screen, &r, colors[i]);
}
int joyInput[][3] = {
{accel[0], accel[1], 10},
{accel[2], accel[3], 10 + abs(accel[4]) * 100 / 32767},
{screenjoy[0], screenjoy[1], 10},
{screenjoy[2], screenjoy[3], 10},
{gamepads[0][0], gamepads[0][1], 10 + gamepads[0][4] * 100 / 32767},
{gamepads[0][2], gamepads[0][3], 10 + gamepads[0][5] * 100 / 32767},
{gamepads[0][6], gamepads[0][7], 10},
{gamepads[1][0], gamepads[1][1], 10 + gamepads[1][4] * 100 / 32767},
{gamepads[1][2], gamepads[1][3], 10 + gamepads[1][5] * 100 / 32767},
{gamepads[1][6], gamepads[1][7], 10},
{gamepads[2][0], gamepads[2][1], 10 + gamepads[2][4] * 100 / 32767},
{gamepads[2][2], gamepads[2][3], 10 + gamepads[2][5] * 100 / 32767},
{gamepads[2][6], gamepads[2][7], 10},
{gamepads[3][0], gamepads[3][1], 10 + gamepads[3][4] * 100 / 32767},
{gamepads[3][2], gamepads[3][3], 10 + gamepads[3][5] * 100 / 32767},
{gamepads[3][6], gamepads[3][7], 10},
};
for( i = 0; i < 15; i++ )
{
r.w = joyInput[i][2];
r.h = joyInput[i][2];
r.x = SCREEN_W/2 + joyInput[i][0] * SCREEN_H / 65536 - r.w/2;
r.y = SCREEN_H/2 + joyInput[i][1] * SCREEN_H / 65536 - r.w/2;
//__android_log_print(ANDROID_LOG_INFO, "Ballfield", "Joy input %d: %d %d %d", i, joyInput[i][0], joyInput[i][1], joyInput[i][2] );
SDL_FillRect(screen, &r, i * 123);
}
int mx, my;
int b = SDL_GetMouseState(&mx, &my);
//__android_log_print(ANDROID_LOG_INFO, "Ballfield", "Mouse: %04d %04d buttons %d", mx, my, b);
int cursorIdx = 0;
if( b & SDL_BUTTON_LMASK )
cursorIdx |= 1;
if( b & SDL_BUTTON_RMASK )
cursorIdx |= 2;
r.x = mx;
r.y = my;
r.w = mouse[cursorIdx]->w;
r.h = mouse[cursorIdx]->h;
r.x -= r.w/2;
r.y -= r.h/2;
SDL_BlitSurface(mouse[cursorIdx], NULL, screen, &r);
SDL_Flip(SDL_GetVideoSurface());
SDL_Event evt;
while( SDL_PollEvent(&evt) )
{
if(evt.type == SDL_KEYUP || evt.type == SDL_KEYDOWN)
{
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "SDL key event: evt %s state %s key %4d %12s scancode %4d mod %2d unicode %d", evt.type == SDL_KEYUP ? "UP " : "DOWN" , evt.key.state == SDL_PRESSED ? "PRESSED " : "RELEASED", (int)evt.key.keysym.sym, SDL_GetKeyName(evt.key.keysym.sym), (int)evt.key.keysym.scancode, (int)evt.key.keysym.mod, (int)evt.key.keysym.unicode);
if(evt.key.keysym.sym == SDLK_ESCAPE)
return 0;
if( evt.key.state == SDL_RELEASED )
{
if(evt.key.keysym.sym == SDLK_0)
{
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, 1);
//SDL_ANDROID_SetMouseEmulationMode(0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
}
if(evt.key.keysym.sym == SDLK_1)
{
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, 0);
//SDL_ANDROID_SetMouseEmulationMode(1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
//*((int*) 0x1000) = 1000; // When you need to test your debugger
}
if(evt.key.keysym.sym == SDLK_2)
{
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "Async text input started");
strcpy(asyncTextInputBuf, "async");
SDL_ANDROID_GetScreenKeyboardTextInputAsync(asyncTextInputBuf, sizeof(asyncTextInputBuf));
}
if(evt.key.keysym.sym == SDLK_3)
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD, 0);
if(evt.key.keysym.sym == SDLK_4)
SDL_ToggleScreenKeyboard(NULL);
if(evt.key.keysym.sym == SDLK_5)
SDL_ANDROID_ToggleScreenKeyboardWithoutTextInput();
}
}
if(evt.type == SDL_MOUSEBUTTONUP || evt.type == SDL_MOUSEBUTTONDOWN)
{
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "SDL mouse button event: evt %s state %s button %d coords %d:%d", evt.type == SDL_MOUSEBUTTONUP ? "UP " : "DOWN" , evt.button.state == SDL_PRESSED ? "PRESSED " : "RELEASED", (int)evt.button.button, (int)evt.button.x, (int)evt.button.y);
}
if(evt.type == SDL_VIDEORESIZE)
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "SDL resize event: %d x %d", evt.resize.w, evt.resize.h);
if(evt.type == SDL_ACTIVEEVENT)
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "======= SDL active event: gain %d state %d", evt.active.gain, evt.active.state);
// Android-specific events - accelerometer, multitoush, and on-screen joystick
if( evt.type == SDL_JOYAXISMOTION )
{
if(evt.jaxis.which == 0) // Multitouch and on-screen joysticks
{
if(evt.jaxis.axis < 4)
screenjoy[evt.jaxis.axis] = evt.jaxis.value;
else
touchPointers[evt.jaxis.axis - 4].pressure = evt.jaxis.value;
}
if(evt.jaxis.which == 1)
{
accel[evt.jaxis.axis] = evt.jaxis.value; // accelerometer and gyroscope
}
if(evt.jaxis.which >= 2)
{
// Each gamepad has 8 axes - two joystick hats, two triggers, and Ouya touchpad
gamepads[evt.jaxis.which - 2][evt.jaxis.axis] = evt.jaxis.value;
}
}
if( evt.type == SDL_JOYBUTTONDOWN || evt.type == SDL_JOYBUTTONUP )
{
if(evt.jbutton.which == 0) // Multitouch and on-screen joystick
touchPointers[evt.jbutton.button].pressed = (evt.jbutton.state == SDL_PRESSED);
}
if( evt.type == SDL_JOYBALLMOTION )
{
if(evt.jball.which == 0) // Multitouch and on-screen joystick
{
touchPointers[evt.jball.ball].x = evt.jball.xrel;
touchPointers[evt.jball.ball].y = evt.jball.yrel;
}
}
}
if( screenKeyboardShown != SDL_IsScreenKeyboardShown(NULL) )
{
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "Screen keyboard shown: %d -> %d", screenKeyboardShown, SDL_IsScreenKeyboardShown(NULL));
screenKeyboardShown = SDL_IsScreenKeyboardShown(NULL);
}
if( SDL_IsScreenKeyboardShown(NULL) )
{
if(SDL_ANDROID_GetScreenKeyboardTextInputAsync(asyncTextInputBuf, sizeof(asyncTextInputBuf)) == SDL_ANDROID_TEXTINPUT_ASYNC_FINISHED)
{
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "Async text input: %s", asyncTextInputBuf);
}
}
/* Animate */
x_speed = 500.0 * sin(t * 0.37);
y_speed = 500.0 * sin(t * 0.53);
z_speed = 400.0 * sin(t * 0.21);
if( SDL_GetKeyState(NULL)[SDLK_LEFT] || SDL_GetKeyState(NULL)[SDLK_a] )
x_speed -= 100000 * dt;
if( SDL_GetKeyState(NULL)[SDLK_RIGHT] || SDL_GetKeyState(NULL)[SDLK_d] )
x_speed += 100000 * dt;
if( SDL_GetKeyState(NULL)[SDLK_UP] || SDL_GetKeyState(NULL)[SDLK_w] )
y_speed -= 100000 * dt;
if( SDL_GetKeyState(NULL)[SDLK_DOWN] || SDL_GetKeyState(NULL)[SDLK_s] )
y_speed += 100000 * dt;
ballfield_move(balls, x_speed, y_speed, z_speed);
x_offs -= x_speed;
y_offs -= y_speed;
t += dt;
}
ballfield_free(balls);
SDL_FreeSurface(back);
SDL_FreeSurface(logo);
SDL_FreeSurface(font);
return 0;
}

View File

@@ -0,0 +1,795 @@
/*
* "Ballfield"
*
* (C) David Olofson <david@olofson.net>, 2002, 2003
*
* This software is released under the terms of the GPL.
*
* Contact author for permission if you want to use this
* software, or work derived from it, under other terms.
*/
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <android/log.h>
#include <wchar.h>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <SDL/SDL_screenkeyboard.h>
#include <SDL/SDL_android.h>
#define fprintf(X, ...) __android_log_print(ANDROID_LOG_INFO, "Ballfield", __VA_ARGS__)
#define printf(...) __android_log_print(ANDROID_LOG_INFO, "Ballfield", __VA_ARGS__)
/*----------------------------------------------------------
Definitions...
----------------------------------------------------------*/
#define SCREEN_W 640
#define SCREEN_H 256
#define BALLS 300
#define COLORS 2
typedef struct
{
Sint32 x, y, z; /* Position */
Uint32 c; /* Color */
} point_t;
/*
* Ballfield
*/
typedef struct
{
point_t points[BALLS];
SDL_Rect *frames;
SDL_Surface *gfx[COLORS];
int use_alpha;
} ballfield_t;
/*
* Size of the biggest ball image in pixels
*
* Balls are scaled down and *packed*, one pixel
* smaller for each frame down to 1x1. The actual
* image width is (obviously...) the same as the
* width of the first frame.
*/
#define BALL_W 32
#define BALL_H 32
/*----------------------------------------------------------
General tool functions
----------------------------------------------------------*/
/*
* Bump areas of low and high alpha to 0% or 100%
* respectively, just in case the graphics contains
* "alpha noise".
*/
SDL_Surface *clean_alpha(SDL_Surface *s)
{
SDL_Surface *work;
SDL_Rect r;
Uint32 *pixels;
int pp;
int x, y;
work = SDL_CreateRGBSurface(SDL_SWSURFACE, s->w, s->h,
32, 0xff000000, 0x00ff0000, 0x0000ff00,
0x000000ff);
if(!work)
return NULL;
r.x = r.y = 0;
r.w = s->w;
r.h = s->h;
if(SDL_BlitSurface(s, &r, work, NULL) < 0)
{
SDL_FreeSurface(work);
return NULL;
}
SDL_LockSurface(work);
pixels = (Uint32 *)work->pixels;
pp = work->pitch / sizeof(Uint32);
for(y = 0; y < work->h; ++y)
for(x = 0; x < work->w; ++x)
{
Uint32 pix = pixels[y*pp + x];
switch((pix & 0xff) >> 4)
{
case 0:
pix = 0x00000000;
break;
default:
break;
case 15:
pix |= 0xff;
break;
}
pixels[y*pp + x] = pix;
}
SDL_UnlockSurface(work);
return work;
}
/*
* Load and convert an antialiazed, zoomed set of sprites.
*/
SDL_Surface *load_zoomed(char *name, int alpha)
{
SDL_Surface *sprites;
SDL_Surface *temp = IMG_Load(name);
if(!temp)
return NULL;
/*
sprites = temp;
SDL_SetAlpha(sprites, 0, 255);
temp = clean_alpha(sprites);
SDL_FreeSurface(sprites);
*/
if(!temp)
{
fprintf(stderr, "Could not clean alpha!\n");
return NULL;
}
if(alpha)
{
SDL_SetAlpha(temp, 0, SDL_ALPHA_OPAQUE);
sprites = SDL_DisplayFormatAlpha(temp);
}
else
{
SDL_SetColorKey(temp, SDL_SRCCOLORKEY,
SDL_MapRGB(temp->format, 0, 0, 0));
sprites = SDL_DisplayFormat(temp);
}
SDL_FreeSurface(temp);
return sprites;
}
void print_num(SDL_Surface *dst, SDL_Surface *font, int x, int y, float value)
{
char buf[16];
int val = (int)(value * 10.0);
int pos, p = 0;
SDL_Rect from;
/* Sign */
if(val < 0)
{
buf[p++] = 10;
val = -val;
}
/* Integer part */
pos = 10000000;
while(pos > 1)
{
int num = val / pos;
val -= num * pos;
pos /= 10;
if(p || num)
buf[p++] = num;
}
/* Decimals */
if(val / pos)
{
buf[p++] = 11;
while(pos > 0)
{
int num = val / pos;
val -= num * pos;
pos /= 10;
buf[p++] = num;
}
}
/* Render! */
from.y = 0;
from.w = 7;
from.h = 10;
for(pos = 0; pos < p; ++pos)
{
SDL_Rect to;
to.x = x + pos * 7;
to.y = y;
from.x = buf[pos] * 7;
SDL_BlitSurface(font, &from, dst, &to);
}
}
void print_num_hex(SDL_Surface *dst, SDL_Surface *font, int x, int y, unsigned val)
{
char buf[8];
int pos, p = 0;
SDL_Rect from;
//val = htonl(val); // Big-endian
/* Render! */
from.y = 0;
from.w = 7;
from.h = 10;
for(pos = 0; pos < 8; ++pos)
{
SDL_Rect to;
to.x = 8 * 7 - (x + pos * 7); // Little-endian number wrapped backwards
to.y = y;
from.x = ( ( val >> (pos * 4) ) & 0xf ) * 7;
SDL_BlitSurface(font, &from, dst, &to);
}
}
/*----------------------------------------------------------
ballfield_t functions
----------------------------------------------------------*/
ballfield_t *ballfield_init(void)
{
int i;
ballfield_t *bf = (ballfield_t *)calloc(sizeof(ballfield_t), 1);
if(!bf)
return NULL;
for(i = 0; i < BALLS; ++i)
{
bf->points[i].x = rand() % 0x20000;
bf->points[i].y = rand() % 0x20000;
bf->points[i].z = 0x20000 * i / BALLS;
if(rand() % 100 > 80)
bf->points[i].c = 1;
else
bf->points[i].c = 0;
}
return bf;
}
void ballfield_free(ballfield_t *bf)
{
int i;
for(i = 0; i < COLORS; ++i)
SDL_FreeSurface(bf->gfx[i]);
}
static int ballfield_init_frames(ballfield_t *bf)
{
int i, j;
/*
* Set up source rects for all frames
*/
bf->frames = (SDL_Rect *)calloc(sizeof(SDL_Rect), bf->gfx[0]->w);
if(!bf->frames)
{
fprintf(stderr, "No memory for frame rects!\n");
return -1;
}
for(j = 0, i = 0; i < bf->gfx[0]->w; ++i)
{
bf->frames[i].x = 0;
bf->frames[i].y = j;
bf->frames[i].w = bf->gfx[0]->w - i;
bf->frames[i].h = bf->gfx[0]->w - i;
j += bf->gfx[0]->w - i;
}
return 0;
}
int ballfield_load_gfx(ballfield_t *bf, char *name, unsigned int color)
{
if(color >= COLORS)
return -1;
bf->gfx[color] = load_zoomed(name, bf->use_alpha);
if(!bf->gfx[color])
return -2;
if(!bf->frames)
return ballfield_init_frames(bf);
return 0;
}
void ballfield_move(ballfield_t *bf, Sint32 dx, Sint32 dy, Sint32 dz)
{
int i;
for(i = 0; i < BALLS; ++i)
{
bf->points[i].x += dx;
bf->points[i].x &= 0x1ffff;
bf->points[i].y += dy;
bf->points[i].y &= 0x1ffff;
bf->points[i].z += dz;
bf->points[i].z &= 0x1ffff;
}
}
void ballfield_render(ballfield_t *bf, SDL_Surface *screen)
{
int i, j, z;
/*
* Find the ball with the highest Z.
*/
z = 0;
j = 0;
for(i = 0; i < BALLS; ++i)
{
if(bf->points[i].z > z)
{
j = i;
z = bf->points[i].z;
}
}
/*
* Render all balls in back->front order.
*/
for(i = 0; i < BALLS; ++i)
{
SDL_Rect r;
int f;
z = bf->points[j].z;
z += 50;
f = ((bf->frames[0].w << 12) + 100000) / z;
f = bf->frames[0].w - f;
if(f < 0)
f = 0;
else if(f > bf->frames[0].w - 1)
f = bf->frames[0].w - 1;
z >>= 7;
z += 1;
r.x = (bf->points[j].x - 0x10000) / z;
r.y = (bf->points[j].y - 0x10000) / z;
r.x += (screen->w - bf->frames[f].w) >> 1;
r.y += (screen->h - bf->frames[f].h) >> 1;
SDL_BlitSurface(bf->gfx[bf->points[j].c],
&bf->frames[f], screen, &r);
if(--j < 0)
j = BALLS - 1;
}
}
/*----------------------------------------------------------
Other rendering functions
----------------------------------------------------------*/
/*
* Draw tiled background image with offset.
*/
void tiled_back(SDL_Surface *back, SDL_Surface *screen, int xo, int yo)
{
/*
int x, y;
SDL_Rect r;
if(xo < 0)
xo += back->w*(-xo/back->w + 1);
if(yo < 0)
yo += back->h*(-yo/back->h + 1);
xo %= back->w;
yo %= back->h;
for(y = -yo; y < screen->h; y += back->h)
for(x = -xo; x < screen->w; x += back->w)
{
r.x = x;
r.y = y;
SDL_BlitSurface(back, NULL, screen, &r);
}
*/
SDL_Rect r;
xo %= back->w/8;
yo %= back->h/8;
r.x = xo - back->w/2 + screen->w/2;
r.y = yo - back->h/2 + screen->h/2;
r.w = back->w;
r.h = back->h;
SDL_BlitSurface(back, NULL, screen, &r);
}
/*----------------------------------------------------------
main()
----------------------------------------------------------*/
int main(int argc, char* argv[])
{
ballfield_t *balls;
SDL_Surface *screen;
SDL_Surface *temp_image;
SDL_Surface *back, *logo, *font, *font_hex;
SDL_Event event;
int bpp = 16,
flags = SDL_HWSURFACE,
alpha = 1;
int x_offs = 0, y_offs = 0;
long tick,
last_tick,
last_avg_tick;
double t = 0;
float dt;
int i;
float fps = 0.0;
int fps_count = 0;
int fps_start = 0;
float x_speed, y_speed, z_speed;
enum { MAX_POINTERS = 16 };
// some random colors
int colors[MAX_POINTERS] = { 0xaaaaaa, 0xffffff, 0x888888, 0xcccccc, 0x666666, 0x999999, 0xdddddd, 0xeeeeee, 0xaaaaaa, 0xffffff, 0x888888, 0xcccccc, 0x666666, 0x999999, 0xdddddd, 0xeeeeee };
struct TouchPointer_t { int x; int y; int pressure; int pressed; } touchPointers[MAX_POINTERS];
int accel[5], screenjoy[4], gamepads[4][8];
SDL_Surface *mouse[4];
int screenKeyboardShown = 0;
int asyncTextInput = 0;
char asyncTextInputBuf[256];
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
SDL_EnableUNICODE(1);
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
SDL_Joystick * joysticks[6];
for( i = 0; i < 6; i++ )
joysticks[i] = SDL_JoystickOpen(i);
atexit(SDL_Quit);
screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, bpp, flags);
if(!screen)
{
fprintf(stderr, "Failed to open screen!\n");
exit(-1);
}
SDL_WM_SetCaption("Ballfield", "Ballfield");
if(flags & SDL_FULLSCREEN)
SDL_ShowCursor(0);
balls = ballfield_init();
if(!balls)
{
fprintf(stderr, "Failed to create ballfield!\n");
exit(-1);
}
/*
* Load and prepare balls...
*/
balls->use_alpha = alpha;
if( ballfield_load_gfx(balls, "blueball.png", 0)
||
ballfield_load_gfx(balls, "redball.png", 1) )
{
fprintf(stderr, "Could not load balls!\n");
exit(-1);
}
/*
* Load background image
*/
temp_image = IMG_Load("sun.gif");
if(!temp_image)
{
fprintf(stderr, "Could not load background!\n");
exit(-1);
}
back = SDL_DisplayFormat(temp_image);
SDL_FreeSurface(temp_image);
/*
* Load logo
*/
temp_image = SDL_LoadBMP("logo.bmp");
if(!temp_image)
{
fprintf(stderr, "Could not load logo!\n");
exit(-1);
}
SDL_SetColorKey(temp_image, SDL_SRCCOLORKEY,
SDL_MapRGB(temp_image->format, 255, 0, 255));
logo = SDL_DisplayFormat(temp_image);
SDL_FreeSurface(temp_image);
/*
* Load font
*/
temp_image = SDL_LoadBMP("font7x10.bmp");
if(!temp_image)
{
fprintf(stderr, "Could not load font!\n");
exit(-1);
}
SDL_SetColorKey(temp_image, SDL_SRCCOLORKEY,
SDL_MapRGB(temp_image->format, 255, 0, 255));
font = SDL_DisplayFormat(temp_image);
SDL_FreeSurface(temp_image);
temp_image = SDL_LoadBMP("font7x10-hex.bmp");
if(!temp_image)
{
fprintf(stderr, "Could not load hex font!\n");
exit(-1);
}
SDL_SetColorKey(temp_image, SDL_SRCCOLORKEY,
SDL_MapRGB(temp_image->format, 255, 0, 255));
font_hex = SDL_DisplayFormat(temp_image);
SDL_FreeSurface(temp_image);
for(i = 0; i < 4; i++)
{
char name[32];
sprintf(name, "mouse%d.png", i);
temp_image = IMG_Load(name);
if(!temp_image)
{
fprintf(stderr, "Could not load %s!\n", name);
exit(-1);
}
//mouse[i] = SDL_DisplayFormat(temp_image);
//SDL_FreeSurface(temp_image);
mouse[i] = temp_image; // Keep alpha
}
last_avg_tick = last_tick = SDL_GetTicks();
memset(touchPointers, 0, sizeof(touchPointers));
memset(accel, 0, sizeof(accel));
memset(screenjoy, 0, sizeof(screenjoy));
memset(gamepads, 0, sizeof(gamepads));
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "sizeof(int) %d long %d long long %d size_t %d", sizeof(int), sizeof(long), sizeof(long long), sizeof(size_t));
/*
wchar_t ss[256];
const wchar_t *ss2 = L"String 2 ЕНГ ---";
swprintf(ss, 256, L"String ЙЦУК --- %ls", ss2);
char ss3[512] = "";
char ss4[512] = "";
for(i = 0; i < wcslen(ss); i++)
{
char tmp[16];
sprintf(tmp, "%04X ", (int)ss[i]);
strcat(ss3, tmp);
sprintf(ss4, "%ls", ss);
}
__android_log_print(ANDROID_LOG_VERBOSE, "Ballfield", "swprintf: len %d data %s: %s", wcslen(ss), ss3, ss4);
*/
__android_log_print(ANDROID_LOG_VERBOSE, "Ballfield", "On-screen buttons:");
for(i = 0; i < SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM; i++)
{
SDL_Rect r;
SDL_ANDROID_GetScreenKeyboardButtonPos(i, &r);
__android_log_print(ANDROID_LOG_VERBOSE, "Ballfield", "{ %d, %d, %d, %d },", r.x, r.y, r.x+r.h, r.y+r.w);
}
//SDL_ANDROID_SetScreenKeyboardButtonGenerateTouchEvents(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, 1);
//SDL_ANDROID_SetScreenKeyboardButtonGenerateTouchEvents(SDL_ANDROID_SCREENKEYBOARD_BUTTON_3, 1);
while(1)
{
SDL_Rect r;
/* Timing */
tick = SDL_GetTicks();
dt = (tick - last_tick) * 0.001f;
last_tick = tick;
if( bpp == 32 )
SDL_FillRect(screen, NULL, 0); // Clear alpha channel
/* Background image */
tiled_back(back, screen, x_offs>>11, y_offs>>11);
/* Ballfield */
ballfield_render(balls, screen);
/* Logo */
r.x = 2;
r.y = 2;
SDL_BlitSurface(logo, NULL, screen, &r);
/* FPS counter */
if(tick > fps_start + 1000)
{
fps = (float)fps_count * 1000.0 / (tick - fps_start);
fps_count = 0;
fps_start = tick;
}
print_num(screen, font, screen->w-37, screen->h-12, fps);
++fps_count;
for(i=0; i<MAX_POINTERS; i++)
{
if( !touchPointers[i].pressed )
continue;
r.x = touchPointers[i].x;
r.y = touchPointers[i].y;
r.w = 50 + touchPointers[i].pressure / 5;
r.h = 50 + touchPointers[i].pressure / 5;
r.x -= r.w/2;
r.y -= r.h/2;
SDL_FillRect(screen, &r, colors[i]);
}
int joyInput[][3] = {
{accel[0], accel[1], 10},
{accel[2], accel[3], 10 + abs(accel[4]) * 100 / 32767},
{screenjoy[0], screenjoy[1], 10},
{screenjoy[2], screenjoy[3], 10},
{gamepads[0][0], gamepads[0][1], 10 + gamepads[0][4] * 100 / 32767},
{gamepads[0][2], gamepads[0][3], 10 + gamepads[0][5] * 100 / 32767},
{gamepads[0][6], gamepads[0][7], 10},
{gamepads[1][0], gamepads[1][1], 10 + gamepads[1][4] * 100 / 32767},
{gamepads[1][2], gamepads[1][3], 10 + gamepads[1][5] * 100 / 32767},
{gamepads[1][6], gamepads[1][7], 10},
{gamepads[2][0], gamepads[2][1], 10 + gamepads[2][4] * 100 / 32767},
{gamepads[2][2], gamepads[2][3], 10 + gamepads[2][5] * 100 / 32767},
{gamepads[2][6], gamepads[2][7], 10},
{gamepads[3][0], gamepads[3][1], 10 + gamepads[3][4] * 100 / 32767},
{gamepads[3][2], gamepads[3][3], 10 + gamepads[3][5] * 100 / 32767},
{gamepads[3][6], gamepads[3][7], 10},
};
for( i = 0; i < 15; i++ )
{
r.w = joyInput[i][2];
r.h = joyInput[i][2];
r.x = SCREEN_W/2 + joyInput[i][0] * SCREEN_H / 65536 - r.w/2;
r.y = SCREEN_H/2 + joyInput[i][1] * SCREEN_H / 65536 - r.w/2;
//__android_log_print(ANDROID_LOG_INFO, "Ballfield", "Joy input %d: %d %d %d", i, joyInput[i][0], joyInput[i][1], joyInput[i][2] );
SDL_FillRect(screen, &r, i * 123);
}
int mx, my;
int b = SDL_GetMouseState(&mx, &my);
//__android_log_print(ANDROID_LOG_INFO, "Ballfield", "Mouse: %04d %04d buttons %d", mx, my, b);
int cursorIdx = 0;
if( b & SDL_BUTTON_LMASK )
cursorIdx |= 1;
if( b & SDL_BUTTON_RMASK )
cursorIdx |= 2;
r.x = mx;
r.y = my;
r.w = mouse[cursorIdx]->w;
r.h = mouse[cursorIdx]->h;
r.x -= r.w/2;
r.y -= r.h/2;
SDL_BlitSurface(mouse[cursorIdx], NULL, screen, &r);
SDL_Flip(SDL_GetVideoSurface());
SDL_Event evt;
while( SDL_PollEvent(&evt) )
{
if(evt.type == SDL_KEYUP || evt.type == SDL_KEYDOWN)
{
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "SDL key event: evt %s state %s key %4d %12s scancode %4d mod %2d unicode %d", evt.type == SDL_KEYUP ? "UP " : "DOWN" , evt.key.state == SDL_PRESSED ? "PRESSED " : "RELEASED", (int)evt.key.keysym.sym, SDL_GetKeyName(evt.key.keysym.sym), (int)evt.key.keysym.scancode, (int)evt.key.keysym.mod, (int)evt.key.keysym.unicode);
if(evt.key.keysym.sym == SDLK_ESCAPE)
return 0;
if( evt.key.state == SDL_RELEASED )
{
if(evt.key.keysym.sym == SDLK_0)
{
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, 1);
SDL_ANDROID_SetMouseEmulationMode(0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
}
if(evt.key.keysym.sym == SDLK_1)
{
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, 0);
SDL_ANDROID_SetMouseEmulationMode(1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
}
if(evt.key.keysym.sym == SDLK_2)
{
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "Async text input started");
asyncTextInput = 1;
asyncTextInputBuf[0] = 0;
SDL_ANDROID_GetScreenKeyboardTextInputAsync(asyncTextInputBuf, sizeof(asyncTextInputBuf));
}
if(evt.key.keysym.sym == SDLK_3)
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD, 0);
if(evt.key.keysym.sym == SDLK_4)
SDL_ToggleScreenKeyboard(NULL);
if(evt.key.keysym.sym == SDLK_5)
SDL_ANDROID_ToggleScreenKeyboardWithoutTextInput();
}
}
if(evt.type == SDL_MOUSEBUTTONUP || evt.type == SDL_MOUSEBUTTONDOWN)
{
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "SDL mouse button event: evt %s state %s button %d coords %d:%d", evt.type == SDL_MOUSEBUTTONUP ? "UP " : "DOWN" , evt.button.state == SDL_PRESSED ? "PRESSED " : "RELEASED", (int)evt.button.button, (int)evt.button.x, (int)evt.button.y);
}
if(evt.type == SDL_VIDEORESIZE)
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "SDL resize event: %d x %d", evt.resize.w, evt.resize.h);
if(evt.type == SDL_ACTIVEEVENT)
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "======= SDL active event: gain %d state %d", evt.active.gain, evt.active.state);
// Android-specific events - accelerometer, multitoush, and on-screen joystick
if( evt.type == SDL_JOYAXISMOTION )
{
if(evt.jaxis.which == 0) // Multitouch and on-screen joysticks
{
if(evt.jaxis.axis < 4)
screenjoy[evt.jaxis.axis] = evt.jaxis.value;
else
touchPointers[evt.jaxis.axis - 4].pressure = evt.jaxis.value;
}
if(evt.jaxis.which == 1)
{
accel[evt.jaxis.axis] = evt.jaxis.value; // accelerometer and gyroscope
}
if(evt.jaxis.which >= 2)
{
// Each gamepad has 8 axes - two joystick hats, two triggers, and Ouya touchpad
gamepads[evt.jaxis.which - 2][evt.jaxis.axis] = evt.jaxis.value;
}
}
if( evt.type == SDL_JOYBUTTONDOWN || evt.type == SDL_JOYBUTTONUP )
{
if(evt.jbutton.which == 0) // Multitouch and on-screen joystick
touchPointers[evt.jbutton.button].pressed = (evt.jbutton.state == SDL_PRESSED);
}
if( evt.type == SDL_JOYBALLMOTION )
{
if(evt.jball.which == 0) // Multitouch and on-screen joystick
{
touchPointers[evt.jball.ball].x = evt.jball.xrel;
touchPointers[evt.jball.ball].y = evt.jball.yrel;
}
}
}
if( screenKeyboardShown != SDL_IsScreenKeyboardShown(NULL))
{
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "Screen keyboard shown: %d -> %d", screenKeyboardShown, SDL_IsScreenKeyboardShown(NULL));
screenKeyboardShown = SDL_IsScreenKeyboardShown(NULL);
}
if( asyncTextInput )
{
if( SDL_ANDROID_GetScreenKeyboardTextInputAsync(asyncTextInputBuf, sizeof(asyncTextInputBuf)) == SDL_ANDROID_TEXTINPUT_ASYNC_FINISHED)
{
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "Async text input: %s", asyncTextInputBuf);
asyncTextInput = 0;
}
}
/* Animate */
x_speed = 500.0 * sin(t * 0.37);
y_speed = 500.0 * sin(t * 0.53);
z_speed = 400.0 * sin(t * 0.21);
if( SDL_GetKeyState(NULL)[SDLK_LEFT] )
x_speed -= 100000 * dt;
if( SDL_GetKeyState(NULL)[SDLK_RIGHT] )
x_speed += 100000 * dt;
if( SDL_GetKeyState(NULL)[SDLK_UP] )
y_speed -= 100000 * dt;
if( SDL_GetKeyState(NULL)[SDLK_DOWN] )
y_speed += 100000 * dt;
ballfield_move(balls, x_speed, y_speed, z_speed);
x_offs -= x_speed;
y_offs -= y_speed;
t += dt;
}
ballfield_free(balls);
SDL_FreeSurface(back);
SDL_FreeSurface(logo);
SDL_FreeSurface(font);
return 0;
}

View File

@@ -7,10 +7,10 @@ AppName="BasiliskII"
AppFullName=net.cebix.basilisk
# Application version code (integer)
AppVersionCode=10005
AppVersionCode=10001
# Application user-visible version name (string)
AppVersionName="1.0.0.05"
AppVersionName="1.0.0.01"
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu
@@ -236,6 +236,3 @@ AdmobTestDeviceId=
# Your AdMob banner size (BANNER/IAB_BANNER/IAB_LEADERBOARD/IAB_MRECT/IAB_WIDE_SKYSCRAPER/SMART_BANNER)
AdmobBannerSize=
# Hide Android system mouse cursor image when USB mouse is attached (y) or (n) - the app must draw it's own mouse cursor
HideSystemMousePointer=y

View File

@@ -9,19 +9,16 @@ ln -sf libsdl-1.2.so $LOCAL_PATH/../../../obj/local/$1/libpthread.so
ln -sf libsdl_image.so $LOCAL_PATH/../../../obj/local/$1/libSDL_image.so
ln -sf libsdl_ttf.so $LOCAL_PATH/../../../obj/local/$1/libSDL_ttf.so
JOBS=4
if [ \! -f basiliskii/src/Unix/configure ] ; then
sh -c "cd basiliskii/src/Unix && ./autogen.sh"
rm -f basiliskii/src/Unix/Makefile
fi
if [ \! -f basiliskii/src/Unix/Makefile ] ; then
env CFLAGS="-Ofast" \
env LIBS="-lgnustl_static -lc -lm" \
../setEnvironment-$1.sh sh -c "cd basiliskii/src/Unix && env no_dev_ptmx=1 ac_cv_file__dev_ptmx=no ac_cv_file__dev_ptc=no ac_cv_sys_file_offset_bits=no \
./configure --build=x86_64-unknown-linux-gnu --host=$2 --enable-sdl-video --enable-sdl-audio --without-gtk --without-esd --without-x" || exit 1
env LIBS="-lgnustl_static" \
../setEnvironment-$1.sh sh -c "cd basiliskii/src/Unix && ./configure --build=x86_64-unknown-linux-gnu --host=$2 --enable-sdl-video --enable-sdl-audio --without-gtk --without-esd --without-x"
fi
make -C basiliskii/src/Unix -j$JOBS && mv -f basiliskii/src/Unix/BasiliskII libapplication-$1.so
make -C basiliskii/src/Unix && mv -f basiliskii/src/Unix/BasiliskII libapplication-$1.so

BIN
project/jni/application/basiliskii/AndroidData/cfg.zip Executable file → Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@@ -13,13 +13,11 @@ AppVersionCode=1406
AppVersionName="1.4.06"
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, '!!' will also hide the entry from the menu, so it cannot be disabled
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu
# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped
# If the URL does not contain 'http://' or 'https://', it is treated as file from 'project/jni/application/src/AndroidData' dir -
# these files are put inside .apk package by the build system
# You can specify Google Play expansion files in the form 'obb:main.12345' or 'obb:patch.12345' where 12345 is the app version for obb file
# You can use .zip.xz archives for better compression, but you need to add 'lzma' to CompiledLibraries
# Generate .zip.xz files like this: zip -0 -r data.zip your-data/* ; xz -8 data.zip
# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir -
# these files are put inside .apk package by build system
# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS
AppDataDownloadUrl="!Game data|data3.zip"
# Reset SDL config when updating application to the new version (y) / (n)
@@ -48,17 +46,10 @@ NeedDepthBuffer=n
# Enable OpenGL stencil buffer (needed only for 3-d applications, small speed decrease) (y) or (n)
NeedStencilBuffer=n
# Use GLES 2.x context
# Try to use GLES 2.x context - will revert to GLES 1.X if unsupported by device
# you need this option only if you're developing 3-d app (y) or (n)
NeedGles2=n
# Use GLES 3.x context
# you need this option only if you're developing 3-d app (y) or (n)
NeedGles3=n
# Use gl4es library for provide OpenGL 1.x functionality to OpenGL ES accelerated cards (y) or (n)
UseGl4es=
# Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL,
# this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n)
SwVideoMode=y
@@ -89,14 +80,6 @@ CompatibilityHacksStaticInit=n
# On-screen Android soft text input emulates hardware keyboard, this will only work with Hackers Keyboard app (y)/(n)
CompatibilityHacksTextInputEmulatesHwKeyboard=n
# Built-in text input keyboards with custom layouts for emulators, requires CompatibilityHacksTextInputEmulatesHwKeyboard=y
# 0 or empty - standard Android keyboard
# 1 - Simple QWERTY keyboard, no function keys, no arrow keys
# 2 - Commodore 64 keyboard
# 3 - Amiga keyboard
# 4 - Atari800 keyboard
TextInputKeyboard=
# Hack for broken devices: prevent audio chopping, by sleeping a bit after pushing each audio chunk (y)/(n)
CompatibilityHacksPreventAudioChopping=n
@@ -130,9 +113,6 @@ RightMouseButtonLongPress=
# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n)
ShowMouseCursor=n
# Screen follows mouse cursor, when it's covered by soft keyboard, this works only in software video mode (y) or (n)
ScreenFollowsMouse=
# Generate more touch events, by default SDL generates one event per one video frame, this is useful for drawing apps (y) or (n)
GenerateSubframeTouchEvents=
@@ -165,9 +145,6 @@ AppUsesAccelerometer=n
# Application uses gyroscope (y) or (n), the gyroscope will be used as joystick 1 axes 2-4
AppUsesGyroscope=n
# Application uses orientation sensor (y) or (n), reported as joystick 1 axes 8-10
AppUsesOrientationSensor=
# Use gyroscope to move mouse cursor (y) or (n), it eats battery, and can be disabled in settings, do not use with AppUsesGyroscope setting
MoveMouseWithGyroscope=
@@ -179,21 +156,15 @@ AppUsesMultitouch=n
# This option will add additional permission to Android manifest (y)/(n)
AppRecordsAudio=n
# Application needs read/write access SD card. Always disable it, unless you want to access user photos and downloads. (y) / (n)
# Application needs to access SD card. If your data files are bigger than 5 Mb, enable it. (y) / (n)
AccessSdCard=
# Application needs to read it's own OBB file. Enable this if you are using Play Store expansion files. (y) / (n)
ReadObbFile=
# Application needs Internet access. If you disable it, you'll have to bundle all your data files inside .apk (y) / (n)
AccessInternet=
# Immersive mode - Android will hide on-screen Home/Back keys. Looks bad if you invoke Android keyboard. (y) / (n)
ImmersiveMode=
# Hide Android system mouse cursor image when USB mouse is attached (y) or (n) - the app must draw it's own mouse cursor
HideSystemMousePointer=
# Application implements Android-specific routines to put to background, and will not draw anything to screen
# between SDL_ACTIVEEVENT lost / gained notifications - you should check for them
# rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n)
@@ -217,62 +188,38 @@ RedefinedKeysScreenKb="RETURN SPACE"
RedefinedKeysScreenKbNames="RETURN SPACE"
# On-screen keys theme
# 0 = Ultimate Droid by Sean Stieber (green, with cross joystick)
# 1 = Simple Theme by Beholder (white, with cross joystick)
# 0 = Ultimate Droid by Sean Stieber (green, with gamepad joystick)
# 1 = Simple Theme by Beholder (white, with gamepad joystick)
# 2 = Sun by Sirea (yellow, with round joystick)
# 3 = Keen by Gerstrong (multicolor, with round joystick)
# 4 = Retro by Santiago Radeff (red/white, with cross joystick)
# 5 = GameBoy from RetroArch
# 6 = PlayStation from RetroArch
# 7 = SuperNintendo from RetroArch
# 8 = DualShock from RetroArch
# 9 = Nintendo64 from RetroArch
TouchscreenKeysTheme=2
# Redefine gamepad keys to SDL keysyms, button order is:
# A B X Y L1 R1 L2 R2 LThumb RThumb Start Select Up Down Left Right LThumbUp LThumbDown LThumbLeft LThumbRight RThumbUp RThumbDown RThumbLeft RThumbRight
# A B X Y L1 R1 L2 R2 LThumb RThumb
RedefinedKeysGamepad="RETURN ESCAPE SPACE SPACE"
# Redefine keys for the second gamepad, same as the first gamepad if not set:
RedefinedKeysSecondGamepad=""
# Redefine keys for the third gamepad, same as the first gamepad if not set:
RedefinedKeysThirdGamepad=""
# Redefine keys for the fourth gamepad, same as the first gamepad if not set:
RedefinedKeysFourthGamepad=""
# How long to show startup menu button, in msec, 0 to disable startup menu
StartupMenuButtonTimeout=0
# Menu items to hide from startup menu, available menu items:
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.StorageAccessConfig SettingsMenuMisc.CommandlineConfig SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout SettingsMenuKeyboard.ScreenKeyboardAdvanced
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout SettingsMenuKeyboard.ScreenKeyboardAdvanced
HiddenMenuOptions='SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.MouseConfigMainMenu'
# Menu items to show at startup - this is Java code snippet, leave empty for default
# new SettingsMenuMisc.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new SettingsMenuMouse.DisplaySizeConfig(true) : new SettingsMenu.DummyMenu()), new SettingsMenuMisc.OptionalDownloadConfig(true), new SettingsMenuMisc.GyroscopeCalibration()
# Available menu items:
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.StorageAccessConfig SettingsMenuMisc.CommandlineConfig SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout SettingsMenuKeyboard.ScreenKeyboardAdvanced
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout SettingsMenuKeyboard.ScreenKeyboardAdvanced
FirstStartMenuOptions=''
# Specify architectures to compile, 'all' or 'y' to compile for all architectures.
# Available architectures: armeabi armeabi-v7a armeabi-v7a-hard x86 mips
MultiABI='armeabi-v7a x86'
# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower
AppMinimumRAM=0
# GCC version, or 'clang' for CLANG
NDK_TOOLCHAIN_VERSION=
# Android platform version.
# android-16 = Android 4.1, the earliest supported version in NDK r18.
# android-18 = Android 4.3, the first version supporting GLES3.
# android-21 = Android 5.1, the first version with SO_REUSEPORT defined.
APP_PLATFORM=
# Specify architectures to compile, 'all' or 'y' to compile for all architectures.
# Available architectures: armeabi-v7a arm64-v8a x86 x86_64
MultiABI='arm64-v8a'
# Optional shared libraries to compile - removing some of them will save space
# MP3 patents are expired, but libmad license is GPL, not LGPL
# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed
# 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
CompiledLibraries="sdl_image sdl_mixer"
@@ -282,9 +229,6 @@ CustomBuildScript=n
# Aditional CFLAGS for application
AppCflags=''
# Aditional C++-specific compiler flags for application, added after AppCflags
AppCppflags=''
# Additional LDFLAGS for application
AppLdflags=''
@@ -316,6 +260,3 @@ AdmobBannerSize=
# Google Play Game Services application ID, required for cloud saves to work
GooglePlayGameServicesId=520035027247
# The app will open files with following extension, file path will be added to commandline params
AppOpenFileExtension=''

View File

@@ -0,0 +1 @@
/*.so

View File

@@ -0,0 +1 @@
bochs/android/bochs/AndroidAppSettings.cfg

View File

@@ -0,0 +1 @@
bochs/android/bochs/AndroidBuild.sh

View File

@@ -0,0 +1 @@
bochs/android/bochs/AndroidData

View File

@@ -0,0 +1 @@
bochs/android/bochs/icon.png

View File

@@ -0,0 +1 @@
/AndroidData

View File

@@ -0,0 +1,237 @@
# The application settings for Android libSDL port
# Specify application name (e.x. My Application)
AppName="C-Dogs"
# Specify reversed site name of application (e.x. com.mysite.myapp)
AppFullName=cxong.cdogs
# Application version code (integer)
AppVersionCode=101
# Application user-visible version name (string)
AppVersionName="1.01"
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu
# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped
# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir -
# these files are put inside .apk package by build system
# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS
AppDataDownloadUrl="!!Game data|data.zip"
# Reset SDL config when updating application to the new version (y) / (n)
ResetSdlConfigForThisVersion=n
# Delete application data files when upgrading (specify file/dir paths separated by spaces)
DeleteFilesOnUpgrade="%"
# Here you may type readme text, which will be shown during startup. Format is:
# Text in English, use \\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/
ReadmeText='^Readme text'
# libSDL version to use (1.2/1.3/2.0)
LibSdlVersion=1.2
# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape
ScreenOrientation=h
# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer
InhibitSuspend=n
# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only
# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32)
VideoDepthBpp=16
# Enable OpenGL depth buffer (needed only for 3-d applications, small speed decrease) (y) or (n)
NeedDepthBuffer=n
# Enable OpenGL stencil buffer (needed only for 3-d applications, small speed decrease) (y) or (n)
NeedStencilBuffer=n
# Try to use GLES 2.x context - will revert to GLES 1.X if unsupported by device
# you need this option only if you're developing 3-d app (y) or (n)
NeedGles2=n
# Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL,
# this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n)
SwVideoMode=n
# Application video output will be resized to fit into native device screen (y)/(n)
SdlVideoResize=y
# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n)
SdlVideoResizeKeepAspect=y
# Application does not call SDL_Flip() or SDL_UpdateRects() appropriately, or draws from non-main thread -
# enabling the compatibility mode will force screen update every 100 milliseconds, which is laggy and inefficient (y) or (n)
CompatibilityHacks=n
# Application initializes SDL audio/video inside static constructors (which is bad, you won't be able to run ndk-gdb) (y)/(n)
CompatibilityHacksStaticInit=n
# On-screen Android soft text input emulates hardware keyboard, this will only work with Hackers Keyboard app (y)/(n)
CompatibilityHacksTextInputEmulatesHwKeyboard=n
# Hack for broken devices: prevent audio chopping, by sleeping a bit after pushing each audio chunk (y)/(n)
CompatibilityHacksPreventAudioChopping=n
# Hack for broken apps: application ignores audio buffer size returned by SDL (y)/(n)
CompatibilityHacksAppIgnoresAudioBufferSize=n
# Hack for VCMI: preload additional shared libraries before aplication start
CompatibilityHacksAdditionalPreloadedSharedLibraries=""
# Hack for Free Heroes 2, which redraws the screen inside SDL_PumpEvents(): slow and compatible SDL event queue -
# do not use it with accelerometer/gyroscope, or your app may freeze at random (y)/(n)
CompatibilityHacksSlowCompatibleEventQueue=n
# Save and restore OpenGL state when drawing on-screen keyboard for apps that use SDL_OPENGL
CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState=n
# Application uses SDL_UpdateRects() properly, and does not draw in any region outside those rects.
# This improves drawing speed, but I know only one application that does that, and it's written by me (y)/(n)
CompatibilityHacksProperUsageOfSDL_UpdateRects=
# Application uses mouse (y) or (n), this will show mouse emulation dialog to the user
AppUsesMouse=n
# Application needs two-button mouse, will also enable advanced point-and-click features (y) or (n)
AppNeedsTwoButtonMouse=n
# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n)
ShowMouseCursor=n
# Generate more touch events, by default SDL generates one event per one video frame, this is useful for drawing apps (y) or (n)
GenerateSubframeTouchEvents=
# Force relative (laptop) mouse movement mode, useful when both on-screen keyboard and mouse are needed (y) or (n)
ForceRelativeMouseMode=n
# Application needs arrow keys (y) or (n), will show on-screen dpad/joystick (y) or (n)
AppNeedsArrowKeys=y
# Application needs text input (y) or (n), enables button for text input on screen
AppNeedsTextInput=y
# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1
AppUsesJoystick=n
# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n)
AppUsesSecondJoystick=n
# Application uses accelerometer (y) or (n), the accelerometer will be used as joystick 1 axes 0-1 and 5-7
AppUsesAccelerometer=n
# Application uses gyroscope (y) or (n), the gyroscope will be used as joystick 1 axes 2-4
AppUsesGyroscope=n
# Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0
AppUsesMultitouch=n
# Application records audio (it will use any available source, such a s microphone)
# API is defined in file SDL_android.h: int SDL_ANDROID_OpenAudioRecording(SDL_AudioSpec *spec); void SDL_ANDROID_CloseAudioRecording(void);
# This option will add additional permission to Android manifest (y)/(n)
AppRecordsAudio=n
# Application needs to access SD card. If your data files are bigger than 5 Mb, enable it. (y) / (n)
AccessSdCard=
# Immersive mode - Android will hide on-screen Home/Back keys. Looks bad if you invoke Android keyboard. (y) / (n)
ImmersiveMode=
# Application implements Android-specific routines to put to background, and will not draw anything to screen
# between SDL_ACTIVEEVENT lost / gained notifications - you should check for them
# rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n)
# This option is reported to be buggy, sometimes failing to restore video state
NonBlockingSwapBuffers=n
# Redefine common hardware keys to SDL keysyms
# BACK hardware key is available on all devices, MENU is available on pre-ICS devices, other keys may be absent
# SEARCH and CALL by default return same keycode as DPAD_CENTER - one of those keys is available on most devices
# Use word NO_REMAP if you want to preserve native functionality for certain key (volume keys are 3-rd and 4-th)
# Keys: TOUCHSCREEN (works only when AppUsesMouse=n), DPAD_CENTER/SEARCH, VOLUMEUP, VOLUMEDOWN, MENU, BACK, CAMERA
RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP SPACE ESCAPE"
# Number of virtual keyboard keys (currently 6 is maximum)
AppTouchscreenKeyboardKeysAmount=3
# Number of virtual keyboard keys that support autofire (currently 2 is maximum)
AppTouchscreenKeyboardKeysAmountAutoFire=0
# Redefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom in/out and rotate left/right)
RedefinedKeysScreenKb="RETURN RSHIFT TAB"
# Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separated by spaces, they are used in SDL config menu
RedefinedKeysScreenKbNames="Fire Weapons Map"
# On-screen keys theme
# 0 = Ultimate Droid by Sean Stieber (green, with gamepad joystick)
# 1 = Simple Theme by Beholder (white, with gamepad joystick)
# 2 = Sun by Sirea (yellow, with round joystick)
# 3 = Keen by Gerstrong (multicolor, with round joystick)
TouchscreenKeysTheme=1
# Redefine gamepad keys to SDL keysyms, button order is:
# A B X Y L1 R1 L2 R2 LThumb RThumb
RedefinedKeysGamepad="RETURN RSHIFT TAB TAB RSHIFT RETURN"
# How long to show startup menu button, in msec, 0 to disable startup menu
StartupMenuButtonTimeout=0
# Menu items to hide from startup menu, available menu items:
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout
HiddenMenuOptions=''
# Menu items to show at startup - this is Java code snippet, leave empty for default
# new SettingsMenuMisc.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new SettingsMenuMouse.DisplaySizeConfig(true) : new SettingsMenu.DummyMenu()), new SettingsMenuMisc.OptionalDownloadConfig(true), new SettingsMenuMisc.GyroscopeCalibration()
# Available menu items:
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout
FirstStartMenuOptions=''
# Enable multi-ABI binary, with hardware FPU support - it will also work on old devices,
# but .apk size is 2x bigger (y) / (n) / (x86) / (all)
MultiABI=all
# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower
AppMinimumRAM=0
# Optional shared libraries to compile - removing some of them will save space
# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed
# 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
CompiledLibraries="sdl_image sdl_mixer"
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
CustomBuildScript=n
# Aditional CFLAGS for application
AppCflags='-O2 -finline-functions -D__MACTYPES__ --include jni/application/android_debug.h'
# Additional LDFLAGS for application
AppLdflags=''
# If application has headers with the same name as system headers, this option tries to fix compiler flags to make it compilable
AppOverlapsSystemHeaders=
# Build only following subdirs (empty will build all dirs, ignored with custom script)
AppSubdirsBuild='src/src src/src/cdogs src/src/json src/src/missions src/src/tinydir src/src/cdogs/hqx/src'
# Exclude these files from build
AppBuildExclude='src/src/cdogsed.c src/src/cdogs/hqx/src/hqx.c'
# Application command line parameters, including app name as 0-th param
AppCmdline='cdogs --fullscreen --screen=800x480'
# Screen size is used by Google Play to prevent an app to be installed on devices with smaller screens
# Minimum screen size that application supports: (s)mall / (m)edium / (l)arge
MinimumScreenSize=s
# Your AdMob Publisher ID, (n) if you don't want advertisements
AdmobPublisherId=n
# Your AdMob test device ID, to receive a test ad
AdmobTestDeviceId=
# Your AdMob banner size (BANNER/IAB_BANNER/IAB_LEADERBOARD/IAB_MRECT/IAB_WIDE_SKYSCRAPER/SMART_BANNER)
AdmobBannerSize=

View File

@@ -0,0 +1,14 @@
#!/bin/sh
echo "Patching..."
[ -e src/patched.flag ] || { patch -p1 -d src < android.diff && touch src/patched.flag || exit 1 ; }
echo "Archiving data"
mkdir -p AndroidData
cd src
#git submodule update --init --recursive
cmake . -DCDOGS_DATA_DIR=\"./\" || { echo "Please install cmake: sudo apt-get install cmake" ; exit 1 ; } || exit 1
zip -r ../AndroidData/data.zip doc dogfights graphics missions music sounds >/dev/null
exit 0

View File

@@ -0,0 +1,38 @@
diff --git a/src/cdogs/files.h b/src/cdogs/files.h
index 2a231df..b42ce0d 100644
--- a/src/cdogs/files.h
+++ b/src/cdogs/files.h
@@ -81,6 +81,8 @@ ssize_t f_read(FILE *f, void *buf, size_t size);
ssize_t f_read32(FILE *f, void *buf, size_t size);
ssize_t f_read16(FILE *f, void *buf, size_t size);
+#undef swap32
+#undef swap16
void swap32 (void *d);
void swap16 (void *d);
diff --git a/src/json/json.c b/src/json/json.c
index fb928d4..be53ea8 100644
--- a/src/json/json.c
+++ b/src/json/json.c
@@ -26,6 +26,7 @@
#include <assert.h>
#include <memory.h>
#include <sys/types.h>
+#include <limits.h>
enum LEX_VALUE
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c44844e..3d1170d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -95,7 +95,7 @@ else()
endif()
endif()
-set(CDOGS_DATA_DIR "../")
+set(CDOGS_DATA_DIR "./")
set(CDOGS_CFG_DIR ".cdogs/")
SET(SOURCE_DIRECTORY ".")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".")

View File

@@ -0,0 +1 @@
src/build/linux/cdogs-icon.48.png

View File

@@ -0,0 +1,9 @@
Quick compilation guide for Debian/Ubuntu (Windows is not supported, MacOsX should be okay though):
Download SDL Git repo from https://github.com/pelya/commandergenius,
install latest Android SDK, Android NDK r8b or newer, and "ant" tool (sudo apt-get install ant),
then launch commands:
git submodule update --init --recursive project/jni/application/c-dogs/src
rm project/jni/application/src
ln -s c-dogs project/jni/application/src
./build.sh
That should do it.

View File

@@ -7,10 +7,10 @@ AppName="Commander Genius"
AppFullName=net.sourceforge.clonekeenplus
# Application version code (integer)
AppVersionCode=207010
AppVersionCode=198700
# Application user-visible version name (string)
AppVersionName="2.0.7 Release"
AppVersionName="1.9.8.7 Beta"
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu
@@ -18,7 +18,7 @@ AppVersionName="2.0.7 Release"
# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir -
# these files are put inside .apk package by build system
# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS
AppDataDownloadUrl="!Games Center|gamecatalogue.zip^!Keen1|keen1.zip^!Keen4|keen4.zip^High-quality GFX and music - 55 Mb|http://sourceforge.net/projects/clonekeenplus/files/High%20Quality%20Packs/Version%202.x/hqpv26.zip/download"
AppDataDownloadUrl="!Games Center|gamecatalogue.zip^!Keen1|keen1.zip^!Keen4|keen4.zip^!Python3 support - 20 Mb|http://sourceforge.net/projects/clonekeenplus/files/extras/python35-assets-android.zip/download ^High-quality GFX and music - 55 Mb|http://sourceforge.net/projects/clonekeenplus/files/High%20Quality%20Packs/Version%202.x/hqpv26.zip/download"
# Reset SDL config when updating application to the new version (y) / (n)
ResetSdlConfigForThisVersion=y
@@ -201,38 +201,33 @@ FirstStartMenuOptions=''
# Enable multi-ABI binary, with hardware FPU support - it will also work on old devices,
# but .apk size is 2x bigger (y) / (n) / (x86) / (all)
MultiABI='armeabi-v7a'
#MultiABI='y'
MultiABI='x86'
# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower
AppMinimumRAM=64
# Optional shared libraries to compile - removing some of them will save space
# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed
# 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
CompiledLibraries="sdl_image sdl_mixer boost_system crypto ssl curl vorbis 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 python3 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
CompiledLibraries="sdl_image boost_system crypto ssl curl vorbis ogg python3"
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
CustomBuildScript=n
# Aditional CFLAGS for application
AppCflags='-frtti -fexceptions -finline-functions -DOGG=1 -DUSE_FILE32API -DDOWNLOADER=1 -DANDROID=1 -DREFKEEN_VER_KDREAMS -DGRMODE=EGAGR -DREFKEEN_VER_KDREAMS_ANYEGA_ALL -DIOAPI_NO_64 -DBUILD_TYPE=LINUX -DTARGET_LNX=1 -DNOTYPESAVE -Werror=strict-aliasing -Werror=cast-align -Werror=pointer-arith -Werror=address -std=c99 -Ijni/../jni/application/commandergenius/commandergenius/GsKit -Ijni/vorbis/include/vorbis -Ijni/curl/include'
# Aditional CXXFLAGS for application
AppCppflags='-frtti -fexceptions -finline-functions -DOGG=1 -DUSE_FILE32API -DDOWNLOADER=1 -DANDROID=1 -DREFKEEN_VER_KDREAMS -DGRMODE=EGAGR -DREFKEEN_VER_KDREAMS_ANYEGA_ALL -DIOAPI_NO_64 -DBUILD_TYPE=LINUX -DTARGET_LNX=1 -DNOTYPESAVE -Werror=strict-aliasing -Werror=cast-align -Werror=pointer-arith -Werror=address -std=c++14 -Ijni/../jni/application/commandergenius/commandergenius/GsKit -Ijni/vorbis/include/vorbis -Ijni/curl/include'
AppCflags='-frtti -fexceptions -finline-functions -DOGG=1 -DDOWNLOADER=1 -DANDROID=1 -DREFKEEN_VER_KDREAMS -DUSE_PYTHON3=1 -DGRMODE=EGAGR -DREFKEEN_VER_KDREAMS_ANYEGA_ALL -DIOAPI_NO_64 -DBUILD_TYPE=LINUX -DTARGET_LNX=1 -DNOTYPESAVE -Werror=strict-aliasing -Werror=cast-align -Werror=pointer-arith -Werror=address -std=c++11 -Ijni/../jni/application/commandergenius/commandergenius/lib/GsKit -Ijni/vorbis/include/vorbis -Ijni/curl/include -Ijni/python3/include/python3.5m'
# Additional LDFLAGS for application
#AppLdflags='-ltremor'
#AppLdflags='-lvorbis -logg -lcrypto -lssl -lcurl'
#AppLdflags='-lz -lvorbis -logg'
AppLdflags='-lz'
AppLdflags='-lz -lvorbis -logg -lpython3 -lpython3.5m'
# If application has headers with the same name as system headers, this option tries to fix compiler flags to make it compilable
AppOverlapsSystemHeaders=
# Build only following subdirs (empty will build all dirs, ignored with custom script)
AppSubdirsBuild='commandergenius/src/* commandergenius/GsKit/*'
AppSubdirsBuild='commandergenius/src/* commandergenius/lib/*'
# Exclude these files from build
AppBuildExclude='commandergenius/src/engine/dbfusion'

View File

@@ -1 +0,0 @@
#!/bin/sh

View File

@@ -25,8 +25,8 @@ InhibitSuspend=n
# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped
# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir -
# these files are put inside .apk package by build system
# Using 'https://' URLs, since http connections to SF.net do not work anymore
AppDataDownloadUrl="!Heroes 2 DEMO (45 Mb) - required if you don't own full version|https://sourceforge.net/projects/libsdl-android/files/FreeHeroes2/h2demo.zip/download^!MIDI music support (18 Mb)|https://sourceforge.net/projects/libsdl-android/files/timidity.zip/download^!Essential map pack (9 Mb)|https://sourceforge.net/projects/libsdl-android/files/FreeHeroes2/EssentialMapPack.zip/download^!T-800 Mod Compaign|https://sourceforge.net/projects/libsdl-android/files/FreeHeroes2/fheroes2_cam_v1.zip/download^Additional map pack (95 Mb)|https://sourceforge.net/projects/libsdl-android/files/FreeHeroes2/AdditionalMapPack.zip/download^Mega map pack (280 Mb)|https://sourceforge.net/projects/libsdl-android/files/FreeHeroes2/MegaMapPack.zip/download^!Engine files|data13.zip^!Engine fonts|data-cfg-fonts.zip^Russian translation|:fheroes2.cfg:fheroes2-ru.cfg^Czech translation|:fheroes2.cfg:fheroes2-cs.cfg^Spanish translation|:fheroes2.cfg:fheroes2-es.cfg^French translation|:fheroes2.cfg:fheroes2-fr.cfg^Hungarian translation|:fheroes2.cfg:fheroes2-hu.cfg^Polish translation|:fheroes2.cfg:fheroes2-pl.cfg^Portugese translation|:fheroes2.cfg:fheroes2-pt_BR.cfg^Swedish translation|:fheroes2.cfg:fheroes2-sv.cfg"
# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS
AppDataDownloadUrl="!Heroes 2 DEMO (45 Mb) - required if you don't own full version|http://sourceforge.net/projects/libsdl-android/files/FreeHeroes2/h2demo.zip/download^!MIDI music support (18 Mb)|http://sourceforge.net/projects/libsdl-android/files/timidity.zip/download^!Essential map pack (9 Mb)|http://sourceforge.net/projects/libsdl-android/files/FreeHeroes2/EssentialMapPack.zip/download^!T-800 Mod Compaign|http://sourceforge.net/projects/libsdl-android/files/FreeHeroes2/fheroes2_cam_v1.zip/download^Additional map pack (95 Mb)|http://sourceforge.net/projects/libsdl-android/files/FreeHeroes2/AdditionalMapPack.zip/download^Mega map pack (280 Mb)|http://sourceforge.net/projects/libsdl-android/files/FreeHeroes2/MegaMapPack.zip/download^!Engine files|data13.zip^!Engine fonts|data-cfg-fonts.zip^Russian translation|:fheroes2.cfg:fheroes2-ru.cfg^Czech translation|:fheroes2.cfg:fheroes2-cs.cfg^Spanish translation|:fheroes2.cfg:fheroes2-es.cfg^French translation|:fheroes2.cfg:fheroes2-fr.cfg^Hungarian translation|:fheroes2.cfg:fheroes2-hu.cfg^Polish translation|:fheroes2.cfg:fheroes2-pl.cfg^Portugese translation|:fheroes2.cfg:fheroes2-pt_BR.cfg^Swedish translation|:fheroes2.cfg:fheroes2-sv.cfg"
# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only
# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32)
@@ -180,10 +180,10 @@ MultiABI=n
AppMinimumRAM=32
# Application version code (integer)
AppVersionCode=327841
AppVersionCode=327821
# Application user-visible version name (string)
AppVersionName="3278.41"
AppVersionName="3278.21"
# Reset SDL config when updating application to the new version (y) / (n)
ResetSdlConfigForThisVersion=n
@@ -194,7 +194,7 @@ DeleteFilesOnUpgrade="libsdl-DownloadFinished-5.flag libsdl-DownloadFinished-6.f
# Optional shared libraries to compile - removing some of them will save space
# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed
# 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
CompiledLibraries="c++_shared sdl_mixer sdl_image sdl_ttf sdl_net png intl"
CompiledLibraries="sdl_mixer sdl_image sdl_ttf sdl_net png intl"
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
CustomBuildScript=n

View File

@@ -0,0 +1,7 @@
#!/bin/sh
LOCAL_PATH=`dirname $0`
LOCAL_PATH=`cd $LOCAL_PATH && pwd`
$LOCAL_PATH/setEnvironment.sh ./configure --host=arm-eabi "$@"

View File

@@ -0,0 +1,288 @@
# The application settings for Android libSDL port
# Specify application name (e.x. My Application)
AppName="LBreakout2"
# Specify reversed site name of application (e.x. com.mysite.myapp)
AppFullName=net.sourceforge.lgames.lbreakout2
# Application version code (integer)
AppVersionCode=26501
# Application user-visible version name (string)
AppVersionName="2.6.5.01"
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu
# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped
# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir -
# these files are put inside .apk package by build system
# You can specify Google Play expansion files in the form 'obb:main.12345' or 'obb:patch.12345' where 12345 is the app version, first associated with the file
AppDataDownloadUrl="!App data size is 5 Mb|https://sourceforge.net/projects/libsdl-android/files/LBreakout2/lbreakout2-2.6.1-data.zip/download|http://sites.google.com/site/xpelyax/Home/lbreakout2-2.6.1-data.zip?attredirects=0&d=1|http://sitesproxy.goapk.com/site/xpelyax/Home/lbreakout2-2.6.1-data.zip"
# Reset SDL config when updating application to the new version (y) / (n)
ResetSdlConfigForThisVersion=n
# Delete application data files when upgrading (specify file/dir paths separated by spaces)
DeleteFilesOnUpgrade=""
# Here you may type readme text, which will be shown during startup. Format is:
# Text in English, use \\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/
ReadmeText='^You may press "Home" now - the data will be downloaded in background'
# libSDL version to use (1.2/1.3/2.0)
LibSdlVersion=1.2
# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape
ScreenOrientation=h
# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only
# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32)
VideoDepthBpp=16
# Enable OpenGL depth buffer (needed only for 3-d applications, small speed decrease) (y) or (n)
NeedDepthBuffer=n
# Enable OpenGL stencil buffer (needed only for 3-d applications, small speed decrease) (y) or (n)
NeedStencilBuffer=
# Try to use GLES 2.x context - will revert to GLES 1.X if unsupported by device
# you need this option only if you're developing 3-d app (y) or (n)
NeedGles2=
# Use glshim library for provide OpenGL 1.x functionality to OpenGL ES accelerated cards (y) or (n)
UseGlshim=
# Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL,
# this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n)
SwVideoMode=
# Application video output will be resized to fit into native device screen (y)/(n)
SdlVideoResize=y
# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n)
SdlVideoResizeKeepAspect=n
# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer
InhibitSuspend=y
# Create Android service, so the app is less likely to be killed while in background
CreateService=
# Application does not call SDL_Flip() or SDL_UpdateRects() appropriately, or draws from non-main thread -
# enabling the compatibility mode will force screen update every 100 milliseconds, which is laggy and inefficient (y) or (n)
CompatibilityHacksForceScreenUpdate=
# Application does not call SDL_Flip() or SDL_UpdateRects() after mouse click (ScummVM and all Amiga emulators do that) -
# force screen update by moving mouse cursor a little after each click (y) or (n)
CompatibilityHacksForceScreenUpdateMouseClick=y
# Application initializes SDL audio/video inside static constructors (which is bad, you won't be able to run ndk-gdb) (y)/(n)
CompatibilityHacksStaticInit=
# On-screen Android soft text input emulates hardware keyboard, this will only work with Hackers Keyboard app (y)/(n)
CompatibilityHacksTextInputEmulatesHwKeyboard=y
# Built-in text input keyboards with custom layouts for emulators, requires CompatibilityHacksTextInputEmulatesHwKeyboard=y
# 0 or empty - standard Android keyboard
# 1 - Simple QWERTY keyboard, no function keys, no arrow keys
# 2 - Commodore 64 keyboard
# 3 - Amiga keyboard
# 4 - Atari800 keyboard
TextInputKeyboard=
# Hack for broken devices: prevent audio chopping, by sleeping a bit after pushing each audio chunk (y)/(n)
CompatibilityHacksPreventAudioChopping=
# Hack for broken apps: application ignores audio buffer size returned by SDL (y)/(n)
CompatibilityHacksAppIgnoresAudioBufferSize=
# Hack for VCMI: preload additional shared libraries before aplication start
CompatibilityHacksAdditionalPreloadedSharedLibraries=""
# Hack for Free Heroes 2, which redraws the screen inside SDL_PumpEvents(): slow and compatible SDL event queue -
# do not use it with accelerometer/gyroscope, or your app may freeze at random (y)/(n)
CompatibilityHacksSlowCompatibleEventQueue=
# Save and restore OpenGL state when drawing on-screen keyboard for apps that use SDL_OPENGL
CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState=
# Application uses SDL_UpdateRects() properly, and does not draw in any region outside those rects.
# This improves drawing speed, but I know only one application that does that, and it's written by me (y)/(n)
CompatibilityHacksProperUsageOfSDL_UpdateRects=
# Application uses mouse (y) or (n), this will show mouse emulation dialog to the user
AppUsesMouse=y
# Application needs two-button mouse, will also enable advanced point-and-click features (y) or (n)
AppNeedsTwoButtonMouse=y
# Right mouse button can do long-press/drag&drop action, necessary for some games (y) or (n)
# If you disable it, swiping with two fingers will send mouse wheel events
RightMouseButtonLongPress=
# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n)
ShowMouseCursor=
# Screen follows mouse cursor, when it's covered by soft keyboard, this works only in software video mode (y) or (n)
ScreenFollowsMouse=
# Generate more touch events, by default SDL generates one event per one video frame, this is useful for drawing apps (y) or (n)
GenerateSubframeTouchEvents=
# Force relative (laptop) mouse movement mode, useful when both on-screen keyboard and mouse are needed (y) or (n)
ForceRelativeMouseMode=
# Show on-screen dpad/joystick, that will act as arrow keys (y) or (n)
AppNeedsArrowKeys=n
# On-screen dpad/joystick will appear under finger when it touches the screen (y) or (n)
# Joystick always follows finger, so moving mouse requires touching the screen with other finger
FloatingScreenJoystick=
# Application needs text input (y) or (n), enables button for text input on screen
AppNeedsTextInput=y
# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1
# This will disable AppNeedsArrowKeys option
AppUsesJoystick=n
# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n)
AppUsesSecondJoystick=n
# Application uses third on-screen joystick, as SDL joystick 0 axes 20-21 (y)/(n)
AppUsesThirdJoystick=
# Application uses accelerometer (y) or (n), the accelerometer will be used as joystick 1 axes 0-1 and 5-7
AppUsesAccelerometer=
# Application uses gyroscope (y) or (n), the gyroscope will be used as joystick 1 axes 2-4
AppUsesGyroscope=
# Application uses orientation sensor (y) or (n), reported as joystick 1 axes 8-10
AppUsesOrientationSensor=
# Use gyroscope to move mouse cursor (y) or (n), it eats battery, and can be disabled in settings, do not use with AppUsesGyroscope setting
MoveMouseWithGyroscope=
# Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0
AppUsesMultitouch=n
# Application records audio (it will use any available source, such a s microphone)
# API is defined in file SDL_android.h: int SDL_ANDROID_OpenAudioRecording(SDL_AudioSpec *spec); void SDL_ANDROID_CloseAudioRecording(void);
# This option will add additional permission to Android manifest (y)/(n)
AppRecordsAudio=
# Application needs to access SD card. If your data files are bigger than 5 Mb, enable it. (y) / (n)
AccessSdCard=
# Application needs Internet access. If you disable it, you'll have to bundle all your data files inside .apk (y) / (n)
AccessInternet=
# Immersive mode - Android will hide on-screen Home/Back keys. Looks bad if you invoke Android keyboard. (y) / (n)
ImmersiveMode=
# Application implements Android-specific routines to put to background, and will not draw anything to screen
# between SDL_ACTIVEEVENT lost / gained notifications - you should check for them
# rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n)
# This option is reported to be buggy, sometimes failing to restore video state
NonBlockingSwapBuffers=y
# Redefine common hardware keys to SDL keysyms
# BACK hardware key is available on all devices, MENU is available on pre-ICS devices, other keys may be absent
# SEARCH and CALL by default return same keycode as DPAD_CENTER - one of those keys is available on most devices
# Use word NO_REMAP if you want to preserve native functionality for certain key (volume keys are 3-rd and 4-th)
# Keys: TOUCHSCREEN (works only when AppUsesMouse=n), DPAD_CENTER/SEARCH, VOLUMEUP, VOLUMEDOWN, MENU, BACK, CAMERA
RedefinedKeys="RETURN SPACE NO_REMAP NO_REMAP"
# Number of virtual keyboard keys (currently 6 is maximum)
AppTouchscreenKeyboardKeysAmount=0
# Redefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom in/out and rotate left/right)
RedefinedKeysScreenKb="RETURN SPACE PAGEUP PAGEDOWN"
# Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separated by spaces, they are used in SDL config menu
RedefinedKeysScreenKbNames=""
# On-screen keys theme
# 0 = Ultimate Droid by Sean Stieber (green, with cross joystick)
# 1 = Simple Theme by Beholder (white, with cross joystick)
# 2 = Sun by Sirea (yellow, with round joystick)
# 3 = Keen by Gerstrong (multicolor, with round joystick)
# 4 = Retro by Santiago Radeff (red/white, with cross joystick)
# 5 = GameBoy from RetroArch
# 6 = PlayStation from RetroArch
# 7 = SuperNintendo from RetroArch
# 8 = DualShock from RetroArch
# 9 = Nintendo64 from RetroArch
TouchscreenKeysTheme=2
# Redefine gamepad keys to SDL keysyms, button order is:
# A B X Y L1 R1 L2 R2 LThumb RThumb
RedefinedKeysGamepad=""
# How long to show startup menu button, in msec, 0 to disable startup menu
StartupMenuButtonTimeout=3000
# Menu items to hide from startup menu, available menu items:
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.CommandlineConfig SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout SettingsMenuKeyboard.ScreenKeyboardAdvanced
HiddenMenuOptions='SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMouse.DisplaySizeConfig'
# Menu items to show at startup - this is Java code snippet, leave empty for default
# new SettingsMenuMisc.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new SettingsMenuMouse.DisplaySizeConfig(true) : new SettingsMenu.DummyMenu()), new SettingsMenuMisc.OptionalDownloadConfig(true), new SettingsMenuMisc.GyroscopeCalibration()
# Available menu items:
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.CommandlineConfig SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout SettingsMenuKeyboard.ScreenKeyboardAdvanced
FirstStartMenuOptions=''
# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower
AppMinimumRAM=256
# GCC version, 4.6 (default) or 4.8, CLANG is not supported yet
NDK_TOOLCHAIN_VERSION=
# Specify architectures to compile, 'all' or 'y' to compile for all architectures.
# Available architectures: armeabi armeabi-v7a armeabi-v7a-hard x86 mips
MultiABI='armeabi'
# Optional shared libraries to compile - removing some of them will save space
# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed
# 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
CompiledLibraries="sdl_mixer sdl_image sdl_net intl"
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
CustomBuildScript=y
# Aditional CFLAGS for application
AppCflags='-DHAVE_CONFIG_H -finline-functions -O2'
# Additional LDFLAGS for application
AppLdflags=''
# If application has headers with the same name as system headers, this option tries to fix compiler flags to make it compilable
AppOverlapsSystemHeaders=
# Build only following subdirs (empty will build all dirs, ignored with custom script)
AppSubdirsBuild='src/dummy'
# Exclude these files from build
AppBuildExclude=''
# Application command line parameters, including app name as 0-th param
AppCmdline=''
# Screen size is used by Google Play to prevent an app to be installed on devices with smaller screens
# Minimum screen size that application supports: (s)mall / (m)edium / (l)arge
MinimumScreenSize=
# Your AdMob Publisher ID, (n) if you don't want advertisements
AdmobPublisherId=
# Your AdMob test device ID, to receive a test ad
AdmobTestDeviceId=
# Your AdMob banner size (BANNER/FULL_BANNER/LEADERBOARD/MEDIUM_RECTANGLE/SMART_BANNER/WIDE_SKYSCRAPER/FULL_WIDTH:Height/Width:AUTO_HEIGHT/Width:Height)
AdmobBannerSize=
# Google Play Game Services application ID, required for cloud saves to work
GooglePlayGameServicesId=

View File

@@ -0,0 +1,15 @@
#!/bin/sh
LOCAL_PATH=`dirname $0`
LOCAL_PATH=`cd $LOCAL_PATH && pwd`
ln -sf libsdl_mixer.so $LOCAL_PATH/../../../obj/local/$1/libSDL_mixer.so
ln -sf libsdl_net.so $LOCAL_PATH/../../../obj/local/$1/libSDL_net.so
cd lbreakout2-2.6.5
if [ \! -f Makefile ] ; then
../../setEnvironment.sh ./configure --host=$2 --disable-install --enable-sdl-net LIBS=-lintl
fi
rm -f ../libapplication.so
make
mv -f client/lbreakout2 ../libapplication.so

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -1,316 +0,0 @@
# The application settings for Android libSDL port
# Specify application name (e.x. My Application)
AppName="OpenLiero"
# Specify reversed site name of application (e.x. com.mysite.myapp)
AppFullName=open.liero.be
# Application version code (integer)
AppVersionCode=13706
# Application user-visible version name (string)
AppVersionName="1.37.06"
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu
# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped
# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir -
# these files are put inside .apk package by build system
# You can specify Google Play expansion files in the form 'obb:main.12345' or 'obb:patch.12345' where 12345 is the app version, first associated with the file
AppDataDownloadUrl="!!Game data|data.zip"
# Reset SDL config when updating application to the new version (y) / (n)
ResetSdlConfigForThisVersion=y
# Delete application data files when upgrading (specify file/dir paths separated by spaces)
DeleteFilesOnUpgrade="libsdl-DownloadFinished-0.flag"
# Here you may type readme text, which will be shown during startup. Format is:
# Text in English, use \\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/
ReadmeText='This game is best played with a gamepad. Two-player mode requires two gamepads.^tv:'
# libSDL version to use (1.2/1.3/2.0)
LibSdlVersion=1.2
# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape
ScreenOrientation=h
# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only
# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32)
VideoDepthBpp=16
# Enable OpenGL depth buffer (needed only for 3-d applications, small speed decrease) (y) or (n)
NeedDepthBuffer=n
# Enable OpenGL stencil buffer (needed only for 3-d applications, small speed decrease) (y) or (n)
NeedStencilBuffer=n
# Use GLES 2.x context
# you need this option only if you're developing 3-d app (y) or (n)
NeedGles2=n
# Use GLES 3.x context
# you need this option only if you're developing 3-d app (y) or (n)
NeedGles3=n
# Use gl4es library for provide OpenGL 1.x functionality to OpenGL ES accelerated cards (y) or (n)
UseGl4es=
# Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL,
# this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n)
SwVideoMode=y
# Application video output will be resized to fit into native device screen (y)/(n)
SdlVideoResize=y
# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n)
SdlVideoResizeKeepAspect=n
# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer
InhibitSuspend=y
# Create Android service, so the app is less likely to be killed while in background
CreateService=
# Application does not call SDL_Flip() or SDL_UpdateRects() appropriately, or draws from non-main thread -
# enabling the compatibility mode will force screen update every 100 milliseconds, which is laggy and inefficient (y) or (n)
CompatibilityHacksForceScreenUpdate=n
# Application does not call SDL_Flip() or SDL_UpdateRects() after mouse click (ScummVM and all Amiga emulators do that) -
# force screen update by moving mouse cursor a little after each click (y) or (n)
CompatibilityHacksForceScreenUpdateMouseClick=n
# Application initializes SDL audio/video inside static constructors (which is bad, you won't be able to run ndk-gdb) (y)/(n)
CompatibilityHacksStaticInit=n
# On-screen Android soft text input emulates hardware keyboard, this will only work with Hackers Keyboard app (y)/(n)
CompatibilityHacksTextInputEmulatesHwKeyboard=n
# Built-in text input keyboards with custom layouts for emulators, requires CompatibilityHacksTextInputEmulatesHwKeyboard=y
# 0 or empty - standard Android keyboard
# 1 - Simple QWERTY keyboard, no function keys, no arrow keys
# 2 - Commodore 64 keyboard
# 3 - Amiga keyboard
# 4 - Atari800 keyboard
TextInputKeyboard=
# Hack for broken devices: prevent audio chopping, by sleeping a bit after pushing each audio chunk (y)/(n)
CompatibilityHacksPreventAudioChopping=n
# Hack for broken apps: application ignores audio buffer size returned by SDL (y)/(n)
CompatibilityHacksAppIgnoresAudioBufferSize=n
# Hack for VCMI: preload additional shared libraries before aplication start
CompatibilityHacksAdditionalPreloadedSharedLibraries=""
# Hack for Free Heroes 2, which redraws the screen inside SDL_PumpEvents(): slow and compatible SDL event queue -
# do not use it with accelerometer/gyroscope, or your app may freeze at random (y)/(n)
CompatibilityHacksSlowCompatibleEventQueue=n
# Save and restore OpenGL state when drawing on-screen keyboard for apps that use SDL_OPENGL
CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState=n
# Application uses SDL_UpdateRects() properly, and does not draw in any region outside those rects.
# This improves drawing speed, but I know only one application that does that, and it's written by me (y)/(n)
CompatibilityHacksProperUsageOfSDL_UpdateRects=
# Application uses mouse (y) or (n), this will show mouse emulation dialog to the user
AppUsesMouse=y
# Application needs two-button mouse, will also enable advanced point-and-click features (y) or (n)
AppNeedsTwoButtonMouse=n
# Right mouse button can do long-press/drag&drop action, necessary for some games (y) or (n)
# If you disable it, swiping with two fingers will send mouse wheel events
RightMouseButtonLongPress=n
# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n)
ShowMouseCursor=n
# Screen follows mouse cursor, when it's covered by soft keyboard, this works only in software video mode (y) or (n)
ScreenFollowsMouse=n
# Generate more touch events, by default SDL generates one event per one video frame, this is useful for drawing apps (y) or (n)
GenerateSubframeTouchEvents=n
# Force relative (laptop) mouse movement mode, useful when both on-screen keyboard and mouse are needed (y) or (n)
ForceRelativeMouseMode=n
# Show on-screen dpad/joystick, that will act as arrow keys (y) or (n)
AppNeedsArrowKeys=y
# On-screen dpad/joystick will appear under finger when it touches the screen (y) or (n)
# Joystick always follows finger, so moving mouse requires touching the screen with other finger
FloatingScreenJoystick=n
# Application needs text input (y) or (n), enables button for text input on screen
AppNeedsTextInput=n
# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1
# This will disable AppNeedsArrowKeys option
AppUsesJoystick=n
# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n)
AppUsesSecondJoystick=n
# Application uses third on-screen joystick, as SDL joystick 0 axes 20-21 (y)/(n)
AppUsesThirdJoystick=n
# Application uses accelerometer (y) or (n), the accelerometer will be used as joystick 1 axes 0-1 and 5-7
AppUsesAccelerometer=n
# Application uses gyroscope (y) or (n), the gyroscope will be used as joystick 1 axes 2-4
AppUsesGyroscope=n
# Application uses orientation sensor (y) or (n), reported as joystick 1 axes 8-10
AppUsesOrientationSensor=n
# Use gyroscope to move mouse cursor (y) or (n), it eats battery, and can be disabled in settings, do not use with AppUsesGyroscope setting
MoveMouseWithGyroscope=n
# Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0
AppUsesMultitouch=n
# Application records audio (it will use any available source, such a s microphone)
# API is defined in file SDL_android.h: int SDL_ANDROID_OpenAudioRecording(SDL_AudioSpec *spec); void SDL_ANDROID_CloseAudioRecording(void);
# This option will add additional permission to Android manifest (y)/(n)
AppRecordsAudio=n
# Application needs to access SD card. Always disable it, unless you want to access user photos and downloads. (y) / (n)
AccessSdCard=n
# Application needs Internet access. If you disable it, you'll have to bundle all your data files inside .apk (y) / (n)
AccessInternet=y
# Immersive mode - Android will hide on-screen Home/Back keys. Looks bad if you invoke Android keyboard. (y) / (n)
ImmersiveMode=y
# Hide Android system mouse cursor image when USB mouse is attached (y) or (n) - the app must draw it's own mouse cursor
HideSystemMousePointer=y
# Application implements Android-specific routines to put to background, and will not draw anything to screen
# between SDL_ACTIVEEVENT lost / gained notifications - you should check for them
# rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n)
# This option is reported to be buggy, sometimes failing to restore video state
NonBlockingSwapBuffers=n
# Redefine common hardware keys to SDL keysyms
# BACK hardware key is available on all devices, MENU is available on pre-ICS devices, other keys may be absent
# SEARCH and CALL by default return same keycode as DPAD_CENTER - one of those keys is available on most devices
# Use word NO_REMAP if you want to preserve native functionality for certain key (volume keys are 3-rd and 4-th)
# Keys: TOUCHSCREEN (works only when AppUsesMouse=n), DPAD_CENTER/SEARCH, VOLUMEUP, VOLUMEDOWN, MENU, BACK, CAMERA
RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP"
# Number of virtual keyboard keys (currently 6 is maximum)
AppTouchscreenKeyboardKeysAmount=5
# Redefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom in/out and rotate left/right)
RedefinedKeysScreenKb="RSHIFT SLASH RCTRL RETURN RALT"
# Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separated by spaces, they are used in SDL config menu
RedefinedKeysScreenKbNames="Jump Rope Fire Dig Change"
# On-screen keys theme
# 0 = Ultimate Droid by Sean Stieber (green, with cross joystick)
# 1 = Simple Theme by Beholder (white, with cross joystick)
# 2 = Sun by Sirea (yellow, with round joystick)
# 3 = Keen by Gerstrong (multicolor, with round joystick)
# 4 = Retro by Santiago Radeff (red/white, with cross joystick)
# 5 = GameBoy from RetroArch
# 6 = PlayStation from RetroArch
# 7 = SuperNintendo from RetroArch
# 8 = DualShock from RetroArch
# 9 = Nintendo64 from RetroArch
TouchscreenKeysTheme=3
# Redefine gamepad keys to SDL keysyms, button order is:
# A B X Y L1 R1 L2 R2 LThumb RThumb Start Select Up Down Left Right
RedefinedKeysGamepad="RETURN RSHIFT RCTRL RALT RSHIFT RALT SLASH RCTRL RETURN RETURN ESCAPE ESCAPE UP DOWN LEFT RIGHT"
# Redefine keys for the second gamepad, same as the first gamepad if not set:
RedefinedKeysSecondGamepad="TAB LALT LCTRL LSHIFT LALT LSHIFT BACKQUOTE LCTRL TAB TAB ESCAPE ESCAPE R F D G"
# Redefine keys for the third gamepad, same as the first gamepad if not set:
RedefinedKeysThirdGamepad=""
# Redefine keys for the fourth gamepad, same as the first gamepad if not set:
RedefinedKeysFourthGamepad=""
# How long to show startup menu button, in msec, 0 to disable startup menu
StartupMenuButtonTimeout=3000
# Menu items to hide from startup menu, available menu items:
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.CommandlineConfig SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout SettingsMenuKeyboard.ScreenKeyboardAdvanced
HiddenMenuOptions='SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMouse.DisplaySizeConfig'
# Menu items to show at startup - this is Java code snippet, leave empty for default
# new SettingsMenuMisc.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new SettingsMenuMouse.DisplaySizeConfig(true) : new SettingsMenu.DummyMenu()), new SettingsMenuMisc.OptionalDownloadConfig(true), new SettingsMenuMisc.GyroscopeCalibration()
# Available menu items:
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.CommandlineConfig SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout SettingsMenuKeyboard.ScreenKeyboardAdvanced
FirstStartMenuOptions='SettingsMenuMisc.ShowReadme'
# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower
AppMinimumRAM=0
# GCC version, or 'clang' for CLANG
NDK_TOOLCHAIN_VERSION=
# Android platform version.
# android-9 = Android 2.3, the earliest supported version.
# android-18 = Android 4.3, the first version supporting GLES3.
# android-21 = Android 5.1, the first version with SO_REUSEPORT defined.
APP_PLATFORM=android-21
# Specify architectures to compile, 'all' or 'y' to compile for all architectures.
# Available architectures: armeabi armeabi-v7a x86 mips arm64-v8a
MultiABI='armeabi-v7a x86 arm64-v8a'
# Optional shared libraries to compile - removing some of them will save space
# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed
# 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
CompiledLibraries=""
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
CustomBuildScript=n
# Aditional CFLAGS for application
AppCflags='-O3 -ffast-math -Werror=format -flto'
# Aditional C++-specific compiler flags for application, added after AppCflags
AppCppflags='-O3 -ffast-math -Werror=format -flto -std=c++11 -frtti -fexceptions'
# Additional LDFLAGS for application
AppLdflags='-flto'
# If application has headers with the same name as system headers, this option tries to fix compiler flags to make it compilable
AppOverlapsSystemHeaders=n
# Build only following subdirs (empty will build all dirs, ignored with custom script)
AppSubdirsBuild='src src/mixer src/gfx src/gvl/zlib/miniz.c src/gvl/system/system.c src/gvl/support src/gvl/io2 src/gvl/containers src/ai src/controller src/menu'
# Exclude these files from build
AppBuildExclude='src/common_exereader.cpp src/common_writer.cpp src/tc_tool_main.cpp src/videotest.c src/bench.cpp src/bench_format.cpp src/tools_main.cpp src/replay_to_video.cpp src/video_recorder.c'
# Application command line parameters, including app name as 0-th param
AppCmdline=''
# Screen size is used by Google Play to prevent an app to be installed on devices with smaller screens
# Minimum screen size that application supports: (s)mall / (m)edium / (l)arge
MinimumScreenSize=n
# Your AdMob Publisher ID, (n) if you don't want advertisements
AdmobPublisherId=n
# Your AdMob test device ID, to receive a test ad
AdmobTestDeviceId=
# Your AdMob banner size (BANNER/FULL_BANNER/LEADERBOARD/MEDIUM_RECTANGLE/SMART_BANNER/WIDE_SKYSCRAPER/FULL_WIDTH:Height/Width:AUTO_HEIGHT/Width:Height)
AdmobBannerSize=
# Google Play Game Services application ID, required for cloud saves to work
GooglePlayGameServicesId=
# The app will open files with following extension, file path will be added to commandline params
AppOpenFileExtension=''

View File

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

View File

@@ -1 +0,0 @@
../banner.png

View File

@@ -1 +0,0 @@
src/data/banner.png

View File

@@ -1 +0,0 @@
src/data/icon.png

View File

@@ -1,13 +0,0 @@
diff --git a/project/java/Globals.java b/project/java/Globals.java
index 2f2e8a77d..47eec2430 100644
--- a/project/java/Globals.java
+++ b/project/java/Globals.java
@@ -137,7 +137,7 @@ class Globals
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 VideoLinearFilter = false;
public static boolean MultiThreadedVideo = false;
public static boolean OuyaEmulation = false; // For debugging

View File

@@ -7,10 +7,10 @@ AppName="Ninslash"
AppFullName=ninslash.com
# Application version code (integer)
AppVersionCode=03231
AppVersionCode=02219
# Application user-visible version name (string)
AppVersionName="0.3.2.31"
AppVersionName="0.2.2.19"
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu
@@ -21,10 +21,10 @@ AppVersionName="0.3.2.31"
AppDataDownloadUrl="!!Game data|data.zip"
# Reset SDL config when updating application to the new version (y) / (n)
ResetSdlConfigForThisVersion=n
ResetSdlConfigForThisVersion=y
# Delete application data files when upgrading (specify file/dir paths separated by spaces)
DeleteFilesOnUpgrade="libsdl-DownloadFinished-0.flag data"
DeleteFilesOnUpgrade="libsdl-DownloadFinished-0.flag .ninslash/settings.cfg"
# Here you may type readme text, which will be shown during startup. Format is:
# Text in English, use \\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/
@@ -54,8 +54,8 @@ NeedGles2=y
# you need this option only if you're developing 3-d app (y) or (n)
NeedGles3=n
# Use gl4es library for provide OpenGL 1.x functionality to OpenGL ES accelerated cards (y) or (n)
UseGl4es=
# Use glshim library for provide OpenGL 1.x functionality to OpenGL ES accelerated cards (y) or (n)
UseGlshim=
# Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL,
# this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n)
@@ -186,9 +186,6 @@ AccessInternet=y
# Immersive mode - Android will hide on-screen Home/Back keys. Looks bad if you invoke Android keyboard. (y) / (n)
ImmersiveMode=y
# Hide Android system mouse cursor image when USB mouse is attached (y) or (n) - the app must draw it's own mouse cursor
HideSystemMousePointer=y
# Application implements Android-specific routines to put to background, and will not draw anything to screen
# between SDL_ACTIVEEVENT lost / gained notifications - you should check for them
# rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n)
@@ -229,7 +226,7 @@ TouchscreenKeysTheme=2
RedefinedKeysGamepad="LCTRL M Q TAB SPACE MOUSE_LEFT MOUSE_RIGHT E SPACE E"
# How long to show startup menu button, in msec, 0 to disable startup menu
StartupMenuButtonTimeout=0
StartupMenuButtonTimeout=3000
# Menu items to hide from startup menu, available menu items:
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.CommandlineConfig SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout SettingsMenuKeyboard.ScreenKeyboardAdvanced
@@ -255,7 +252,7 @@ APP_PLATFORM=android-21
# Specify architectures to compile, 'all' or 'y' to compile for all architectures.
# Available architectures: armeabi armeabi-v7a x86 mips arm64-v8a
MultiABI='armeabi-v7a x86 arm64-v8a'
MultiABI='armeabi-v7a x86'
# Optional shared libraries to compile - removing some of them will save space
# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed
@@ -266,13 +263,13 @@ CompiledLibraries="sdl_image freetype glu"
CustomBuildScript=n
# Aditional CFLAGS for application
AppCflags='-O2 -Werror=format -isystem jni/application/src/src/src/base/android'
AppCflags='-O2 -Werror=format -isystem jni/application/src/src/src/base/android' # -flto
# Aditional C++-specific compiler flags for application, added after AppCflags
AppCppflags='-std=c++11'
# Additional LDFLAGS for application
AppLdflags='-lEGL'
AppLdflags='-lEGL' # -flto
# If application has headers with the same name as system headers, this option tries to fix compiler flags to make it compilable
AppOverlapsSystemHeaders=n

View File

@@ -20,13 +20,15 @@ python datasrc/compile.py server_content_header > src/game/generated/server_data
python scripts/cmd5.py src/engine/shared/protocol.h src/game/generated/protocol.h src/game/tuning.h src/game/gamecore.cpp src/game/generated/protocol.h > src/game/generated/nethash.cpp
}
echo "Archiving data"
mkdir -p ../AndroidData
ln -sf ../src/logo.png ../AndroidData
rm -f ../AndroidData/data.zip
zip -r ../AndroidData/data.zip data *.txt *.cfg "example configs" cfg >/dev/null
zip -r ../AndroidData/data.zip data *.txt *.cfg "example configs" >/dev/null
for ARCH in armeabi-v7a x86 arm64-v8a; do
for ARCH in armeabi-v7a x86; do
[ -e ../AndroidData/binaries-$ARCH.zip ] && \
find `cat ../server-sources.txt` -cnewer ../AndroidData/binaries-$ARCH.zip | \
[ `wc -c` -eq 0 ] && continue

View File

@@ -1,6 +1,5 @@
src/game/server/*.cpp
src/game/server/*/*.cpp
src/game/server/*/*/*.cpp
src/game/*.cpp
src/engine/server/*.cpp
src/engine/shared/*.cpp

View File

@@ -1 +0,0 @@
/AndroidData/data.zip.xz

View File

@@ -1,317 +0,0 @@
# The application settings for Android libSDL port
# Specify application name (e.x. My Application)
AppName="OpenLieroX"
# Specify reversed site name of application (e.x. com.mysite.myapp)
AppFullName=openlierox.net
# Application version code (integer)
AppVersionCode=10580526
# Application user-visible version name (string)
AppVersionName="0.58rc5a26"
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu
# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped
# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir -
# these files are put inside .apk package by build system
# You can specify Google Play expansion files in the form 'obb:main.12345' or 'obb:patch.12345' where 12345 is the app version, first associated with the file
AppDataDownloadUrl="!!Game data|data.zip.xz"
# Reset SDL config when updating application to the new version (y) / (n)
ResetSdlConfigForThisVersion=y
# Delete application data files when upgrading (specify file/dir paths separated by spaces)
DeleteFilesOnUpgrade="libsdl-DownloadFinished-0.flag"
# Here you may type readme text, which will be shown during startup. Format is:
# Text in English, use \\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/
ReadmeText='This game is best played with a gamepad. Two-player mode requires two gamepads. Tap the screen to dig.^tv:'
# libSDL version to use (1.2/1.3/2.0)
LibSdlVersion=1.2
# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape
ScreenOrientation=h
# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only
# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32)
VideoDepthBpp=16
# Enable OpenGL depth buffer (needed only for 3-d applications, small speed decrease) (y) or (n)
NeedDepthBuffer=n
# Enable OpenGL stencil buffer (needed only for 3-d applications, small speed decrease) (y) or (n)
NeedStencilBuffer=n
# Use GLES 2.x context
# you need this option only if you're developing 3-d app (y) or (n)
NeedGles2=n
# Use GLES 3.x context
# you need this option only if you're developing 3-d app (y) or (n)
NeedGles3=n
# Use gl4es library for provide OpenGL 1.x functionality to OpenGL ES accelerated cards (y) or (n)
UseGl4es=
# Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL,
# this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n)
SwVideoMode=y
# Application video output will be resized to fit into native device screen (y)/(n)
SdlVideoResize=y
# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n)
SdlVideoResizeKeepAspect=n
# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer
InhibitSuspend=y
# Create Android service, so the app is less likely to be killed while in background
CreateService=
# Application does not call SDL_Flip() or SDL_UpdateRects() appropriately, or draws from non-main thread -
# enabling the compatibility mode will force screen update every 100 milliseconds, which is laggy and inefficient (y) or (n)
CompatibilityHacksForceScreenUpdate=n
# Application does not call SDL_Flip() or SDL_UpdateRects() after mouse click (ScummVM and all Amiga emulators do that) -
# force screen update by moving mouse cursor a little after each click (y) or (n)
CompatibilityHacksForceScreenUpdateMouseClick=n
# Application initializes SDL audio/video inside static constructors (which is bad, you won't be able to run ndk-gdb) (y)/(n)
CompatibilityHacksStaticInit=n
# On-screen Android soft text input emulates hardware keyboard, this will only work with Hackers Keyboard app (y)/(n)
CompatibilityHacksTextInputEmulatesHwKeyboard=n
# Built-in text input keyboards with custom layouts for emulators, requires CompatibilityHacksTextInputEmulatesHwKeyboard=y
# 0 or empty - standard Android keyboard
# 1 - Simple QWERTY keyboard, no function keys, no arrow keys
# 2 - Commodore 64 keyboard
# 3 - Amiga keyboard
# 4 - Atari800 keyboard
TextInputKeyboard=
# Hack for broken devices: prevent audio chopping, by sleeping a bit after pushing each audio chunk (y)/(n)
CompatibilityHacksPreventAudioChopping=n
# Hack for broken apps: application ignores audio buffer size returned by SDL (y)/(n)
CompatibilityHacksAppIgnoresAudioBufferSize=n
# Hack for VCMI: preload additional shared libraries before aplication start
CompatibilityHacksAdditionalPreloadedSharedLibraries=""
# Hack for Free Heroes 2, which redraws the screen inside SDL_PumpEvents(): slow and compatible SDL event queue -
# do not use it with accelerometer/gyroscope, or your app may freeze at random (y)/(n)
CompatibilityHacksSlowCompatibleEventQueue=n
# Save and restore OpenGL state when drawing on-screen keyboard for apps that use SDL_OPENGL
CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState=n
# Application uses SDL_UpdateRects() properly, and does not draw in any region outside those rects.
# This improves drawing speed, but I know only one application that does that, and it's written by me (y)/(n)
CompatibilityHacksProperUsageOfSDL_UpdateRects=
# Application uses mouse (y) or (n), this will show mouse emulation dialog to the user
AppUsesMouse=y
# Application needs two-button mouse, will also enable advanced point-and-click features (y) or (n)
AppNeedsTwoButtonMouse=n
# Right mouse button can do long-press/drag&drop action, necessary for some games (y) or (n)
# If you disable it, swiping with two fingers will send mouse wheel events
RightMouseButtonLongPress=n
# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n)
ShowMouseCursor=n
# Screen follows mouse cursor, when it's covered by soft keyboard, this works only in software video mode (y) or (n)
ScreenFollowsMouse=n
# Generate more touch events, by default SDL generates one event per one video frame, this is useful for drawing apps (y) or (n)
GenerateSubframeTouchEvents=n
# Force relative (laptop) mouse movement mode, useful when both on-screen keyboard and mouse are needed (y) or (n)
ForceRelativeMouseMode=n
# Show on-screen dpad/joystick, that will act as arrow keys (y) or (n)
AppNeedsArrowKeys=n
# On-screen dpad/joystick will appear under finger when it touches the screen (y) or (n)
# Joystick always follows finger, so moving mouse requires touching the screen with other finger
FloatingScreenJoystick=n
# Application needs text input (y) or (n), enables button for text input on screen
AppNeedsTextInput=n
# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1
# This will disable AppNeedsArrowKeys option
AppUsesJoystick=y
# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n)
AppUsesSecondJoystick=n
# Application uses third on-screen joystick, as SDL joystick 0 axes 20-21 (y)/(n)
AppUsesThirdJoystick=n
# Application uses accelerometer (y) or (n), the accelerometer will be used as joystick 1 axes 0-1 and 5-7
AppUsesAccelerometer=n
# Application uses gyroscope (y) or (n), the gyroscope will be used as joystick 1 axes 2-4
AppUsesGyroscope=n
# Application uses orientation sensor (y) or (n), reported as joystick 1 axes 8-10
AppUsesOrientationSensor=n
# Use gyroscope to move mouse cursor (y) or (n), it eats battery, and can be disabled in settings, do not use with AppUsesGyroscope setting
MoveMouseWithGyroscope=n
# Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0
AppUsesMultitouch=n
# Application records audio (it will use any available source, such a s microphone)
# API is defined in file SDL_android.h: int SDL_ANDROID_OpenAudioRecording(SDL_AudioSpec *spec); void SDL_ANDROID_CloseAudioRecording(void);
# This option will add additional permission to Android manifest (y)/(n)
AppRecordsAudio=n
# Application needs to access SD card. Always disable it, unless you want to access user photos and downloads. (y) / (n)
AccessSdCard=n
# Application needs Internet access. If you disable it, you'll have to bundle all your data files inside .apk (y) / (n)
AccessInternet=y
# Immersive mode - Android will hide on-screen Home/Back keys. Looks bad if you invoke Android keyboard. (y) / (n)
ImmersiveMode=y
# Hide Android system mouse cursor image when USB mouse is attached (y) or (n) - the app must draw it's own mouse cursor
HideSystemMousePointer=y
# Application implements Android-specific routines to put to background, and will not draw anything to screen
# between SDL_ACTIVEEVENT lost / gained notifications - you should check for them
# rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n)
# This option is reported to be buggy, sometimes failing to restore video state
NonBlockingSwapBuffers=n
# Redefine common hardware keys to SDL keysyms
# BACK hardware key is available on all devices, MENU is available on pre-ICS devices, other keys may be absent
# SEARCH and CALL by default return same keycode as DPAD_CENTER - one of those keys is available on most devices
# Use word NO_REMAP if you want to preserve native functionality for certain key (volume keys are 3-rd and 4-th)
# Keys: TOUCHSCREEN (works only when AppUsesMouse=n), DPAD_CENTER/SEARCH, VOLUMEUP, VOLUMEDOWN, MENU, BACK, CAMERA
RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP"
# Number of virtual keyboard keys (currently 6 is maximum)
AppTouchscreenKeyboardKeysAmount=4
# Redefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom in/out and rotate left/right)
RedefinedKeysScreenKb="LALT X LCTRL LSHIFT I"
# Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separated by spaces, they are used in SDL config menu
RedefinedKeysScreenKbNames="Jump Rope Shoot SelectWeapon Chat"
# On-screen keys theme
# 0 = Ultimate Droid by Sean Stieber (green, with cross joystick)
# 1 = Simple Theme by Beholder (white, with cross joystick)
# 2 = Sun by Sirea (yellow, with round joystick)
# 3 = Keen by Gerstrong (multicolor, with round joystick)
# 4 = Retro by Santiago Radeff (red/white, with cross joystick)
# 5 = GameBoy from RetroArch
# 6 = PlayStation from RetroArch
# 7 = SuperNintendo from RetroArch
# 8 = DualShock from RetroArch
# 9 = Nintendo64 from RetroArch
TouchscreenKeysTheme=3
# Redefine gamepad keys to SDL keysyms, button order is:
# A B X Y L1 R1 L2 R2 LThumb RThumb Start Select Up Down Left Right
RedefinedKeysGamepad="A LALT LCTRL X LALT LSHIFT X LCTRL LSHIFT 1 ESCAPE ESCAPE UP DOWN LEFT RIGHT UP DOWN LEFT RIGHT 2 3 4 5"
# Redefine keys for the second gamepad, same as the first gamepad if not set:
RedefinedKeysSecondGamepad="KP_DIVIDE KP_ENTER KP_PLUS KP_MINUS KP_ENTER KP_0 KP_MINUS KP_PLUS KP_0 6 ESCAPE ESCAPE KP_8 KP_5 KP_4 KP_6 KP_8 KP_5 KP_4 KP_6 7 8 9 0"
# Redefine keys for the third gamepad, same as the first gamepad if not set:
RedefinedKeysThirdGamepad=""
# Redefine keys for the fourth gamepad, same as the first gamepad if not set:
RedefinedKeysFourthGamepad=""
# How long to show startup menu button, in msec, 0 to disable startup menu
StartupMenuButtonTimeout=1000
# Menu items to hide from startup menu, available menu items:
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.CommandlineConfig SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout SettingsMenuKeyboard.ScreenKeyboardAdvanced
HiddenMenuOptions='SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMouse.DisplaySizeConfig'
# Menu items to show at startup - this is Java code snippet, leave empty for default
# new SettingsMenuMisc.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new SettingsMenuMouse.DisplaySizeConfig(true) : new SettingsMenu.DummyMenu()), new SettingsMenuMisc.OptionalDownloadConfig(true), new SettingsMenuMisc.GyroscopeCalibration()
# Available menu items:
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.CommandlineConfig SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout SettingsMenuKeyboard.ScreenKeyboardAdvanced
FirstStartMenuOptions='SettingsMenuMisc.ShowReadme'
# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower
AppMinimumRAM=0
# GCC version, or 'clang' for CLANG
NDK_TOOLCHAIN_VERSION=clang
# Android platform version.
# android-9 = Android 2.3, the earliest supported version.
# android-18 = Android 4.3, the first version supporting GLES3.
# android-21 = Android 5.1, the first version with SO_REUSEPORT defined.
APP_PLATFORM=android-21
# Specify architectures to compile, 'all' or 'y' to compile for all architectures.
# Available architectures: armeabi armeabi-v7a x86 mips arm64-v8a
MultiABI='armeabi-v7a arm64-v8a x86 x86_64' # arm64-v8a x86 x86_64
# Optional shared libraries to compile - removing some of them will save space
# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed
# 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
CompiledLibraries="sdl_image sdl_mixer xml2 curl ssl crypto gd jpeg vorbis ogg lzma mad"
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
CustomBuildScript=n
# Aditional CFLAGS for application
AppCflags='-O3 -ffast-math -Werror=format -DDISABLE_JOYSTICK -DHAVE_LINENOISE -DNBREAKPAD -DHAVE_EXECINFO=0' # -flto=thin
# Aditional C++-specific compiler flags for application, added after AppCflags
AppCppflags='-O3 -ffast-math -Werror=format -std=c++11 -frtti -fexceptions -DDISABLE_JOYSTICK -DHAVE_LINENOISE -DNBREAKPAD -DHAVE_EXECINFO=0' #-flto=thin
# Additional LDFLAGS for application
AppLdflags='-O3' #-flto=thin -flto-jobs=8
# If application has headers with the same name as system headers, this option tries to fix compiler flags to make it compilable
AppOverlapsSystemHeaders=n
# Build only following subdirs (empty will build all dirs, ignored with custom script)
# src/src/game/* src/src/gui/* src/src/gusanos/* src/src/level/* src/src/utils/*
AppSubdirsBuild='src/include src/src src/src/client/* src/src/common/* src/src/server/* src/libs/hawknl/include src/libs/hawknl/src src/libs/libzip src/libs/linenoise src/libs/lua src/libs/pstreams'
# Exclude these files from build
AppBuildExclude='src/libs/hawknl/src/ipx.c src/libs/linenoise/example.c'
# Application command line parameters, including app name as 0-th param
AppCmdline=''
# Screen size is used by Google Play to prevent an app to be installed on devices with smaller screens
# Minimum screen size that application supports: (s)mall / (m)edium / (l)arge
MinimumScreenSize=n
# Your AdMob Publisher ID, (n) if you don't want advertisements
AdmobPublisherId=n
# Your AdMob test device ID, to receive a test ad
AdmobTestDeviceId=
# Your AdMob banner size (BANNER/FULL_BANNER/LEADERBOARD/MEDIUM_RECTANGLE/SMART_BANNER/WIDE_SKYSCRAPER/FULL_WIDTH:Height/Width:AUTO_HEIGHT/Width:Height)
AdmobBannerSize=
# Google Play Game Services application ID, required for cloud saves to work
GooglePlayGameServicesId=
# The app will open files with following extension, file path will be added to commandline params
AppOpenFileExtension=''

View File

@@ -1 +0,0 @@
../src/share/gamedir/data/gfx/console.png

View File

@@ -1,11 +0,0 @@
#!/bin/sh
cp -f liero.raw ../../../res/raw/
[ -e AndroidData/data.zip.xz ] && exit 0
cd src/share/gamedir
rm -f ../data.zip
zip -0 -r ../data.zip .
cd ../../..
xz -9 < src/share/data.zip > AndroidData/data.zip.xz
rm -f src/share/data.zip

View File

@@ -1 +0,0 @@
src/share/tv-banner.png

View File

@@ -1 +0,0 @@
src/share/android-icon.png

View File

@@ -1,131 +0,0 @@
diff --git a/project/java/Settings.java b/project/java/Settings.java
index 9e6150a..09ade66 100644
--- a/project/java/Settings.java
+++ b/project/java/Settings.java
@@ -736,7 +736,7 @@ public class Settings
if( Globals.TouchscreenKeyboardTheme == 2 )
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.sun));
if( Globals.TouchscreenKeyboardTheme == 3 )
- nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.keen));
+ nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.liero));
if( Globals.TouchscreenKeyboardTheme == 4 )
nativeSetupScreenKeyboardButtons(loadRaw(p, R.raw.retro));
if( Globals.TouchscreenKeyboardTheme == 5 )
--- /dev/null 2018-12-13 18:37:19.876000065 +0200
+++ Connect.java 2018-12-17 21:16:01.027001714 +0200
@@ -0,0 +1,115 @@
+/*
+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 openlierox.net;
+
+import android.app.Activity;
+import android.app.Service;
+import android.content.Context;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.view.MotionEvent;
+import android.view.KeyEvent;
+import android.view.Window;
+import android.view.WindowManager;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+import android.widget.EditText;
+import android.text.Editable;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.FrameLayout;
+import android.graphics.drawable.Drawable;
+import android.graphics.Color;
+import android.content.res.Configuration;
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.content.Intent;
+import android.view.View.OnKeyListener;
+import android.view.MenuItem;
+import android.view.Menu;
+import android.view.Gravity;
+import android.text.method.TextKeyListener;
+import java.util.LinkedList;
+import java.io.SequenceInputStream;
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.FileOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.zip.*;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import java.util.Set;
+import android.text.SpannedString;
+import java.io.BufferedReader;
+import java.io.BufferedInputStream;
+import java.io.InputStreamReader;
+import android.view.inputmethod.InputMethodManager;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.os.Handler;
+import android.os.Message;
+import android.os.SystemClock;
+import java.util.concurrent.Semaphore;
+import android.content.pm.ActivityInfo;
+import android.view.Display;
+import android.util.DisplayMetrics;
+import android.text.InputType;
+import android.util.Log;
+import android.view.Surface;
+import android.app.ProgressDialog;
+import android.app.KeyguardManager;
+import android.view.ViewTreeObserver;
+import android.graphics.Rect;
+import android.net.Uri;
+import android.content.ComponentName;
+
+
+public class Connect extends Activity
+{
+ @Override
+ protected void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+
+ Intent main = new Intent(this, MainActivity.class);
+ main.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ if( getIntent().getScheme() != null && getIntent().getScheme().equals("openlierox") && getIntent().getData() != null && getIntent().getData().getHost().equals("connect") )
+ {
+ main.putExtra(RestartMainActivity.SDL_RESTART_PARAMS, getIntent().getData().getPath().replace("/","").replace("!",":"));
+ }
+ if( getIntent().getScheme() != null && getIntent().getScheme().equals("https") && getIntent().getData() != null && getIntent().getData().getPath().contains("connect") )
+ {
+ if( getIntent().getData().getQueryParameter("a") != null )
+ main.putExtra(RestartMainActivity.SDL_RESTART_PARAMS, getIntent().getData().getQueryParameter("a").replace("!",":"));
+ else
+ main.putExtra(RestartMainActivity.SDL_RESTART_PARAMS, getIntent().getData().getPath().replace("/connect/","").replace("!",":"));
+ }
+ startActivity(main);
+ finish();
+ }
+}

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