Skip to content

Commit

Permalink
Updated OpenTTD
Browse files Browse the repository at this point in the history
  • Loading branch information
pelya committed Mar 13, 2014
1 parent f128990 commit 744561a
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 108 deletions.
2 changes: 1 addition & 1 deletion project/jni/application/openttd/AndroidAppSettings.cfg
Expand Up @@ -209,7 +209,7 @@ 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="jpeg png freetype timidity lzma lzo2 icui18n iculx icule icudata icuuc"
CompiledLibraries="jpeg png freetype timidity expat fontconfig lzma lzo2 icui18n iculx icule icudata icuuc"

# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
CustomBuildScript=y
Expand Down
4 changes: 2 additions & 2 deletions project/jni/application/openttd/AndroidBuild.sh
Expand Up @@ -19,6 +19,6 @@ fi

export ARCH=$1
if [ \! -f openttd-$VER-$1/Makefile ] ; then
../setEnvironment-$1.sh sh -c "cd openttd-$VER-$1 && env ./configure --host=$2 --with-sdl --with-freetype=sdl-config --with-png --with-zlib --with-icu --with-libtimidity=$LOCAL_PATH/../../../obj/local/armeabi/libtimidity.so --with-lzo2=$LOCAL_PATH/../../../obj/local/armeabi/liblzo2.so --prefix-dir='.' --data-dir='' --without-allegro --without-fontconfig --with-lzma --endian=LE || echo 'Run: sudo apt-get install liblzma-dev - it is needed only for configure script'"
../setEnvironment-$1.sh sh -c "cd openttd-$VER-$1 && env ./configure --host=$2 --with-sdl --with-freetype=sdl-config --with-png --with-zlib --with-icu --with-libtimidity=$LOCAL_PATH/../../../obj/local/armeabi/libtimidity.so --with-lzo2=$LOCAL_PATH/../../../obj/local/armeabi/liblzo2.so --prefix-dir='.' --data-dir='' --without-allegro --with-fontconfig --with-lzma --endian=LE || echo 'Run: sudo apt-get install liblzma-dev - it is needed only for configure script'"
fi
../setEnvironment-$1.sh sh -c "cd openttd-$VER-$1 && make -j4 VERBOSE=1 STRIP='' LIBS='-lsdl-1.2 -llzo2 -lpng -ltimidity -lfreetype -licui18n -liculx -licule -licuuc -licudata -lgcc -lz -lc -lgnustl_static -lsupc++'" && cp -f openttd-$VER-$1/objs/release/openttd libapplication-$1.so
../setEnvironment-$1.sh sh -c "cd openttd-$VER-$1 && make -j4 VERBOSE=1 STRIP='' LIBS='-lsdl-1.2 -llzo2 -lpng -ltimidity -lfreetype -lfontconfig -lexpat -licui18n -liculx -licule -licuuc -licudata -lgcc -lz -lc -lgnustl_static -lsupc++'" && cp -f openttd-$VER-$1/objs/release/openttd libapplication-$1.so
129 changes: 85 additions & 44 deletions project/jni/application/openttd/openttd-trunk-android.patch
@@ -1,5 +1,15 @@
--- src/debug.cpp 2013-07-27 18:09:40.000000000 +0300
+++ src/debug.cpp 2013-08-01 19:17:24.013408999 +0300
--- findversion.sh 2014-02-25 11:17:27.000000000 +0200
+++ findversion.sh 2014-03-13 22:51:42.431059430 +0200
@@ -134,6 +134,7 @@
REV_NR=""
fi

