summaryrefslogtreecommitdiff
path: root/play.sh
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2010-06-15 01:53:30 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2010-06-15 01:53:30 +0200
commit9786e03de9c14445769c4d04130f6512f16fbb9d (patch)
tree3a1db0bdbfa2a15fa0fa4ab971cbd4bf63604006 /play.sh
parent2b51b03b6284a0a8c8a1f4f73db152dc577b626d (diff)
downloadplay-9786e03de9c14445769c4d04130f6512f16fbb9d.tar.gz
play-9786e03de9c14445769c4d04130f6512f16fbb9d.tar.bz2
play-9786e03de9c14445769c4d04130f6512f16fbb9d.zip
Moved to the ebuild-like way
Diffstat (limited to 'play.sh')
-rwxr-xr-xplay.sh86
1 files changed, 36 insertions, 50 deletions
diff --git a/play.sh b/play.sh
index 973669a..92934e5 100755
--- a/play.sh
+++ b/play.sh
@@ -1,7 +1,11 @@
-#!/bin/zsh
+#!/bin/zsh -f
+
+log () {
+ echo "*** $@"
+}
exp () {
- echo "*** Setting envvar '$1' to '$2'"
+ log "Setting envvar '$1' to '$2'"
export $1=$2
}
@@ -12,7 +16,7 @@ exc () {
shift
fi
- echo "*** Executing${msg}:"
+ log "Executing${msg}:"
echo $@
sleep 3
@@ -24,64 +28,46 @@ exc () {
fi
}
-if [[ $1 == "-x" ]]; then
- local prefix=$2
- local gpath=$3
- local args=$5
- local size=$4
+EXPORT () {
+ local name=$1
+ shift
- # load settings
- nvidia-settings -l
+ for f in $@; do
+ eval "$f () { ${name}_${f}; }"
+ done
+}
- # set display size
- [[ -n $size ]] && xrandr -s $size
+inherit () {
+ source games/$1
+}
- # exporting variables
- exp WINEPREFIX `eval echo $prefix`
- exp WINEDEBUG "-all"
- exp DISPLAY ":1"
+typeset -A ENV EENV
+BIN=$0
- # start game
- exc wine start $gpath "$args"
-
- # wait for wine to shutdown
- exc wineserver -w
+source default
- # when the script reaches this point,
- # the new X will be terminated
+if [[ $1 == "-x" ]]; then
+ source games/$2
+ setenv
+ prepare
+ run
else
- local game=$1
-
- echo "*** Launching '$game'"
+ GAME=$1
- local prefix="~/.wine/"
- local gpath size args
- local x11args
-
- steam () {
- prefix="~/.steam/"
- gpath="c:/Programme/steam/steam.exe"
- size="1280x1024"
-
- [[ $# > 0 ]] && args="-applaunch ${=@}"
- }
-
- typeset -A games
- games[bg2]='gpath=c:/spiele/bg2/baldur.exe; size=1024x768'
- games[fallout]='prefix=~/.fallout/; gpath=c:/spiele/fallout/falloutw.exe; size=800x600; x11args="-depth 16"'
- games[steam]='steam'
- games[torchlight]='steam 41600'
-
- if [[ -z $games[$game] ]]; then
- echo "*** Game '$game' not found"
+ list () {
echo "Games are:"
- for k in ${(ko)games}; do
+ for k in games/*(.:t); do
echo "\t> $k"
done
+ }
+
+ if [[ -z $GAME || ! -e games/$GAME ]]; then
+ [[ ! -e games/$GAME ]] && log "Game '$GAME' not found"
+ list
exit 1
else
- eval $games[$game]
+ log "Launching '$GAME'"
+ source games/$GAME
+ execute
fi
-
- exc -f startx $0 -x $prefix $gpath $size $args -- :1 -ac -br -quiet ${=x11args}
fi