[AD] SPEED on Android

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hi,

If anyone is interested, I managed to run SPEED on Android/x86 using the
AndroVM image in VirtualBox on Linux.

I didn't change the code except to remove the dependency on a4_font.tga
because I couldn't be bothered figuring out file loading.

I could enter the game with Enter and fire with Space but the arrow keys
and Escape didn't work.  Didn't investigate further.

Sound works but the timing is off.  There are no clicks/pops, but the
music is slightly erratic.  Some beats come too early/late and notes are
cut off too early or drag too long.  Didn't investigate further.

Back/foregrounding didn't work properly, obviously because it doesn't
handle those events at all.

The build system hacks for the android-project directory are attached
if anyone wants.  Copy the speed source files into the jni directory.

Peter

PS. It ran on a Nexus 7 after commenting out the ALLEGRO_SAMPLE_BUFFERS
and ALLEGRO_SAMPLES lines.  Didn't investigate further.  I couldn't
enter the game, of course.

PPS. It ran on my phone after hacking getPubDataDir, which was throwing
a null pointer exception.  Didn't investigate further.

    public String getPubDataDir()
    {
-      return getExternalFilesDir(null).getAbsolutePath();
+      //return getExternalFilesDir(null).getAbsolutePath();
+      return "/mnt/sdcard";
    }
diff --git a/android-project/jni/Android.mk b/android-project/jni/Android.mk
index 7f873d3..680b0fe 100644
--- a/android-project/jni/Android.mk
+++ b/android-project/jni/Android.mk
@@ -35,12 +35,24 @@ include $(PREBUILT_SHARED_LIBRARY)
 
 include $(CLEAR_VARS)
 
+LOCAL_MODULE := liballegro_font-prebuilt
+LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/liballegro_font-debug.so
+include $(PREBUILT_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := liballegro_audio-prebuilt
+LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/liballegro_audio-debug.so
+include $(PREBUILT_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+
 LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
 LOCAL_MODULE    := allegro-example
-LOCAL_SRC_FILES := main.c
+LOCAL_SRC_FILES := a4_aux.c  badguys.c  bullets.c  explode.c  hiscore.c  main.c  message.c  player.c  sound.c  title.c  view.c
 LOCAL_CFLAGS    := -I$(ANDROID_NDK_TOOLCHAIN_ROOT)/user/$(TARGET_ARCH_ABI)/include
 LOCAL_CFLAGS    += -DDEBUGMODE
-LOCAL_CFLAGS    += -W -Wall
+LOCAL_CFLAGS    += -W -Wall -I.
 
 LOCAL_LDLIBS    := -L$(ANDROID_NDK_TOOLCHAIN_ROOT)/user/$(TARGET_ARCH_ABI)/lib
 LOCAL_LDLIBS    += -L$(LOCAL_PATH)/$(TARGET_ARCH_ABI)
@@ -48,6 +60,8 @@ LOCAL_LDLIBS    += -llog
 LOCAL_LDLIBS    += libs/$(TARGET_ARCH_ABI)/liballegro-debug.so
 LOCAL_LDLIBS    += libs/$(TARGET_ARCH_ABI)/liballegro_primitives-debug.so
 LOCAL_LDLIBS    += libs/$(TARGET_ARCH_ABI)/liballegro_image-debug.so
+LOCAL_LDLIBS    += libs/$(TARGET_ARCH_ABI)/liballegro_font-debug.so
+LOCAL_LDLIBS    += libs/$(TARGET_ARCH_ABI)/liballegro_audio-debug.so
 
 include $(BUILD_SHARED_LIBRARY)
 
diff --git a/android-project/jni/Application.mk b/android-project/jni/Application.mk
index 15471e3..e8bb90f 100644
--- a/android-project/jni/Application.mk
+++ b/android-project/jni/Application.mk
@@ -4,4 +4,6 @@ APP_ABI := $(TARGET_ARCH_ABI)
 APP_MODULES := liballegro-prebuilt
 APP_MODULES += liballegro_primitives-prebuilt
 APP_MODULES += liballegro_image-prebuilt
+APP_MODULES += liballegro_audio-prebuilt
+APP_MODULES += liballegro_font-prebuilt
 APP_MODULES += allegro-example
diff --git a/android-project/src/org/liballeg/app/AllegroActivity.java b/android-project/src/org/liballeg/app/AllegroActivity.java
index aa6a103..9f83be7 100644
--- a/android-project/src/org/liballeg/app/AllegroActivity.java
+++ b/android-project/src/org/liballeg/app/AllegroActivity.java
@@ -111,9 +111,9 @@ public class AllegroActivity extends Activity implements SensorEventListener
       System.loadLibrary("allegro-debug");
       System.loadLibrary("allegro_primitives-debug");
       System.loadLibrary("allegro_image-debug");
-      //System.loadLibrary("allegro_font-debug");
+      System.loadLibrary("allegro_font-debug");
       //System.loadLibrary("allegro_ttf-debug");
-      //System.loadLibrary("allegro_audio-debug");
+      System.loadLibrary("allegro_audio-debug");
       //System.loadLibrary("allegro_acodec-debug");
       //System.loadLibrary("allegro_monolith-debug");
    }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/