Portable Puzzles on OpenMoko

Introduction

This page is for the package (port?) I'm maintaining of Simon Tatham's Portable Puzzle Collection, for SHR and similar OpenMoko distros for use on the Neo FreeRunner.

For information on the games themselves, read Simon's page on them.

Download

The package can be downloaded via its page on opkg.org, downloaded from here, installed by using this command:

opkg install http://ipk.edorfaus.info/armv4t/sgt-puzzles_8750-p25_armv4t.ipk

from an Internet-enabled Neo, or installed via my package repository:

Package repository

If you want easy installation and automatic upgrades (with opkg update/upgrade or other package manager), then instead of installing manually with a URL or downloaded file you can add my repository and install the "sgt-puzzles" package from there.

Adding the repository feed is done by adding this line:

src/gz edorfaus-armv4t http://ipk.edorfaus.info/armv4t

to a .conf file in /etc/opkg (I would suggest /etc/opkg/edorfaus-feed.conf or similar).

Then run opkg update to download the package lists, followed by opkg install sgt-puzzles to install the package for the puzzle collection.

Launcher

Some people think that having 27 new icons on the desktop (one for each game) is a bit too much, and would prefer having a launcher for them instead - that is, a program placed on the desktop instead of the games, that when started shows a list of games, letting the user select which one to start.

While this makes it a two-step process to start a game, I have no problems understanding the desire, as it makes the desktop a lot less cluttered, making it easier to find the other programs.

This package includes some basic support for having a launcher, as long as the launcher is built for working with this package:

First, the package includes a file (/usr/share/sgt-puzzles/gameinfo) with some basic information on all the games it installs (name, executable name and a short description), that can be used by the launcher to generate the list of games. (You don't have to use it, of course, but it is available for convenience, and is used internally by the desktop script.)

Second, if the launcher package installs a file named /usr/share/sgt-puzzles/has-launcher (it can be empty, the contents are not looked at), and calls the desktop script in the postinst stage, the desktop icons installed by this package will automatically be removed. If this is done, the package should also call the desktop script in the postrm step (after the has-launcher file is removed), so that the icons are put back on the desktop.

My launcher

I have made (and maintain a package of) a simple launcher for this collection, using the above, based on the Elementary toolkit. See here for more information.

The desktop script

The sgt-puzzles-desktop script is used to generate and remove .desktop files, and to select for which games there should be a .desktop file.

It is called automatically in the postinst and prerm scripts, to generate and remove the .desktop files on install, and should also be called by the postinst and postrm scripts of the package for a launcher, for the same reason.

It should also be called manually to select which games should be available on the desktop, if the default is not good enough. To explain this, let's start with the script's help output:

Usage: sgt-puzzles-desktop {enable|disable|default} <game>
   or: sgt-puzzles-desktop update [force|removeall]

The first variant enables or disables the desktop icon for a
specific game, or removes configuration for one so that the
default is used for that game.
The second variant updates the actual desktop files based on
the configuration. If the "force" parameter is given, existing
desktop files are rewritten; if the "removeall" parameter is
given, all the desktop files are removed (until next update).

In general, you'll call enable and/or disable one or more times, then update to activate the changes that the others save in configuration.

Example 1 - no launcher

As an example, say you've installed the package (but not a launcher), and want to get rid of the desktop icon for a couple games you never play anyway - for example's sake, Fifteen and Black Box. You'll need to know the command for the games, which usually is the same as the game name, in all lowercase and with no spaces; in this case, fifteen and blackbox. To remove these two games from the desktop, you would run these three commands:

sgt-puzzles-desktop disable fifteen
sgt-puzzles-desktop disable blackbox
sgt-puzzles-desktop update

Notice the update command in the last line; this is where the actual removal happens (the disable commands just write to the configuration). This is separate for two reasons: one, it is used separately by the installer, and two, it is fairly slow, so if you want to disable several games, it is faster to do it only once.

If you then change your mind, and want to have Black Box anyway, you would run these commands:

sgt-puzzles-desktop default blackbox
sgt-puzzles-desktop update

Notice the default? This could be enable instead, and would still work, but using default has the advantage of not forcing the issue if you later install a launcher. See example 2 for more info.

Example 2 - with launcher

For this example, we'll assume that you have installed both the games package and a compatible launcher for it. With the default configuration, this would remove all the game icons from the desktop, leaving only the launcher. Now, say you have a favorite game that you play all the time, and therefore want to have on the desktop for quick access. For the example's sake, Light Up. To do this, you would again run two commands:

sgt-puzzles-desktop enable lightup
sgt-puzzles-desktop update

After the update, Light Up will have appeared on your desktop, along with the launcher (and any other games you have specifically enabled).

This is the main reason it's recommended to use default to re-enable (or for this example, re-disable) a game you have changed away from the default setting; if you had used enable it would have stayed on the desktop when you installed the launcher.

Source code

Most of the source for this package - all of the games - is in Simon's Subversion repository. However, the packaging system (including some code that does the building with the toolchain), and the scripts for creating/removing the .desktop files, are in a separate Subversion repository that I run.
To get a working copy, you can use a command such as this:

svn co http://svn.edorfaus.info/om/sgt-puzzles/trunk

This will also check out the game code (using svn:externals), so you do not need to check that out as well, and will thus get the latest code for the games without having to do anything more.

License

The games themselves are under the Expat License (Simon calls it the MIT licence, but that's ambiguous, as MIT has used many licenses (according to GNU)).

In Simon's words: This means that you can do pretty much anything you like with the game binaries or the code, except pretending you wrote them yourself, or suing me if anything goes wrong.

To keep things as simple as possible, my own code for this (what little there is of it), is also under the Expat License.

Changelog

This section will only contain changes done in the code specific to my package, so you will get updated packages with nothing new here, when something has changed upstream but not locally.


(last modified 2009-12-05 00:56:01 CET)