+MODIFIED="0" # This prevents Andorid build from connecting to a public servers
if [ "$MODIFIED" -eq "2" ]; then
REV="${REV}M"
fi
--- src/debug.cpp 2014-02-25 11:17:24.000000000 +0200
+++ src/debug.cpp 2014-03-13 22:51:41.679014683 +0200
@@ -16,6 +16,9 @@
#include "string_func.h"
#include "fileio_func.h"
Expand All @@ -20,27 +30,8 @@
#if defined(ENABLE_NETWORK)
if (_debug_socket != INVALID_SOCKET) {
char buf2[1024 + 32];
--- src/fontdetection.cpp 2013-07-27 18:09:39.000000000 +0300
+++ src/fontdetection.cpp 2013-08-01 19:19:43.089408999 +0300
@@ -772,7 +772,15 @@
return ret;
}

-#else /* without WITH_FONTCONFIG */
+#elif defined(__ANDROID__) /* end if defined(WITH_FONTCONFIG) */
+FT_Error GetFontByFaceName(const char *font_name, FT_Face *face) {return FT_Err_Cannot_Open_Resource;}
+bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, int winlangid, MissingGlyphSearcher *callback)
+{
+ callback->SetFontNames(settings, "fonts/FreeSans.ttf"); /* We don't really have other fonts on Android, other than our own */
+ callback->FindMissingGlyphs(NULL);
+ return true;
+}
+#else /* end if defined(__ANDROID__) */
FT_Error GetFontByFaceName(const char *font_name, FT_Face *face) {return FT_Err_Cannot_Open_Resource;}
bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, int winlangid, MissingGlyphSearcher *callback) { return false; }
#endif /* WITH_FONTCONFIG */
--- src/music/libtimidity.cpp 2013-07-27 18:09:28.000000000 +0300
+++ src/music/libtimidity.cpp 2013-08-01 19:17:24.013408999 +0300
--- src/music/libtimidity.cpp 2014-02-25 11:17:00.000000000 +0200
+++ src/music/libtimidity.cpp 2014-03-13 22:51:41.711016587 +0200
@@ -13,6 +13,7 @@
#include "../openttd.h"
#include "../sound_type.h"
Expand Down Expand Up @@ -82,8 +73,8 @@

/** Factory for the libtimidity driver. */
static FMusicDriver_LibTimidity iFMusicDriver_LibTimidity;
--- src/network/core/os_abstraction.h 2013-07-27 18:09:36.000000000 +0300
+++ src/network/core/os_abstraction.h 2013-08-01 19:17:24.013408999 +0300
--- src/network/core/os_abstraction.h 2014-02-25 11:17:18.000000000 +0200
+++ src/network/core/os_abstraction.h 2014-03-13 22:51:42.427059192 +0200
@@ -161,7 +161,7 @@
# include <net/if.h>
/* According to glibc/NEWS, <ifaddrs.h> appeared in glibc-2.3. */
Expand All @@ -93,8 +84,8 @@
/* 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. */
--- src/os/unix/crashlog_unix.cpp 2013-07-27 18:09:32.000000000 +0300
+++ src/os/unix/crashlog_unix.cpp 2013-08-01 19:17:24.017408999 +0300
--- src/os/unix/crashlog_unix.cpp 2014-02-25 11:17:03.000000000 +0200
+++ src/os/unix/crashlog_unix.cpp 2014-03-13 22:51:42.427059192 +0200
@@ -141,7 +141,11 @@
};

Expand All @@ -107,8 +98,8 @@

