diff --git a/changeAppSettings.sh b/changeAppSettings.sh index 4f963bd4c..64778975c 100755 --- a/changeAppSettings.sh +++ b/changeAppSettings.sh @@ -396,7 +396,7 @@ echo "# android-21 = Android 5.1, the first version with SO_REUSEPORT defined." 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 armeabi-v7a x86 mips arm64-v8a" >> AndroidAppSettings.cfg +echo "# Available architectures: 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 diff --git a/project/jni/application/ballfield/AndroidAppSettings.cfg b/project/jni/application/ballfield/AndroidAppSettings.cfg index b418804af..43475006c 100644 --- a/project/jni/application/ballfield/AndroidAppSettings.cfg +++ b/project/jni/application/ballfield/AndroidAppSettings.cfg @@ -68,10 +68,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=n +InhibitSuspend=y # Create Android service, so the app is less likely to be killed while in background -CreateService=y +CreateService=n # 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) @@ -238,7 +238,7 @@ RedefinedKeysThirdGamepad="F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 PR RedefinedKeysFourthGamepad="KP0 KP1 KP2 KP3 KP4 KP5 KP6 KP7 KP8 KP9 KP_PERIOD KP_DIVIDE KP_MULTIPLY KP_MINUS KP_PLUS KP_ENTER" # How long to show startup menu button, in msec, 0 to disable startup menu -StartupMenuButtonTimeout=3000 +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 @@ -264,7 +264,7 @@ APP_PLATFORM= # 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' +MultiABI='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 @@ -275,13 +275,13 @@ CompiledLibraries="sdl_image" CustomBuildScript=n # Aditional CFLAGS for application -AppCflags='-O2 -finline-functions' +AppCflags='-O0' # Aditional C++-specific compiler flags for application, added after AppCflags -AppCppflags='' +AppCppflags='-frtti -fexceptions' # Additional LDFLAGS for application -AppLdflags='' +AppLdflags='-frtti -fexceptions' # If application has headers with the same name as system headers, this option tries to fix compiler flags to make it compilable AppOverlapsSystemHeaders= diff --git a/project/jni/application/ballfield/ballfield.cpp b/project/jni/application/ballfield/ballfield.cpp index 2d4348d91..61a90bad6 100644 --- a/project/jni/application/ballfield/ballfield.cpp +++ b/project/jni/application/ballfield/ballfield.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -129,7 +130,7 @@ SDL_Surface *clean_alpha(SDL_Surface *s) /* * Load and convert an antialiazed, zoomed set of sprites. */ -SDL_Surface *load_zoomed(char *name, int alpha) +SDL_Surface *load_zoomed(const char *name, int alpha) { SDL_Surface *sprites; SDL_Surface *temp = IMG_Load(name); @@ -295,7 +296,7 @@ static int ballfield_init_frames(ballfield_t *bf) } -int ballfield_load_gfx(ballfield_t *bf, char *name, unsigned int color) +int ballfield_load_gfx(ballfield_t *bf, const char *name, unsigned int color) { if(color >= COLORS) return -1; @@ -410,6 +411,16 @@ void tiled_back(SDL_Surface *back, SDL_Surface *screen, int xo, int yo) SDL_BlitSurface(back, NULL, screen, &r); } +void throw_something_more() +{ + throw std::runtime_error("Exception: whoops"); +} + +void throw_something() +{ + throw_something_more(); +} + /*---------------------------------------------------------- main() ----------------------------------------------------------*/ @@ -689,6 +700,11 @@ int main(int argc, char* argv[]) { 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); + try { + throw_something(); + } catch (const std::exception & e) { + __android_log_print(ANDROID_LOG_INFO, "Ballfield", "Got exception: %s", e.what()); + } } if(evt.key.keysym.sym == SDLK_1) { diff --git a/project/jni/application/openttd/AndroidAppSettings.cfg b/project/jni/application/openttd/AndroidAppSettings.cfg index 2c0c8bfc2..2effeb7c2 100644 --- a/project/jni/application/openttd/AndroidAppSettings.cfg +++ b/project/jni/application/openttd/AndroidAppSettings.cfg @@ -7,10 +7,10 @@ AppName="OpenTTD" AppFullName=org.openttd.sdl # Application version code (integer) -AppVersionCode=18075 +AppVersionCode=18076 # Application user-visible version name (string) -AppVersionName="1.8.0.75" +AppVersionName="1.8.0.76" # 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 @@ -243,7 +243,7 @@ AppMinimumRAM=0 NDK_TOOLCHAIN_VERSION=clang # Specify architectures to compile, 'all' or 'y' to compile for all architectures. -# Available architectures: armeabi armeabi-v7a x86 mips arm64-v8a x86_64 +# Available architectures: armeabi-v7a x86 arm64-v8a x86_64 MultiABI='armeabi-v7a x86 arm64-v8a x86_64' # Optional shared libraries to compile - removing some of them will save space diff --git a/project/jni/application/openttd/AndroidBuild.sh b/project/jni/application/openttd/AndroidBuild.sh index c4d960d23..bc21ae70e 100755 --- a/project/jni/application/openttd/AndroidBuild.sh +++ b/project/jni/application/openttd/AndroidBuild.sh @@ -26,12 +26,5 @@ CPU_TYPE=32 NCPU=4 uname -s | grep -i "linux" > /dev/null && NCPU=`cat /proc/cpuinfo | grep -c -i processor` -# clang arm hack -LIBATOMIC= -echo $1 | grep 'armeabi-v7a' && LIBATOMIC="-lunwind" +env CLANG=1 ../setEnvironment-$1.sh sh -c "cd openttd-$VER-$1 && make -j$NCPU VERBOSE=1 STRIP='' "' LIBS="-lsdl-1.2 -llzo2 -lpng -ltimidity -lfontconfig -lfreetype -lexpat-sdl -licui18n -liculx -licu-le-hb -lharfbuzz -licuuc -licudata $LDFLAGS"' && cp -f openttd-$VER-$1/objs/release/openttd libapplication-$1.so || exit 1 -LIBANDROIDSUPPORT= -[ "$1" = "armeabi-v7a" ] && LIBANDROIDSUPPORT="-landroid_support" -[ "$1" = "x86" ] && LIBANDROIDSUPPORT="-landroid_support" - -env CLANG=1 LIBATOMIC=$LIBATOMIC ../setEnvironment-$1.sh sh -c "cd openttd-$VER-$1 && make -j$NCPU VERBOSE=1 STRIP='' LIBS='-lsdl-1.2 -llzo2 -lpng -ltimidity -lfontconfig -lfreetype -lexpat-sdl -licui18n -liculx -licu-le-hb -lharfbuzz -licuuc -licudata -lgcc -lz -lc -lc++_static -lc++abi $LIBANDROIDSUPPORT $LIBATOMIC'" && cp -f openttd-$VER-$1/objs/release/openttd libapplication-$1.so || exit 1 diff --git a/project/jni/application/openttd/src b/project/jni/application/openttd/src index 39ba220ec..e3e91f53b 160000 --- a/project/jni/application/openttd/src +++ b/project/jni/application/openttd/src @@ -1 +1 @@ -Subproject commit 39ba220eca315ad0b9fae6833fdaaefa2d814d74 +Subproject commit e3e91f53bb927bfddb3ef9c06c1389f9e5ea2081 diff --git a/project/jni/application/setEnvironment-arm64-v8a.sh b/project/jni/application/setEnvironment-arm64-v8a.sh index a9759b36b..22d02f161 100755 --- a/project/jni/application/setEnvironment-arm64-v8a.sh +++ b/project/jni/application/setEnvironment-arm64-v8a.sh @@ -132,7 +132,7 @@ $NDK/toolchains/aarch64-linux-android-4.9/prebuilt/$MYARCH -target aarch64-none-linux-android -fpic ---sysroot $NDK/platforms/android-21/arch-arm64 +--sysroot $NDK/sysroot -isystem $NDK/sysroot/usr/include -isystem $NDK/sysroot/usr/include/aarch64-linux-android -D__ANDROID_API__=21 @@ -151,12 +151,13 @@ $APP_SHARED_LIBS -L$NDK/sources/android/support/../../cxx-stl/llvm-libc++/libs/$ARCH $NDK/sources/cxx-stl/llvm-libc++/libs/$ARCH/libc++_static.a $NDK/sources/cxx-stl/llvm-libc++abi/../llvm-libc++/libs/$ARCH/libc++abi.a +-lgcc -Wl,--exclude-libs,libgcc.a -latomic -Wl,--exclude-libs,libatomic.a -gcc-toolchain $NDK/toolchains/aarch64-linux-android-4.9/prebuilt/$MYARCH -target aarch64-none-linux-android -no-canonical-prefixes -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings --lc -lm -lstdc++ -ldl -llog -lz +-lc -lm -nostdlib++ -ldl -llog -lz $LDFLAGS" LDFLAGS="`echo $LDFLAGS | tr '\n' ' '`" diff --git a/project/jni/application/setEnvironment-armeabi-v7a.sh b/project/jni/application/setEnvironment-armeabi-v7a.sh index 0b8690f0e..55925d7c0 100755 --- a/project/jni/application/setEnvironment-armeabi-v7a.sh +++ b/project/jni/application/setEnvironment-armeabi-v7a.sh @@ -130,24 +130,24 @@ CFLAGS=" -gcc-toolchain $NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/$MYARCH -target -armv7-none-linux-androideabi15 +armv7-none-linux-androideabi18 -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -fpic -fno-integrated-as ---sysroot $NDK/platforms/android-14/arch-arm +--sysroot $NDK/sysroot -isystem $NDK/sysroot/usr/include -isystem $NDK/sysroot/usr/include/arm-linux-androideabi --D__ANDROID_API__=15 +-D__ANDROID_API__=18 $APP_MODULES_INCLUDE $CFLAGS" CFLAGS="`echo $CFLAGS | tr '\n' ' '`" LDFLAGS=" ---sysroot $NDK/platforms/android-14/arch-arm +--sysroot $NDK/platforms/android-18/arch-arm $SHARED $UNRESOLVED -L$LOCAL_PATH/../../obj/local/$ARCH $APP_SHARED_LIBS @@ -158,12 +158,13 @@ $NDK/sources/cxx-stl/llvm-libc++/libs/$ARCH/libc++_static.a $NDK/sources/cxx-stl/llvm-libc++abi/../llvm-libc++/libs/$ARCH/libc++abi.a $NDK/sources/android/support/../../cxx-stl/llvm-libc++/libs/$ARCH/libandroid_support.a $NDK/sources/cxx-stl/llvm-libc++/libs/$ARCH/libunwind.a +-lgcc -Wl,--exclude-libs,libgcc.a -latomic -Wl,--exclude-libs,libatomic.a -gcc-toolchain $NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/$MYARCH --no-canonical-prefixes -target armv7-none-linux-androideabi14 +-no-canonical-prefixes -target armv7-none-linux-androideabi18 -Wl,--fix-cortex-a8 -Wl,--exclude-libs,libunwind.a -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings --lc -lm -lstdc++ -ldl -llog -lz +-lc -lm -nostdlib++ -ldl -llog -lz $LDFLAGS" LDFLAGS="`echo $LDFLAGS | tr '\n' ' '`" diff --git a/project/jni/application/setEnvironment-x86.sh b/project/jni/application/setEnvironment-x86.sh index 73a2f88be..4b1b32288 100755 --- a/project/jni/application/setEnvironment-x86.sh +++ b/project/jni/application/setEnvironment-x86.sh @@ -133,17 +133,17 @@ $NDK/toolchains/x86-4.9/prebuilt/$MYARCH i686-none-linux-android -fPIC -mstackrealign ---sysroot $NDK/platforms/android-14/arch-x86 +--sysroot $NDK/sysroot -isystem $NDK/sysroot/usr/include -isystem $NDK/sysroot/usr/include/i686-linux-android --D__ANDROID_API__=15 +-D__ANDROID_API__=18 $APP_MODULES_INCLUDE $CFLAGS" CFLAGS="`echo $CFLAGS | tr '\n' ' '`" LDFLAGS=" ---sysroot $NDK/platforms/android-14/arch-x86 +--sysroot $NDK/platforms/android-18/arch-x86 $SHARED $UNRESOLVED -L$LOCAL_PATH/../../obj/local/$ARCH $APP_SHARED_LIBS @@ -153,12 +153,13 @@ $APP_SHARED_LIBS $NDK/sources/cxx-stl/llvm-libc++/libs/$ARCH/libc++_static.a $NDK/sources/cxx-stl/llvm-libc++abi/../llvm-libc++/libs/$ARCH/libc++abi.a $NDK/sources/android/support/../../cxx-stl/llvm-libc++/libs/$ARCH/libandroid_support.a +-lgcc -Wl,--exclude-libs,libgcc.a -latomic -Wl,--exclude-libs,libatomic.a -gcc-toolchain $NDK/toolchains/x86-4.9/prebuilt/$MYARCH -target i686-none-linux-android -no-canonical-prefixes -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings --lc -lm -lstdc++ -ldl -llog -lz +-lc -lm -nostdlib++ -ldl -llog -lz $LDFLAGS" LDFLAGS="`echo $LDFLAGS | tr '\n' ' '`" diff --git a/project/jni/application/setEnvironment-x86_64.sh b/project/jni/application/setEnvironment-x86_64.sh index 464292f69..76e15bcef 100755 --- a/project/jni/application/setEnvironment-x86_64.sh +++ b/project/jni/application/setEnvironment-x86_64.sh @@ -132,7 +132,7 @@ $NDK/toolchains/x86_64-4.9/prebuilt/$MYARCH -target x86_64-none-linux-android -fPIC ---sysroot $NDK/platforms/android-21/arch-x86_64 +--sysroot $NDK/sysroot -isystem $NDK/sysroot/usr/include -isystem $NDK/sysroot/usr/include/x86_64-linux-android -D__ANDROID_API__=21 @@ -151,12 +151,13 @@ $APP_SHARED_LIBS -L$NDK/sources/android/support/../../cxx-stl/llvm-libc++/libs/$ARCH $NDK/sources/cxx-stl/llvm-libc++/libs/$ARCH/libc++_static.a $NDK/sources/cxx-stl/llvm-libc++abi/../llvm-libc++/libs/$ARCH/libc++abi.a +-lgcc -Wl,--exclude-libs,libgcc.a -latomic -Wl,--exclude-libs,libatomic.a -gcc-toolchain $NDK/toolchains/x86_64-4.9/prebuilt/$MYARCH -target x86_64-none-linux-android -no-canonical-prefixes -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings --lc -lm -lstdc++ -ldl -llog -lz +-lc -lm -nostdlib++ -ldl -llog -lz $LDFLAGS" LDFLAGS="`echo $LDFLAGS | tr '\n' ' '`"