aboutsummaryrefslogtreecommitdiff
path: root/dists/android
diff options
context:
space:
mode:
authorMax Horn2010-06-06 09:34:36 +0000
committerMax Horn2010-06-06 09:34:36 +0000
commit46155b2c3678784f6333eed1d65a35eefdcb2001 (patch)
tree1f570683935a5bede0e2475493a4f48b1548d320 /dists/android
parent3efec5720de2c46355c323763dee96b719ed5aa1 (diff)
downloadscummvm-rg350-46155b2c3678784f6333eed1d65a35eefdcb2001.tar.gz
scummvm-rg350-46155b2c3678784f6333eed1d65a35eefdcb2001.tar.bz2
scummvm-rg350-46155b2c3678784f6333eed1d65a35eefdcb2001.zip
Add Android backend from patch #2603856
svn-id: r49449
Diffstat (limited to 'dists/android')
-rw-r--r--dists/android/mkmanifest.pl169
-rw-r--r--dists/android/res/drawable/gradient.xml7
-rw-r--r--dists/android/res/layout/main.xml10
-rw-r--r--dists/android/res/layout/splash.xml19
-rw-r--r--dists/android/res/values/strings.xml22
5 files changed, 227 insertions, 0 deletions
diff --git a/dists/android/mkmanifest.pl b/dists/android/mkmanifest.pl
new file mode 100644
index 0000000000..00d15f561e
--- /dev/null
+++ b/dists/android/mkmanifest.pl
@@ -0,0 +1,169 @@
+#!/usr/bin/perl
+
+use File::Basename qw(dirname);
+use File::Path qw(mkpath);
+use IO::File;
+use XML::Writer;
+use XML::Parser;
+use Getopt::Long;
+
+use warnings;
+use strict;
+
+use constant ANDROID => 'http://schemas.android.com/apk/res/android';
+
+my $id;
+my $package_versionName;
+my $package_versionCode;
+my $configure = 'configure';
+my $stringres = 'res/string/values.xml';
+my $manifest = 'AndroidManifest.xml';
+my $master_manifest;
+my @unpack_libs;
+GetOptions('id=s' => \$id,
+ 'version-name=s' => \$package_versionName,
+ 'version-code=i' => \$package_versionCode,
+ 'configure=s' => \$configure,
+ 'stringres=s' => \$stringres,
+ 'manifest=s' => \$manifest,
+ 'master-manifest=s' => \$master_manifest,
+ 'unpacklib=s' => \@unpack_libs,
+ ) or die;
+die "Missing required arg"
+ unless $id and $package_versionName and $package_versionCode;
+
+
+sub grope_engine_info {
+ my $configure = shift;
+ my @ret;
+ while (<$configure>) {
+ m/^add_engine \s+ (\w+) \s+ "(.*?)" \s+ \w+ (?:\s+ "([\w\s]*)")?/x
+ or next;
+ my $subengines = $3 || '';
+ my %info = (id => $1, name => $2,
+ subengines => [split / /, $subengines]);
+ push @ret, \%info;
+ }
+ return @ret;
+}
+
+sub read_constraints {
+ my $manifest = shift;
+ my @constraints;
+ my $parser = new XML::Parser Handlers => {
+ Start => sub {
+ my $expat = shift;
+ my $elem = shift;
+ return if $elem !~
+ /^(uses-configuration|supports-screens|uses-sdk)$/;
+ my @constraint = ($elem);
+ while (@_) {
+ my $attr = shift;
+ my $value = shift;
+ $attr = [ANDROID, $attr] if $attr =~ s/^android://;
+ push @constraint, $attr, $value;
+ }
+ push @constraints, \@constraint;
+ },
+ };
+ $parser->parse($manifest);
+ return @constraints;
+}
+
+sub print_stringres {
+ my $output = shift;
+ my $info = shift;
+
+ my $writer = new XML::Writer(OUTPUT => $output, ENCODING => 'utf-8',
+ DATA_MODE => 1, DATA_INDENT => 2);
+
+ $writer->xmlDecl();
+ $writer->startTag('resources');
+
+ while (my ($k,$v) = each %$info) {
+ $writer->dataElement('string', $v, name => $k);
+ }
+
+ $writer->endTag('resources');
+ $writer->end();
+}
+
+sub print_manifest {
+ my $output = shift;
+ my $info = shift;
+ my $constraints = shift;
+
+ my $writer = new XML::Writer(OUTPUT => $output, ENCODING => 'utf-8',
+ DATA_MODE => 1, DATA_INDENT => 2,
+ NAMESPACES => 1,
+ PREFIX_MAP => {ANDROID, 'android'});
+
+ $writer->xmlDecl();
+
+ $writer->startTag(
+ 'manifest',
+ 'package' => "org.inodes.gus.scummvm.plugin.$info->{name}",
+ [ANDROID, 'versionCode'] => $package_versionCode,
+ [ANDROID, 'versionName'] => $package_versionName,
+ );
+
+ $writer->startTag(
+ 'application',
+ [ANDROID, 'label'] => '@string/app_name',
+ [ANDROID, 'description'] => '@string/app_desc',
+ [ANDROID, 'icon'] => '@drawable/scummvm',
+ );
+
+ $writer->startTag(
+ 'receiver',
+ [ANDROID, 'name'] => 'org.inodes.gus.scummvm.PluginProvider',
+ [ANDROID, 'process'] => 'org.inodes.gus.scummvm');
+
+ $writer->startTag('intent-filter');
+ $writer->emptyTag('action', [ANDROID, 'name'] =>
+ 'org.inodes.gus.scummvm.action.PLUGIN_QUERY');
+ $writer->emptyTag('category', [ANDROID, 'name'] =>
+ 'android.intent.category.INFO');
+ $writer->endTag('intent-filter');
+ $writer->emptyTag(
+ 'meta-data',
+ [ANDROID, 'name'] => 'org.inodes.gus.scummvm.meta.UNPACK_LIB',
+ [ANDROID, 'value'] => $_)
+ for @{$info->{unpack_libs}};
+
+ $writer->endTag('receiver');
+ $writer->endTag('application');
+
+ $writer->emptyTag('uses-permission', [ANDROID, 'name'] =>
+ 'org.inodes.gus.scummvm.permission.SCUMMVM_PLUGIN');
+
+ $writer->emptyTag(@$_) foreach @$constraints;
+
+ $writer->endTag('manifest');
+ $writer->end();
+}
+
+
+my %engines;
+for my $engine (grope_engine_info(new IO::File $configure, 'r')) {
+ $engines{$engine->{id}} = $engine;
+}
+
+my @games = ($id, @{$engines{$id}{subengines}});
+my $games_desc = join('; ', map $engines{$_}{name}, @games);
+
+my @constraints = read_constraints(new IO::File $master_manifest, 'r');
+
+print "Writing $stringres ...\n";
+mkpath(dirname($stringres));
+print_stringres(IO::File->new($stringres, 'w'),
+ {app_name => qq{ScummVM plugin: "$id"},
+ app_desc => "Game engine for: $games_desc",
+ });
+
+print "Writing $manifest ...\n";
+mkpath(dirname($manifest));
+print_manifest(IO::File->new($manifest, 'w'),
+ {name => $id, unpack_libs => \@unpack_libs}, \@constraints);
+
+exit 0;
diff --git a/dists/android/res/drawable/gradient.xml b/dists/android/res/drawable/gradient.xml
new file mode 100644
index 0000000000..dbfd9b5b34
--- /dev/null
+++ b/dists/android/res/drawable/gradient.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <gradient
+ android:startColor="#e9bb8b"
+ android:endColor="#d16e09"
+ android:angle="315" />
+</shape>
diff --git a/dists/android/res/layout/main.xml b/dists/android/res/layout/main.xml
new file mode 100644
index 0000000000..f5276ce41b
--- /dev/null
+++ b/dists/android/res/layout/main.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<org.inodes.gus.scummvm.EditableSurfaceView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent" android:layout_height="fill_parent"
+ android:id="@+id/main_surface"
+ android:gravity="center"
+ android:keepScreenOn="true"
+ android:focusable="true"
+ android:focusableInTouchMode="true"
+/>
diff --git a/dists/android/res/layout/splash.xml b/dists/android/res/layout/splash.xml
new file mode 100644
index 0000000000..e9fd5f70e7
--- /dev/null
+++ b/dists/android/res/layout/splash.xml
@@ -0,0 +1,19 @@
+<?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/scummvm_big" />
+ <ProgressBar android:id="@+id/progress"
+ style="?android:attr/progressBarStyleHorizontal"
+ android:layout_width="300dip"
+ android:layout_height="wrap_content"
+ android:padding="20dip"/>
+</LinearLayout>
diff --git a/dists/android/res/values/strings.xml b/dists/android/res/values/strings.xml
new file mode 100644
index 0000000000..e06509d3ed
--- /dev/null
+++ b/dists/android/res/values/strings.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="app_name">ScummVM</string>
+ <string name="app_desc">Graphic adventure game engine</string>
+ <string name="quit">Quit</string>
+ <string name="scummvm_perm_plugin_label">ScummVM plugin</string>
+ <string name="scummvm_perm_plugin_desc">Allows the application to
+ provide a ScummVM loadable plugin: code that will be executed in the
+ ScummVM application. Malicious plugins may do anything ScummVM
+ itself could do: write to your SD card, delete your savegames,
+ change the ScummVM background to puce, replace menu labels with rude
+ words, etc.</string>
+ <string name="no_sdcard_title">No SD card?</string>
+ <string name="no_sdcard">Unable to read your SD card. This usually
+ means you still have it mounted on your PC. Unmount, reinsert,
+ whatever and then try again.</string>
+ <string name="no_plugins_title">No plugins found</string>
+ <string name="no_plugins_found">ScummVM requires at least one <i>game
+ engine</i> to be useful. Engines are available as separate plugin
+ packages, from wherever you found ScummVM.</string>
+ <string name="to_market">To Market</string>
+</resources>