From 878b439fb9dda53e3159ae6e21775d1c22f8643d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Mon, 10 Sep 2012 23:59:29 +0200 Subject: Split 'prepare' in setupX and prepare -- this allows to cleanup even after killing X --- games/ff8 | 4 ++-- play.sh | 17 +++++++++++------ templates/cdemu | 1 + templates/default | 12 ++++++++++-- templates/fuseiso | 1 + 5 files changed, 25 insertions(+), 10 deletions(-) diff --git a/games/ff8 b/games/ff8 index a36d96d..04f4801 100644 --- a/games/ff8 +++ b/games/ff8 @@ -4,8 +4,8 @@ GPATH=c:/spiele/ff8/FF8.exe SIZE=1024x768 MOUNT=ff8/FF8_CD1.iso -prepare () { - iso_prepare +setupX () { + default_setupX exc nvidia-settings -a FSAA=1 exc nvidia-settings -a FSAAAppControlled=0 } diff --git a/play.sh b/play.sh index e683a7e..9c881da 100755 --- a/play.sh +++ b/play.sh @@ -149,13 +149,13 @@ ENV[DISPLAY]=":1" # phase functions {{{1 # Array of phases -PHASES=(startX setenv run prepare cleanup) +PHASES=(setenv prepare setupX startX run cleanup) declare -r PHASES # starts a new X # if overridden, this MUST call `$BIN --in-X` play_startX () { - exc -e startx $BIN --in-X $GAME -- $DISPLAY -ac -br -quiet ${=EXARGS} + exc startx $BIN --in-X $GAME -- $DISPLAY -ac -br -quiet ${=EXARGS} } # populate the environment @@ -189,12 +189,16 @@ play_run () { exc wineserver -w } -# prepare things for the game, e.g. mount ISOs -play_prepare () { +# manipulate the newly created X instance +play_setupX () { # set display size [[ -n $SIZE ]] && exc xrandr -s $SIZE } +# prepare things for the game, e.g. mount ISOs +play_prepare () { +} + # cleanup after yourself play_cleanup () { } @@ -262,9 +266,8 @@ EOF _continue_in_X () { # {{{2 _load - prepare + setupX run - cleanup } _run () { #{{{2 @@ -282,7 +285,9 @@ _run () { #{{{2 out "Launching '$GAME'" _load setenv + prepare startX + cleanup fi } diff --git a/templates/cdemu b/templates/cdemu index f978884..f6690a8 100644 --- a/templates/cdemu +++ b/templates/cdemu @@ -16,6 +16,7 @@ cdemu_prepare () { } cdemu_cleanup () { + default_cleanup exc umount $(_cdemu_dev) exc cdemu unload $CDEMU_NO } diff --git a/templates/default b/templates/default index 7e856df..099ca1d 100644 --- a/templates/default +++ b/templates/default @@ -1,12 +1,20 @@ -default_prepare () { +default_setupX () { exc nvidia-settings -l + play_setupX +} + +default_prepare () { play_prepare } +default_cleanup () { + play_cleanup +} + [[ $PLAY_DEBUG == 0 ]] && ENV[WINEDEBUG]="-all" EENV[WINEPREFIX]='{ [[ -z $NO_WINEINSTS ]] && echo $HOME/.wineinsts/$PREFIX; } || echo $PREFIX' -EXPORT prepare +EXPORT setupX prepare cleanup # vim:ft=sh diff --git a/templates/fuseiso b/templates/fuseiso index 8baf63f..97df277 100644 --- a/templates/fuseiso +++ b/templates/fuseiso @@ -10,6 +10,7 @@ fuseiso_prepare () { } fuseiso_cleanup () { + default_cleanup exc fusermount -u $MOUNTTARGET } -- cgit v1.2.3