mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 17:33:05 +00:00
ANDROID: Remove Unpacker and plugin related things
Also remove the splash screen that happend during unpacking.
This commit is contained in:
parent
841d08db2e
commit
0afc2b8e0b
@ -398,12 +398,6 @@ void OSystem_Android::initBackend() {
|
||||
EventsBaseBackend::initBackend();
|
||||
}
|
||||
|
||||
void OSystem_Android::addPluginDirectories(Common::FSList &dirs) const {
|
||||
ENTER();
|
||||
|
||||
JNI::getPluginDirectories(dirs);
|
||||
}
|
||||
|
||||
bool OSystem_Android::hasFeature(Feature f) {
|
||||
return (f == kFeatureFullscreenMode ||
|
||||
f == kFeatureAspectRatioCorrection ||
|
||||
@ -611,10 +605,4 @@ Common::String OSystem_Android::getSystemProperty(const char *name) const {
|
||||
return Common::String(value, len);
|
||||
}
|
||||
|
||||
#ifdef DYNAMIC_MODULES
|
||||
void AndroidPluginProvider::addCustomDirectories(Common::FSList &dirs) const {
|
||||
((OSystem_Android *)g_system)->addPluginDirectories(dirs);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -100,13 +100,6 @@ extern void checkGlError(const char *expr, const char *file, int line);
|
||||
#define GLTHREADCHECK do { } while (false)
|
||||
#endif
|
||||
|
||||
#ifdef DYNAMIC_MODULES
|
||||
class AndroidPluginProvider : public POSIXPluginProvider {
|
||||
protected:
|
||||
virtual void addCustomDirectories(Common::FSList &dirs) const;
|
||||
};
|
||||
#endif
|
||||
|
||||
class OSystem_Android : public EventsBaseBackend, public PaletteManager, public KeyReceiver {
|
||||
private:
|
||||
// passed from the dark side
|
||||
@ -188,7 +181,6 @@ public:
|
||||
virtual ~OSystem_Android();
|
||||
|
||||
virtual void initBackend();
|
||||
void addPluginDirectories(Common::FSList &dirs) const;
|
||||
void enableZoning(bool enable) { _enable_zoning = enable; }
|
||||
|
||||
virtual bool hasFeature(Feature f);
|
||||
|
@ -19,8 +19,6 @@ RESOURCES = \
|
||||
$(PATH_BUILD_RES)/values/strings.xml \
|
||||
$(PATH_BUILD_RES)/menu/game_menu.xml \
|
||||
$(PATH_BUILD_RES)/layout/main.xml \
|
||||
$(PATH_BUILD_RES)/layout/splash.xml \
|
||||
$(PATH_BUILD_RES)/drawable/gradient.xml \
|
||||
$(PATH_BUILD_RES)/drawable/residualvm.png \
|
||||
$(PATH_BUILD_RES)/drawable/residualvm_big.png
|
||||
|
||||
|
@ -79,7 +79,6 @@ jmethodID JNI::_MID_displayMessageOnOSD = 0;
|
||||
jmethodID JNI::_MID_setWindowCaption = 0;
|
||||
jmethodID JNI::_MID_showVirtualKeyboard = 0;
|
||||
jmethodID JNI::_MID_getSysArchives = 0;
|
||||
jmethodID JNI::_MID_getPluginDirectories = 0;
|
||||
jmethodID JNI::_MID_initSurface = 0;
|
||||
jmethodID JNI::_MID_deinitSurface = 0;
|
||||
|
||||
@ -293,46 +292,6 @@ void JNI::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
|
||||
}
|
||||
}
|
||||
|
||||
void JNI::getPluginDirectories(Common::FSList &dirs) {
|
||||
JNIEnv *env = JNI::getEnv();
|
||||
|
||||
jobjectArray array =
|
||||
(jobjectArray)env->CallObjectMethod(_jobj, _MID_getPluginDirectories);
|
||||
|
||||
if (env->ExceptionCheck()) {
|
||||
LOGE("Error finding plugin directories");
|
||||
|
||||
env->ExceptionDescribe();
|
||||
env->ExceptionClear();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
jsize size = env->GetArrayLength(array);
|
||||
for (jsize i = 0; i < size; ++i) {
|
||||
jstring path_obj = (jstring)env->GetObjectArrayElement(array, i);
|
||||
|
||||
if (path_obj == 0)
|
||||
continue;
|
||||
|
||||
const char *path = env->GetStringUTFChars(path_obj, 0);
|
||||
|
||||
if (path == 0) {
|
||||
LOGE("Error getting string characters from plugin directory");
|
||||
|
||||
env->ExceptionClear();
|
||||
env->DeleteLocalRef(path_obj);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
dirs.push_back(Common::FSNode(path));
|
||||
|
||||
env->ReleaseStringUTFChars(path_obj, path);
|
||||
env->DeleteLocalRef(path_obj);
|
||||
}
|
||||
}
|
||||
|
||||
bool JNI::initSurface() {
|
||||
JNIEnv *env = JNI::getEnv();
|
||||
|
||||
@ -454,7 +413,6 @@ void JNI::create(JNIEnv *env, jobject self, jobject asset_manager,
|
||||
FIND_METHOD(, displayMessageOnOSD, "(Ljava/lang/String;)V");
|
||||
FIND_METHOD(, showVirtualKeyboard, "(Z)V");
|
||||
FIND_METHOD(, getSysArchives, "()[Ljava/lang/String;");
|
||||
FIND_METHOD(, getPluginDirectories, "()[Ljava/lang/String;");
|
||||
FIND_METHOD(, initSurface, "()Ljavax/microedition/khronos/egl/EGLSurface;");
|
||||
FIND_METHOD(, deinitSurface, "()V");
|
||||
|
||||
@ -543,10 +501,6 @@ jint JNI::main(JNIEnv *env, jobject self, jobjectArray args) {
|
||||
env->DeleteLocalRef(arg);
|
||||
}
|
||||
|
||||
#ifdef DYNAMIC_MODULES
|
||||
PluginManager::instance().addPluginProvider(new AndroidPluginProvider());
|
||||
#endif
|
||||
|
||||
LOGI("Entering scummvm_main with %d args", argc);
|
||||
|
||||
res = scummvm_main(argc, argv);
|
||||
|
@ -55,7 +55,6 @@ public:
|
||||
|
||||
static void setReadyForEvents(bool ready);
|
||||
|
||||
static void getPluginDirectories(Common::FSList &dirs);
|
||||
static void setWindowCaption(const char *caption);
|
||||
static void getDPI(float *values);
|
||||
static void displayMessageOnOSD(const char *msg);
|
||||
@ -93,7 +92,6 @@ private:
|
||||
static jmethodID _MID_setWindowCaption;
|
||||
static jmethodID _MID_showVirtualKeyboard;
|
||||
static jmethodID _MID_getSysArchives;
|
||||
static jmethodID _MID_getPluginDirectories;
|
||||
static jmethodID _MID_initSurface;
|
||||
static jmethodID _MID_deinitSurface;
|
||||
|
||||
|
@ -1,63 +0,0 @@
|
||||
package org.residualvm.residualvm;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class PluginProvider extends BroadcastReceiver {
|
||||
private final static String LOG_TAG = "ResidualVM";
|
||||
|
||||
public final static String META_UNPACK_LIB =
|
||||
"org.residualvm.residualvm.meta.UNPACK_LIB";
|
||||
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (!intent.getAction().equals(ResidualVMApplication.ACTION_PLUGIN_QUERY))
|
||||
return;
|
||||
|
||||
Bundle extras = getResultExtras(true);
|
||||
|
||||
final ActivityInfo info;
|
||||
final PackageInfo pinfo;
|
||||
try {
|
||||
info = context.getPackageManager()
|
||||
.getReceiverInfo(new ComponentName(context, this.getClass()),
|
||||
PackageManager.GET_META_DATA);
|
||||
pinfo = context.getPackageManager()
|
||||
.getPackageInfo(context.getPackageName(), 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.e(LOG_TAG, "Error finding my own info?", e);
|
||||
return;
|
||||
}
|
||||
|
||||
String host_version = extras.getString(ResidualVMApplication.EXTRA_VERSION);
|
||||
if (!pinfo.versionName.equals(host_version)) {
|
||||
Log.e(LOG_TAG, "Plugin version " + pinfo.versionName + " is not equal to ResidualVM version " + host_version);
|
||||
return;
|
||||
}
|
||||
|
||||
String mylib = info.metaData.getString(META_UNPACK_LIB);
|
||||
if (mylib != null) {
|
||||
ArrayList<String> all_libs =
|
||||
extras.getStringArrayList(ResidualVMApplication.EXTRA_UNPACK_LIBS);
|
||||
all_libs.add(new Uri.Builder()
|
||||
.scheme("plugin")
|
||||
.authority(context.getPackageName())
|
||||
.path(mylib)
|
||||
.toString());
|
||||
|
||||
extras.putStringArrayList(ResidualVMApplication.EXTRA_UNPACK_LIBS,
|
||||
all_libs);
|
||||
}
|
||||
|
||||
setResultExtras(extras);
|
||||
}
|
||||
}
|
@ -54,7 +54,6 @@ public abstract class ResidualVM implements SurfaceHolder.Callback, Runnable {
|
||||
abstract protected void getDPI(float[] values);
|
||||
abstract protected void displayMessageOnOSD(String msg);
|
||||
abstract protected void setWindowCaption(String caption);
|
||||
abstract protected String[] getPluginDirectories();
|
||||
abstract protected void showVirtualKeyboard(boolean enable);
|
||||
abstract protected String[] getSysArchives();
|
||||
|
||||
@ -449,10 +448,6 @@ public abstract class ResidualVM implements SurfaceHolder.Callback, Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
File cache_dir = ResidualVMApplication.getLastCacheDir();
|
||||
String libname = System.mapLibraryName("residualvm");
|
||||
File libpath = new File(cache_dir, libname);
|
||||
|
||||
System.load(libpath.getPath());
|
||||
System.load("libresidualvm.so");
|
||||
}
|
||||
}
|
||||
|
@ -75,13 +75,6 @@ public class ResidualVMActivity extends Activity {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getPluginDirectories() {
|
||||
String[] dirs = new String[1];
|
||||
dirs[0] = ResidualVMApplication.getLastCacheDir().getPath();
|
||||
return dirs;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void showVirtualKeyboard(final boolean enable) {
|
||||
runOnUiThread(new Runnable() {
|
||||
|
@ -1,31 +0,0 @@
|
||||
package org.residualvm.residualvm;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class ResidualVMApplication extends Application {
|
||||
public final static String ACTION_PLUGIN_QUERY = "org.residualvm.residualvm.action.PLUGIN_QUERY";
|
||||
public final static String EXTRA_UNPACK_LIBS = "org.residualvm.residualvm.extra.UNPACK_LIBS";
|
||||
public final static String EXTRA_VERSION = "org.residualvm.residualvm.extra.VERSION";
|
||||
|
||||
private static File _cache_dir;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
// This is still on /data :(
|
||||
_cache_dir = getCacheDir();
|
||||
// This is mounted noexec :(
|
||||
//cache_dir = new File(Environment.getExternalStorageDirectory(),
|
||||
// "/.ResidualVM.tmp");
|
||||
// This is owned by download manager and requires special
|
||||
// permissions to access :(
|
||||
//cache_dir = Environment.getDownloadCacheDirectory();
|
||||
}
|
||||
|
||||
public static File getLastCacheDir() {
|
||||
return _cache_dir;
|
||||
}
|
||||
}
|
@ -1,388 +0,0 @@
|
||||
package org.residualvm.residualvm;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.zip.ZipFile;
|
||||
import java.util.zip.ZipEntry;
|
||||
|
||||
public class Unpacker extends Activity {
|
||||
protected final static String LOG_TAG = "ResidualVM";
|
||||
// TODO don't hardcode this
|
||||
private final static boolean PLUGINS_ENABLED = false;
|
||||
private final static String META_NEXT_ACTIVITY =
|
||||
"org.residualvm.unpacker.nextActivity";
|
||||
private ProgressBar mProgress;
|
||||
private File mUnpackDest; // location to unpack into
|
||||
private AsyncTask<String, Integer, Void> mUnpacker;
|
||||
private final static int REQUEST_MARKET = 1;
|
||||
|
||||
// Android 3.1+ only
|
||||
public static final int FLAG_INCLUDE_STOPPED_PACKAGES = 32;
|
||||
|
||||
private static class UnpackJob {
|
||||
public ZipFile zipfile;
|
||||
public Set<String> paths;
|
||||
|
||||
public UnpackJob(ZipFile zipfile, Set<String> paths) {
|
||||
this.zipfile = zipfile;
|
||||
this.paths = paths;
|
||||
}
|
||||
|
||||
public long UnpackSize() {
|
||||
long size = 0;
|
||||
for (String path: paths) {
|
||||
ZipEntry entry = zipfile.getEntry(path);
|
||||
if (entry != null) size += entry.getSize();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
private class UnpackTask extends AsyncTask<String, Integer, Void> {
|
||||
@Override
|
||||
protected void onProgressUpdate(Integer... progress) {
|
||||
mProgress.setIndeterminate(false);
|
||||
mProgress.setMax(progress[1]);
|
||||
mProgress.setProgress(progress[0]);
|
||||
mProgress.postInvalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
Bundle md = getMetaData();
|
||||
String nextActivity = md.getString(META_NEXT_ACTIVITY);
|
||||
if (nextActivity != null) {
|
||||
final ComponentName cn =
|
||||
ComponentName.unflattenFromString(nextActivity);
|
||||
if (cn != null) {
|
||||
final Intent origIntent = getIntent();
|
||||
Intent intent = new Intent();
|
||||
intent.setComponent(cn);
|
||||
if (origIntent.getExtras() != null)
|
||||
intent.putExtras(origIntent.getExtras());
|
||||
intent.putExtra(Intent.EXTRA_INTENT, origIntent);
|
||||
intent.setDataAndType(origIntent.getData(),
|
||||
origIntent.getType());
|
||||
//intent.fillIn(getIntent(), 0);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
|
||||
Log.i(LOG_TAG,
|
||||
"Starting next activity with intent " + intent);
|
||||
startActivity(intent);
|
||||
} else {
|
||||
Log.w(LOG_TAG,
|
||||
"Unable to extract a component name from " + nextActivity);
|
||||
}
|
||||
}
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(String... all_libs) {
|
||||
// This will contain all unpack jobs
|
||||
Map<String, UnpackJob> unpack_jobs =
|
||||
new HashMap<String, UnpackJob>(all_libs.length);
|
||||
|
||||
// This will contain all unpack filenames (so we can
|
||||
// detect stale files in the unpack directory)
|
||||
Set<String> all_files = new HashSet<String>(all_libs.length);
|
||||
|
||||
for (String lib: all_libs) {
|
||||
final Uri uri = Uri.parse(lib);
|
||||
final String pkg = uri.getAuthority();
|
||||
final String path = uri.getPath().substring(1); // skip first /
|
||||
|
||||
all_files.add(new File(path).getName());
|
||||
|
||||
UnpackJob job = unpack_jobs.get(pkg);
|
||||
if (job == null) {
|
||||
try {
|
||||
// getPackageResourcePath is hidden in Context,
|
||||
// but exposed in ContextWrapper...
|
||||
ContextWrapper context =
|
||||
new ContextWrapper(createPackageContext(pkg, 0));
|
||||
ZipFile zipfile =
|
||||
new ZipFile(context.getPackageResourcePath());
|
||||
job = new UnpackJob(zipfile, new HashSet<String>(1));
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.e(LOG_TAG, "Package " + pkg +
|
||||
" not found", e);
|
||||
continue;
|
||||
} catch (IOException e) {
|
||||
// FIXME: show some sort of GUI error dialog
|
||||
Log.e(LOG_TAG,
|
||||
"Error opening ZIP for package " + pkg, e);
|
||||
continue;
|
||||
}
|
||||
unpack_jobs.put(pkg, job);
|
||||
}
|
||||
job.paths.add(path);
|
||||
}
|
||||
|
||||
// Delete stale filenames from mUnpackDest
|
||||
for (File file: mUnpackDest.listFiles()) {
|
||||
if (!all_files.contains(file.getName())) {
|
||||
Log.i(LOG_TAG,
|
||||
"Deleting stale cached file " + file);
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
||||
int total_size = 0;
|
||||
for (UnpackJob job: unpack_jobs.values())
|
||||
total_size += job.UnpackSize();
|
||||
|
||||
publishProgress(0, total_size);
|
||||
|
||||
mUnpackDest.mkdirs();
|
||||
|
||||
int progress = 0;
|
||||
|
||||
for (UnpackJob job: unpack_jobs.values()) {
|
||||
try {
|
||||
ZipFile zipfile = job.zipfile;
|
||||
for (String path: job.paths) {
|
||||
ZipEntry zipentry = zipfile.getEntry(path);
|
||||
if (zipentry == null)
|
||||
throw new FileNotFoundException(
|
||||
"Couldn't find " + path + " in zip");
|
||||
File dest = new File(mUnpackDest, new File(path).getName());
|
||||
if (dest.exists() &&
|
||||
dest.lastModified() == zipentry.getTime() &&
|
||||
dest.length() == zipentry.getSize()) {
|
||||
// Already unpacked
|
||||
progress += zipentry.getSize();
|
||||
} else {
|
||||
if (dest.exists())
|
||||
Log.d(LOG_TAG,
|
||||
"Replacing " + dest.getPath() +
|
||||
" old.mtime=" + dest.lastModified() +
|
||||
" new.mtime=" + zipentry.getTime() +
|
||||
" old.size=" + dest.length() +
|
||||
" new.size=" + zipentry.getSize());
|
||||
else
|
||||
Log.i(LOG_TAG,
|
||||
"Extracting " + zipentry.getName() +
|
||||
" from " + zipfile.getName() +
|
||||
" to " + dest.getPath());
|
||||
|
||||
long next_update = progress;
|
||||
|
||||
InputStream in = zipfile.getInputStream(zipentry);
|
||||
OutputStream out = new FileOutputStream(dest);
|
||||
int len;
|
||||
byte[] buffer = new byte[4096];
|
||||
while ((len = in.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, len);
|
||||
progress += len;
|
||||
if (progress >= next_update) {
|
||||
publishProgress(progress, total_size);
|
||||
// Arbitrary limit of 2% update steps
|
||||
next_update += total_size / 50;
|
||||
}
|
||||
}
|
||||
|
||||
in.close();
|
||||
out.close();
|
||||
dest.setLastModified(zipentry.getTime());
|
||||
}
|
||||
publishProgress(progress, total_size);
|
||||
}
|
||||
|
||||
zipfile.close();
|
||||
} catch (IOException e) {
|
||||
// FIXME: show some sort of GUI error dialog
|
||||
Log.e(LOG_TAG, "Error unpacking plugin", e);
|
||||
}
|
||||
}
|
||||
|
||||
if (progress != total_size)
|
||||
Log.d(LOG_TAG, "Ended with progress " + progress +
|
||||
" != total size " + total_size);
|
||||
|
||||
setResult(RESULT_OK);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class PluginBroadcastReciever extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (!intent.getAction()
|
||||
.equals(ResidualVMApplication.ACTION_PLUGIN_QUERY)) {
|
||||
Log.e(LOG_TAG,
|
||||
"Received unexpected action " + intent.getAction());
|
||||
return;
|
||||
}
|
||||
|
||||
Bundle extras = getResultExtras(false);
|
||||
if (extras == null) {
|
||||
// Nothing for us to do.
|
||||
Unpacker.this.setResult(RESULT_OK);
|
||||
finish();
|
||||
}
|
||||
|
||||
ArrayList<String> unpack_libs =
|
||||
extras.getStringArrayList(ResidualVMApplication.EXTRA_UNPACK_LIBS);
|
||||
|
||||
if (unpack_libs != null && !unpack_libs.isEmpty()) {
|
||||
final String[] libs =
|
||||
unpack_libs.toArray(new String[unpack_libs.size()]);
|
||||
mUnpacker = new UnpackTask().execute(libs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void initPlugins() {
|
||||
Bundle extras = new Bundle(1);
|
||||
|
||||
ArrayList<String> unpack_libs = new ArrayList<String>(1);
|
||||
// This is the common ResidualVM code (not really a "plugin" as such)
|
||||
unpack_libs.add(new Uri.Builder()
|
||||
.scheme("plugin")
|
||||
.authority(getPackageName())
|
||||
.path("lib/armeabi/libresidualvm.so")
|
||||
.toString());
|
||||
extras.putStringArrayList(ResidualVMApplication.EXTRA_UNPACK_LIBS,
|
||||
unpack_libs);
|
||||
|
||||
final PackageInfo info;
|
||||
try {
|
||||
info = getPackageManager().getPackageInfo(getPackageName(), 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.e(LOG_TAG, "Error finding my own info?", e);
|
||||
return;
|
||||
}
|
||||
extras.putString(ResidualVMApplication.EXTRA_VERSION, info.versionName);
|
||||
|
||||
Intent intent = new Intent(ResidualVMApplication.ACTION_PLUGIN_QUERY);
|
||||
// Android 3.1 defaults to FLAG_EXCLUDE_STOPPED_PACKAGES, and since
|
||||
// none of our plugins will ever be running, that is not helpful
|
||||
intent.setFlags(FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
sendOrderedBroadcast(intent, Manifest.permission.RESIDUALVM_PLUGIN,
|
||||
new PluginBroadcastReciever(),
|
||||
null, RESULT_OK, null, extras);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle b) {
|
||||
super.onCreate(b);
|
||||
|
||||
mUnpackDest = ResidualVMApplication.getLastCacheDir();
|
||||
|
||||
setContentView(R.layout.splash);
|
||||
mProgress = (ProgressBar)findViewById(R.id.progress);
|
||||
|
||||
setResult(RESULT_CANCELED);
|
||||
|
||||
tryUnpack();
|
||||
}
|
||||
|
||||
private void tryUnpack() {
|
||||
Intent intent = new Intent(ResidualVMApplication.ACTION_PLUGIN_QUERY);
|
||||
List<ResolveInfo> plugins = getPackageManager()
|
||||
.queryBroadcastReceivers(intent, 0);
|
||||
if (PLUGINS_ENABLED && plugins.isEmpty()) {
|
||||
// No plugins installed
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.no_plugins_title)
|
||||
.setMessage(R.string.no_plugins_found)
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.quit,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
final Uri uri = Uri.parse("market://search?q=ResidualVM plugin");
|
||||
final Intent market_intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||
if (getPackageManager().resolveActivity(market_intent, 0) != null) {
|
||||
alert.setPositiveButton(R.string.to_market,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
try {
|
||||
startActivityForResult(market_intent,
|
||||
REQUEST_MARKET);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Log.e(LOG_TAG,
|
||||
"Error starting market", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
alert.show();
|
||||
|
||||
} else {
|
||||
// Already have at least one plugin installed
|
||||
initPlugins();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
if (mUnpacker != null)
|
||||
mUnpacker.cancel(true);
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode,
|
||||
Intent data) {
|
||||
switch (requestCode) {
|
||||
case REQUEST_MARKET:
|
||||
if (resultCode != RESULT_OK)
|
||||
Log.w(LOG_TAG, "Market returned " + resultCode);
|
||||
tryUnpack();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private Bundle getMetaData() {
|
||||
try {
|
||||
ActivityInfo ai = getPackageManager()
|
||||
.getActivityInfo(getComponentName(), PackageManager.GET_META_DATA);
|
||||
return ai.metaData;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.w(LOG_TAG, "Unable to find my own meta-data", e);
|
||||
return new Bundle();
|
||||
}
|
||||
}
|
||||
}
|
@ -19,29 +19,14 @@
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name=".Unpacker"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
<meta-data android:name="org.residualvm.unpacker.nextActivity"
|
||||
android:value="org.residualvm.residualvm/.ResidualVMActivity"/>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="tv.ouya.intent.category.GAME"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<permission android:name="org.residualvm.residualvm.permission.RESIDUALVM_PLUGIN"
|
||||
android:label="@string/residualvm_perm_plugin_label"
|
||||
android:description="@string/residualvm_perm_plugin_desc"
|
||||
android:protectionLevel="signature"/>
|
||||
</application>
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
|
||||
|
@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ $# -ne 5 ]; then
|
||||
echo "usage: $0 configure plugin template versioncode target"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CONFIGURE=$1
|
||||
PLUGIN_NAME=$2
|
||||
TEMPLATE=$3
|
||||
PLUGIN_VERSION_CODE=$4
|
||||
TARGET=$5
|
||||
|
||||
PLUGIN_DESC=`sed -n "s/add_engine\s$PLUGIN_NAME\s\"\(.\+\)\"\s.*/\1/p" < $CONFIGURE`
|
||||
|
||||
sed "s|@PLUGIN_NAME@|$PLUGIN_NAME|;s|@PLUGIN_VERSION_CODE@|$PLUGIN_VERSION_CODE|;s|@PLUGIN_DESC@|$PLUGIN_DESC|" < $TEMPLATE > $TARGET
|
@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.residualvm.residualvm.plugin.@PLUGIN_NAME@"
|
||||
android:versionCode="@PLUGIN_VERSION_CODE@"
|
||||
android:versionName="0.2.0git"
|
||||
android:installLocation="preferExternal"
|
||||
android:sharedUserId="org.residualvm.residualvm">
|
||||
|
||||
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="8" />
|
||||
|
||||
<application android:label="@string/app_name"
|
||||
android:description="@string/app_desc"
|
||||
android:icon="@drawable/residualvm">
|
||||
<receiver android:name="org.residualvm.residualvm.PluginProvider"
|
||||
android:process="org.residualvm.residualvm">
|
||||
<intent-filter>
|
||||
<action android:name="org.residualvm.residualvm.action.PLUGIN_QUERY"/>
|
||||
<category android:name="android.intent.category.INFO"/>
|
||||
</intent-filter>
|
||||
<meta-data android:name="org.residualvm.residualvm.meta.UNPACK_LIB"
|
||||
android:value="mylib/armeabi/lib@PLUGIN_NAME@.so" />
|
||||
</receiver>
|
||||
</application>
|
||||
|
||||
<uses-permission android:name="org.residualvm.residualvm.permission.RESIDUALVM_PLUGIN"/>
|
||||
<uses-configuration android:reqFiveWayNav="true"
|
||||
android:reqKeyboardType="qwerty"/>
|
||||
|
||||
<uses-configuration android:reqTouchScreen="finger"
|
||||
android:reqKeyboardType="qwerty"/>
|
||||
|
||||
<uses-configuration android:reqTouchScreen="stylus"
|
||||
android:reqKeyboardType="qwerty"/>
|
||||
</manifest>
|
@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.residualvm.residualvm.plugin.@PLUGIN_NAME@"
|
||||
android:versionCode="@PLUGIN_VERSION_CODE@"
|
||||
android:versionName="@VERSION@"
|
||||
android:installLocation="preferExternal"
|
||||
android:sharedUserId="org.residualvm.residualvm">
|
||||
|
||||
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="8" />
|
||||
|
||||
<application android:label="@string/app_name"
|
||||
android:description="@string/app_desc"
|
||||
android:icon="@drawable/residualvm">
|
||||
<receiver android:name="org.residualvm.residualvm.PluginProvider"
|
||||
android:process="org.residualvm.residualvm">
|
||||
<intent-filter>
|
||||
<action android:name="org.residualvm.residualvm.action.PLUGIN_QUERY"/>
|
||||
<category android:name="android.intent.category.INFO"/>
|
||||
</intent-filter>
|
||||
<meta-data android:name="org.residualvm.residualvm.meta.UNPACK_LIB"
|
||||
android:value="mylib/armeabi/lib@PLUGIN_NAME@.so" />
|
||||
</receiver>
|
||||
</application>
|
||||
|
||||
<uses-permission android:name="org.residualvm.residualvm.permission.RESIDUALVM_PLUGIN"/>
|
||||
<uses-configuration android:reqFiveWayNav="true"
|
||||
android:reqKeyboardType="qwerty"/>
|
||||
|
||||
<uses-configuration android:reqTouchScreen="finger"
|
||||
android:reqKeyboardType="qwerty"/>
|
||||
|
||||
<uses-configuration android:reqTouchScreen="stylus"
|
||||
android:reqKeyboardType="qwerty"/>
|
||||
</manifest>
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<resources>
|
||||
<string name="app_name">ResidualVM plugin: "@PLUGIN_NAME@"</string>
|
||||
<string name="app_desc">Game engine for: @PLUGIN_DESC@</string>
|
||||
</resources>
|
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:startColor="#4889a7"
|
||||
android:endColor="#1d7095"
|
||||
android:angle="315" />
|
||||
</shape>
|
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/gradient"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/residualvm_big" />
|
||||
<ProgressBar android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="300dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="20dip"/>
|
||||
</LinearLayout>
|
Loading…
x
Reference in New Issue
Block a user