VCMI loads main menu on a device, but crashes right after click on any botton. Megadebug patch attached.

This commit is contained in:
pelya
2011-06-16 19:57:53 +03:00
parent e8dd7d71d6
commit 62fd0b2dd6
17 changed files with 737 additions and 280 deletions

View File

@@ -25,7 +25,7 @@ fi
cd project && env PATH=$NDKBUILDPATH nice -n19 ndk-build -j4 V=1 && \
{ grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
[ -`which ndk-build | grep '/android-ndk-r5b/\|/android-ndk-r5-crystax/'` != - ] && \
[ -`which ndk-build | grep '/android-ndk-r5'` != - ] && \
echo Stripping libapplication.so by hand \
rm obj/local/armeabi/libapplication.so && \
cp jni/application/src/libapplication.so obj/local/armeabi && \
@@ -34,6 +34,4 @@ cd project && env PATH=$NDKBUILDPATH nice -n19 ndk-build -j4 V=1 && \
|| true ; } && \
ant debug && \
test -z "$1" && cd bin && adb uninstall `grep AppFullName ../../AndroidAppSettings.cfg | sed 's/.*=//'` && \
adb push DemoActivity-debug.apk /data/local && \
adb shell pm install -f /data/local/DemoActivity-debug.apk && \
adb shell rm /data/local/DemoActivity-debug.apk
adb install -r DemoActivity-debug.apk

View File

