-
Notifications
You must be signed in to change notification settings - Fork 19
/
osu-wine
384 lines (298 loc) · 14.2 KB
/
osu-wine
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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
#!/usr/bin/env bash
## Welcome to your osu! launch script!
## Most stuff here is explained with comments, but if you just need to add
## any argument to osu!, use #LAUNCH_ARGS!
## If you ever need to change something to the osu! launcher besides args, just go to line ~68
LAUNCH_ARGS="env PROTONFIXES_DISABLE=1" # Use this for args like prime-run or gamemoderun!
export PRESSURE_VESSEL_FILESYSTEMS_RW= # Add your external disks paths here if you use symlinks
export WINEDEBUG=${WINEDEBUG:-}
export WINEESYNC=1 # PROTON_NO_ESYNC=1 is also needed to disable
export WINEFSYNC=1 # PROTON_NO_FSYNC=1 is also needed to disable
export WINE_BLOCK_GET_VERSION=0 # Set this to 1 to enable Windows fonts/boss key, but it might cause crashes in future updates! Revert back if so.
export PROTONPATH="$HOME/.local/share/osuconfig/proton-osu"
export WINESERVER_PATH="$PROTONPATH/files/bin/wineserver"
export WINE_PATH="$PROTONPATH/files/bin/wine"
export WINETRICKS_PATH="$PROTONPATH/protontricks/winetricks"
export GAMEID="umu-727"
UMU_RUN="$PROTONPATH/umu-run"
export WINEARCH=win64
export WINEPREFIX="$HOME/.local/share/wineprefixes/osu-wineprefix"
osuinstall=$(</"$HOME/.local/share/osuconfig/osupath")
export OSUPATH="$osuinstall"
export vblank_mode=0 # Disables vsync for mesa
export __GL_SYNC_TO_VBLANK=0 # Disables vsync for NVIDIA >=510
export WINEDLLOVERRIDES=winemenubuilder.exe=d# # Blocks wine from creating .desktop files
export WINE_ENABLE_ABS_TABLET_HACK=0 # Set this to 1 to play with absolute mode in OTD on Wayland (might cause issues with cursor, but feel free to try!)
function Info(){
echo -e '\033[1;34m'"Winello:\033[0m $*";
}
function Error(){
echo -e '\033[1;31m'"Script failed:\033[0m $*"; exit 1;
}
function Help(){
Info "Script features:
osu-wine: Runs osu!
osu-wine --winecfg : Runs winecfg on the osu! Wineprefix
osu-wine --winetricks: Install packages on osu! Wineprefix
osu-wine --regedit: Opens regedit on osu! Wineprefix
osu-wine --kill: Kills osu! and related processes in osu! Wineprefix
osu-wine --kill9: Kills osu! but with wineserver -k9
osu-wine --update: Updates wine-osu to latest version
osu-wine --fixprefix: Reinstalls the osu! Wineprefix from system
osu-wine --info: Troubleshooting and more info
osu-wine --remove: Uninstalls osu! and the script
osu-wine --changedir: Changes directory of the install according to the user
osu-wine --devserver <address>: Runs osu on with the specified devserver
osu-wine --fixfolders: Reinstalls registry keys for native file manager in case they break
osu-wine --fixrpc: Reinstalls rpc-bridge if needed!
osu-wine --gosumemory: Installs and runs gosumemory without any needed config!
osu-wine --tosu: Installs and runs tosu without any needed config!
osu-wine --disable-memory-reader: Turn off gosumemory and tosu"
}
function Checkshort(){ # Deletes useless shortcuts created when installing
if [ -e "$HOME/.local/share/applications/wine/Programs/osu!.desktop" ] ; then
rm -f "$HOME/.local/share/applications/wine/Programs/osu!.desktop" ; fi
DESKTOPDIR=$(xdg-user-dir DESKTOP)
if [ -e "$DESKTOPDIR/osu!.lnk" ] ; then
rm -f "$DESKTOPDIR/osu!.lnk" ; fi
}
function Update(){
Info "Checking for Steam Runtime updates first.."
$LAUNCH_ARGS "$UMU_RUN" wineboot -u
$LAUNCH_ARGS "$WINESERVER_PATH" -k
git -C "$HOME/.local/share/osuconfig/update" pull --quiet
bash "/$HOME/.local/share/osuconfig/update/osu-winello.sh" update
}
function longPathsFix(){
# Applying fix for long names/paths...
rm -rf "$WINEPREFIX/dosdevices/d:"
ln -s "$OSUPATH" "$WINEPREFIX/dosdevices/d:"
}
case "$1" in
'')
if [ -f "$OSUPATH/launch_with_memory.bat" ]; then
UMU_RUNTIME_UPDATE=0 $LAUNCH_ARGS PROTON_VERB=runinprefix "$UMU_RUN" "$OSUPATH/launch_with_memory.bat"
else
UMU_RUNTIME_UPDATE=0 $LAUNCH_ARGS "$UMU_RUN" "$OSUPATH/osu!.exe"
fi
Checkshort
;;
###################################################################################################
'--devserver')
if [ -f "$OSUPATH/launch_with_memory.bat" ]; then
UMU_RUNTIME_UPDATE=0 $LAUNCH_ARGS PROTON_VERB=runinprefix "$UMU_RUN" "$OSUPATH/launch_with_memory.bat" -devserver "$2"
else
UMU_RUNTIME_UPDATE=0 $LAUNCH_ARGS "$UMU_RUN" "$OSUPATH/osu!.exe" -devserver "$2"
fi
;;
###################################################################################################
'--regedit')
$LAUNCH_ARGS "$UMU_RUN" regedit
;;
###################################################################################################
'--winecfg')
$LAUNCH_ARGS "$UMU_RUN" winecfg
;;
###################################################################################################
'--winetricks')
$LAUNCH_ARGS "$UMU_RUN" winetricks "${@:2}"
;;
###################################################################################################
'--changedir')
function deleteFolder(){
Info "Do you want to delete the previous install?"
read -r -p "$(Info "Choose your option (y/n): ")" dirchoice
if [ "$dirchoice" = 'y' ] || [ "$dirchoice" = 'Y' ]; then
read -r -p "$(Info "Are you sure? This will delete your files! (y/n)")" dirchoice2
if [ "$dirchoice2" = 'y' ] || [ "$dirchoice2" = 'Y' ]; then
lastdir=$(</"$HOME/.local/share/osuconfig/osupath")
rm -rf "$lastdir/osu!" && Info "Cleaning done!"
else
Info "Skipping..."
fi
else
Info "Skipping.."
fi
}
Info "Please choose your new directory:"
newdir="$(zenity --file-selection --directory)"
lastdir=$(</"$HOME/.local/share/osuconfig/osupath")
rm -f "$HOME/.local/share/osuconfig/osupath"
if [ -d "$newdir/osu!" ] || [ -s "$newdir/osu!.exe" ]; then
Info "osu! folder/game already exists: skipping.."
if [ -d "$newdir/osu!" ]; then
OSUPATH="$newdir/osu!"
echo "$OSUPATH" > "$HOME/.local/share/osuconfig/osupath"
Info "Change done from '$lastdir' to '$newdir'!"
deleteFolder
fi
if [ -s "$newdir/osu!.exe" ]; then
OSUPATH="$newdir"
echo "$OSUPATH" > "$HOME/.local/share/osuconfig/osupath"
Info "Change done from '$lastdir' to '$newdir'!"
deleteFolder
fi
else
mkdir "$newdir/osu!"
OSUPATH="$newdir/osu!"
echo "$OSUPATH" > "$HOME/.local/share/osuconfig/osupath"
Info "Downloading osu! to your new install.."
wget -O "$OSUPATH/osu!.exe" "http://m1.ppy.sh/r/osu!install.exe" && wgetcheck6="$?"
if [ ! "$wgetcheck6" = 0 ] ; then
Info "wget failed; trying with --no-check-certificate.."
wget --no-check-certificate -O "$OSUPATH/osu!.exe" "http://m1.ppy.sh/r/osu!install.exe" ; fi
Info "Change done from '$lastdir' to '$newdir'!"
deleteFolder
fi
longPathsFix
;;
###################################################################################################
'--remove')
bash "$HOME/.local/share/osuconfig/update/osu-winello.sh" uninstall
;;
###################################################################################################
'--kill')
"$WINESERVER_PATH" -k
;;
###################################################################################################
'--kill9')
"$WINESERVER_PATH" -k9
;;
###################################################################################################
'--update')
Update
;;
###################################################################################################
'--fixfolders')
$LAUNCH_ARGS "$UMU_RUN" reg add "HKEY_CLASSES_ROOT\folder\shell\open\command"
$LAUNCH_ARGS "$UMU_RUN" reg delete "HKEY_CLASSES_ROOT\folder\shell\open\ddeexec" /f
$LAUNCH_ARGS "$UMU_RUN" reg add "HKEY_CLASSES_ROOT\folder\shell\open\command" /f /ve /t REG_SZ /d "/home/$USER/.local/share/osuconfig/folderfixosu xdg-open \"%1\""
;;
###################################################################################################
'--fixrpc')
if [ ! -d "$HOME/.local/share/wineprefixes/osu-wineprefix/drive_c/windows/bridge.exe" ] ; then
Info "Configuring rpc-bridge (Discord RPC)"
wget -O "/tmp/bridge.zip" "https://github.com/EnderIce2/rpc-bridge/releases/download/v1.2/bridge.zip" && chk="$?"
if [ ! "$chk" = 0 ] ; then
Info "wget failed; trying with --no-check-certificate.."
wget --no-check-certificate -O "/tmp/bridge.zip" "https://github.com/EnderIce2/rpc-bridge/releases/download/v1.2/bridge.zip" || Error "Download failed, check your connection or open an issue here: https://github.com/NelloKudo/osu-winello/issues"
fi
mkdir -p /tmp/rpc-bridge
unzip -d /tmp/rpc-bridge -q "/tmp/bridge.zip"
$LAUNCH_ARGS "$UMU_RUN" /tmp/rpc-bridge/bridge.exe --install
rm -f "/tmp/bridge.zip"
rm -rf "/tmp/rpc-bridge"
fi
;;
###################################################################################################
'--fixprefix')
Info "Checking for internet connection.."
! ping -c 1 1.1.1.1 >/dev/null 2>&1 && Error "Please connect to internet before continuing xd. Run the script again"
Info "Deleting old Wineprefix..."
rm -rf "$WINEPREFIX"
export WINEPREFIX="$HOME/.local/share/wineprefixes/osu-wineprefix"
WINEESYNC=0 WINEFSYNC=0 PROTON_NO_ESYNC=1 PROTON_NO_FSYNC=1 "$UMU_RUN" \
winetricks dotnet20 dotnet48 gdiplus_winxp win2k3
# Adding fixfolderosu again
$LAUNCH_ARGS "$UMU_RUN" reg add "HKEY_CLASSES_ROOT\folder\shell\open\command"
$LAUNCH_ARGS "$UMU_RUN" reg delete "HKEY_CLASSES_ROOT\folder\shell\open\ddeexec" /f
$LAUNCH_ARGS "$UMU_RUN" reg add "HKEY_CLASSES_ROOT\folder\shell\open\command" /f /ve /t REG_SZ /d "/home/$USER/.local/share/osuconfig/folderfixosu xdg-open \"%1\""
# Applying fix for long names/paths...
longPathsFix
if [ ! -d "$HOME/.local/share/wineprefixes/osu-wineprefix/drive_c/windows/bridge.exe" ] ; then
Info "Configuring rpc-bridge (Discord RPC)"
wget -O "/tmp/bridge.zip" "https://github.com/EnderIce2/rpc-bridge/releases/download/v1.2/bridge.zip" && chk="$?"
if [ ! "$chk" = 0 ] ; then
Info "wget failed; trying with --no-check-certificate.."
wget --no-check-certificate -O "/tmp/bridge.zip" "https://github.com/EnderIce2/rpc-bridge/releases/download/v1.2/bridge.zip" || Error "Download failed, check your connection or open an issue here: https://github.com/NelloKudo/osu-winello/issues"
fi
mkdir -p /tmp/rpc-bridge
unzip -d /tmp/rpc-bridge -q "/tmp/bridge.zip"
$LAUNCH_ARGS "$UMU_RUN" /tmp/rpc-bridge/bridge.exe --install
rm -f "/tmp/bridge.zip"
rm -rf "/tmp/rpc-bridge"
fi
Info "Wineprefix is now working; launch osu! with osu-wine"
;;
###################################################################################################
'--gosumemory')
if [ ! -d "$HOME/.local/share/osuconfig/gosumemory" ]; then
git -C "$HOME/.local/share/osuconfig/update" pull --quiet
bash "$HOME/.local/share/osuconfig/update/osu-winello.sh" gosumemory
fi
Info "Setting up gosumemory wrapper..."
GOSUMEM_PATH="$($LAUNCH_ARGS PROTON_VERB=runinprefix "$UMU_RUN" winepath -w "$HOME/.local/share/osuconfig/gosumemory/gosumemory.exe")"
OSU_PATH="$($LAUNCH_ARGS PROTON_VERB=runinprefix "$UMU_RUN" winepath -w "$OSUPATH/osu!.exe")"
OSU_DIR="$($LAUNCH_ARGS PROTON_VERB=runinprefix "$UMU_RUN" winepath -w "$OSUPATH")"
# launcher batch file which monitors osu! and closes gosumemory when osu! exits
cat > "$OSUPATH/launch_with_memory.bat" << EOF
@echo off
cd /d "$OSU_DIR"
start "" "$OSU_PATH" %*
start /b "" "$GOSUMEM_PATH"
:loop
tasklist | find "osu!.exe" >nul
if ERRORLEVEL 1 (
taskkill /F /IM gosumemory.exe >nul 2>&1
exit
)
ping -n 5 127.0.0.1 >nul
goto loop
EOF
Info "gosumemory wrapper enabled. Launch osu! normally to use it!"
;;
###################################################################################################
'--tosu')
if [ ! -d "$HOME/.local/share/osuconfig/tosu" ]; then
git -C "$HOME/.local/share/osuconfig/update" pull --quiet
bash "$HOME/.local/share/osuconfig/update/osu-winello.sh" tosu
fi
Info "Setting up tosu wrapper..."
TOSU_PATH="$($LAUNCH_ARGS PROTON_VERB=runinprefix $UMU_RUN winepath -w "$HOME/.local/share/osuconfig/tosu/tosu.exe")"
OSU_PATH="$($LAUNCH_ARGS PROTON_VERB=runinprefix $UMU_RUN winepath -w "$OSUPATH/osu!.exe")"
OSU_DIR="$($LAUNCH_ARGS PROTON_VERB=runinprefix $UMU_RUN winepath -w "$OSUPATH")"
# ditto
cat > "$OSUPATH/launch_with_memory.bat" << EOF
@echo off
set NODE_SKIP_PLATFORM_CHECK=1
cd /d "$OSU_DIR"
start "" "$OSU_PATH" %*
start /b "" "$TOSU_PATH"
:loop
tasklist | find "osu!.exe" >nul
if ERRORLEVEL 1 (
taskkill /F /IM tosu.exe >nul 2>&1
exit
)
ping -n 5 127.0.0.1 >nul
goto loop
EOF
Info "tosu wrapper enabled. Launch osu! normally to use it!"
;;
###################################################################################################
'--disable-memory-reader')
if [ -f "$OSUPATH/launch_with_memory.bat" ]; then
rm "$OSUPATH/launch_with_memory.bat"
Info "Memory reader wrapper disabled."
else
Info "No memory reader wrapper was enabled."
fi
;;
###################################################################################################
'--info')
Info "Need info?:
Wineprefix location: $WINEPREFIX
osu! folder: '$OSUPATH'
If you need to add more options to osu!, see around line 77 of the script (ex. nano ~/.local/bin/osu-wine)
You can run 'osu-wine --help' to see all the script's functions (fix prefix, w10 fonts etc.)
You can find more troubleshooting and info at here: https://osu.ppy.sh/community/forums/topics/1248084?n=1"
;;
###################################################################################################
'--help')
Help
;;
###################################################################################################
'help')
Help
;;
esac