summarylogtreecommitdiffstats
path: root/osulauncher
blob: 5650bb11be492053119252bbfb29b956232591a2 (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
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
#!/bin/sh
export WINEARCH=win32
mkdir -p "$HOME/.local/share/wineprefixes/"
export WINEPREFIX="$HOME/.local/share/wineprefixes/osu"
export WINEDEBUG=-all
export PULSE_LATENCY_MSEC=22

function doinstall {
    echo "Installing osu!"
    echo

    if [ -d "$HOME/.osu" ]
    then
        while true
        do
            read -p "$HOME/.osu exists, would you like to move it to $WINEPREFIX? (Will assume that the wineprefix is configured correctly) [Y/n] " yn
            case $yn in
            ""|[Yy]* )
            rm -r "$WINEPREFIX" &>/dev/null
            mv "$HOME/.osu" "$WINEPREFIX"
            /opt/osu/osulauncher & exit;;
            [Nn]* ) break;;
            * ) echo "Please answer y or n.";;
            esac
        done
    fi
    # maybe this should test $XDG_DATA_HOME?
    if [ -f "$HOME/.local/share/applications/wine-extension-osz.desktop" ]
    then
        sed -i "s:$HOME/.osu:$WINEPREFIX:" "$HOME/.local/share/applications/wine-extension-*.desktop"
    fi

    echo "Creating wineprefix..."
    echo "Do NOT install Mono (press cancel)!"
    wine hh || exit 1
    echo "Wineprefix created successfully!"
    echo "Installing .NET 4.5"
    if [ -z "$(which winetricks)" ]
    then
        echo "Installation failed. Please install winetricks."
        read
        exit 1
    fi
    winetricks dotnet45 || (doremove && exit 1)
    echo ".NET 4.5 installed successfully!"
    echo
    echo "Applying some settings..."
    winetricks ddr=opengl fontsmooth=rgb sound=alsa strictdrawordering=enabled
    regedit /opt/osu/directsound-latency.reg
    echo "All done! Running osu! updater..."
    sleep 1
    cp "/opt/osu/game/osu!install.exe" "$WINEPREFIX/osu!install.exe"
    wine "$WINEPREFIX/osu!install.exe"
}

function doinstalloptional {
    if [ ! -d "$WINEPREFIX" ]
    then
        doinstall
    fi

    echo "Installing optional dependencies for osu!"
    echo

    winetricks gdiplus corefonts cjkfonts
}

function doremove {
    echo "Removing wineprefix..."
    rm -rf "$WINEPREFIX"
}


case "$1" in
"install")
 doinstall
 exit 0
 ;;

"install-optional")
 doinstalloptional
 exit 0
 ;;

"remove")
 doremove
 exit 0
 ;;

"reinstall")
 doremove
 doinstall
 exit 0
 ;;

"winecfg")
 winecfg
 exit 0
 ;;

"regedit")
 regedit
 exit 0
 ;;

"winetricks")
 winetricks
 exit 0
 ;;
esac

if [ ! -d "$WINEPREFIX" ]
then
    doinstall
    exit 0
fi

vblank_mode=0 wine "$WINEPREFIX/drive_c/users/$USER/Local Settings/Application Data/osu!/osu!.exe" $@