@@ -230,7 +230,9 @@ class DataDownloader extends Thread
// Create output directory (not necessary for phone storage)
System.out.println("Downloading data to: '" + outFilesDir + "'");
try {
(new File( outFilesDir )).mkdirs();
File outDir = new File( outFilesDir );
if( !(outDir.exists() && outDir.isDirectory()) )
outDir.mkdirs();
OutputStream out = new FileOutputStream( getOutFilePath(".nomedia") );
out.flush();
out.close();
@@ -340,7 +342,9 @@ class DataDownloader extends Thread
OutputStream out = null;
try {
try {
(new File( path.substring(0, path.lastIndexOf("/") ))).mkdirs();
File outDir = new File( path.substring(0, path.lastIndexOf("/") ));
if( !(outDir.exists() && outDir.isDirectory()) )
outDir.mkdirs();
} catch( SecurityException e ) { };
out = new FileOutputStream( path );
@@ -405,7 +409,9 @@ class DataDownloader extends Thread
{
System.out.println("Creating dir '" + getOutFilePath(entry.getName()) + "'");
try {
(new File( getOutFilePath(entry.getName()) )).mkdirs();
File outDir = new File( getOutFilePath(entry.getName()) );
if( !(outDir.exists() && outDir.isDirectory()) )
outDir.mkdirs();
} catch( SecurityException e ) { };
continue;
}
@@ -416,7 +422,9 @@ class DataDownloader extends Thread
System.out.println("Saving file '" + path + "'");
try {
(new File( path.substring(0, path.lastIndexOf("/") ))).mkdirs();
File outDir = new File( path.substring(0, path.lastIndexOf("/") ));
if( !(outDir.exists() && outDir.isDirectory()) )
outDir.mkdirs();
} catch( SecurityException e ) { };
try {
@@ -431,9 +439,7 @@ class DataDownloader extends Thread
}
System.out.println("File '" + path + "' exists and passed CRC check - not overwriting it");
continue;
} catch( Exception e )
{
}
} catch( Exception e ) { }
try {
out = new FileOutputStream( path );

View File

@@ -67,7 +67,7 @@ class Globals {
public static int MoveMouseWithJoystickSpeed = 0;
public static int MoveMouseWithJoystickAccel = 0;
public static boolean ClickMouseWithDpad = false;
public static boolean RelativeMouseMovement = AppNeedsTwoButtonMouse; // Laptop touchpad mode
public static boolean RelativeMouseMovement = false; // Laptop touchpad mode
public static int RelativeMouseMovementSpeed = 2;
public static int RelativeMouseMovementAccel = 0;
public static boolean ShowScreenUnderFinger = false;

View File

@@ -43,6 +43,8 @@ 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 android.text.SpannedString;
@@ -584,6 +586,20 @@ public class MainActivity extends Activity {
OutputStream out = null;
String path = cacheDir.getAbsolutePath() + "/" + entry.getName();
try {
CheckedInputStream check = new CheckedInputStream( new FileInputStream(path), new CRC32() );
while( check.read(buf, 0, buf.length) > 0 ) {};
check.close();
if( check.getChecksum().getValue() != entry.getCrc() )
{
File ff = new File(path);
ff.delete();
throw new Exception();
}
System.out.println("File '" + path + "' exists and passed CRC check - not overwriting it");
continue;
} catch( Exception e ) { }
System.out.println("Saving to file '" + path + "'");
out = new FileOutputStream( path );
@@ -597,7 +613,12 @@ public class MainActivity extends Activity {
out.flush();
out.close();
(new ProcessBuilder().command("/system/bin/chmod", "0755", path).start()).waitFor();
try {
(new ProcessBuilder().command("/system/bin/chmod", "0755", path).start()).waitFor();
} catch ( Exception eeee ) {}
try {
(new ProcessBuilder().command("/system/xbin/chmod", "0755", path).start()).waitFor();
} catch ( Exception eeeee ) {}
}
}
catch ( Exception eee )

View File

@@ -265,18 +265,6 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
mGlContextLost = false;
// ----- VCMI hack -----
try
{
File libpath = new File(context.getFilesDir(), "libvcmi.so");
System.load(libpath.getPath());
}
catch ( UnsatisfiedLinkError eee )
{
//System.out.println("libSDL: error loading lib: " + eee.toString());
}
// ----- VCMI hack -----
String libs[] = { "application", "sdl_main" };
try
{

View File

@@ -25,11 +25,6 @@ LOCAL_PATH=`dirname $0`
LOCAL_PATH=`cd $LOCAL_PATH && pwd`
echo LOCAL_PATH $LOCAL_PATH
if [ -z "`echo $NDK | grep 'android-ndk-r5b'``echo $NDK | grep 'android-ndk-r5-crystax'`" ] ; then
echo "The only supported NDK versions are android-ndk-r5b or android-ndk-r5-crystax"
exit 1
fi
APP_MODULES=`grep 'APP_MODULES [:][=]' $LOCAL_PATH/../Settings.mk | sed 's@.*[=]\(.*\)@\1@'`
APP_AVAILABLE_STATIC_LIBS=`grep 'APP_AVAILABLE_STATIC_LIBS [:][=]' $LOCAL_PATH/../Settings.mk | sed 's@.*[=]\(.*\)@\1@'`
APP_SHARED_LIBS=$(
@@ -72,7 +67,6 @@ if [ -n "$NO_SHARED_LIBS" ]; then
fi
#-shared flag creates problems with damn libtool, so we're using -Wl,-shared instead
LDFLAGS="\
-fexceptions -frtti $SHARED \
--sysroot=$NDK/platforms/$PLATFORMVER/arch-arm \

View File

@@ -14,7 +14,7 @@ LOCAL_PATH=`cd $LOCAL_PATH && pwd`
SCRIPT=setEnvironment-r4b.sh
CRYSTAX_WCHAR=
if [ -n "`echo $NDK | grep 'android-ndk-r5b\|android-ndk-r5-crystax-1.beta3'`" ]; then
if [ -n "`echo $NDK | grep 'android-ndk-r5'`" ]; then
SCRIPT=setEnvironment-r5b.sh
if [ -n "`echo $NDK | grep 'android-ndk-r5-crystax-1.beta3'`" ]; then
CRYSTAX_WCHAR=1

View File

@@ -1 +1 @@
fheroes2
vcmi

View File

@@ -0,0 +1,19 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := vcmi
ifneq ($(NDK_R5_TOOLCHAIN),)
LOCAL_SRC_FILES := libvcmi.so
include $(PREBUILT_SHARED_LIBRARY)
else
LOCAL_SRC_FILES := dummy.c
include $(BUILD_SHARED_LIBRARY)
$(abspath $(LOCAL_PATH)/../../obj/local/armeabi/libvcmi.so): $(LOCAL_PATH)/libvcmi.so OVERRIDE_CUSTOM_LIB
cp -f $< $@
$(abspath $(LOCAL_PATH)/../../obj/local/armeabi-v7a/libvcmi.so): $(LOCAL_PATH)/libvcmi.so OVERRIDE_CUSTOM_LIB
cp -f $< $@
.PHONY: OVERRIDE_CUSTOM_LIB
OVERRIDE_CUSTOM_LIB:
endif

View File

@@ -25,12 +25,12 @@ RedefinedKeysScreenKb="LALT RETURN KP_PLUS KP_MINUS SPACE DELETE KP_PLUS KP_MINU
StartupMenuButtonTimeout=3000
HiddenMenuOptions='KeyboardConfigMainMenu AudioConfig OptionalDownloadConfig'
MultiABI=n
AppVersionCode=08501
AppVersionName="0.85.01"
CompiledLibraries="sdl_mixer sdl_image sdl_ttf avutil avcore avcodec avformat swscale boost_program_options boost_filesystem boost_iostreams boost_system boost_thread"
AppVersionCode=08502
AppVersionName="0.85.02"
CompiledLibraries="sdl_mixer sdl_image sdl_ttf avutil avcore avcodec avformat swscale boost_program_options boost_filesystem boost_iostreams boost_system boost_thread vcmi"
CustomBuildScript=n
AppCflags='-DDATA_DIR=\\\"/sdcard/app-data/eu.vcmi\\\" -DBIN_DIR=\\\"/data/data/eu.vcmi/files\\\" -DLIB_DIR=\\\"/data/data/eu.vcmi/files\\\" -DWITH_AVCODEC_DECODE_VIDEO2=1'
AppLdflags='-lz -Ljni/application/vcmi -lvcmi'
AppSubdirsBuild='vcmi vcmi/client'
AppSubdirsBuild='vcmi/client vcmi/CGameInterface.cpp vcmi/CCallback.cpp'
AppCmdline=''
ReadmeText='^You may press "Home" now - the data will be downloaded in background'

View File

@@ -28,7 +28,7 @@ AndroidData/vcmiserver0: vcmiserver.zip
split -b 1048576 -d -a 1 $< AndroidData/vcmiserver
cp -f AndroidData/vcmiserver* ../../../assets
vcmiserver.zip: vcmiserver libvcmi.so GeniusAI.so StupidAI.so
vcmiserver.zip: vcmiserver GeniusAI.so StupidAI.so
rm -f $@
zip $@ $^
@@ -41,6 +41,7 @@ $(OBJS_SERVER) $(OBJS_LIB) $(OBJS_GENIUSAI) $(OBJS_STUPIDAI) $(OBJS_CLIENT): out
-DLIB_DIR=\\\"/data/data/eu.vcmi/files\\\" \
-DWITH_AVCODEC_DECODE_VIDEO2=1 \
$< -o $@"
# -Werror=strict-aliasing -Werror=cast-align -Werror=pointer-arith -Werror=address
vcmiserver: $(OBJS_SERVER) $(OBJS_LIB)
env BUILD_EXECUTABLE=1 NO_SHARED_LIBS=1 ../setEnvironment.sh sh -c \

File diff suppressed because it is too large Load Diff

View File

@@ -14,13 +14,13 @@
//
// Android defines
#define BOOST_THREAD_LINUX 1
#define BOOST_HAS_PTHREADS 1
// #define BOOST_THREAD_LINUX 1 // defined in thread/detail/platform.hpp
// #define BOOST_HAS_PTHREADS 1 // defined in config/posix_features.hpp
#define __arm__ 1
#define _REENTRANT 1
#define _GLIBCXX__PTHREADS 1
#define BOOST_HAS_GETTIMEOFDAY 1
#define BOOST_HAS_UNISTD_H 1
// #define BOOST_HAS_GETTIMEOFDAY 1 // defined in config/posix_features.hpp
// #define BOOST_HAS_UNISTD_H 1 // defined in config/platform/linux.hpp
#define BOOST_INTERPROCESS_POSIX_PROCESS_SHARED 1
// define this to locate a compiler config file:

1
project/jni/vcmi Symbolic link
View File

@@ -0,0 +1 @@
application/vcmi