#!/bin/tcsh

if (-r defaultenv) then
  source defaultenv
endif

if (-r games/${1}.conf) then
  source games/${1}.conf
endif

sync&

# Some games require >128M of memory to start up, then settle
# back down to requiring <128M.  Since the target Flynn platform
# is a machine with 128M and enabling swap is a performance
# hit (no, you don't want the game graphics roms which were paged-out
# during hungry start-up paging in again on-demand halfway through a
# level) we provide a mechanism to turn on swap for the game
# startup sequence and then turn it off again (paging in all swapped
# data at once) a certain number of seconds later.
test -n "${SWAPTIME}" && eval "./swaptimer.csh ${SWAPTIME}"

# no over-ride?
test -n "${CMDLINE}" && eval "${CMDLINE}" >& /tmp/GAMELOG
test -z "${CMDLINE}" && eval "${CMD} -rp ${RP} -v ${VOL} -widthscale ${WIDTHSCALE} -heightscale ${HEIGHTSCALE} -sf ${SFREQ} -bs ${BUFFRAMES} -x11 ${XMODE} -B ${BEAM} -sp ${SP} -ap ${AP} -ah ${ARBHEIGHT} ${OTHER} ${GAME}" >& /tmp/GAMELOG

cd $2
exec $3 $4



