diff --git a/project/jni/application/openttd/AndroidAppSettings.cfg b/project/jni/application/openttd/AndroidAppSettings.cfg new file mode 100644 index 000000000..f37b1b642 --- /dev/null +++ b/project/jni/application/openttd/AndroidAppSettings.cfg @@ -0,0 +1,33 @@ +# The application settings for Android libSDL port +AppSettingVersion=15 +LibSdlVersion=1.2 +AppName="OpenTTD" +AppFullName=org.openttd.sdl +ScreenOrientation=h +InhibitSuspend=n +AppDataDownloadUrl="Data files size is 19 Mb|https://sites.google.com/site/andgamdev/openttd-1.0.4-data.zip?attredirects=0&d=1/download^OpenTTD fonts 4MB|https://sites.google.com/site/andgamdev/openttd-1.0.4-fonts-data.zip?attredirects=0&d=1^MIDI music support (18 Mb)|http://sourceforge.net/projects/libsdl-android/files/timidity.zip/download" +SdlVideoResize=y +SdlVideoResizeKeepAspect=n +NeedDepthBuffer=n +AppUsesMouse=y +AppNeedsTwoButtonMouse=n +AppNeedsArrowKeys=y +AppNeedsTextInput=y +AppUsesJoystick=n +AppHandlesJoystickSensitivity=n +AppUsesMultitouch=n +NonBlockingSwapBuffers=n +RedefinedKeys="LALT RETURN KP_PLUS KP_MINUS DELETE" +AppTouchscreenKeyboardKeysAmount=0 +AppTouchscreenKeyboardKeysAmountAutoFire=0 +MultiABI=n +AppVersionCode=10501 +AppVersionName="1.0.5.01" +CompiledLibraries="jpeg png freetype timidity lzma lzo2" +CustomBuildScript=y +AppCflags='' +AppLdflags='' +AppSubdirsBuild='' +AppUseCrystaXToolchain=y +AppCmdline='' +ReadmeText='^You may press "Home" now - the data will be downloaded in background' diff --git a/project/jni/application/openttd/AndroidBuild.sh b/project/jni/application/openttd/AndroidBuild.sh new file mode 100755 index 000000000..1b48651f7 --- /dev/null +++ b/project/jni/application/openttd/AndroidBuild.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +LOCAL_PATH=`dirname $0` +LOCAL_PATH=`cd $LOCAL_PATH && pwd` + + +# Uncomment if your configure expects SDL libraries in form "libSDL_name.so" +#ln -sf libtremor.a $LOCAL_PATH/../../../obj/local/armeabi/libvorbisidec.a +#ln -sf libflac.a $LOCAL_PATH/../../../obj/local/armeabi/libFLAC.a + +if [ \! -f openttd/objs/lang/english.lng ] ; then + sh -c "cd openttd && ./configure --without-freetype --without-png --without-zlib --without-lzma --without-lzo2 --endian=LE && make lang && make -C objs/release endian_target.h depend" + rm -f openttd/Makefile +fi + +if [ \! -f openttd/Makefile ] ; then + ../setEnvironment.sh sh -c "cd openttd && ./configure --host=arm-eabi --with-sdl --with-freetype=sdl-config --with-png --with-zlib --with-libtimidity=$LOCAL_PATH/../../../obj/local/armeabi/libtimidity.so --with-lzma=sdl-config --with-lzo2=$LOCAL_PATH/../../../obj/local/armeabi/liblzo2.so --prefix-dir='.' --data-dir='' --without-allegro --without-fontconfig --endian=LE" +fi +../setEnvironment.sh sh -c "cd openttd && make -j1 VERBOSE=1 LIBS='-lsdl-1.2 -llzo2 -lpng -ltimidity -lfreetype -lgcc -lz -lc -lstdc++'" && cp -f openttd/objs/release/openttd libapplication.so diff --git a/project/jni/application/openttd/icon.png b/project/jni/application/openttd/icon.png new file mode 100644 index 000000000..607f06043 Binary files /dev/null and b/project/jni/application/openttd/icon.png differ diff --git a/project/jni/application/openttd/libapplication.so b/project/jni/application/openttd/libapplication.so new file mode 100755 index 000000000..b55cf9f56 Binary files /dev/null and b/project/jni/application/openttd/libapplication.so differ diff --git a/project/jni/application/openttd/openttd b/project/jni/application/openttd/openttd new file mode 120000 index 000000000..0ef52a8a9 --- /dev/null +++ b/project/jni/application/openttd/openttd @@ -0,0 +1 @@ +../../../../../openttd/ \ No newline at end of file diff --git a/project/jni/application/openttd/openttd-1.0.4-android.patch b/project/jni/application/openttd/openttd-1.0.4-android.patch new file mode 100644 index 000000000..c98fb0e37 --- /dev/null +++ b/project/jni/application/openttd/openttd-1.0.4-android.patch @@ -0,0 +1,33 @@ +diff -ru orig/openttd-1.0.4/src/network/core/os_abstraction.h openttd-1.0.4/src/network/core/os_abstraction.h +--- orig/openttd-1.0.4/src/network/core/os_abstraction.h 2010-05-18 17:49:59.000000000 -0400 ++++ openttd-1.0.4/src/network/core/os_abstraction.h 2010-11-13 16:35:45.000000000 -0500 +@@ -159,7 +159,7 @@ + # include + /* According to glibc/NEWS, appeared in glibc-2.3. */ + # if !defined(__sgi__) && !defined(SUNOS) && !defined(__MORPHOS__) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__INNOTEK_LIBC__) \ +- && !(defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 2)) && !defined(__dietlibc__) && !defined(HPUX) ++ && !(defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 2)) && !defined(__dietlibc__) && !defined(HPUX) && !defined(ANDROID) + /* If for any reason ifaddrs.h does not exist on your system, comment out + * the following two lines and an alternative way will be used to fetch + * the list of IPs from the system. */ +diff -ru orig/openttd-1.0.4/src/os/unix/unix.cpp openttd-1.0.4/src/os/unix/unix.cpp +--- orig/openttd-1.0.4/src/os/unix/unix.cpp 2010-05-18 17:44:47.000000000 -0400 ++++ openttd-1.0.4/src/os/unix/unix.cpp 2010-11-13 18:06:14.000000000 -0500 +@@ -25,7 +25,7 @@ + #ifdef __APPLE__ + #include + #elif (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) || defined(__GLIBC__) +- #define HAS_STATVFS ++// #define HAS_STATVFS + #endif + + #ifdef HAS_STATVFS +@@ -239,6 +239,8 @@ + void cocoaReleaseAutoreleasePool(); + #endif + ++#include ++extern "C" int CDECL main(int, char *[]); + int CDECL main(int argc, char *argv[]) + { + int ret; diff --git a/project/jni/application/openttd/openttd-trunk-android.patch b/project/jni/application/openttd/openttd-trunk-android.patch new file mode 100644 index 000000000..6a5897f06 --- /dev/null +++ b/project/jni/application/openttd/openttd-trunk-android.patch @@ -0,0 +1,38 @@ +Index: src/os/unix/unix.cpp +=================================================================== +--- src/os/unix/unix.cpp (revision 21200) ++++ src/os/unix/unix.cpp (working copy) +@@ -24,7 +24,7 @@ + + #ifdef __APPLE__ + #include +-#elif (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) || defined(__GLIBC__) ++#elif ((defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) || defined(__GLIBC__)) && !defined(ANDROID) + #define HAS_STATVFS + #endif + +@@ -245,6 +245,11 @@ + void cocoaReleaseAutoreleasePool(); + #endif + ++#ifdef ANDROID ++#define main SDL_main ++extern "C" int CDECL main(int, char *[]); ++#endif ++ + int CDECL main(int argc, char *argv[]) + { + int ret; +Index: src/network/core/os_abstraction.h +=================================================================== +--- src/network/core/os_abstraction.h (revision 21200) ++++ src/network/core/os_abstraction.h (working copy) +@@ -161,7 +161,7 @@ + # include + /* According to glibc/NEWS, appeared in glibc-2.3. */ + # if !defined(__sgi__) && !defined(SUNOS) && !defined(__MORPHOS__) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__INNOTEK_LIBC__) \ +- && !(defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 2)) && !defined(__dietlibc__) && !defined(HPUX) ++ && !(defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 2)) && !defined(__dietlibc__) && !defined(HPUX) && !defined(ANDROID) + /* If for any reason ifaddrs.h does not exist on your system, comment out + * the following two lines and an alternative way will be used to fetch + * the list of IPs from the system. */