From aa56c63aeb12b5f3e918feead01ae0a4f9d14d41 Mon Sep 17 00:00:00 2001 From: Sergii Pylypenko Date: Mon, 13 Oct 2014 22:44:27 +0300 Subject: [PATCH] Updated JA2 --- .../application/ja2/AndroidAppSettings.cfg | 6 +- project/jni/application/ja2/AndroidBuild.sh | 2 +- project/jni/application/ja2/ja2.patch | 55 +++++++++++++++++-- 3 files changed, 53 insertions(+), 10 deletions(-) diff --git a/project/jni/application/ja2/AndroidAppSettings.cfg b/project/jni/application/ja2/AndroidAppSettings.cfg index 9e0bd05ce..6eafe2770 100644 --- a/project/jni/application/ja2/AndroidAppSettings.cfg +++ b/project/jni/application/ja2/AndroidAppSettings.cfg @@ -7,10 +7,10 @@ AppName="JaggedAlliance2" AppFullName=com.opensourced.ja2 # Application version code (integer) -AppVersionCode=01235202 +AppVersionCode=01235203 # Application user-visible version name (string) -AppVersionName="0.12.352.02" +AppVersionName="0.12.352.03" # 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 @@ -221,7 +221,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 boost_filesystem boost_system" +CompiledLibraries="jpeg png boost_filesystem boost_system android_support" # Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n) CustomBuildScript=y diff --git a/project/jni/application/ja2/AndroidBuild.sh b/project/jni/application/ja2/AndroidBuild.sh index c921742e1..c31fabf57 100755 --- a/project/jni/application/ja2/AndroidBuild.sh +++ b/project/jni/application/ja2/AndroidBuild.sh @@ -5,4 +5,4 @@ patch -p1 -d src-$1 < ja2.patch || exit 1 } || exit 1 -../setEnvironment-$1.sh sh -c "make -j4 -C src-$1 WITH_LPTHREAD=0" && cp -f src-$1/ja2 libapplication-$1.so +../setEnvironment-$1.sh sh -c "make -j4 -C src-$1 WITH_LPTHREAD=0 Q=" && cp -f src-$1/ja2 libapplication-$1.so diff --git a/project/jni/application/ja2/ja2.patch b/project/jni/application/ja2/ja2.patch index d9e66c0d6..046f30472 100644 --- a/project/jni/application/ja2/ja2.patch +++ b/project/jni/application/ja2/ja2.patch @@ -1,5 +1,5 @@ diff --git a/Makefile b/Makefile -index a21c6b5..8a65a69 100644 +index a21c6b5..d6a8e9d 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ endif @@ -21,6 +21,15 @@ index a21c6b5..8a65a69 100644 CFLAGS += -I _build/lib-rapidjson CFLAGS += -I _build/lib-slog CFLAGS += -I _build/lib-smacker/libsmacker +@@ -154,7 +155,7 @@ CCFLAGS += -Wmissing-prototypes + + CXXFLAGS += $(CFLAGS) + +-LDFLAGS += -lm ++LDFLAGS += -lm -landroid_support + + ifeq "$(WITH_LPTHREAD)" "1" + LDFLAGS += -lpthread @@ -522,15 +523,15 @@ SRCS += _build/lib-MicroIni/src/MicroIni/Line.cpp SRCS += _build/lib-MicroIni/src/MicroIni/Section.cpp SRCS += _build/lib-MicroIni/src/MicroIni/Value.cpp @@ -254,7 +263,7 @@ index 7d69ce0..246d80c 100644 #else #define EXPENSIVE_SDL_UPDATE_RECT (0) diff --git a/sgp/SGP.cc b/sgp/SGP.cc -index d156d73..95c4097 100644 +index d156d73..e34ecd8 100644 --- a/sgp/SGP.cc +++ b/sgp/SGP.cc @@ -13,6 +13,9 @@ @@ -267,7 +276,17 @@ index d156d73..95c4097 100644 #include "Button_System.h" #include "Debug.h" -@@ -49,9 +52,6 @@ +@@ -32,6 +35,9 @@ + #include "Video.h" + #include "VSurface.h" + #include ++#ifdef __ANDROID__ ++#include ++#endif + #include "UILayout.h" + #include "GameRes.h" + #include "Logger.h" +@@ -49,9 +55,6 @@ #include "slog/slog.h" #define TAG "SGP" @@ -277,7 +296,15 @@ index d156d73..95c4097 100644 #if defined _WIN32 # define WIN32_LEAN_AND_MEAN -@@ -318,7 +318,7 @@ static BOOLEAN ParseParameters(int argc, char* const argv[], +@@ -273,6 +276,7 @@ static void MainLoop(int msPerGameCycle) + + static int Failure(char const* const msg, bool showInfoIcon=false) + { ++ __android_log_print(ANDROID_LOG_FATAL, "JA2", "%s", msg); + fprintf(stderr, "%s\n", msg); + #if defined _WIN32 + MessageBox(0, msg, APPLICATION_NAME, MB_OK | (showInfoIcon ? MB_ICONINFORMATION : MB_ICONERROR) | MB_TASKMODAL); +@@ -318,7 +322,7 @@ static BOOLEAN ParseParameters(int argc, char* const argv[], int main(int argc, char* argv[]) try { @@ -286,7 +313,23 @@ index d156d73..95c4097 100644 #if defined BROKEN_SWPRINTF if (setlocale(LC_CTYPE, "UTF-8") == NULL) -@@ -398,7 +398,7 @@ try +@@ -365,6 +369,15 @@ try + SDL_Init(SDL_INIT_VIDEO); + SDL_EnableUNICODE(SDL_ENABLE); + ++#ifdef __ANDROID__ ++ SDL_Rect r = { 64 * SDL_ListModes(NULL, 0)[0]->w / 1280, ++ 492 * SDL_ListModes(NULL, 0)[0]->h / 800, ++ (199 - 64) * SDL_ListModes(NULL, 0)[0]->w / 1280, ++ (627 - 492) * SDL_ListModes(NULL, 0)[0]->h / 800}; ++ if (!SDL_ANDROID_GetScreenKeyboardRedefinedByUser()) ++ SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, &r); ++#endif ++ + #ifdef __APPLE__ + // Enable 3-button mouse support if the user haven't instructed + // otherwise +@@ -398,7 +411,7 @@ try if(extraDataDir.empty()) { // use location of the exe file @@ -295,7 +338,7 @@ index d156d73..95c4097 100644 } std::string externalizedDataPath = FileMan::joinPaths(extraDataDir, "externalized"); -@@ -775,7 +775,7 @@ static void WriteDefaultConfigFile(const char* ConfigFile) +@@ -775,7 +788,7 @@ static void WriteDefaultConfigFile(const char* ConfigFile) #ifdef _WIN32 fprintf(IniFile, "data_dir = C:\\Program Files\\Jagged Alliance 2"); #else