From: Christian Weiske Date: Sat, 12 Sep 2015 21:42:56 +0000 (+0200) Subject: script to prepare a new game X-Git-Url: https://git.cweiske.de/ouya-romlauncher.git/commitdiff_plain/e5467ee2b2a1787d6a541ef6180ce22705e0fef9 script to prepare a new game --- diff --git a/LaunchRomActivity.java.tpl b/LaunchRomActivity.java.tpl new file mode 100644 index 0000000..9a4c33f --- /dev/null +++ b/LaunchRomActivity.java.tpl @@ -0,0 +1,11 @@ +package FIXME_PACKAGE; + +import de.cweiske.ouya.romlauncher.LaunchSnesActivity; + +public class LaunchRomActivity extends LaunchSnesActivity +{ + protected String getAssetFilename() + { + return "FIXME_FILENAME"; + } +} diff --git a/README.rst b/README.rst index 5d53ba7..c097af4 100644 --- a/README.rst +++ b/README.rst @@ -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 index 0000000..5ecd856 --- /dev/null +++ b/cleanup.sh @@ -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 index 0000000..be51057 --- /dev/null +++ b/prepare-game.sh @@ -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"