Author Topic: Running xspect games from their icon  (Read 1675 times)

danr

  • Full Member
  • ***
  • Posts: 138
    • View Profile
    • http://
Running xspect games from their icon
« on: February 26, 2004, 08:24:15 am »
Hi all,

I\'ve found a way of running Spectrum games by clicking on their icon in Qtopia, even though xspect is an x app.  This principle could be used to associate other types of file with a non-qtopia app.

Requirements:
xspect (http://ipkgfind.handhelds.org/details.phtml?package=xspectrum&official=&format=)
perl
Xqt
wm2 (optional)
spectrum games (http://www.worldofspectrum.org/)

After installing all the above, create a desktop entry for xspect, /home/QtPalmtop/apps/Games/xspect.desktop

Code: [Select]
[Desktop Entry]

Comment=Spectrum emulator

Exec=runxspect

Icon=WordGame

Type=Application

Name=Spectrum emulator

MimeType=application/spectrum

(Icon=WordGame as I don\'t have any interesting pics on my Zaurus ;-))

and associate Spectrum files with this by adding to /home/QtPalmtop/etc:

Code: [Select]
application/spectrum            tap z80 sna tzx

runxspect is a simple shell script living in /home/QtPalmtop/bin:

Code: [Select]
#!/bin/sh

. /home/zaurus/.bashrc

export DISPLAY=:0

runxspect.pl < /tmp/qcop-msg-runxspect > /tmp/xspect.sh

. /tmp/xspect.sh

(alter the bashrc line to point to your initialisation script as necessary)

When you click on a Spectrum file, Qtopia appears to create a file, /tmp/qcop-msg-runxspect, with the name of the file clicked on, as well as a load of binary characters.  The runxspect.pl script strips out everything except for the filename, and creates the output:

xspect <filename>

which is then run in the above script.

runxspect.pl is

Code: [Select]
#!/usr/bin/perl -w

{

  # gets rid of non-ASCII in QPE file, and creates the string xspect

  my $string;

  while (<>) {

    y/a-zA-Z0-9_/./!/cs;

    s/!//g;

    s/(QPE/Application/runxspectraiseQPE/Application/runxspectraiseQPE/Application/runxspectsetDocumentQString[fb]*[d]*[vr]*)(.*)/xspect $2*n/s;

    print $_;

  }

}

which is somewhat messy, but seems to work most of the time.

You\'ll have to reset Qtopia to associate the Spectrum files with the desktop entry, and Xqt should be running.  After doing this, clicking on a Spectrum game file in the file manager should start up xspect.

It\'s all a bit messy so if anyone has a better way of doing it, give me a shout :-)

One annoyance I find is that on my SL5500 the Spectrum display is too wide and the wm2 window manager always opens the display from the left hand side of the Zaurus screen, so I always have to drag the display left to centre it.  Anyone know a way to automatically get an x window manager to centre it?

Cheers,

Daniel
SL-C860 running Debian EABI on top of Angstrom 2.6 kernel