Archive for November, 2006

A pcsx mythgame player using xautomation

Thursday, November 30th, 2006

Scripting a gui tester for Tuxpaint with xautomation was fun and quite useful too, but really only appeals to developers. Today I found use for xautomation that will appeal to sys admins and users: hacking around a user interface that refuses to work the way it ought to.

I wanted to add another mythgame player, this time for the pcsx-df Playstation emulator. Unfortunately, I couldn’t pass it a CD image from the command line. It seems to know only how to do two things: run a game file, or run a real CD. My best guess is that it doesn’t know its plugins until the GUI starts, so it is unaware that it ought to be able to use the cdrmooby plugin to load the specified image when it is parsing the command line.

After a brief and fruitless grep through the source, it dawned on me that I could put xautomation to work for me to do the job in much less time. Here is the resulting startpcsx script, which sucessfully operates as my pcsx mythgame player.

#!/bin/bash
slowtype () {
   echo "$@" | sed -re 's/(.)/\"str \1\"\n\"usleep 15\"\n/g'
}

pcsx &
xte "sleep 2" "keydown Control_R" "key o" "keyup Control_R" "sleep 1"
slowtype "$@" | xargs xte
xte "key Return"

The hard part was that pcsx is afflicted by one of my pet peeves, a typeahead find that cannot be disabled. As a result, if you make xte type at full speed into the open file dialog, the filepath comes out all jumbled up. This happens because the filepath is constantly being redrawn as xte types characters, so the cursor isn’t always at the end of the line. The usleep 15 allows the cursor to reach the end of the line before typing the next character.

Of course, this is truly a hack, subject to variations in timing between systems, so if you use it, you may have to tweak the sleep and usleep values. But it works well enough as a workaround until pcsx-df is fixed to accept a CD image on the command line.

Home video hub on a shoestring

Monday, November 27th, 2006

In our family, we have centralized all our best entertainment technology in a single system, a white box amd64 with PVR, 3D graphics, 1G, a 21” monitor, DVD burner and VCR. A number of older, far less capable systems have always surrounded this “hub”. A K6-2/400 with a less-than wonderful ATI Rage IIc graphics card presently serves as my wife’s system, and my PII/300 laptop roams the house on wireless B.

This has always been the model for our home network, dating back to the late 90’s when the hub in our cramped apartment was a P/100 delivering sound through a $30 pawn-shop stereo to two main rooms, and the satellite node in the family room was a DEC VT-420 on a long serial cable. So, house-wide delivery of sound has always been possible. But doing the same for video remained unsolved until just this weekend.

Kudos to the Videolan team for making it possible. A number of years ago, I recognized their vlc player was ideal for playing DVDs on my K6-2, handling the job with less CPU and less frame drop than other alternatives at the time. Not too long afterwards, though, we upgraded our hardware so saving CPU cycles was no longer an issue, and switched to other players to take advantage of features they offered over vlc.

But a recent email from a friend brought me back. This friend asked if I had seen a certain Linux documentary video he had found. I hadn’t, and was intrigued. But since the hub was tied up by the kids at that moment, I figured I’d try watching on the old PII laptop. I didn’t really think it would work, but remembering how well vlc did on my other old hardware, I gave it a try. It worked! No frame drop at all.

Buoyed by that victory, I recalled that I had downloaded the Debconf 6 DVD ISOs some days ago, but had not yet been able to watch them. You probably can guess why … yup, the single hub system, the only one really capable of doing a good job displaying video, was pretty much always tied up by various other family members.

Now, I knew there was no way I could get those DVDs onto the laptop, as it has no drive and only a 4G hdd. Nor was I willing to go to the bother of ripping individual tracks to transcode and send over one at a time. But I then recalled that vlc, as well as being an excellent standalone player, is primarily the client for a streaming video system. So I set out to learn how to stream video.

Back when I was first introduced to Videolan, I knew there was a server program, vls. I had a quick look at that and was overwhelmed by the wide variety of possible MRLs and codecs, and a bit mystified as to which magic spells were needed to make it stream to the laptop.

It then occurred to me I had probably plunged in too quickly, and should back off and go look for more docs than just the man pages. Sure enough, they have plenty of excellent docs, leading to the discovery that the vlc gui itself has easy to use Wizard and Open dialogs to set up streaming. With that sorted out, I was streaming in no time.

