Merge branch 'dhewg-android'
This commit is contained in:
commit
8cddb2a401
14 changed files with 291 additions and 185 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -22,9 +22,6 @@ lib*.a
|
||||||
/.project
|
/.project
|
||||||
/.cproject
|
/.cproject
|
||||||
|
|
||||||
/backends/platform/android/org/inodes/gus/scummvm/R.java
|
|
||||||
/backends/platform/android/org/inodes/gus/scummvm/Manifest.java
|
|
||||||
|
|
||||||
/backends/platform/dc/gui
|
/backends/platform/dc/gui
|
||||||
/backends/platform/dc/graphics
|
/backends/platform/dc/graphics
|
||||||
/backends/platform/dc/sound
|
/backends/platform/dc/sound
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -76,7 +76,7 @@ ZIP ?= zip -q
|
||||||
# Misc stuff - you should never have to edit this #
|
# Misc stuff - you should never have to edit this #
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
EXECUTABLE := scummvm$(EXEEXT)
|
EXECUTABLE := $(EXEPRE)scummvm$(EXEEXT)
|
||||||
|
|
||||||
include $(srcdir)/Makefile.common
|
include $(srcdir)/Makefile.common
|
||||||
|
|
||||||
|
|
|
@ -23,14 +23,14 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined(__ANDROID__)
|
||||||
|
|
||||||
#include "backends/base-backend.h"
|
#include "backends/base-backend.h"
|
||||||
#include "base/main.h"
|
#include "base/main.h"
|
||||||
#include "graphics/surface.h"
|
#include "graphics/surface.h"
|
||||||
|
|
||||||
#include "backends/platform/android/video.h"
|
#include "backends/platform/android/video.h"
|
||||||
|
|
||||||
#if defined(ANDROID_BACKEND)
|
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -73,12 +73,20 @@
|
||||||
#undef JNIEXPORT
|
#undef JNIEXPORT
|
||||||
#define JNIEXPORT __attribute__ ((visibility("default")))
|
#define JNIEXPORT __attribute__ ((visibility("default")))
|
||||||
|
|
||||||
// This replaces the bionic libc assert message with something that
|
// This replaces the bionic libc assert functions with something that
|
||||||
// actually prints the assertion failure before aborting.
|
// actually prints the assertion failure before aborting.
|
||||||
extern "C"
|
extern "C" {
|
||||||
void __assert(const char *file, int line, const char *expr) {
|
void __assert(const char *file, int line, const char *expr) {
|
||||||
__android_log_assert(expr, LOG_TAG, "%s:%d: Assertion failure: %s",
|
__android_log_assert(expr, LOG_TAG,
|
||||||
file, line, expr);
|
"Assertion failure: '%s' in %s:%d",
|
||||||
|
expr, file, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
void __assert2(const char *file, int line, const char *func, const char *expr) {
|
||||||
|
__android_log_assert(expr, LOG_TAG,
|
||||||
|
"Assertion failure: '%s' in %s:%d (%s)",
|
||||||
|
expr, file, line, func);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static JavaVM *cached_jvm;
|
static JavaVM *cached_jvm;
|
||||||
|
@ -94,10 +102,14 @@ static jfieldID FID_ScummVM_nativeScummVM;
|
||||||
static jmethodID MID_Object_wait;
|
static jmethodID MID_Object_wait;
|
||||||
|
|
||||||
JNIEnv* JNU_GetEnv() {
|
JNIEnv* JNU_GetEnv() {
|
||||||
JNIEnv* env;
|
JNIEnv* env = 0;
|
||||||
bool version_unsupported =
|
|
||||||
cached_jvm->GetEnv((void**)&env, JNI_VERSION_1_2);
|
jint res = cached_jvm->GetEnv((void**)&env, JNI_VERSION_1_2);
|
||||||
assert(! version_unsupported);
|
if (res != JNI_OK) {
|
||||||
|
__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "GetEnv() failed: %d", res);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
return env;
|
return env;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,6 +457,14 @@ void* OSystem_Android::timerThreadFunc(void* arg) {
|
||||||
OSystem_Android* system = (OSystem_Android*)arg;
|
OSystem_Android* system = (OSystem_Android*)arg;
|
||||||
DefaultTimerManager* timer = (DefaultTimerManager*)(system->_timer);
|
DefaultTimerManager* timer = (DefaultTimerManager*)(system->_timer);
|
||||||
|
|
||||||
|
JNIEnv *env = 0;
|
||||||
|
jint res = cached_jvm->AttachCurrentThread(&env, 0);
|
||||||
|
|
||||||
|
if (res != JNI_OK) {
|
||||||
|
__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "AttachCurrentThread() failed: %d", res);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
struct timespec tv;
|
struct timespec tv;
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = 0;
|
||||||
tv.tv_nsec = 100 * 1000 * 1000; // 100ms
|
tv.tv_nsec = 100 * 1000 * 1000; // 100ms
|
||||||
|
@ -454,6 +474,13 @@ void* OSystem_Android::timerThreadFunc(void* arg) {
|
||||||
nanosleep(&tv, NULL);
|
nanosleep(&tv, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
res = cached_jvm->DetachCurrentThread();
|
||||||
|
|
||||||
|
if (res != JNI_OK) {
|
||||||
|
__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "DetachCurrentThread() failed: %d", res);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1276,17 +1303,15 @@ void OSystem_Android::addSysArchivesToSearchSet(Common::SearchSet &s,
|
||||||
void OSystem_Android::logMessage(LogMessageType::Type type, const char *message) {
|
void OSystem_Android::logMessage(LogMessageType::Type type, const char *message) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case LogMessageType::kDebug:
|
case LogMessageType::kDebug:
|
||||||
BaseBackend::logMessage(type, message);
|
__android_log_write(ANDROID_LOG_DEBUG, LOG_TAG, message);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LogMessageType::kWarning:
|
case LogMessageType::kWarning:
|
||||||
__android_log_write(ANDROID_LOG_WARN, "ScummVM", message);
|
__android_log_write(ANDROID_LOG_WARN, LOG_TAG, message);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LogMessageType::kError:
|
case LogMessageType::kError:
|
||||||
// FIXME: From the name it looks like this will also quit the program.
|
__android_log_write(ANDROID_LOG_ERROR, LOG_TAG, message);
|
||||||
// This shouldn't do that though.
|
|
||||||
__android_log_assert("Fatal error", "ScummVM", "%s", message);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,59 +1,173 @@
|
||||||
# Android specific build targets
|
# Android specific build targets
|
||||||
|
|
||||||
AAPT = aapt
|
# These must be incremented for each market upload
|
||||||
DX = dx
|
#ANDROID_VERSIONCODE = 6 Specified in dists/android/AndroidManifest.xml.in
|
||||||
APKBUILDER = apkbuilder
|
ANDROID_PLUGIN_VERSIONCODE = 6
|
||||||
ADB = adb -e
|
|
||||||
JAVAC ?= javac
|
JAVA_FILES = \
|
||||||
JAVACFLAGS = -source 1.5 -target 1.5
|
ScummVM.java \
|
||||||
|
ScummVMApplication.java \
|
||||||
|
ScummVMActivity.java \
|
||||||
|
EditableSurfaceView.java \
|
||||||
|
Unpacker.java
|
||||||
|
|
||||||
|
JAVA_FILES_PLUGIN = \
|
||||||
|
PluginProvider.java
|
||||||
|
|
||||||
|
JAVA_FILES_GEN = \
|
||||||
|
Manifest.java \
|
||||||
|
R.java
|
||||||
|
|
||||||
|
PATH_DIST = $(srcdir)/dists/android
|
||||||
|
PATH_RESOURCES = $(PATH_DIST)/res
|
||||||
|
|
||||||
|
RESOURCES = \
|
||||||
|
$(PATH_RESOURCES)/values/strings.xml \
|
||||||
|
$(PATH_RESOURCES)/layout/main.xml \
|
||||||
|
$(PATH_RESOURCES)/layout/splash.xml \
|
||||||
|
$(PATH_RESOURCES)/drawable/gradient.xml \
|
||||||
|
$(PATH_RESOURCES)/drawable/scummvm.png \
|
||||||
|
$(PATH_RESOURCES)/drawable/scummvm_big.png
|
||||||
|
|
||||||
|
PLUGIN_RESOURCES = \
|
||||||
|
$(PATH_RESOURCES)/values/strings.xml \
|
||||||
|
$(PATH_RESOURCES)/drawable/scummvm.png
|
||||||
|
|
||||||
# FIXME: find/mark plugin entry points and add all this back again:
|
# FIXME: find/mark plugin entry points and add all this back again:
|
||||||
#LDFLAGS += -Wl,--gc-sections
|
#LDFLAGS += -Wl,--gc-sections
|
||||||
#CXXFLAGS += -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden
|
#CXXFLAGS += -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden
|
||||||
|
|
||||||
resources.ap_: $(srcdir)/dists/android/AndroidManifest.xml $(RESOURCES) $(ASSETS) $(ANDROID_JAR8) $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA)
|
AAPT = $(ANDROID_SDK)/platform-tools/aapt
|
||||||
$(INSTALL) -d build.tmp/assets/
|
ADB = $(ANDROID_SDK)/platform-tools/adb
|
||||||
$(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) build.tmp/assets/
|
DX = $(ANDROID_SDK)/platform-tools/dx
|
||||||
$(AAPT) package -f -M $< -S $(srcdir)/dists/android/res -A build.tmp/assets -I $(ANDROID_JAR8) -F $@
|
APKBUILDER = $(ANDROID_SDK)/tools/apkbuilder
|
||||||
|
JAVAC ?= javac
|
||||||
|
JAVACFLAGS = -source 1.5 -target 1.5
|
||||||
|
|
||||||
build.tmp/%/resources.ap_: build.tmp/%/AndroidManifest.xml build.stage/%/res/values/strings.xml build.stage/%/res/drawable/scummvm.png $(ANDROID_JAR8)
|
# This is a bit silly. I want to compile against the 1.6 android.jar,
|
||||||
$(AAPT) package -f -M $< -S build.stage/$*/res -I $(ANDROID_JAR8) -F $@
|
# to make the compiler check that I don't use something that requires
|
||||||
|
# a newer Android. However, in order to use android:installLocation,
|
||||||
|
# we need to give aapt a version >=8 android.jar - even though the
|
||||||
|
# result will work ok on 1.5+.
|
||||||
|
ANDROID_JAR = $(ANDROID_SDK)/platforms/android-4/android.jar
|
||||||
|
ANDROID_JAR8 = $(ANDROID_SDK)/platforms/android-8/android.jar
|
||||||
|
|
||||||
|
PATH_BUILD = build.tmp
|
||||||
|
PATH_BUILD_ASSETS = $(PATH_BUILD)/assets
|
||||||
|
PATH_BUILD_CLASSES_MAIN_TOP = $(PATH_BUILD)/classes.main
|
||||||
|
PATH_BUILD_CLASSES_PLUGIN_TOP = $(PATH_BUILD)/classes.plugin
|
||||||
|
|
||||||
|
PATH_STAGE_PREFIX = build.stage
|
||||||
|
PATH_STAGE_MAIN = $(PATH_STAGE_PREFIX).main
|
||||||
|
|
||||||
|
PATH_REL = org/inodes/gus/scummvm
|
||||||
|
PATH_SRC_TOP = $(srcdir)/backends/platform/android
|
||||||
|
PATH_SRC = $(PATH_SRC_TOP)/$(PATH_REL)
|
||||||
|
|
||||||
|
PATH_GEN_TOP = $(PATH_BUILD)/java
|
||||||
|
PATH_GEN = $(PATH_GEN_TOP)/$(PATH_REL)
|
||||||
|
PATH_CLASSES_MAIN = $(PATH_BUILD_CLASSES_MAIN_TOP)/$(PATH_REL)
|
||||||
|
PATH_CLASSES_PLUGIN = $(PATH_BUILD_CLASSES_PLUGIN_TOP)/$(PATH_REL)
|
||||||
|
|
||||||
|
FILE_MANIFEST = $(srcdir)/dists/android/AndroidManifest.xml
|
||||||
|
FILE_DEX = $(PATH_BUILD)/classes.dex
|
||||||
|
FILE_DEX_PLUGIN = $(PATH_BUILD)/plugins/classes.dex
|
||||||
|
FILE_RESOURCES = resources.ap_
|
||||||
|
FILE_RESOURCES_MAIN = $(PATH_BUILD)/$(FILE_RESOURCES)
|
||||||
|
|
||||||
|
SRC_GEN = $(addprefix $(PATH_GEN)/, $(JAVA_FILES_GEN))
|
||||||
|
|
||||||
|
CLASSES_MAIN = $(addprefix $(PATH_CLASSES_MAIN)/, $(JAVA_FILES:%.java=%.class))
|
||||||
|
CLASSES_GEN = $(addprefix $(PATH_CLASSES_MAIN)/, $(JAVA_FILES_GEN:%.java=%.class))
|
||||||
|
CLASSES_PLUGIN = $(addprefix $(PATH_CLASSES_PLUGIN)/, $(JAVA_FILES_PLUGIN:%.java=%.class))
|
||||||
|
|
||||||
|
APK_MAIN = scummvm.apk
|
||||||
|
APK_PLUGINS = $(patsubst plugins/lib%.so, scummvm-engine-%.apk, $(PLUGINS))
|
||||||
|
|
||||||
|
$(SRC_GEN): $(FILE_MANIFEST) $(filter %.xml,$(RESOURCES)) $(ANDROID_JAR8)
|
||||||
|
@$(MKDIR) -p $(PATH_GEN_TOP)
|
||||||
|
$(AAPT) package -m -J $(PATH_GEN_TOP) -M $< -S $(PATH_RESOURCES) -I $(ANDROID_JAR8)
|
||||||
|
|
||||||
|
$(PATH_CLASSES_MAIN)/%.class: $(PATH_GEN)/%.java $(SRC_GEN)
|
||||||
|
@$(MKDIR) -p $(@D)
|
||||||
|
$(JAVAC) $(JAVACFLAGS) -cp $(PATH_SRC_TOP) -d $(PATH_BUILD_CLASSES_MAIN_TOP) -bootclasspath $(ANDROID_JAR) $<
|
||||||
|
|
||||||
|
$(PATH_CLASSES_MAIN)/%.class: $(PATH_SRC)/%.java $(SRC_GEN)
|
||||||
|
@$(MKDIR) -p $(@D)
|
||||||
|
$(JAVAC) $(JAVACFLAGS) -cp $(PATH_SRC_TOP):$(PATH_GEN_TOP) -d $(PATH_BUILD_CLASSES_MAIN_TOP) -bootclasspath $(ANDROID_JAR) $<
|
||||||
|
|
||||||
|
$(PATH_CLASSES_PLUGIN)/%.class: $(PATH_SRC)/%.java
|
||||||
|
@$(MKDIR) -p $(@D)
|
||||||
|
$(JAVAC) $(JAVACFLAGS) -cp $(PATH_SRC_TOP) -d $(PATH_BUILD_CLASSES_PLUGIN_TOP) -bootclasspath $(ANDROID_JAR) $<
|
||||||
|
|
||||||
|
$(FILE_DEX): $(CLASSES_MAIN) $(CLASSES_GEN)
|
||||||
|
$(DX) --dex --output=$@ $(PATH_BUILD_CLASSES_MAIN_TOP)
|
||||||
|
|
||||||
|
$(FILE_DEX_PLUGIN): $(CLASSES_PLUGIN)
|
||||||
|
@$(MKDIR) -p $(@D)
|
||||||
|
$(DX) --dex --output=$@ $(PATH_BUILD_CLASSES_PLUGIN_TOP)
|
||||||
|
|
||||||
|
$(PATH_BUILD)/%/AndroidManifest.xml $(PATH_STAGE_PREFIX).%/res/values/strings.xml: $(PATH_DIST)/mkmanifest.pl $(srcdir)/configure $(PATH_DIST)/AndroidManifest.xml
|
||||||
|
$(PATH_DIST)/mkmanifest.pl --id=$* --configure=$(srcdir)/configure \
|
||||||
|
--version-name=$(VERSION) \
|
||||||
|
--version-code=$(ANDROID_PLUGIN_VERSIONCODE) \
|
||||||
|
--stringres=$(PATH_STAGE_PREFIX).$*/res/values/strings.xml \
|
||||||
|
--manifest=$(PATH_BUILD)/$*/AndroidManifest.xml \
|
||||||
|
--master-manifest=$(PATH_DIST)/AndroidManifest.xml \
|
||||||
|
--unpacklib=mylib/armeabi/lib$*.so
|
||||||
|
|
||||||
|
$(PATH_STAGE_PREFIX).%/res/drawable/scummvm.png: $(PATH_RESOURCES)/drawable/scummvm.png
|
||||||
|
@$(MKDIR) -p $(@D)
|
||||||
|
$(CP) $< $@
|
||||||
|
|
||||||
|
$(FILE_RESOURCES_MAIN): $(FILE_MANIFEST) $(RESOURCES) $(ANDROID_JAR8) $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA)
|
||||||
|
$(INSTALL) -d $(PATH_BUILD_ASSETS)
|
||||||
|
$(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) $(PATH_BUILD_ASSETS)/
|
||||||
|
$(AAPT) package -f -M $< -S $(PATH_RESOURCES) -A $(PATH_BUILD_ASSETS) -I $(ANDROID_JAR8) -F $@
|
||||||
|
|
||||||
|
$(PATH_BUILD)/%/$(FILE_RESOURCES): $(PATH_BUILD)/%/AndroidManifest.xml $(PATH_STAGE_PREFIX).%/res/values/strings.xml $(PATH_STAGE_PREFIX).%/res/drawable/scummvm.png $(ANDROID_JAR8)
|
||||||
|
$(AAPT) package -f -M $< -S $(PATH_STAGE_PREFIX).$*/res -I $(ANDROID_JAR8) -F $@
|
||||||
|
|
||||||
scummvm.apk: build.tmp/libscummvm.so resources.ap_ classes.dex
|
|
||||||
# Package installer won't delete old libscummvm.so on upgrade so
|
# Package installer won't delete old libscummvm.so on upgrade so
|
||||||
# replace it with a zero size file
|
# replace it with a zero size file
|
||||||
$(INSTALL) -d build.stage/common/lib/armeabi
|
$(APK_MAIN): $(EXECUTABLE) $(FILE_RESOURCES_MAIN) $(FILE_DEX)
|
||||||
touch build.stage/common/lib/armeabi/libscummvm.so
|
$(INSTALL) -d $(PATH_STAGE_MAIN)/common/lib/armeabi
|
||||||
# We now handle the library unpacking ourselves from mylib/
|
touch $(PATH_STAGE_MAIN)/common/lib/armeabi/libscummvm.so
|
||||||
$(INSTALL) -d build.stage/common/mylib/armeabi
|
$(INSTALL) -d $(PATH_STAGE_MAIN)/common/mylib/armeabi
|
||||||
$(INSTALL) -c -m 644 build.tmp/libscummvm.so build.stage/common/mylib/armeabi/
|
$(INSTALL) -c -m 644 libscummvm.so $(PATH_STAGE_MAIN)/common/mylib/armeabi/
|
||||||
$(STRIP) build.stage/common/mylib/armeabi/libscummvm.so
|
$(STRIP) $(PATH_STAGE_MAIN)/common/mylib/armeabi/libscummvm.so
|
||||||
# "-nf lib/armeabi/libscummvm.so" builds bogus paths?
|
$(APKBUILDER) $@ -z $(FILE_RESOURCES_MAIN) -f $(FILE_DEX) -rf $(PATH_STAGE_MAIN)/common || { $(RM) $@; exit 1; }
|
||||||
$(APKBUILDER) $@ -z resources.ap_ -f classes.dex -rf build.stage/common || { $(RM) $@; exit 1; }
|
|
||||||
|
|
||||||
scummvm-engine-%.apk: plugins/lib%.so build.tmp/%/resources.ap_ build.tmp/plugins/classes.dex
|
scummvm-engine-%.apk: plugins/lib%.so $(PATH_BUILD)/%/$(FILE_RESOURCES) $(FILE_DEX_PLUGIN)
|
||||||
$(INSTALL) -d build.stage/$*/apk/mylib/armeabi/
|
$(INSTALL) -d $(PATH_STAGE_PREFIX).$*/apk/mylib/armeabi/
|
||||||
$(INSTALL) -c -m 644 plugins/lib$*.so build.stage/$*/apk/mylib/armeabi/
|
$(INSTALL) -c -m 644 plugins/lib$*.so $(PATH_STAGE_PREFIX).$*/apk/mylib/armeabi/
|
||||||
$(STRIP) build.stage/$*/apk/mylib/armeabi/lib$*.so
|
$(STRIP) $(PATH_STAGE_PREFIX).$*/apk/mylib/armeabi/lib$*.so
|
||||||
$(APKBUILDER) $@ -z build.tmp/$*/resources.ap_ -f build.tmp/plugins/classes.dex -rf build.stage/$*/apk || { $(RM) $@; exit 1; }
|
$(APKBUILDER) $@ -z $(PATH_BUILD)/$*/$(FILE_RESOURCES) -f $(FILE_DEX_PLUGIN) -rf $(PATH_STAGE_PREFIX).$*/apk || { $(RM) $@; exit 1; }
|
||||||
|
|
||||||
|
all: $(APK_MAIN) $(APK_PLUGINS)
|
||||||
|
|
||||||
|
clean: androidclean
|
||||||
|
|
||||||
|
androidclean:
|
||||||
|
@$(RM) -rf $(PATH_BUILD) $(PATH_STAGE_PREFIX).* *.apk release
|
||||||
|
|
||||||
|
# remove debugging signature
|
||||||
release/%.apk: %.apk
|
release/%.apk: %.apk
|
||||||
@$(MKDIR) -p $(@D)
|
@$(MKDIR) -p $(@D)
|
||||||
@$(RM) $@
|
@$(RM) $@
|
||||||
$(CP) $< $@.tmp
|
$(CP) $< $@.tmp
|
||||||
# remove debugging signature
|
|
||||||
zip -d $@.tmp META-INF/\*
|
zip -d $@.tmp META-INF/\*
|
||||||
jarsigner $(JARSIGNER_FLAGS) $@.tmp release
|
jarsigner $(JARSIGNER_FLAGS) $@.tmp release
|
||||||
zipalign 4 $@.tmp $@
|
zipalign 4 $@.tmp $@
|
||||||
$(RM) $@.tmp
|
$(RM) $@.tmp
|
||||||
|
|
||||||
androidrelease: release/scummvm.apk $(patsubst plugins/lib%.so,release/scummvm-engine-%.apk,$(PLUGINS))
|
androidrelease: $(addprefix release/, $(APK_MAIN) $(APK_PLUGINS))
|
||||||
|
|
||||||
androidtest: scummvm.apk scummvm-engine-scumm.apk scummvm-engine-kyra.apk
|
androidtest: $(APK_MAIN) $(APK_PLUGINS)
|
||||||
@set -e; for apk in $^; do \
|
@set -e; for apk in $^; do \
|
||||||
echo $(ADB) install -r $$apk; \
|
|
||||||
$(ADB) install -r $$apk; \
|
$(ADB) install -r $$apk; \
|
||||||
done
|
done
|
||||||
$(ADB) shell am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n org.inodes.gus.scummvm/.Unpacker
|
$(ADB) shell am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n org.inodes.gus.scummvm/.Unpacker
|
||||||
|
|
||||||
.PHONY: androidrelease androidtest
|
.PHONY: androidrelease androidtest
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(ANDROID)
|
#if defined(__ANDROID__)
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(ANDROID)
|
#if defined(__ANDROID__)
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
|
|
|
@ -1,84 +1,12 @@
|
||||||
MODULE := backends/platform/android
|
MODULE := backends/platform/android
|
||||||
|
|
||||||
MODULE_OBJS := \
|
MODULE_OBJS := \
|
||||||
android.o asset-archive.o video.o
|
android.o \
|
||||||
|
asset-archive.o \
|
||||||
|
video.o
|
||||||
|
|
||||||
# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
|
# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
|
||||||
MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
|
MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
|
||||||
OBJS := $(MODULE_OBJS) $(OBJS)
|
OBJS := $(MODULE_OBJS) $(OBJS)
|
||||||
MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))
|
MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))
|
||||||
|
|
||||||
JAVA_SRC = \
|
|
||||||
$(MODULE)/org/inodes/gus/scummvm/ScummVM.java \
|
|
||||||
$(MODULE)/org/inodes/gus/scummvm/ScummVMApplication.java \
|
|
||||||
$(MODULE)/org/inodes/gus/scummvm/ScummVMActivity.java \
|
|
||||||
$(MODULE)/org/inodes/gus/scummvm/EditableSurfaceView.java \
|
|
||||||
$(MODULE)/org/inodes/gus/scummvm/Unpacker.java \
|
|
||||||
$(MODULE)/org/inodes/gus/scummvm/Manifest.java \
|
|
||||||
$(MODULE)/org/inodes/gus/scummvm/R.java
|
|
||||||
|
|
||||||
JAVA_PLUGIN_SRC = \
|
|
||||||
$(MODULE)/org/inodes/gus/scummvm/PluginProvider.java
|
|
||||||
|
|
||||||
RESOURCES = \
|
|
||||||
$(srcdir)/dists/android/res/values/strings.xml \
|
|
||||||
$(srcdir)/dists/android/res/layout/main.xml \
|
|
||||||
$(srcdir)/dists/android/res/layout/splash.xml \
|
|
||||||
$(srcdir)/dists/android/res/drawable/gradient.xml \
|
|
||||||
$(srcdir)/dists/android/res/drawable/scummvm.png \
|
|
||||||
$(srcdir)/dists/android/res/drawable/scummvm_big.png
|
|
||||||
|
|
||||||
ASSETS = $(DIST_FILES_ENGINEDATA) $(DIST_FILES_THEMES)
|
|
||||||
|
|
||||||
PLUGIN_RESOURCES = \
|
|
||||||
$(srcdir)/dists/android/res/values/strings.xml \
|
|
||||||
$(srcdir)/dists/android/res/drawable/scummvm.png
|
|
||||||
|
|
||||||
# These must be incremented for each market upload
|
|
||||||
#ANDROID_VERSIONCODE = 6 Specified in dists/android/AndroidManifest.xml.in
|
|
||||||
ANDROID_PLUGIN_VERSIONCODE = 6
|
|
||||||
|
|
||||||
# This is a bit silly. I want to compile against the 1.6 android.jar,
|
|
||||||
# to make the compiler check that I don't use something that requires
|
|
||||||
# a newer Android. However, in order to use android:installLocation,
|
|
||||||
# we need to give aapt a version >=8 android.jar - even though the
|
|
||||||
# result will work ok on 1.5+.
|
|
||||||
ANDROID_JAR = $(ANDROID_SDK)/platforms/android-1.5/android.jar
|
|
||||||
ANDROID_JAR8 = $(ANDROID_SDK)/platforms/android-8/android.jar
|
|
||||||
|
|
||||||
# This library contains scummvm proper
|
|
||||||
build.tmp/libscummvm.so: $(OBJS)
|
|
||||||
@$(MKDIR) -p $(@D)
|
|
||||||
$(QUIET_LINK)$(CXX) -shared $(LDFLAGS) -Wl,-Bsymbolic -Wl,-soname,$(@F) -Wl,--no-undefined -o $@ $(PRE_OBJS_FLAGS) $(OBJS) $(POST_OBJS_FLAGS) $(LIBS)
|
|
||||||
|
|
||||||
|
|
||||||
backends/platform/android/org/inodes/gus/scummvm/R.java backends/platform/android/org/inodes/gus/scummvm/Manifest.java: $(srcdir)/dists/android/AndroidManifest.xml $(filter %.xml,$(RESOURCES)) $(ANDROID_JAR8)
|
|
||||||
$(AAPT) package -m -J backends/platform/android -M $< -S $(srcdir)/dists/android/res -I $(ANDROID_JAR8)
|
|
||||||
|
|
||||||
build.tmp/classes/%.class: $(srcdir)/backends/platform/android/%.java $(srcdir)/backends/platform/android/org/inodes/gus/scummvm/R.java
|
|
||||||
@$(MKDIR) -p $(@D)
|
|
||||||
$(JAVAC) $(JAVACFLAGS) -cp $(srcdir)/backends/platform/android -d build.tmp/classes -bootclasspath $(ANDROID_JAR) $<
|
|
||||||
|
|
||||||
build.tmp/classes.plugin/%.class: $(srcdir)/backends/platform/android/%.java
|
|
||||||
@$(MKDIR) -p $(@D)
|
|
||||||
$(JAVAC) $(JAVACFLAGS) -cp $(srcdir)/backends/platform/android -d build.tmp/classes.plugin -bootclasspath $(ANDROID_JAR) $<
|
|
||||||
|
|
||||||
classes.dex: $(JAVA_SRC:backends/platform/android/%.java=build.tmp/classes/%.class)
|
|
||||||
$(DX) --dex --output=$@ build.tmp/classes
|
|
||||||
|
|
||||||
build.tmp/plugins/classes.dex: $(JAVA_PLUGIN_SRC:backends/platform/android/%.java=build.tmp/classes.plugin/%.class)
|
|
||||||
@$(MKDIR) -p $(@D)
|
|
||||||
$(DX) --dex --output=$@ build.tmp/classes.plugin
|
|
||||||
|
|
||||||
build.tmp/%/AndroidManifest.xml build.stage/%/res/values/strings.xml: dists/android/mkmanifest.pl configure dists/android/AndroidManifest.xml
|
|
||||||
dists/android/mkmanifest.pl --id=$* --configure=configure \
|
|
||||||
--version-name=$(VERSION) \
|
|
||||||
--version-code=$(ANDROID_PLUGIN_VERSIONCODE) \
|
|
||||||
--stringres=build.stage/$*/res/values/strings.xml \
|
|
||||||
--manifest=build.tmp/$*/AndroidManifest.xml \
|
|
||||||
--master-manifest=dists/android/AndroidManifest.xml \
|
|
||||||
--unpacklib=mylib/armeabi/lib$*.so
|
|
||||||
|
|
||||||
build.stage/%/res/drawable/scummvm.png: dists/android/res/drawable/scummvm.png
|
|
||||||
@$(MKDIR) -p $(@D)
|
|
||||||
$(CP) $< $@
|
|
||||||
|
|
|
@ -13,6 +13,8 @@ import android.util.Log;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class PluginProvider extends BroadcastReceiver {
|
public class PluginProvider extends BroadcastReceiver {
|
||||||
|
private final static String LOG_TAG = "ScummVM";
|
||||||
|
|
||||||
public final static String META_UNPACK_LIB =
|
public final static String META_UNPACK_LIB =
|
||||||
"org.inodes.gus.scummvm.meta.UNPACK_LIB";
|
"org.inodes.gus.scummvm.meta.UNPACK_LIB";
|
||||||
|
|
||||||
|
@ -28,7 +30,7 @@ public class PluginProvider extends BroadcastReceiver {
|
||||||
.getReceiverInfo(new ComponentName(context, this.getClass()),
|
.getReceiverInfo(new ComponentName(context, this.getClass()),
|
||||||
PackageManager.GET_META_DATA);
|
PackageManager.GET_META_DATA);
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
Log.e(this.toString(), "Error finding my own info?", e);
|
Log.e(LOG_TAG, "Error finding my own info?", e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import java.util.LinkedHashMap;
|
||||||
// use the Java versions of most EGL functions :(
|
// use the Java versions of most EGL functions :(
|
||||||
|
|
||||||
public class ScummVM implements SurfaceHolder.Callback {
|
public class ScummVM implements SurfaceHolder.Callback {
|
||||||
private final static String LOG_TAG = "ScummVM.java";
|
protected final static String LOG_TAG = "ScummVM";
|
||||||
|
|
||||||
private final int AUDIO_FRAME_SIZE = 2 * 2; // bytes. 16bit audio * stereo
|
private final int AUDIO_FRAME_SIZE = 2 * 2; // bytes. 16bit audio * stereo
|
||||||
public static class AudioSetupException extends Exception {}
|
public static class AudioSetupException extends Exception {}
|
||||||
|
@ -98,16 +98,14 @@ public class ScummVM implements SurfaceHolder.Callback {
|
||||||
public void surfaceChanged(SurfaceHolder holder, int format,
|
public void surfaceChanged(SurfaceHolder holder, int format,
|
||||||
int width, int height) {
|
int width, int height) {
|
||||||
// Disabled while I debug GL problems
|
// Disabled while I debug GL problems
|
||||||
//pushEvent(new Event(Event.EVENT_SCREEN_CHANGED));
|
pushEvent(new Event(Event.EVENT_SCREEN_CHANGED));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void surfaceDestroyed(SurfaceHolder holder) {
|
public void surfaceDestroyed(SurfaceHolder holder) {
|
||||||
pushEvent(new Event(Event.EVENT_SCREEN_CHANGED));
|
|
||||||
try {
|
try {
|
||||||
surfaceLock.acquire();
|
surfaceLock.acquire();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Log.e(this.toString(),
|
Log.e(LOG_TAG, "Interrupted while waiting for surface lock", e);
|
||||||
"Interrupted while waiting for surface lock", e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,8 +149,7 @@ public class ScummVM implements SurfaceHolder.Callback {
|
||||||
if (value[0] == EGL10.EGL_NONE)
|
if (value[0] == EGL10.EGL_NONE)
|
||||||
Log.d(LOG_TAG, entry.getKey() + ": NONE");
|
Log.d(LOG_TAG, entry.getKey() + ": NONE");
|
||||||
else
|
else
|
||||||
Log.d(LOG_TAG, String.format("%s: %d",
|
Log.d(LOG_TAG, String.format("%s: %d", entry.getKey(), value[0]));
|
||||||
entry.getKey(), value[0]));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,8 +171,7 @@ public class ScummVM implements SurfaceHolder.Callback {
|
||||||
num_config);
|
num_config);
|
||||||
|
|
||||||
if (false) {
|
if (false) {
|
||||||
Log.d(LOG_TAG,
|
Log.d(LOG_TAG, String.format("Found %d EGL configurations.", numConfigs));
|
||||||
String.format("Found %d EGL configurations.", numConfigs));
|
|
||||||
for (EGLConfig config : configs)
|
for (EGLConfig config : configs)
|
||||||
dumpEglConfig(config);
|
dumpEglConfig(config);
|
||||||
}
|
}
|
||||||
|
@ -184,8 +180,7 @@ public class ScummVM implements SurfaceHolder.Callback {
|
||||||
// devices so we have to filter/rank the configs again ourselves.
|
// devices so we have to filter/rank the configs again ourselves.
|
||||||
eglConfig = chooseEglConfig(configs);
|
eglConfig = chooseEglConfig(configs);
|
||||||
if (false) {
|
if (false) {
|
||||||
Log.d(LOG_TAG,
|
Log.d(LOG_TAG, String.format("Chose EGL config from %d possibilities.", numConfigs));
|
||||||
String.format("Chose EGL config from %d possibilities.", numConfigs));
|
|
||||||
dumpEglConfig(eglConfig);
|
dumpEglConfig(eglConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,6 +194,7 @@ public class ScummVM implements SurfaceHolder.Callback {
|
||||||
int best = 0;
|
int best = 0;
|
||||||
int bestScore = -1;
|
int bestScore = -1;
|
||||||
int[] value = new int[1];
|
int[] value = new int[1];
|
||||||
|
|
||||||
for (int i = 0; i < configs.length; i++) {
|
for (int i = 0; i < configs.length; i++) {
|
||||||
EGLConfig config = configs[i];
|
EGLConfig config = configs[i];
|
||||||
int score = 10000;
|
int score = 10000;
|
||||||
|
@ -396,7 +392,7 @@ public class ScummVM implements SurfaceHolder.Callback {
|
||||||
offset += ret;
|
offset += ret;
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Log.e(this.toString(), "Audio thread interrupted", e);
|
Log.e(LOG_TAG, "Audio thread interrupted", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class ScummVMActivity extends Activity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void displayMessageOnOSD(String msg) {
|
protected void displayMessageOnOSD(String msg) {
|
||||||
Log.i(this.toString(), "OSD: " + msg);
|
Log.i(LOG_TAG, "OSD: " + msg);
|
||||||
Toast.makeText(ScummVMActivity.this, msg, Toast.LENGTH_LONG).show();
|
Toast.makeText(ScummVMActivity.this, msg, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,6 +137,7 @@ public class ScummVMActivity extends Activity {
|
||||||
}
|
}
|
||||||
|
|
||||||
SurfaceView main_surface = (SurfaceView)findViewById(R.id.main_surface);
|
SurfaceView main_surface = (SurfaceView)findViewById(R.id.main_surface);
|
||||||
|
|
||||||
main_surface.setOnTouchListener(new View.OnTouchListener() {
|
main_surface.setOnTouchListener(new View.OnTouchListener() {
|
||||||
public boolean onTouch(View v, MotionEvent event) {
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
return onTouchEvent(event);
|
return onTouchEvent(event);
|
||||||
|
@ -156,7 +157,7 @@ public class ScummVMActivity extends Activity {
|
||||||
try {
|
try {
|
||||||
runScummVM();
|
runScummVM();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e("ScummVM", "Fatal error in ScummVM thread", e);
|
Log.e(ScummVM.LOG_TAG, "Fatal error in ScummVM thread", e);
|
||||||
new AlertDialog.Builder(ScummVMActivity.this)
|
new AlertDialog.Builder(ScummVMActivity.this)
|
||||||
.setTitle("Error")
|
.setTitle("Error")
|
||||||
.setMessage(e.toString())
|
.setMessage(e.toString())
|
||||||
|
@ -174,8 +175,7 @@ public class ScummVMActivity extends Activity {
|
||||||
try {
|
try {
|
||||||
scummvm.waitUntilRunning();
|
scummvm.waitUntilRunning();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Log.e(this.toString(),
|
Log.e(ScummVM.LOG_TAG, "Interrupted while waiting for ScummVM.initBackend", e);
|
||||||
"Interrupted while waiting for ScummVM.initBackend", e);
|
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ public class ScummVMActivity extends Activity {
|
||||||
"--config=" + getFileStreamPath("scummvmrc").getPath(),
|
"--config=" + getFileStreamPath("scummvmrc").getPath(),
|
||||||
"--path=" + Environment.getExternalStorageDirectory().getPath(),
|
"--path=" + Environment.getExternalStorageDirectory().getPath(),
|
||||||
"--gui-theme=scummmodern",
|
"--gui-theme=scummmodern",
|
||||||
"--savepath=" + getDir("saves", 0).getPath(),
|
"--savepath=" + getDir("saves", 0).getPath()
|
||||||
};
|
};
|
||||||
|
|
||||||
int ret = scummvm.scummVMMain(args);
|
int ret = scummvm.scummVMMain(args);
|
||||||
|
@ -226,8 +226,7 @@ public class ScummVMActivity extends Activity {
|
||||||
try {
|
try {
|
||||||
scummvm_thread.join(1000); // 1s timeout
|
scummvm_thread.join(1000); // 1s timeout
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Log.i(this.toString(),
|
Log.i(ScummVM.LOG_TAG, "Error while joining ScummVM thread", e);
|
||||||
"Error while joining ScummVM thread", e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.onStop();
|
super.onStop();
|
||||||
|
|
|
@ -34,7 +34,9 @@ import java.util.zip.ZipFile;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
|
|
||||||
public class Unpacker extends Activity {
|
public class Unpacker extends Activity {
|
||||||
private final static boolean PLUGINS_ENABLED = true;
|
protected final static String LOG_TAG = "ScummVM";
|
||||||
|
// TODO don't hardcode this
|
||||||
|
private final static boolean PLUGINS_ENABLED = false;
|
||||||
private final static String META_NEXT_ACTIVITY =
|
private final static String META_NEXT_ACTIVITY =
|
||||||
"org.inodes.gus.unpacker.nextActivity";
|
"org.inodes.gus.unpacker.nextActivity";
|
||||||
private ProgressBar mProgress;
|
private ProgressBar mProgress;
|
||||||
|
@ -88,11 +90,11 @@ public class Unpacker extends Activity {
|
||||||
origIntent.getType());
|
origIntent.getType());
|
||||||
//intent.fillIn(getIntent(), 0);
|
//intent.fillIn(getIntent(), 0);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
|
intent.addFlags(Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
|
||||||
Log.i(this.toString(),
|
Log.i(LOG_TAG,
|
||||||
"Starting next activity with intent " + intent);
|
"Starting next activity with intent " + intent);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} else {
|
} else {
|
||||||
Log.w(this.toString(),
|
Log.w(LOG_TAG,
|
||||||
"Unable to extract a component name from " + nextActivity);
|
"Unable to extract a component name from " + nextActivity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,12 +130,12 @@ public class Unpacker extends Activity {
|
||||||
new ZipFile(context.getPackageResourcePath());
|
new ZipFile(context.getPackageResourcePath());
|
||||||
job = new UnpackJob(zipfile, new HashSet<String>(1));
|
job = new UnpackJob(zipfile, new HashSet<String>(1));
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
Log.e(this.toString(), "Package " + pkg +
|
Log.e(LOG_TAG, "Package " + pkg +
|
||||||
" not found", e);
|
" not found", e);
|
||||||
continue;
|
continue;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// FIXME: show some sort of GUI error dialog
|
// FIXME: show some sort of GUI error dialog
|
||||||
Log.e(this.toString(),
|
Log.e(LOG_TAG,
|
||||||
"Error opening ZIP for package " + pkg, e);
|
"Error opening ZIP for package " + pkg, e);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +147,7 @@ public class Unpacker extends Activity {
|
||||||
// Delete stale filenames from mUnpackDest
|
// Delete stale filenames from mUnpackDest
|
||||||
for (File file: mUnpackDest.listFiles()) {
|
for (File file: mUnpackDest.listFiles()) {
|
||||||
if (!all_files.contains(file.getName())) {
|
if (!all_files.contains(file.getName())) {
|
||||||
Log.i(this.toString(),
|
Log.i(LOG_TAG,
|
||||||
"Deleting stale cached file " + file);
|
"Deleting stale cached file " + file);
|
||||||
file.delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
|
@ -177,14 +179,14 @@ public class Unpacker extends Activity {
|
||||||
progress += zipentry.getSize();
|
progress += zipentry.getSize();
|
||||||
} else {
|
} else {
|
||||||
if (dest.exists())
|
if (dest.exists())
|
||||||
Log.d(this.toString(),
|
Log.d(LOG_TAG,
|
||||||
"Replacing " + dest.getPath() +
|
"Replacing " + dest.getPath() +
|
||||||
" old.mtime=" + dest.lastModified() +
|
" old.mtime=" + dest.lastModified() +
|
||||||
" new.mtime=" + zipentry.getTime() +
|
" new.mtime=" + zipentry.getTime() +
|
||||||
" old.size=" + dest.length() +
|
" old.size=" + dest.length() +
|
||||||
" new.size=" + zipentry.getSize());
|
" new.size=" + zipentry.getSize());
|
||||||
else
|
else
|
||||||
Log.i(this.toString(),
|
Log.i(LOG_TAG,
|
||||||
"Extracting " + zipentry.getName() +
|
"Extracting " + zipentry.getName() +
|
||||||
" from " + zipfile.getName() +
|
" from " + zipfile.getName() +
|
||||||
" to " + dest.getPath());
|
" to " + dest.getPath());
|
||||||
|
@ -215,12 +217,12 @@ public class Unpacker extends Activity {
|
||||||
zipfile.close();
|
zipfile.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// FIXME: show some sort of GUI error dialog
|
// FIXME: show some sort of GUI error dialog
|
||||||
Log.e(this.toString(), "Error unpacking plugin", e);
|
Log.e(LOG_TAG, "Error unpacking plugin", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (progress != total_size)
|
if (progress != total_size)
|
||||||
Log.d(this.toString(), "Ended with progress " + progress +
|
Log.d(LOG_TAG, "Ended with progress " + progress +
|
||||||
" != total size " + total_size);
|
" != total size " + total_size);
|
||||||
|
|
||||||
setResult(RESULT_OK);
|
setResult(RESULT_OK);
|
||||||
|
@ -234,7 +236,7 @@ public class Unpacker extends Activity {
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
if (!intent.getAction()
|
if (!intent.getAction()
|
||||||
.equals(ScummVMApplication.ACTION_PLUGIN_QUERY)) {
|
.equals(ScummVMApplication.ACTION_PLUGIN_QUERY)) {
|
||||||
Log.e(this.toString(),
|
Log.e(LOG_TAG,
|
||||||
"Received unexpected action " + intent.getAction());
|
"Received unexpected action " + intent.getAction());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -323,7 +325,7 @@ public class Unpacker extends Activity {
|
||||||
startActivityForResult(market_intent,
|
startActivityForResult(market_intent,
|
||||||
REQUEST_MARKET);
|
REQUEST_MARKET);
|
||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
Log.e(this.toString(),
|
Log.e(LOG_TAG,
|
||||||
"Error starting market", e);
|
"Error starting market", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -351,7 +353,7 @@ public class Unpacker extends Activity {
|
||||||
switch (requestCode) {
|
switch (requestCode) {
|
||||||
case REQUEST_MARKET:
|
case REQUEST_MARKET:
|
||||||
if (resultCode != RESULT_OK)
|
if (resultCode != RESULT_OK)
|
||||||
Log.w(this.toString(), "Market returned " + resultCode);
|
Log.w(LOG_TAG, "Market returned " + resultCode);
|
||||||
tryUnpack();
|
tryUnpack();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -363,7 +365,7 @@ public class Unpacker extends Activity {
|
||||||
.getActivityInfo(getComponentName(), PackageManager.GET_META_DATA);
|
.getActivityInfo(getComponentName(), PackageManager.GET_META_DATA);
|
||||||
return ai.metaData;
|
return ai.metaData;
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
Log.w(this.toString(), "Unable to find my own meta-data", e);
|
Log.w(LOG_TAG, "Unable to find my own meta-data", e);
|
||||||
return new Bundle();
|
return new Bundle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined(__ANDROID__)
|
||||||
|
|
||||||
#include "base/main.h"
|
#include "base/main.h"
|
||||||
#include "graphics/surface.h"
|
#include "graphics/surface.h"
|
||||||
|
|
||||||
|
@ -42,7 +44,7 @@
|
||||||
#define TEXSUBIMAGE_IS_EXPENSIVE 0
|
#define TEXSUBIMAGE_IS_EXPENSIVE 0
|
||||||
|
|
||||||
#undef LOG_TAG
|
#undef LOG_TAG
|
||||||
#define LOG_TAG "ScummVM-video"
|
#define LOG_TAG "ScummVM"
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#define ENTER(args...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, args)
|
#define ENTER(args...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, args)
|
||||||
|
@ -133,7 +135,14 @@ GLESTexture::~GLESTexture() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLESTexture::reinitGL() {
|
void GLESTexture::reinitGL() {
|
||||||
|
glDeleteTextures(1, &_texture_name);
|
||||||
glGenTextures(1, &_texture_name);
|
glGenTextures(1, &_texture_name);
|
||||||
|
|
||||||
|
// bypass allocBuffer() shortcut to reinit the texture properly
|
||||||
|
_texture_width = 0;
|
||||||
|
_texture_height = 0;
|
||||||
|
|
||||||
|
allocBuffer(_surface.w, _surface.h);
|
||||||
setDirty();
|
setDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,3 +361,6 @@ void GLESPaletteTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h)
|
||||||
|
|
||||||
GLESTexture::drawTexture(x, y, w, h);
|
GLESTexture::drawTexture(x, y, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(ANDROID)
|
#if defined(__ANDROID__)
|
||||||
|
|
||||||
#include <GLES/gl.h>
|
#include <GLES/gl.h>
|
||||||
|
|
||||||
|
|
67
configure
vendored
67
configure
vendored
|
@ -979,7 +979,7 @@ case $_host in
|
||||||
android)
|
android)
|
||||||
_host_os=android
|
_host_os=android
|
||||||
_host_cpu=arm
|
_host_cpu=arm
|
||||||
_host_alias=arm-oe-linux-androideabi
|
_host_alias=arm-linux-androideabi
|
||||||
;;
|
;;
|
||||||
arm-riscos)
|
arm-riscos)
|
||||||
_host_os=riscos
|
_host_os=riscos
|
||||||
|
@ -1184,6 +1184,7 @@ fi
|
||||||
# Determine extension used for executables
|
# Determine extension used for executables
|
||||||
#
|
#
|
||||||
get_system_exe_extension $_host_os
|
get_system_exe_extension $_host_os
|
||||||
|
HOSTEXEPRE=
|
||||||
HOSTEXEEXT=$_exeext
|
HOSTEXEEXT=$_exeext
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -1207,6 +1208,10 @@ android)
|
||||||
echo "Please set ANDROID_SDK in your environment. export ANDROID_SDK=<path to Android SDK>"
|
echo "Please set ANDROID_SDK in your environment. export ANDROID_SDK=<path to Android SDK>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
if test -z "$ANDROID_NDK"; then
|
||||||
|
echo "Please set ANDROID_NDK in your environment. export ANDROID_NDK=<path to Android NDK>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
ds | gamecube | wii)
|
ds | gamecube | wii)
|
||||||
if test -z "$DEVKITPRO"; then
|
if test -z "$DEVKITPRO"; then
|
||||||
|
@ -1499,7 +1504,13 @@ case $_host_os in
|
||||||
add_line_to_config_mk 'AMIGAOS = 1'
|
add_line_to_config_mk 'AMIGAOS = 1'
|
||||||
;;
|
;;
|
||||||
android)
|
android)
|
||||||
CXXFLAGS="$CXXFLAGS -Os -msoft-float -mtune=xscale -march=armv5te -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5TE__"
|
CXXFLAGS="$CXXFLAGS --sysroot=$ANDROID_NDK/platforms/android-4/arch-arm"
|
||||||
|
CXXFLAGS="$CXXFLAGS -Os -mandroid -msoft-float -mthumb-interwork"
|
||||||
|
CXXFLAGS="$CXXFLAGS -march=armv5te -mtune=xscale"
|
||||||
|
# supress 'mangling of 'va_list' has changed in GCC 4.4'
|
||||||
|
CXXFLAGS="$CXXFLAGS -Wno-psabi"
|
||||||
|
LDFLAGS="$LDFLAGS --sysroot=$ANDROID_NDK/platforms/android-4/arch-arm"
|
||||||
|
LDFLAGS="$LDFLAGS -mandroid -mthumb-interwork"
|
||||||
add_line_to_config_mk "ANDROID_SDK = $ANDROID_SDK"
|
add_line_to_config_mk "ANDROID_SDK = $ANDROID_SDK"
|
||||||
_unix=yes
|
_unix=yes
|
||||||
_seq_midi=no
|
_seq_midi=no
|
||||||
|
@ -1648,9 +1659,12 @@ if test -n "$_host"; then
|
||||||
echo "Cross-compiling to $_host"
|
echo "Cross-compiling to $_host"
|
||||||
case "$_host" in
|
case "$_host" in
|
||||||
android)
|
android)
|
||||||
DEFINES="$DEFINES -DANDROID -DUSE_ARM_SMUSH_ASM"
|
|
||||||
_unix=yes
|
_unix=yes
|
||||||
_need_memalign=yes
|
_need_memalign=yes
|
||||||
|
# we link a .so as default
|
||||||
|
LDFLAGS="$LDFLAGS -shared -Wl,-Bsymbolic,--no-undefined"
|
||||||
|
HOSTEXEPRE=lib
|
||||||
|
HOSTEXEEXT=.so
|
||||||
add_line_to_config_mk 'USE_ARM_SOUND_ASM = 1'
|
add_line_to_config_mk 'USE_ARM_SOUND_ASM = 1'
|
||||||
add_line_to_config_mk 'USE_ARM_SMUSH_ASM = 1'
|
add_line_to_config_mk 'USE_ARM_SMUSH_ASM = 1'
|
||||||
add_line_to_config_mk 'USE_ARM_GFX_ASM = 1'
|
add_line_to_config_mk 'USE_ARM_GFX_ASM = 1'
|
||||||
|
@ -1658,6 +1672,7 @@ if test -n "$_host"; then
|
||||||
add_line_to_config_mk 'USE_ARM_COSTUME_ASM = 1'
|
add_line_to_config_mk 'USE_ARM_COSTUME_ASM = 1'
|
||||||
_backend="android"
|
_backend="android"
|
||||||
_port_mk="backends/platform/android/android.mk"
|
_port_mk="backends/platform/android/android.mk"
|
||||||
|
_build_scalers=no
|
||||||
_seq_midi=no
|
_seq_midi=no
|
||||||
;;
|
;;
|
||||||
arm-linux|arm*-linux-gnueabi|arm-*-linux)
|
arm-linux|arm*-linux-gnueabi|arm-*-linux)
|
||||||
|
@ -2134,6 +2149,32 @@ _def_plugin="/* -> plugins disabled */"
|
||||||
if test "$_dynamic_modules" = yes ; then
|
if test "$_dynamic_modules" = yes ; then
|
||||||
echo_n "Checking whether building plugins is supported... "
|
echo_n "Checking whether building plugins is supported... "
|
||||||
case $_host_os in
|
case $_host_os in
|
||||||
|
android)
|
||||||
|
_def_plugin='
|
||||||
|
#define PLUGIN_PREFIX "lib"
|
||||||
|
#define PLUGIN_SUFFIX ".so"
|
||||||
|
'
|
||||||
|
# Work around an Android 2.0+ run-time linker bug:
|
||||||
|
# The linker doesn't actually look in previously
|
||||||
|
# loaded libraries when trying to resolve symbols -
|
||||||
|
# effectively turning all dlopen(RTLD_GLOBAL) calls
|
||||||
|
# into dlopen(RTLD_LOCAL). It *does* look in
|
||||||
|
# DT_NEEDED libraries, so the workaround is to add an
|
||||||
|
# (otherwise unnecessary) dependency from plugins back
|
||||||
|
# to the main libscummvm.so.
|
||||||
|
_mak_plugins='
|
||||||
|
DYNAMIC_MODULES := 1
|
||||||
|
PLUGIN_PREFIX := lib
|
||||||
|
PLUGIN_SUFFIX := .so
|
||||||
|
PLUGIN_EXTRA_DEPS = libscummvm.so
|
||||||
|
CXXFLAGS += -DDYNAMIC_MODULES
|
||||||
|
CXXFLAGS += -fpic
|
||||||
|
PLUGIN_LDFLAGS += $(LDFLAGS) -L. -lscummvm
|
||||||
|
PRE_OBJS_FLAGS := -Wl,-export-dynamic -Wl,-whole-archive
|
||||||
|
POST_OBJS_FLAGS := -Wl,-no-whole-archive
|
||||||
|
LIBS += -ldl
|
||||||
|
'
|
||||||
|
;;
|
||||||
darwin*)
|
darwin*)
|
||||||
_def_plugin='
|
_def_plugin='
|
||||||
#define PLUGIN_PREFIX ""
|
#define PLUGIN_PREFIX ""
|
||||||
|
@ -2216,7 +2257,7 @@ POST_OBJS_FLAGS := -Wl,-no-whole-archive
|
||||||
LIBS += -ldl
|
LIBS += -ldl
|
||||||
'
|
'
|
||||||
;;
|
;;
|
||||||
linux*|android)
|
linux*)
|
||||||
_def_plugin='
|
_def_plugin='
|
||||||
#define PLUGIN_PREFIX "lib"
|
#define PLUGIN_PREFIX "lib"
|
||||||
#define PLUGIN_SUFFIX ".so"
|
#define PLUGIN_SUFFIX ".so"
|
||||||
|
@ -2927,20 +2968,9 @@ case $_backend in
|
||||||
# -lgcc is carefully placed here - we want to catch
|
# -lgcc is carefully placed here - we want to catch
|
||||||
# all toolchain symbols in *our* libraries rather
|
# all toolchain symbols in *our* libraries rather
|
||||||
# than pick up anything unhygenic from the Android libs.
|
# than pick up anything unhygenic from the Android libs.
|
||||||
LIBS="-Wl,-Bstatic $static_libs -Wl,-Bdynamic -lgcc $system_libs -lstdc++ -llog -lGLESv1_CM"
|
LIBS="-Wl,-Bstatic $static_libs"
|
||||||
DEFINES="$DEFINES -D__ANDROID__ -DANDROID_BACKEND -DREDUCE_MEMORY_USAGE"
|
LIBS="$LIBS -Wl,-Bdynamic -lgcc $system_libs -llog -lGLESv1_CM"
|
||||||
add_line_to_config_mk 'PLUGIN_LDFLAGS += $(LDFLAGS) -Wl,-shared,-Bsymbolic'
|
DEFINES="$DEFINES -D__ANDROID__ -DREDUCE_MEMORY_USAGE"
|
||||||
|
|
||||||
# Work around an Android 2.0+ run-time linker bug:
|
|
||||||
# The linker doesn't actually look in previously
|
|
||||||
# loaded libraries when trying to resolve symbols -
|
|
||||||
# effectively turning all dlopen(RTLD_GLOBAL) calls
|
|
||||||
# into dlopen(RTLD_LOCAL). It *does* look in
|
|
||||||
# DT_NEEDED libraries, so the workaround is to add an
|
|
||||||
# (otherwise unnecessary) dependency from plugins back
|
|
||||||
# to the main libscummvm.so.
|
|
||||||
add_line_to_config_mk 'PLUGIN_LDFLAGS += -Lbuild.tmp -lscummvm'
|
|
||||||
add_line_to_config_mk 'PLUGIN_EXTRA_DEPS += build.tmp/libscummvm.so'
|
|
||||||
;;
|
;;
|
||||||
dc)
|
dc)
|
||||||
INCLUDES="$INCLUDES "'-I$(srcdir)/backends/platform/dc -isystem $(ronindir)/include'
|
INCLUDES="$INCLUDES "'-I$(srcdir)/backends/platform/dc -isystem $(ronindir)/include'
|
||||||
|
@ -3222,6 +3252,7 @@ STATICLIBPATH=$_staticlibpath
|
||||||
BACKEND := $_backend
|
BACKEND := $_backend
|
||||||
MODULES += $MODULES
|
MODULES += $MODULES
|
||||||
MODULE_DIRS += $MODULE_DIRS
|
MODULE_DIRS += $MODULE_DIRS
|
||||||
|
EXEPRE := $HOSTEXEPRE
|
||||||
EXEEXT := $HOSTEXEEXT
|
EXEEXT := $HOSTEXEEXT
|
||||||
NASM := $NASM
|
NASM := $NASM
|
||||||
NASMFLAGS := $NASMFLAGS
|
NASMFLAGS := $NASMFLAGS
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue