-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDLCUnlocker.sh
301 lines (247 loc) · 8.73 KB
/
DLCUnlocker.sh
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
#! /usr/bin/bash
# Ensure we are running under bash
if [ "$BASH_SOURCE" = "" ]; then
/usr/bin/bash "$0"
exit 0
fi
#
# Load bash-menu script
#
# NOTE: Ensure this is done before using
# or overriding menu functions/variables.
#
scriptDir=$(dirname $0)
if [ $# = 0 ]; then
echo "No directory provided. Please specify a valid game directory."
exit
fi
installDir=$1
if [ ${#installDir} -lt 3 ]; then
echo "No directory provided. Please specify a valid game directory."
exit
fi
installDir=$1
bitness="Unknown"
if [ ! -d $installDir ]; then
echo "Invalid directory provided. Please specify a valid game directory."
exit
fi
. "$scriptDir/bash-menu.sh"
################################
## Example Menu Actions
##
## They should return 1 to indicate that the menu
## should continue, or return 0 to signify the menu
## should exit.
################################
windowsH() {
setupBitMenu
menuInit
menuLoop
setupMenu
menuInit
echo "SmokeAPI Hook Mode Installer"
echo ""
echo "Installing SmokeAPI Hook Mode ($bitness-Bit)"
if [ $bitness = "unknown" ]; then
exit
fi
echo "[1/3] Copying SmokeAPI.dll"
if [ $bitness = "64" ]; then
cp "$scriptDir/assets/SmokeAPI/steam_api64.dll" "$installDir/SmokeAPI.dll"
elif [ $bitness = "32" ]; then
cp "$scriptDir/assets/SmokeAPI/steam_api.dll" "$installDir/SmokeAPI.dll"
fi
echo "[2/3] Copying version.dll"
cp "$scriptDir/assets/SmokeAPI/version$bitness.dll" "$installDir/version.dll"
echo "[3/3] Checking for SmokeAPI.config.json"
if [ -f "$installDir/SmokeAPI.config.json" ]; then
echo "Existing SmokeAPI.config.json found, skipping copying";
else
echo "[3/3] Copying SmokeAPI.config.json"
cp "$scriptDir/assets/SmokeAPI/SmokeAPI.config.json" "$installDir/SmokeAPI.config.json"
fi
echo "SmokeAPI Hook Mode x$bitness installation complete. Proton users please refer to github for Steam Launch arguments."
echo ""
echo -n "Press Enter to return to menu"
read response
return 1
}
windowsP() {
setupBitMenu
menuInit
menuLoop
setupMenu
menuInit
echo "SmokeAPI Proxy Mode Installer"
echo ""
echo "Installing SmokeAPI Proxy Mode ($bitness-Bit)"
if [ $bitness = "unknown" ]; then
exit
fi
bitnessStr=$bitness
if [ $bitness = "32" ]; then
bitnessStr=""
fi
echo "[1/3] Renaming original steam_api$bitness.dll"
echo "Checking for existing install"
if [ -f "$installDir/steam_api""$bitnessStr""_o.dll" ]; then
userCont=" "
echo "SmokeAPI proxy mode has been installed before. Only reinstall if SmokeAPI has been replaced (steam integrity check). "
read -p "Do you wish to install it again? (y/N) " userCont
if [ $userCont = "y" ] || [ $userCont = "Y" ]; then
echo "Overriding steam_api""$bitnessStr""_o.dll."
else
echo "Cancelling installation."
exit
fi
fi
cp "$installDir/steam_api$bitnessStr.dll" "$installDir/steam_api""$bitnessStr""_o.dll"
echo "[2/3] Copying SmokeAPI.dll"
cp "$scriptDir/assets/SmokeAPI/steam_api$bitness.dll" "$installDir/steam_api$bitness.dll"
echo "[3/3] Checking for SmokeAPI.config.json"
if [ -f "$installDir/SmokeAPI.config.json" ]; then
echo "Existing SmokeAPI.config.json found, skipping copying";
else
echo "[3/3] Copying SmokeAPI.config.json"
cp "$scriptDir/assets/SmokeAPI/SmokeAPI.config.json" "$installDir/SmokeAPI.config.json"
fi
echo "SmokeAPI Proxy Mode x$bitness installation complete."
echo ""
echo -n "Press Enter to return to menu"
read response
return 1
}
linuxO() {
echo "CreamLinux Installer (x32/x64)"
echo ""
echo "[1/4] Copying lib32Creamlinux.so"
cp "$scriptDir/assets/CreamLinux/lib32Creamlinux.so" "$installDir/lib32Creamlinux.so"
echo "[2/4] Copying lib64Creamlinux.so"
cp "$scriptDir/assets/CreamLinux/lib64Creamlinux.so" "$installDir/lib64Creamlinux.so"
echo "[3/4] Copying cream.sh"
cp "$scriptDir/assets/CreamLinux/cream.sh" "$installDir/cream.sh"
echo "[4/4] Checking for cream_api.ini"
if [ -f "$installDir/cream_api.ini" ]; then
echo "Existing cream_api.ini found, skipping copying";
else
echo "[4/4] Copying cream_api.ini"
cp "$scriptDir/assets/CreamLinux/cream_api.ini" "$installDir/cream_api.ini"
fi
echo "CreamLinux installation complete."
echo ""
echo "Please add the following to your steam launch arguments: sh ./cream.sh %command%"
echo ""
echo -n "Press Enter to return to menu"
read response
return 1
}
bit32() {
bitness="32"
return 0
}
bit64() {
bitness="64"
return 0
}
bitHelp() {
echo "Bitness Help"
echo "This is a free open source steam DLC unlocking script available from https://github.com/lily-software/DLCUnlockerScript"
echo ""
echo "64-Bit is the usual standard, if you are unsure just select 64-Bit. Otherwise, you can determine it by whether the game directory uses 'steam_api.dll' (32-bit) or 'steam_api64.dll' (64-bit). If for whatever reason the game has both, try using the 64-bit version first, and then also the 32-bit version if that doesn't work."
echo ""
echo -n "Press Enter to return to menu"
read response
return 1
}
helpM() {
echo "DLC Unlocker Help"
echo "This is a free open source steam DLC unlocking script available from https://github.com/lily-software/DLCUnlockerScript"
echo ""
echo "Hook Mode vs Proxy Mode"
echo "- In Hook Mode, no files are replaced, instead SmokeAPI will 'hook' into the Steam API file each launch. This is the recommended installation method, however will require additional Steam launch arguments for users using Proton. This can be found in the github readme."
echo "- In Proxy Mode, the original Steam API is renamed and SmokeAPI takes its place. This will break should you decide to validate the game files with Steam and you will have to reinstall the proxy. This is the recommended installation method for Linux users on Proton."
echo ""
echo "Linux DLC Unlocking"
echo "This script was originally created to help with installing SmokeAPI/CreamLinux on Linux. If you are using Linux with Proton and wish to use SmokeAPI's hook mode, please read the wiki provided on github as there are a lot of small things that can go wrong.It is recommended that if possible you do not use Proton and instead opt for the native CreamAPI hook. Unfortunately, you will still have to specify each unlocked DLC manually."
echo ""
echo -n "Press Enter to return to menu"
read response
return 1
}
installerInfo() {
echo "[v0.1.1] [MIT License] DLC Unlocker Script"
echo "This is a free open source steam DLC unlocking script available from https://github.com/lily-software/DLCUnlockerScript"
echo ""
echo "Projects Utilised + Licensing"
echo "[20180720] [MIT License] Bash Menu from bash-menu https://github.com/barbw1re/bash-menu"
echo "[ v2.0.3 ] [MIT License] CreamLinux from creamlinux https://github.com/anticitizn/creamlinux"
echo "[ v2.0.5 ] [ Unlicense ] SmokeAPI from SmokeAPI https://github.com/acidicoala/SmokeAPI"
echo "[ v3.0.2 ] [ Unlicense ] Version API from Koaloader https://github.com/acidicoala/Koaloader"
echo ""
echo -n "Press Enter to return to menu"
read response
return 1
}
exitM() {
exit
}
setupBitMenu() {
## Menu Item Text
## NOTE: If these are not all the same width
## the menu highlight will look wonky
menuItems=(
"1. 64-Bit"
"2. 32-Bit"
"3. Help "
"4. Exit "
)
## Menu Item Actions
menuActions=(
bit64
bit32
bitHelp
exitM
)
## Override Defaults
menuTitle=" Select Game Bitness"
menuFooter=" "
menuWidth=40
menuLeft=25
menuHighlight=$DRAW_COL_YELLOW
}
setupMenu() {
## Menu Item Text
## NOTE: If these are not all the same width
## the menu highlight will look wonky
menuItems=(
"1. Windows/Proton (Hook)"
"2. Windows/Proton (Proxy)"
"3. Linux Native (Override)"
"4. Unsure/Help "
"5. Installer Info "
"6. Exit "
)
## Menu Item Actions
menuActions=(
windowsH
windowsP
linuxO
helpM
installerInfo
exitM
)
## Override Defaults
menuTitle=" Select Unlocking Method"
menuFooter=" Enter=Select, Navigate via Up/Down/Number"
menuWidth=60
menuLeft=25
menuHighlight=$DRAW_COL_BLUE
}
################################
## Run Menu
################################
setupMenu
menuInit
menuLoop
exit 0