summaryrefslogtreecommitdiff
path: root/play.sh
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2010-06-15 13:26:40 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2010-06-15 13:26:40 +0200
commitb8d3c010d8641a55de8753642c866ab104185ebf (patch)
tree3371d7e66eaf7a9c6bb5595df1fd9596041fa309 /play.sh
parentec3966063975875984a118707fbd8ba7622268d4 (diff)
downloadplay-b8d3c010d8641a55de8753642c866ab104185ebf.tar.gz
play-b8d3c010d8641a55de8753642c866ab104185ebf.tar.bz2
play-b8d3c010d8641a55de8753642c866ab104185ebf.zip
Added implicit default template
Diffstat (limited to 'play.sh')
-rwxr-xr-xplay.sh41
1 files changed, 30 insertions, 11 deletions
diff --git a/play.sh b/play.sh
index 799047e..d4cdf08 100755
--- a/play.sh
+++ b/play.sh
@@ -22,6 +22,11 @@ log () {
[[ $PLAY_DEBUG > 0 ]] && echo "*** $@"
}
+die () {
+ out "*** ERROR: $@"
+ exit 1
+}
+
exp () {
log "Setting envvar '$1' to '$2'"
export $1=$2
@@ -51,32 +56,46 @@ EXPORT () {
}
inherit () {
+ zparseopts -D e=nonfatal
+
+ if [[ ! -e $PLAY_TEMPLATES/$1 ]]; then
+ if [[ -n $nonfatal ]]; then
+ log "Template '$1' not found"
+ return
+ else
+ die "Template '$1' not found"
+ fi
+ fi
+
source $PLAY_TEMPLATES/$1
}
+
+load () {
+ inherit -e default
+
+ source "$PLAY_GAMES/$1"
+}
# }}}
# default template {{{
# exporting variables
EENV[WINEPREFIX]='eval echo $PREFIX'
-ENV[WINEDEBUG]="-all"
ENV[DISPLAY]=":1"
PREFIX="~/.wine"
# functions
-default_execute () {
+play_execute () {
exc -e startx $BIN -x $GAME -- :1 -ac -br -quiet ${=EXARGS}
}
-default_prepare () {
- exc nvidia-settings -l
-
+play_prepare () {
# set display size
[[ -n $SIZE ]] && exc xrandr -s $SIZE
}
-default_setenv () {
+play_setenv () {
for e v in ${(kv)ENV}; do
exp $e $v
done
@@ -86,7 +105,7 @@ default_setenv () {
done
}
-default_run () {
+play_run () {
# start game
exc wine start $GPATH "$ARGS"
@@ -94,14 +113,14 @@ default_run () {
exc wineserver -w
}
-default_cleanup () {
+play_cleanup () {
}
-EXPORT default execute prepare setenv run cleanup
+EXPORT play execute prepare setenv run cleanup
# }}}
if [[ $1 == "-x" ]]; then
- source $PLAY_GAMES/$2
+ load $2
setenv
prepare
run
@@ -123,7 +142,7 @@ else
exit 1
else
out "Launching '$GAME'"
- source $DGAME
+ load $GAME
execute
fi
fi