#!/bin/bash
# SANDBOX_DIR should refer to the directory in which sandbox is placed.
#SANDBOX_DIR=~/sandbox
#SANDBOX_DIR=/usr/local/sandbox
SANDBOX_DIR=.

#SANDBOX_OPTIONS="-r"
SANDBOX_OPTIONS="-q${HOME}/.platinumarts -r"

case $(uname -m) in
i386|i486|i586|i686)
  MACHINE_BIT=32
  ;;
*)
  MACHINE_BIT=64 #assume 64bit otherwise
  ;;
esac

if [ -a ${SANDBOX_DIR}/bin/sandbox_client_${MACHINE_BIT}_fps ]
then
	cd ${SANDBOX_DIR}
	chmod +x ./bin/sandbox_??????_* #server and client are 6 characters; don't want to make the windows stuff executable
	exec ./bin/sandbox_client_${MACHINE_BIT}_fps ${SANDBOX_OPTIONS} $*
else
	echo "A problem was encountered, please check which of the following it is."
	echo "1) There isn't an available executable for your architecture; $(uname -m)"
	echo "2) the executable was moved"
	echo "3) There isn't an executable"
	echo "install the sdl, sdlimage and sdlmixer libs and try \"cd src && make install\" to compile a binary"
	exit 1
fi
