-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproton
221 lines (194 loc) · 10.6 KB
/
proton
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
#!/bin/bash
PROTONDIR="$HOME/.proton/proton-"
COMPDIR="$HOME/.proton/comp"
DEFAULTVERSION="7.0"
check_1_0 () {
if [ ! -z "$2" ]; then if [ "$2" != "0" ] && [ "$2" != "1" ]; then echo; echo -e " [\e[1;31mE\e[0m]\e[1;31m Variable $1 is not 1 or 0\e[0m"; echo; exit; fi; fi
}
check_empty () {
if [ -z "$2" ]; then echo; echo -e " [\e[1;33mW\e[0m]\e[1;33m Variable $1 is empty\e[0m"; fi
}
if [ -z "$1" ]; then
echo
echo -e " [\e[1;34mi\e[0m]\e[1;34m No command supplied\e[0m"
fi
if [ ! -z "$1" ]; then
if [ -d "$1" ]; then
echo
echo -e " [\e[1;34mi\e[0m]\e[1;34m $(readlink -f "$1") is a folder"
fi
fi
if [ ! -z "$1" ]; then
if [ ! -e "$1" ]; then
echo
echo -e " [\e[1;33mW\e[0m]\e[1;33m File does not exist\e[0m"
fi
fi
FILE="$(readlink -f "$1")"
FOLDER="$(dirname "$FILE")"
#COMPATDIR=$(basename "$FOLDER")
if [ ! -z "$MANGOHUD" ]; then if [ "$MANGOHUD" != "0" ] && [ "$MANGOHUD" != "1" ] && [ "$MANGOHUD" != "2" ]; then echo; echo -e " [\e[1;31mE\e[0m]\e[1;31m Variable MANGOHUD is not 0, 1 or 2\e[0m"; echo; exit; fi; fi
#check_1_0 MANGOHUD $MANGOHUD
check_1_0 "GAMEMODE $GAMEMODE"
check_1_0 "DXVK" "$DXVK"
check_1_0 "ESYNC" "$ESYNC"
if [ ! -z "$FSYNC" ]; then if [ "$FSYNC" != "0" ] && [ "$FSYNC" != "1" ] && [ "$FSYNC" != "2" ]; then echo; echo -e " [\e[1;31mE\e[0m]\e[1;31m Variable FSYNC is not 0, 1 or 2\e[0m"; echo; exit; fi; fi
#check_1_0 "FSYNC" "$FSYNC"
check_1_0 "D3D10" "$D3D10"
check_1_0 "D3D11" "$D3D11"
ENV_VERSION="$VERSION"
ENV_COMPATDIR="$COMPATDIR"
ENV_WORKINGDIR="$WORKINGDIR"
ENV_MANGOHUD="$MANGOHUD"
ENV_GAMEMODE="$GAMEMODE"
ENV_DXVK="$DXVK"
ENV_ESYNC="$ESYNC"
ENV_FSYNC="$FSYNC"
ENV_D3D10="$D3D10"
ENV_D3D11="$D3D11"
# 1 $CONF variable
# 2 EXE-directory/proton.conf
# 3 EXE-directory/.proton.conf
# 4 ~/proton.conf
# 5 ~/.proton.conf
# 6 ~/.config/proton.conf (default)
# 7 ~/.config/.proton.conf
if [ -z "$CONF" ]; then
if [ -e "$FOLDER/proton.conf" ]; then
echo
echo -e " [\e[1;34mi\e[0m] Using $FOLDER/proton.conf"
CONF="$FOLDER/proton.conf"
else
if [ -e "$FOLDER/.proton.conf" ]; then
echo
echo -e " [\e[1;34mi\e[0m] Using $FOLDER/.proton.conf"
CONF="$FOLDER/.proton.conf"
else
if [ -e "$HOME/proton.conf" ]; then
echo
echo -e " [\e[1;34mi\e[0m] Using default $HOME/proton.conf"
CONF="$HOME/proton.conf"
else
if [ -e "$HOME/.proton.conf" ]; then
echo
echo -e " [\e[1;34mi\e[0m] Using $HOME/.proton.conf"
CONF="$HOME/.proton.conf"
else
if [ -e "$HOME/.config/proton.conf" ]; then
echo
echo -e " [\e[1;34mi\e[0m] Using default $HOME/.config/proton.conf"
CONF="$HOME/.config/proton.conf"
else
if [ -e "$HOME/.config/.proton.conf" ]; then
echo
echo -e " [\e[1;34mi\e[0m] Using $HOME/.config/.proton.conf"
CONF="$HOME/.config/.proton.conf"
else
echo
echo "Creating new proton config"
printf "VERSION=$DEFAULTVERSION\n\nCOMPATDIR=Default\n\n# If empty, the working dir is same as exe directory. Path can be absolute or relative to exe directory.\nWORKINGDIR=\n\n\n# 0: Disabled, 1: Enabled, 2: OpenGL\nMANGOHUD=0\n\nGAMEMODE=0\n\n\nDXVK=1\n\nESYNC=1\n\n# 0: Disabled, 1: Enabled, 2: Disable Futex2\nFSYNC=1\n\nD3D11=1\n\nD3D10=1" > "$HOME/.config/proton.conf"
echo -e " [\e[1;34mi\e[0m] Using default $HOME/.config/proton.conf"
CONF="$HOME/.config/proton.conf"
fi
fi
fi
fi
fi
fi
else
if [ ! -e "$CONF" ]; then
echo
echo "Creating new proton config"
printf "VERSION=$DEFAULTVERSION\n\nCOMPATDIR=Default\n\n# If empty, the working dir is same as exe directory. Path can be absolute or relative to exe directory.\nWORKINGDIR=\n\n\n# 0: Disabled, 1: Enabled, 2: OpenGL\nMANGOHUD=0\n\nGAMEMODE=0\n\n\nDXVK=1\n\nESYNC=1\n\n# 0: Disabled, 1: Enabled, 2: Disable Futex2\nFSYNC=1\n\nD3D11=1\n\nD3D10=1" > "$CONF"
echo -e " [\e[1;34mi\e[0m] Using $CONF"
else
echo
echo -e " [\e[1;34mi\e[0m] Using $CONF"
fi
fi
. "$CONF"
if [ ! -z "$MANGOHUD" ]; then if [ "$MANGOHUD" != "0" ] && [ "$MANGOHUD" != "1" ] && [ "$MANGOHUD" != "2" ]; then echo; echo -e " [\e[1;31mE\e[0m]\e[1;31m Variable MANGOHUD is not 0, 1 or 2\e[0m"; echo; exit; fi; fi
#check_1_0 MANGOHUD $MANGOHUD
check_1_0 "GAMEMODE $GAMEMODE"
check_1_0 "DXVK" "$DXVK"
check_1_0 "ESYNC" "$ESYNC"
if [ ! -z "$FSYNC" ]; then if [ "$FSYNC" != "0" ] && [ "$FSYNC" != "1" ] && [ "$FSYNC" != "2" ]; then echo; echo -e " [\e[1;31mE\e[0m]\e[1;31m Variable FSYNC is not 0, 1 or 2\e[0m"; echo; exit; fi; fi
#check_1_0 "FSYNC" "$FSYNC"
check_1_0 "D3D10" "$D3D10"
check_1_0 "D3D11" "$D3D11"
check_empty "VERSION" "$VERSION"
check_empty "COMPATDIR" "$COMPATDIR"
check_empty "MANGOHUD" "$MANGOHUD"
check_empty "GAMEMODE" "$GAMEMODE"
check_empty "DXVK" "$DXVK"
check_empty "ESYNC" "$ESYNC"
check_empty "FSYNC" "$FSYNC"
check_empty "D3D10" "$D3D10"
check_empty "D3D11" "$D3D11"
if [ ! -z "$ENV_VERSION" ]; then VERSION="$ENV_VERSION"; fi
if [ ! -z "$ENV_COMPATDIR" ]; then COMPATDIR="$ENV_COMPATDIR"; fi
if [ ! -z "$ENV_WORKINGDIR" ]; then WORKINGDIR="$ENV_WORKINGDIR"; fi
if [ ! -z "$ENV_MANGOHUD" ]; then MANGOHUD="$ENV_MANGOHUD"; fi
if [ ! -z "$ENV_GAMEMODE" ]; then GAMEMODE="$ENV_GAMEMODE"; fi
if [ ! -z "$ENV_DXVK" ]; then DXVK="$ENV_DXVK"; fi
if [ ! -z "$ENV_ESYNC" ]; then ESYNC="$ENV_ESYNC"; fi
if [ ! -z "$ENV_FSYNC" ]; then FSYNC="$ENV_FSYNC"; fi
if [ ! -z "$ENV_D3D10" ]; then D3D10="$ENV_D3D10"; fi
if [ ! -z "$ENV_D3D11" ]; then D3D11="$ENV_D3D11"; fi
if [ -z "$VERSION" ]; then VERSION="$DEFAULTVERSION"; fi
if [ -z "$COMPATDIR" ]; then COMPATDIR="Default"; fi
echo
if [ ! "$DXVK" = "0" ]; then echo -e " [\e[1;34mi\e[0m] Using DXVK\e[0m"; else echo -e " [\e[1;34mi\e[0m] Using WineD3D"; fi
if [ "$MANGOHUD" = "1" ]; then echo -e " [\e[1;34mi\e[0m] Using MangoHud"; fi
if [ "$MANGOHUD" = "2" ]; then echo -e " [\e[1;34mi\e[0m] Using MangoHud (OpenGL)"; fi
if [ ! "$GAMEMODE" = "0" ]; then echo -e " [\e[1;34mi\e[0m] Enabling GameMode"; fi
if [ "$ESYNC" = "0" ]; then echo -e " [\e[1;34mi\e[0m] Disabling Esync"; fi
if [ "$FSYNC" = "0" ]; then echo -e " [\e[1;34mi\e[0m] Disabling Fsync"; fi
if [ "$FSYNC" = "2" ]; then echo -e " [\e[1;34mi\e[0m] Disabling Futex2"; fi
if [ "$D3D10" = "0" ]; then echo -e " [\e[1;34mi\e[0m] Disabling Direct3D 10"; fi
if [ "$D3D11" = "0" ]; then echo -e " [\e[1;34mi\e[0m] Disabling Direct3D 11"; fi
if [ "$COMPATDIR" = "Default" ]; then echo -e " [\e[1;34mi\e[0m] Using default compat dir"; else echo -e " [\e[1;34mi\e[0m] Using compat dir $COMPATDIR"; fi
echo -e " [\e[1;34mi\e[0m] Using version $VERSION"
if [ -e "$1" ]; then
ISPATH="1"
fi
if [ -z "$WORKINGDIR" ]; then
if [ "$ISPATH" = "1" ]; then
echo -e " [\e[1;34mi\e[0m] Using Working Directory $FOLDER"
cd "$FOLDER"
else
echo -e " [\e[1;34mi\e[0m] Using Working Directory $(readlink -f "./")"
fi
else
if [ -e "$WORKINGDIR" ]; then
echo -e " [\e[1;34mi\e[0m] Using Working Directory $(readlink -f "$WORKINGDIR")"
cd $(readlink -f "$WORKINGDIR")
else
echo -e " [\e[1;31mE\e[0m]\e[1;31m Working Directory does not exist\e[0m"
echo
exit
fi
fi
if [ ! -e "$PROTONDIR$VERSION/proton" ]; then
echo
echo -e " [\e[1;31mE\e[0m]\e[1;31m $PROTONDIR$VERSION/proton does not exist\e[0m"
echo
exit
fi
echo
mkdir -p "$COMPDIR/$COMPATDIR" &> /dev/null
if [ "$ISPATH" = "1" ]; then
echo "Copyable command:"
echo
echo -n env STEAM_COMPAT_DATA_PATH=\"$COMPDIR/$COMPATDIR\" env STEAM_COMPAT_CLIENT_INSTALL_PATH=\"$COMPDIR\" $(if [ "$DXVK" = "0" ]; then echo "env PROTON_USE_WINED3D=1"; fi) $(if [ "$D3D10" = "0" ]; then echo "env PROTON_NO_D3D10=1"; fi) $(if [ "$D3D11" = "0" ]; then echo "env PROTON_NO_D3D11=1"; fi) $(if [ "$FSYNC" = "0" ]; then echo "env PROTON_NO_FSYNC=1"; fi) $(if [ "$FSYNC" = "2" ]; then echo "env WINEFSYNC_FUTEX2=0"; fi) $(if [ "$ESYNC" = "0" ]; then echo "env PROTON_NO_ESYNC=1"; fi) $(if [ ! "$GAMEMODE" = "0" ]; then echo "gamemoderun"; fi) $(if [ "$MANGOHUD" = "1" ]; then echo "mangohud"; fi) $(if [ "$MANGOHUD" = "2" ]; then echo "mangohud --dlsym"; fi) \"$PROTONDIR$VERSION/proton\" run "\"$FILE\"" "${@#$1}"
echo
echo
env STEAM_COMPAT_DATA_PATH="$COMPDIR/$COMPATDIR" env STEAM_COMPAT_CLIENT_INSTALL_PATH="$COMPDIR" $(if [ "$DXVK" = "0" ]; then echo "env PROTON_USE_WINED3D=1"; fi) $(if [ "$D3D10" = "0" ]; then echo "env PROTON_NO_D3D10=1"; fi) $(if [ "$D3D11" = "0" ]; then echo "env PROTON_NO_D3D11=1"; fi) $(if [ "$FSYNC" = "0" ]; then echo "env PROTON_NO_FSYNC=1"; fi) $(if [ "$FSYNC" = "2" ]; then echo "env WINEFSYNC_FUTEX2=0"; fi) $(if [ "$ESYNC" = "0" ]; then echo "env PROTON_NO_ESYNC=1"; fi) $(if [ ! "$GAMEMODE" = "0" ]; then echo "gamemoderun"; fi) $(if [ "$MANGOHUD" = "1" ]; then echo "mangohud"; fi) $(if [ "$MANGOHUD" = "2" ]; then echo "mangohud --dlsym"; fi) "$PROTONDIR$VERSION/proton" run "$FILE" "${@#$1}"
else
echo "Copyable command:"
echo
echo -n env STEAM_COMPAT_DATA_PATH=\"$COMPDIR/$COMPATDIR\" env STEAM_COMPAT_CLIENT_INSTALL_PATH=\"$COMPDIR\" $(if [ "$DXVK" = "0" ]; then echo "env PROTON_USE_WINED3D=1"; fi) $(if [ "$D3D10" = "0" ]; then echo "env PROTON_NO_D3D10=1"; fi) $(if [ "$D3D11" = "0" ]; then echo "env PROTON_NO_D3D11=1"; fi) $(if [ "$FSYNC" = "0" ]; then echo "env PROTON_NO_FSYNC=1"; fi) $(if [ "$FSYNC" = "2" ]; then echo "env WINEFSYNC_FUTEX2=0"; fi) $(if [ "$ESYNC" = "0" ]; then echo "env PROTON_NO_ESYNC=1"; fi) $(if [ ! "$GAMEMODE" = "0" ]; then echo "gamemoderun"; fi) $(if [ "$MANGOHUD" = "1" ]; then echo "mangohud"; fi) $(if [ "$MANGOHUD" = "2" ]; then echo "mangohud --dlsym"; fi) \"$PROTONDIR$VERSION/proton\" run "$@"
echo
echo
env STEAM_COMPAT_DATA_PATH="$COMPDIR/$COMPATDIR" env STEAM_COMPAT_CLIENT_INSTALL_PATH="$COMPDIR" $(if [ "$DXVK" = "0" ]; then echo "env PROTON_USE_WINED3D=1"; fi) $(if [ "$D3D10" = "0" ]; then echo "env PROTON_NO_D3D10=1"; fi) $(if [ "$D3D11" = "0" ]; then echo "env PROTON_NO_D3D11=1"; fi) $(if [ "$FSYNC" = "0" ]; then echo "env PROTON_NO_FSYNC=1"; fi) $(if [ "$FSYNC" = "2" ]; then echo "env WINEFSYNC_FUTEX2=0"; fi) $(if [ "$ESYNC" = "0" ]; then echo "env PROTON_NO_ESYNC=1"; fi) $(if [ ! "$GAMEMODE" = "0" ]; then echo "gamemoderun"; fi) $(if [ "$MANGOHUD" = "1" ]; then echo "mangohud"; fi) $(if [ "$MANGOHUD" = "2" ]; then echo "mangohud --dlsym"; fi) "$PROTONDIR$VERSION/proton" run "$@"
fi