At this point, I was delighted to discover that I could successfully stream a 1024 kbps mp4 stream across wireless B form the basement to any other room of our two-story semi. And ever since then, I’ve been having great fun with the family, trying a wide variety of other video sources lying around: music videos, home videos made by friends, TV shows recorded from the PVR, DVDs direct from disc, and yes, finally, those Debconf 6 ISOs.

I tell you, it’s like Christmas come early! Thanks, Videolan. You’ve made my week.

Towards a Debian Jr. Live CD

Monday, November 20th, 2006

Debian Jr. development revived

Recently there has been some lively discussion on the Debian Jr. list about how to arrange an account for a child of 1 to 3 years of age. Suggestions included using set-top box software like Freevo, tailoring DEs with panels and large buttons, using simpler WMs like fvwm, or using an “activity centre” app like Gcompris.

Now, I respect those parents who hold that a child this young should interact more with the “real world”. While I wouldn’t go so far as to outright prohibit my young ones from computer use, I can see the wisdom in keeping it to a minimum. But, for better or worse, our family is one of several who have some experience helping our youngest members use our Debian systems. We would like to share what we’ve learned through the Debian Jr. project.

Getting started with live.debian.net

To that end, last week I was inspired to follow the Debian Live ISO Howto to produce my first rough draft of a Debian Jr. live CD built from scratch on Etch.

For the final product, we’ll want to use a local partial Debian archive mirror, as it not only optimizes fetching packages for several build iterations, but also can be kept stable, which is important as we near release. But for this draft, I ran into trouble building the complete package list to populate the partial mirror, as cdebootstrap, which make-live uses, has no handy --print-debs switch like debootstrap does. So for now, I rely on approx to cache packages for optimization only.

A straightforward process to create a working live CD

The rest of the process was straightforward: using live-package, I created a package list1 containing Gnome and the Debian Jr. metapackages, I configured /etc/make-live.conf to point at my proxy, and then I ran the make-live script on the package list. The end result was ./debian-live/binary.iso, which successfully booted under qemu.

At this stage, there is not much to show. To be truly useful, the live CD needs to be set up so that children and their guides can immediately find and use the material intended for them. We will need not only one live CD user, but four, varying in age range and role. (More about this in a future article.) However, it is an encouraging start, and shows that we may be able to produce something usable by the time Etch releases.

1 For this exercise, I simply combined /usr/share/make-live/lists/gnome with the junior-* metapackages in Etch, and added mozilla-firefox-gnome-support to satisfy Gnome’s web browser dependency and cut down on redundancy, resulting in the following list.

junior-art
junior-doc
junior-games-card
junior-games-gl
junior-games-net
junior-games-sim
junior-games-text
junior-gnome
junior-internet
junior-kde
junior-math
junior-programming
junior-puzzle
junior-sound
junior-system
junior-toys
junior-typing
junior-writing
mozilla-firefox-gnome-support
eject sudo
console-common locales
gdm gdm-themes gnome-desktop-environment gnome-cups-manager gnome-screensaver
gnome-themes-extras
rhythmbox synaptic
x-window-system-core

Mythgame player to run native Linux games

Sunday, November 5th, 2006

I recently started to be aware of a problem in our family. Ever since we configured Mythgame to run Xmame games, we started to ignore native Linux games. This is a shame, because often the quality of such games is much higher, and besides, they are open source, which I strongly believe in.

I looked around for help configuring Mythgame to run Linux games, and was unable to find a way to make a game player that would play any Linux game. So I devised the following solution:

Step 1: Set up directories for pseudo-roms, command switches and snapshots


mkdir /usr/share/games/roms
mkdir /usr/share/games/switches
mkdir /usr/share/games/snaps

Step 2: Define a player in Mythgame


Player name: Linux
Type: OTHER
Command: %s `cat \`dirname %s\`/../switches/\`basename %s\``
Rom Path: /usr/share/games/roms
ScreenShots: /usr/share/games/snaps

Step 3: Populate the directories with data


cd /usr/share/games/roms
ln -s /usr/games/oolite
ln -s /usr/games/starvoyager
cd /usr/share/games/snaps
cp ~synrg/snaps/oolite.png .
cp ~synrg/snaps/starvoyager.png .
cd /usr/share/games/switches
touch oolite
echo "-f" >starvoyager

Step 4: In Mythgame, “Scan for Games”

Step 5: Play!