#!/bin/bash

# Set up commands
if [ -n "`echo $ATHENA_SYS | grep sun`" ] ; then
    GAMEBOY=xgnuboy
    SNES=snes9x
elif [ -n "`echo $ATHENA_SYS | grep i386`" ] ; then
    GAMEBOY=xgnuboy
    SNES=zsnes
else
    zenity --error --text="Unknown system $ATHENA_SYS!"
    exit 1
fi

FILES=~/VG/*
GFILE=`zenity --list --column Game $FILES`

if [ -z "$GFILE" ] ; then
    exit 0
fi
echo $GFILE
SUF=`basename "$GFILE" | cut -f 2 -d \.`

case $SUF in
    gb)
        $GAMEBOY "$GFILE"
	;;
    smc)
	$SNES "$GFILE"
	;;
    *)
	zenity --error --text="Unknown suffix '$SUF'!"
	exit 1
	;;
esac