/**
* Entry point for the crash handler.
--- src/os/unix/unix.cpp 2013-07-27 18:09:32.000000000 +0300
+++ src/os/unix/unix.cpp 2013-08-01 19:17:24.017408999 +0300
--- src/os/unix/unix.cpp 2014-02-25 11:17:03.000000000 +0200
+++ src/os/unix/unix.cpp 2014-03-13 22:51:42.427059192 +0200
@@ -25,7 +25,7 @@

#ifdef __APPLE__
Expand All @@ -130,9 +121,9 @@
int CDECL main(int argc, char *argv[])
{
int ret;
--- src/osk_gui.cpp 2013-07-27 18:09:40.000000000 +0300
+++ src/osk_gui.cpp 2013-08-01 19:17:24.017408999 +0300
@@ -21,6 +21,9 @@
--- src/osk_gui.cpp 2014-02-25 11:17:24.000000000 +0200
+++ src/osk_gui.cpp 2014-03-13 22:51:42.431059430 +0200
@@ -22,6 +22,9 @@

#include "table/sprites.h"
#include "table/strings.h"
Expand All @@ -142,7 +133,7 @@

char _keyboard_opt[2][OSK_KEYBOARD_ENTRIES * 4 + 1];
static WChar _keyboard[2][OSK_KEYBOARD_ENTRIES];
@@ -411,6 +414,16 @@
@@ -413,6 +416,16 @@

GetKeyboardLayout();
new OskWindow(&_osk_desc, parent, button);
Expand All @@ -159,8 +150,8 @@
}

/**
--- src/script/api/script_date.cpp 2013-07-27 18:09:35.000000000 +0300
+++ src/script/api/script_date.cpp 2013-08-01 19:17:24.017408999 +0300
--- src/script/api/script_date.cpp 2014-02-25 11:17:12.000000000 +0200
+++ src/script/api/script_date.cpp 2014-03-13 22:51:42.431059430 +0200
@@ -9,8 +9,8 @@

/** @file script_date.cpp Implementation of ScriptDate. */
Expand All @@ -171,8 +162,58 @@
#include "script_date.hpp"
#include "../../date_func.h"

--- src/sound/sdl_s.cpp 2013-07-27 18:09:28.000000000 +0300
+++ src/sound/sdl_s.cpp 2013-08-01 19:17:24.017408999 +0300
--- src/settings_gui.cpp 2014-02-25 11:17:23.000000000 +0200
+++ src/settings_gui.cpp 2014-03-13 23:01:22.521550369 +0200
@@ -323,17 +323,17 @@
switch (widget) {
case WID_GO_BASE_GRF_DESCRIPTION:
SetDParamStr(0, BaseGraphics::GetUsedSet()->GetDescription(GetCurrentLanguageIsoCode()));
- DrawStringMultiLine(r.left, r.right, r.top, UINT16_MAX, STR_BLACK_RAW_STRING);
+ DrawString(r.left, r.right, r.top, STR_BLACK_RAW_STRING);
break;

case WID_GO_BASE_SFX_DESCRIPTION:
SetDParamStr(0, BaseSounds::GetUsedSet()->GetDescription(GetCurrentLanguageIsoCode()));
- DrawStringMultiLine(r.left, r.right, r.top, UINT16_MAX, STR_BLACK_RAW_STRING);
+ DrawString(r.left, r.right, r.top, STR_BLACK_RAW_STRING);
break;

case WID_GO_BASE_MUSIC_DESCRIPTION:
SetDParamStr(0, BaseMusic::GetUsedSet()->GetDescription(GetCurrentLanguageIsoCode()));
- DrawStringMultiLine(r.left, r.right, r.top, UINT16_MAX, STR_BLACK_RAW_STRING);
+ DrawString(r.left, r.right, r.top, STR_BLACK_RAW_STRING);
break;
}
}
@@ -344,7 +344,7 @@
case WID_GO_BASE_GRF_DESCRIPTION:
/* Find the biggest description for the default size. */
for (int i = 0; i < BaseGraphics::GetNumSets(); i++) {
- SetDParamStr(0, BaseGraphics::GetSet(i)->GetDescription(GetCurrentLanguageIsoCode()));
+ SetDParamStr(0, "123");
size->height = max(size->height, (uint)GetStringHeight(STR_BLACK_RAW_STRING, size->width));
}
break;
@@ -363,7 +363,7 @@
case WID_GO_BASE_SFX_DESCRIPTION:
/* Find the biggest description for the default size. */
for (int i = 0; i < BaseSounds::GetNumSets(); i++) {
- SetDParamStr(0, BaseSounds::GetSet(i)->GetDescription(GetCurrentLanguageIsoCode()));
+ SetDParamStr(0, "123");
size->height = max(size->height, (uint)GetStringHeight(STR_BLACK_RAW_STRING, size->width));
}
break;
@@ -371,7 +371,7 @@
case WID_GO_BASE_MUSIC_DESCRIPTION:
/* Find the biggest description for the default size. */
for (int i = 0; i < BaseMusic::GetNumSets(); i++) {
- SetDParamStr(0, BaseMusic::GetSet(i)->GetDescription(GetCurrentLanguageIsoCode()));
+ SetDParamStr(0, "123");
size->height = max(size->height, (uint)GetStringHeight(STR_BLACK_RAW_STRING, size->width));
}
break;
--- src/sound/sdl_s.cpp 2014-02-25 11:16:59.000000000 +0200
+++ src/sound/sdl_s.cpp 2014-03-13 22:51:42.431059430 +0200
@@ -21,6 +21,10 @@
/** Factory for the SDL sound driver. */
static FSoundDriver_SDL iFSoundDriver_SDL;
Expand All @@ -194,8 +235,8 @@
}

