script to prepare a new game
authorChristian Weiske <cweiske@cweiske.de>
Sat, 12 Sep 2015 21:42:56 +0000 (23:42 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Sat, 12 Sep 2015 21:42:56 +0000 (23:42 +0200)
LaunchRomActivity.java.tpl [new file with mode: 0644]
README.rst
cleanup.sh [new file with mode: 0755]
prepare-game.sh [new file with mode: 0755]

diff --git a/LaunchRomActivity.java.tpl b/LaunchRomActivity.java.tpl
new file mode 100644 (file)
index 0000000..9a4c33f
--- /dev/null
@@ -0,0 +1,11 @@
+package FIXME_PACKAGE;
+
+import de.cweiske.ouya.romlauncher.LaunchSnesActivity;
+
+public class LaunchRomActivity extends LaunchSnesActivity
+{
+    protected String getAssetFilename()
+    {
+        return "FIXME_FILENAME";
+    }
+}
index 5d53ba754efbe39cdb41c496d3d33b9d5c0c3fb3..c097af46394f317f60021e1c0c41ff4f42a57d60 100644 (file)
@@ -2,7 +2,7 @@
 Generic OUYA SNES game launcher
 *******************************
 Based on this code you can pack up a SNES game and make it
-available in the OUYA launcher, just as a normal game.
+directly available in the OUYA launcher, just as a normal game.
 
 When running it, the game file is extracted and
 `Snes9x EX+`__ is started with it.
@@ -10,15 +10,18 @@ When running it, the game file is extracted and
 __ http://www.explusalpha.com/home/snes9x-ex
 
 
-Configuring
-===========
-Things to adjust:
+Packing a game
+==============
+Run ``prepare-game.sh``::
 
-- Put the game file into ``assets/game/``
-- Replace ``FIXME_ASSETFILENAME`` in
-  ``src/de/cweiske/ouya/gamelauncher/LaunchGameActivity.java``
-  with the game file name (name, not path).
-- Replace ``FIXME_GAMETITLE`` in ``AndroidManifest.xml`` with
-  the game's name.
-- You should also adjust the package path, otherwise one game
-  overwrites the other
+  $ ./prepare-game.sh "Super Pac-Man" superpacman ~/public-domain/superpacman.smc
+  Game title: Super Pac-Man
+  Full package path: romlauncher.superpacman
+  Game file: superpacman.smc
+  All prepared.
+  Put a 732x412 image into res/drawable-xhdpi/ouya_icon.png
+
+Now adjust the launcher image ``ouya_icon.png`` and build/run it
+with the Android Developer Tools Eclipse IDE.
+
+The generated ``.apkg`` file will be located in the ``bin/`` folder.
diff --git a/cleanup.sh b/cleanup.sh
new file mode 100755 (executable)
index 0000000..5ecd856
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+set -e
+
+#clean up from last run
+git checkout AndroidManifest.xml res/drawable-xhdpi/ouya_icon.png
+for i in `ls assets/game`; do
+    rm assets/game/$i
+done
+[ -d bin ] && rm -r bin
+[ -d gen ] && rm -r gen
+[ -d src/romlauncher ] && rm -r src/romlauncher
+
+exit 0
diff --git a/prepare-game.sh b/prepare-game.sh
new file mode 100755 (executable)
index 0000000..be51057
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+set -e
+
+#clean up from last run
+./cleanup.sh
+
+if [ $# -lt 3 ]; then
+    echo "Usage: ./prepare-game.sh title java.package path-to-game.smc"
+    exit
+fi
+
+title=$1
+package=$2
+fullpackage="romlauncher.$package"
+filepath=$3
+filename=`basename "$filepath"`
+
+echo "Game title: $title"
+echo "Full package path: $fullpackage"
+echo "Game file: $filename"
+
+#prepare manifest
+sed -i\
+ -e "s/FIXME_PACKAGE/$fullpackage/" \
+ -e "s/FIXME_TITLE/$title/" \
+ AndroidManifest.xml
+
+#copy game
+cp "$filepath" assets/game/
+
+#prepare launcher
+mkdir -p "src/romlauncher/$package"
+sed -e "s/FIXME_PACKAGE/$fullpackage/"\
+ -e "s/FIXME_FILENAME/$filename/"\
+ LaunchRomActivity.java.tpl\
+ > src/romlauncher/$package/LaunchRomActivity.java
+
+echo "All prepared."
+echo "Put a 732x412 image into res/drawable-xhdpi/ouya_icon.png"