forked from CEMULinux/cemutil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcemutil.sh
executable file
·173 lines (156 loc) · 4.67 KB
/
cemutil.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
#!/bin/bash
if [ -z "$DISPLAY" ]; then
export DISPLAY=:0.0
fi
# help function:
function printhelp {
echo "usage examples: Download latest public cemu + cemuhook and install to ~/.cemu (default):"
echo "./cemutil.sh -a"
echo "Use local zips and install to ~/Documents/cemu:"
echo "./cemutil.sh -c cemu.zip -h cemuhook.zip -i ~/Documents/cemu/"
exit 1
}
function downloadlatest {
echo "Downloading latest cemu"
wget -q --show-progress -O cemutemp.zip $(curl -s http://cemu.info |grep .zip |awk -F '"' {'print $2'})
echo "Downloading latest cemuhook"
wget -q --show-progress -O cemuhooktemp.zip $(curl -s https://cemuhook.sshnuke.net |grep .zip |awk -F '"' NR==2{'print $2'})
echo "Downloading latest cemuhook"
wget -q --show-progress -O gfxpacktemp.zip https://github.com$(curl https://github.com/slashiee/cemu_graphic_packs/releases |grep graphicPacks |awk -F '"' NR==1{'print $2'})
return
}
#Check installed software
declare -a reqsw=("wine" "bsdtar" "unzip" "glxinfo" "curl" "wget" "winetricks")
for i in "${reqsw[@]}"
do
if ! [ -x "$(command -v $i)" ]; then
echo "You must install $i"
exit 1
fi
done
function checkgfxver {
echo "Checking graphics packages are new enough. To skip this check (on Nvidia for instance), run with -f flag."
if ! $(glxinfo | grep -q -e 'Mesa 18.2' -e 'Mesa 18.3' -e 'Mesa 18.4' -e 'Mesa 19'); then
echo "You must install at least Mesa 18.2.0"
exit 1
fi
if ! $(glxinfo | grep -q "LLVM 8"); then
if ! $(glxinfo | grep -q "LLVM 7"); then
echo "You must install Mesa built with at least LLVM 7"
exit 1
fi
fi
if ! $(glxinfo | grep -q "4.5 (Compat"); then
echo "Your hardware doesn't support the required OpenGL version."
echo "You may attempt using MESA_GL_VERSION_OVERRIDE=4.4COMPAT in the LaunchCEMU script."
echo "This isn't officially supported, and may cause heavy glitches or not work. Proceeding as usual..."
fi
return
}
#Check for args
if [[ ! $@ =~ ^\-.+ ]]
then
printhelp;
fi
#Handle args
while getopts ":c:h:afi:" opt; do
case ${opt} in
c )
cemuzip=$OPTARG
if [ ! -f "$cemuzip" ]; then
echo "cemu zip doesn't exist"
exit 1
fi
;;
h )
cemuhookzip=$OPTARG
if [ ! -f "$cemuhookzip" ]; then
echo "cemuhook zip doesn't exist"
exit 1
fi
;;
a )
downloadlatest
;;
f )
skipgfxcheck=1
;;
i )
instdir=$OPTARG
;;
\? )
printhelp
;;
: )
echo "Invalid option: $OPTARG requires an argument" 1>&2
printhelp
;;
esac
done
shift $((OPTIND -1))
#check gfx package vers
if [[ "$skipgfxcheck" == "" ]]; then
checkgfxver
fi
#Set opts if unset
if [[ "$instdir" == "" ]]; then
instdir=$HOME/.cemu
fi
if [[ "$cemuzip" == "" ]]; then
cemuzip=cemutemp.zip
fi
if [[ "$cemuhookzip" == "" ]]; then
cemuhookzip=cemuhooktemp.zip
fi
#Extract zips
echo "Extracting zips"
mkdir -p $instdir
bsdtar -xf "$cemuzip" -s'|[^/]*/||' -C $instdir
unzip -q -o "$cemuhookzip" -d $instdir
if [ -f "gfxpacktemp.zip" ]; then
unzip -q -o gfxpacktemp.zip -d $instdir/graphicPacks
rm -rf gfxpacktemp.zip
fi
#Delete downloaded zips if applicable
if [ -f "cemutemp.zip" ]; then
rm -rf cemutemp.zip
rm -rf cemuhooktemp.zip
fi
#Create launch scripts
cat > LaunchCEMU << EOF1
#!/bin/bash
export WINEPREFIX="$(realpath $instdir)/wine"
#for cemuhook
export WINEDLLOVERRIDES="mscoree=;mshtml=;dbghelp.dll=n,b"
if [ -z `winetricks list-installed|grep vcrun2015` ]; then
if [ -n "`whereis zenity|grep bin`" ]; then
zenity --info --title 'Cemu' --text 'Installing wine dependencies.\n\nThe process may take a few minutes'
fi
winetricks -q vcrun2015
winetricks settings win7
fi
cd $(realpath $instdir)
mesa_glthread=true __GL_THREADED_OPTIMIZATIONS=1 vblank_mode=0 WINEESYNC=0 wine Cemu.exe "\$@"
EOF1
chmod +x LaunchCEMU
cat > LaunchCEMUgcn3BOTW << EOF1
#!/bin/bash
export WINEPREFIX="$(realpath $instdir)/wine"
#for cemuhook
export WINEDLLOVERRIDES="mscoree=;mshtml=;dbghelp.dll=n,b"
if [ -z `winetricks list-installed|grep vcrun2015` ]; then
if [ -n "`whereis zenity|grep bin`" ]; then
zenity --info --title 'Cemu' --text 'Installing wine dependencies.\n\nThe process may take a few minutes'
fi
winetricks -q vcrun2015
winetricks settings win7
fi
cd $(realpath $instdir)
R600_DEBUG=nohyperz mesa_glthread=true vblank_mode=0 WINEESYNC=0 wine Cemu.exe "\$@"
EOF1
chmod +x LaunchCEMUgcn3BOTW
echo "Successfully installed to $(realpath $instdir)"
echo "You may now run CEMU with LaunchCEMU written in this directory"
echo "You may place LaunchCEMU anywhere, and even pass arguments to it just like Cemu.exe on Windows"
echo "Note: When launching there may be a WxWidgets error. Press Cancel; this is normal from cemuhook"
echo "Note2: gcn3 (radeon 300-500 series) users should use the gcn3BOTW script for launching BOTW"