const char *SoundDriver_SDL::Start(const char * const *parm)
--- src/video/sdl_v.cpp 2013-07-27 18:09:22.000000000 +0300
+++ src/video/sdl_v.cpp 2013-08-01 19:17:24.017408999 +0300
--- src/video/sdl_v.cpp 2014-02-25 11:16:44.000000000 +0200
+++ src/video/sdl_v.cpp 2014-03-13 22:51:42.431059430 +0200
@@ -25,6 +25,9 @@
#include "../fileio_func.h"
#include "sdl_v.h"
Expand Down Expand Up @@ -231,7 +272,7 @@
#else
if (sym->scancode == 49) key = WKC_BACKQUOTE;
#endif
@@ -596,7 +610,7 @@
@@ -597,7 +611,7 @@
}
HandleMouseEvents();
break;
Expand All @@ -240,7 +281,7 @@
case SDL_ACTIVEEVENT:
if (!(ev.active.state & SDL_APPMOUSEFOCUS)) break;

@@ -607,7 +621,7 @@
@@ -608,7 +622,7 @@
_cursor.in_window = false;
}
break;
Expand All @@ -249,8 +290,8 @@
case SDL_QUIT:
HandleExitGameRequest();
break;
@@ -620,13 +634,14 @@
HandleKeypress(ConvertSdlKeyIntoMy(&ev.key.keysym));
@@ -623,13 +637,14 @@
HandleKeypress(keycode, character);
}
break;
-
Expand All @@ -265,7 +306,7 @@
case SDL_VIDEOEXPOSE: {
/* Force a redraw of the entire screen. Note
* that SDL 1.2 seems to do this automatically
@@ -658,6 +673,9 @@
@@ -661,6 +676,9 @@
SetupKeyboard();

_draw_threaded = GetDriverParam(parm, "no_threads") == NULL && GetDriverParam(parm, "no_thread") == NULL;
Expand Down
60 changes: 0 additions & 60 deletions project/jni/fontconfig/src/fcarch.c

This file was deleted.

2 changes: 1 addition & 1 deletion project/jni/freetype/Android.mk
Expand Up @@ -7,7 +7,7 @@ LOCAL_MODULE := freetype
APP_SUBDIRS := $(patsubst $(LOCAL_PATH)/%, %, $(shell find $(LOCAL_PATH)/src -type d))

LOCAL_C_INCLUDES := $(foreach D, $(APP_SUBDIRS), $(LOCAL_PATH)/$(D)) $(LOCAL_PATH)/include
LOCAL_CFLAGS := -Os -DFT2_BUILD_LIBRARY
LOCAL_CFLAGS := -O2 -DFT2_BUILD_LIBRARY


LOCAL_CPP_EXTENSION := .cpp
Expand Down

0 comments on commit 744561a

Please sign in to comment.