forked from FasterMelee/FasterMelee-installer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup
215 lines (177 loc) · 6.91 KB
/
setup
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
#!/bin/sh
set -e
# Currently we assume that configuration for all Slippi releases will be based
# on the FM 5.9 configuration files (which should be tracked in the repository
# with this script). This script needs to modify these files.
DOLPHIN_REPO="https://github.com/JLaferri/Ishiiruka"
SCRIPT_REPO="https://github.com/hosaka-corp/Slippi-FM-installer"
PROJECT_REPO="https://github.com/JLaferri/project-slippi"
CONFIG_TAR="5.9-fmconfig.tar.gz"
CONFIG_URL="${SCRIPT_REPO}/raw/master/config/${CONFIG_TAR}"
# Attempts to determine the number of cores in the CPU
# Source: https://gist.github.com/jj1bdx/5746298
CPUS=$(getconf _NPROCESSORS_ONLN 2>/dev/null)
[ -z "$CPUS" ] && CPUS=$(getconf NPROCESSORS_ONLN)
[ -z "$CPUS" ] && CPUS=$(ksh93 -c 'getconf NPROCESSORS_ONLN')
[ -z "$CPUS" ] && CPUS=1
# -----------------------------------------------------------------------------
# Deal with existing installations
for f in Slippi-FM*; do
if [ -d "${f}" ] && [ ! -d "$f/bin" ]; then
echo "[*] Found incomplete installation at $f/, deleting."
rm -rf "$f" # is incomplete if bin/ doesn't exist
fi
done
echo ""
echo "[*] Would you like to overwrite ALL of your previous installations? (y/N) "
read -r RESP
if [ "$RESP" = "y" ] || [ "$RESP" = "Y" ]; then
echo "[*] Are you sure? This action is not reversible! (y/N) "
read -r RESP
if [ "$RESP" = "y" ] || [ "$RESP" = "Y" ] ; then
rm -rf Slippi-FM*/
echo "Sucessfully deleted all FM folders!"
fi
else
echo "No changes made!"
fi
echo ""
# -----------------------------------------------------------------------------
# Ask the user about udev rules, shortcuts, build options
if [ ! -e /etc/udev/rules.d/51-gcadapter.rules ]; then
echo "[*] Would you like to install udev rules for your Wii U adapter? (Y/n) "
read -r RESP
if [ "$RESP" = "y" ] || [ "$RESP" = "Y" ]; then
sudo rm -f /etc/udev/rules.d/51-gcadapter.rules
sudo touch /etc/udev/rules.d/51-gcadapter.rules
echo 'SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="057e", ATTRS{idProduct}=="0337", MODE="0666"' | sudo tee /etc/udev/rules.d/51-gcadapter.rules > /dev/null
sudo udevadm control --reload-rules
echo "Successfully added udev rules"
else
echo "Skipped adding udev rules"
fi
echo ""
else
echo "[*] Looks like you already have Wii U adapter udev rules"
fi
echo "[*] Would you like to make a desktop shortcut? (Y/n) "
read -r RESP
if [ ! "$RESP" = "n" ] && [ ! "$RESP" = "N" ]; then
SHORTCUTBOOL=1
echo "A desktop shortcut will be created after building Ishiiruka"
else
SHORTCUTBOOL=0
echo "Skipped desktop shortcut creation"
fi
echo ""
# -----------------------------------------------------------------------------
# Set options for targeting a particular release.
# For now, just deal with building r9 (make this user-configurable later).
COMMITHASH="50f504eb710d1b1e74356e75f8fbef310b811951"
DOLPHIN_REPO="https://github.com/JLaferri/Ishiiruka.git"
SLIPVER="r10"
echo "[*] Targeting Slippi release: $SLIPVER"
FOLDERNAME="Slippi-FM-${SLIPVER}"
if [ -d "$FOLDERNAME" ]; then
echo "[*] FM Folder with same version found! Would you like to overwrite? (y/N) "
read -r RESP
if [ "$RESP" = "y" ] || [ "$RESP" = "Y" ]; then
echo "[*] Are you sure? This action is not reversible! (y/N) "
read -r RESP
if [ "$RESP" = "y" ] || [ "$RESP" = "Y" ] ; then
rm -r "$FOLDERNAME"
echo "Sucessfully deleted $FOLDERNAME"
else
echo "[!] Quitting!"
exit
fi
else
echo "[!] Quitting!"
exit
fi
fi
echo ""
echo "[*] CPU Threads detected: $CPUS"
echo "[*] How many threads would you like to use to compile? "
echo " (passed to make as -j flag, default: 1, range 1-$((CPUS)): "
read -r RESP
if [ "$RESP" -ge 1 ] 2> /dev/null && [ "$RESP" -le $((CPUS + 1)) ] 2> /dev/null; then
CPUS=$RESP
else
CPUS=1
fi
echo "[*] Compiling with $CPUS thread(s)!"
echo ""
# -----------------------------------------------------------------------------
# Pull in Dolphin configuration from upstream FM and clone Slippi Ishiiruka
echo ""
mkdir "$FOLDERNAME" && cd "$FOLDERNAME"
echo "[*] Downloading config files..."
curl -LO# $CONFIG_URL
echo "[*] Extracting config files..."
tar -xzf "$CONFIG_TAR" --checkpoint-action='exec=printf "%d/410 records extracted.\r" $TAR_CHECKPOINT' --totals
rm "$CONFIG_TAR"
echo "[*] Cloning from $DOLPHIN_REPO ..."
git clone -b "feature/slippi-extraction" --depth 1 "$DOLPHIN_REPO" Ishiiruka
cd Ishiiruka
git checkout "$COMMITHASH"
# -----------------------------------------------------------------------------
# Add config files into the build directory, then compile Ishiiruka and pull
# out the binary/configuration before deleting the tree
echo "[*] Moving FM config files into the build directory"
mkdir build && cd build
mv ../../Binaries .
mv ../Data/dolphin-emu.png Binaries/
cmake .. -DLINUX_LOCAL_DEV=true
make -j $CPUS -s
cd ../..
mv Ishiiruka/build/Binaries/ bin/
rm -rf Ishiiruka
rm -f ../launch-slippi-fm
# -----------------------------------------------------------------------------
# Modify the upstream FM config for use with Slippi Ishiiruka
GALE01_INI="./bin/User/GameSettings/GALE01.ini"
GALE01R2_INI="./bin/Sys/GameSettings/GALE01r2.ini"
DOLPHIN_INI="./bin/User/Config/Dolphin.ini"
CODELIST_URL="${PROJECT_REPO}/raw/master/Gecko%20Codes/CodeList.txt"
echo "[*] Adding Slippi configuration files .."
mkdir ./bin/Slippi
# Set device in EXI Slot B to Slippi (device 10)
sed -i -e 's/SlotA = .*$/SlotA = 255/g' \
-e 's/SlotB = .*$/SlotB = 10/g' \
"$DOLPHIN_INI"
# Add both Slippi codesets to the set of NTSC v1.02 Gecko codes
echo '' >> "$GALE01R2_INI"
curl -Ls "$CODELIST_URL" >> "$GALE01R2_INI"
# Enable Slippi Recording
sed -i -e '/\$Game Music ON/a \$Slippi Recording' "$GALE01_INI"
# -----------------------------------------------------------------------------
# Make a symlink to Slippi Ishiiruka, optionally create a shortcut
ln -s "$FOLDERNAME/bin/dolphin-emu" ../launch-slippi-fm
if [ "$SHORTCUTBOOL" -eq 1 ] && [ -d ~/.local/share/applications ]; then
rm -f ~/.local/share/applications/slippi-fm-$SLIPVER.desktop
rm -f ~/Desktop/slippi-fm-$SLIPVER.desktop
touch ~/.local/share/applications/slippi-fm-$SLIPVER.desktop
EXEPATH="$(pwd)/bin"
FMNAME="Slippi FM $SLIPVER"
echo "[Desktop Entry]
Type=Application
GenericName=Wii/GameCube Emulator
Comment=Slippi Ishiiruka fork for SSBM
Categories=Emulator;Game;
Icon=$EXEPATH/dolphin-emu.png
Version=$SLIPVER
Name=$FMNAME
Exec=$EXEPATH/dolphin-emu" | tee ~/.local/share/applications/slippi-fm-$SLIPVER.desktop > /dev/null
cp ~/.local/share/applications/slippi-fm-$SLIPVER.desktop ~/Desktop
chmod +x ~/Desktop/slippi-fm-$SLIPVER.desktop
echo "[*] Created a desktop shortcut"
else
echo "[!] .local folder not found, skipping desktop shortcut"
fi
echo "[!] All done! Run ./launch-slippi-fm to run the latest installed version!"
echo " Alternatively, go to Application > Games or your desktop and select the"
echo " desired Slippi FM version."
echo ""
echo " If you've installed udev rules, make sure to unplug and replug your"
echo " adapter before opening Dolphin!"