summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2013-02-15 12:34:32 +0100
committerRené 'Necoro' Neumann <necoro@necoro.net>2013-02-15 12:34:32 +0100
commit933a93e4a71591e867182999a7daf8ae3bad5596 (patch)
treeb2969a0ccd0d050a8288ffc72756be2c94975de5 /templates
parent2dfc64f9f3137cd7522b32a55e6cbcaa672492f6 (diff)
downloadplay-933a93e4a71591e867182999a7daf8ae3bad5596.tar.gz
play-933a93e4a71591e867182999a7daf8ae3bad5596.tar.bz2
play-933a93e4a71591e867182999a7daf8ae3bad5596.zip
Major overhaul: Support non-wine games
* Moved wine support to own template * Added xpad template * Added no-x template for games that don't support being started on another X. * Improved ways template functions work together: - EXPORT now appends - OVERRIDE replaces all the others - in game: command 'super' to call the phases of the templates - super supports "-r tpl" to remove the phase function of tpl
Diffstat (limited to 'templates')
-rw-r--r--templates/cdemu3
-rw-r--r--templates/default15
-rw-r--r--templates/fuseiso3
-rw-r--r--templates/iso9
-rw-r--r--templates/no-x12
-rw-r--r--templates/steam28
-rw-r--r--templates/wine18
-rw-r--r--templates/xpad21
8 files changed, 91 insertions, 18 deletions
diff --git a/templates/cdemu b/templates/cdemu
index f6690a8..f532106 100644
--- a/templates/cdemu
+++ b/templates/cdemu
@@ -4,8 +4,6 @@ _cdemu_dev () {
}
cdemu_prepare () {
- default_prepare
-
declare -g MOUNT CDEMU_NO
[[ $MOUNT != /* ]] && MOUNT="$HOME/isos/spiele/$MOUNT"
@@ -16,7 +14,6 @@ cdemu_prepare () {
}
cdemu_cleanup () {
- default_cleanup
exc umount $(_cdemu_dev)
exc cdemu unload $CDEMU_NO
}
diff --git a/templates/default b/templates/default
index 2f62395..0d1c0ea 100644
--- a/templates/default
+++ b/templates/default
@@ -4,16 +4,21 @@ default_setupX () {
play_setupX
}
+default_setenv () {
+ if loaded wine; then
+ EENV[WINEPREFIX]='{ [[ -z $NO_WINEINSTS ]] && echo $HOME/.wineinsts/$PREFIX; } || echo $PREFIX'
+ fi
+
+ play_setenv
+}
+
default_prepare () {
- play_prepare
}
default_cleanup () {
- play_cleanup
}
-EENV[WINEPREFIX]='{ [[ -z $NO_WINEINSTS ]] && echo $HOME/.wineinsts/$PREFIX; } || echo $PREFIX'
-
-EXPORT setupX prepare cleanup
+EXPORT prepare cleanup
+OVERRIDE setenv setupX
# vim:ft=sh
diff --git a/templates/fuseiso b/templates/fuseiso
index 97df277..0be20ff 100644
--- a/templates/fuseiso
+++ b/templates/fuseiso
@@ -1,7 +1,5 @@
fuseiso_prepare () {
- default_prepare
-
declare -g MOUNT MOUNTTARGET
[[ $MOUNT != /* ]] && MOUNT="$HOME/isos/spiele/$MOUNT"
@@ -10,7 +8,6 @@ fuseiso_prepare () {
}
fuseiso_cleanup () {
- default_cleanup
exc fusermount -u $MOUNTTARGET
}
diff --git a/templates/iso b/templates/iso
index 2aad3cd..2b65c26 100644
--- a/templates/iso
+++ b/templates/iso
@@ -1,3 +1,6 @@
+#
+# NB: MUST be included before other templates defining cleanup and prepare
+#
if [[ -z $ISO_TYPE ]]; then
# default
@@ -18,12 +21,16 @@ esac
# wrapper phases
iso_prepare () {
+ default_prepare
${ISO_TYPE}_prepare
}
iso_cleanup () {
+ default_cleanup
${ISO_TYPE}_cleanup
}
-EXPORT prepare cleanup
+# we need to OVERRIDE and not EXPORT, to not execute them twice
+# as they are already exported in the other template
+OVERRIDE prepare cleanup
# vim:ft=sh
diff --git a/templates/no-x b/templates/no-x
new file mode 100644
index 0000000..e811e85
--- /dev/null
+++ b/templates/no-x
@@ -0,0 +1,12 @@
+unset "ENV[DISPLAY]"
+
+no-x_startX () {
+ exc $BIN --in-X $GAME
+}
+
+no-x_setupX () {
+}
+
+OVERRIDE startX setupX
+
+# vim:ft=sh
diff --git a/templates/steam b/templates/steam
index 3321e92..2516277 100644
--- a/templates/steam
+++ b/templates/steam
@@ -1,9 +1,25 @@
-PREFIX="steam"
-SIZE="1280x960"
-GPATH="c:/program files/steam/steam.exe"
+if loaded wine; then
+ PREFIX="steam"
+ #SIZE="1280x960"
+ GPATH="c:/program files/steam/steam.exe"
-steamapp () {
- [[ $# > 0 ]] && export ARGS="-applaunch ${=@}"
-}
+ steamapp () {
+ [[ $# -gt 0 ]] && export ARGS="-applaunch ${=@}"
+ }
+else
+ GPATH=steam
+ SIZE=1680x1050
+
+ steamapp () {
+ [[ $# -gt 0 ]] && export ARGS="steam://rungameid/$1"
+ }
+
+ # force cleanup -- yields a normal shutdown
+ steam_cleanup () {
+ [[ $1 == force ]] && exc steam -shutdown
+ }
+
+ OVERRIDE cleanup
+fi
# vim:ft=sh
diff --git a/templates/wine b/templates/wine
new file mode 100644
index 0000000..e6c8d2e
--- /dev/null
+++ b/templates/wine
@@ -0,0 +1,18 @@
+EENV[WINEPREFIX]='eval echo $PREFIX'
+PREFIX=${PREFIX:-$GAME}
+
+# run wine and therefore the game
+wine_run () {
+ # cd into dir
+ local dir="$(exc winepath -u $GPATH)"
+ exc cd "${dir:h}"
+
+ # start game
+ exc wine start ${dir:t} "$ARGS"
+
+ # wait for wine to shutdown
+ exc wineserver -w
+}
+
+OVERRIDE run
+# vim: ft=sh
diff --git a/templates/xpad b/templates/xpad
new file mode 100644
index 0000000..1e67429
--- /dev/null
+++ b/templates/xpad
@@ -0,0 +1,21 @@
+xpad_prepare () {
+ declare -g XBOX_PID XBOX_DEADZONE XBOX_UIAXISMAP \
+ XBOX_UIBUTTONMAP XBOX_NO_FF
+
+ local args="--silent \
+ --deadzone ${XBOX_DEADZONE:-4000}"
+
+ [[ -n $XBOX_UIAXISMAP ]] && args+=" --ui-axismap $XBOX_UIAXISMAP"
+ [[ -n $XBOX_UIBUTTONMAP ]] && args+=" --ui-buttonmap $XBOX_UIBUTTONMAP"
+ [[ -z $XBOX_NO_FF ]] || args+=" --force-feedback"
+
+ exc -b xboxdrv ${=args}
+ XBOX_PID=$!
+}
+
+xpad_cleanup () {
+ [[ -n $XBOX_PID ]] && exc kill -SIGINT $XBOX_PID
+}
+
+EXPORT prepare cleanup
+# vim:ft=sh