blob: 973669adc1b532c58e402f0393cf643232fa2e8d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
#!/bin/zsh
exp () {
echo "*** Setting envvar '$1' to '$2'"
export $1=$2
}
exc () {
if [[ $1 == "-f" ]]; then
fork=1
msg=" (forking)"
shift
fi
echo "*** Executing${msg}:"
echo $@
sleep 3
if [[ -n $fork ]]; then
exec "$@" &!
else
eval "$@"
fi
}
if [[ $1 == "-x" ]]; then
local prefix=$2
local gpath=$3
local args=$5
local size=$4
# load settings
nvidia-settings -l
# set display size
[[ -n $size ]] && xrandr -s $size
# exporting variables
exp WINEPREFIX `eval echo $prefix`
exp WINEDEBUG "-all"
exp DISPLAY ":1"
# start game
exc wine start $gpath "$args"
# wait for wine to shutdown
exc wineserver -w
# when the script reaches this point,
# the new X will be terminated
else
local game=$1
echo "*** Launching '$game'"
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"
echo "Games are:"
for k in ${(ko)games}; do
echo "\t> $k"
done
exit 1
else
eval $games[$game]
fi
exc -f startx $0 -x $prefix $gpath $size $args -- :1 -ac -br -quiet ${=x11args}
fi
|