blob: a6873c07c142df364abd955b85bde321a154f0bf (
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
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
|
#!/bin/bash
# This patcher is NOT OFFICIAL AND DOES NOT COME WITH ANY WARRANTY.
echo
echo ====================================
echo Riibalanced ISO Patcher
echo ====================================
echo
# check for riibalanced files ---------------------------------------------------
if [[ ! -d "./V5/" ]]; then
echo "ERROR: The Riibalanced patch files do not exist. Please download the zip file from the Riibalanced Discord, and extract the contents so that the folder 'V5' is in the same directory as 'patch_iso.sh'"
echo
echo "Like this:"
echo "/your/current/directory"
echo "├── patch_iso.sh
└── V5
├── Mario Kart Riibalanced V5.cover.png
├── Mario Kart Riibalanced V5.json
├── Mario Kart Riibalanced V5.png
├── readme.txt
├── Riibalanced
├── Riibalanced Extras
└── riivolution
"
exit 3;
fi
# check if correct programs are installed ---------------------------------------
# curl ------
type curl
ERROR="$?"
if [[ ERROR -ne 0 ]]; then
echo
echo "You must install 'curl' in order for this script to work correctly."
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "Try running 'xcode-select --install'."
else
echo "Please consult your system's package manager."
fi
exit 0
fi
# wit -------
type wit
ERROR="$?"
echo
if [[ ERROR -ne 0 ]]; then
echo "In order for the patcher to work, Wiimm's ISO Tools (https://wit.wiimm.de/) must be installed. By answering yes, you allow this script to download and install the software. Don't worry! This is completely safe. This program is developed by the same person who created Wiimmfi. The patcher cannot continue if wit is not installed."
printf "Would you like to install wit? [y/n] "
while read -r key; do
case $key in
n) echo "ERROR: Without wit, the patcher cannot continue."; exit 1 ;;
y) break ;;
esac
printf "Would you like to install wit? [y/n] "
done
arch=$(uname -m)
if [[ "$OSTYPE" == "linux"* ]]; then
if [[ $arch == x86_64* ]]; then
curl https://wit.wiimm.de/download/wit-v3.04a-r8427-x86_64.tar.gz > wit.tar.gz
elif [[ $arch == i*86 ]]; then
curl https://wit.wiimm.de/download/wit-v3.04a-r8427-i386.tar.gz > wit.tar.gz
else
echo "ERROR: Your system's architecture ($arch) does not support Wiimm's ISO Tools. Please refer to wit's website for more information on how to install the tools. https://wit.wiimm.de/"
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
curl https://wit.wiimm.de/download/wit-v3.04a-r8427-mac.tar.gz > wit.tar.gz
elif [[ "$OSTYPE" == "cygwin" ]]; then
break
else
echo "Riibalanced Patcher: Your operating system ($OSTYPE) does not support Wiimm's ISO Tools. Please refer to wit's website for more information on how to install the tools. https://wit.wiimm.de/"
exit 2;
fi
tar -xvf wit.tar.gz
cd wit-v*/
if [[ $(id -u) == 0 ]]; then
./install.sh
else
echo "You will now be prompted to enter your password for sudo in order for wit to install."
sudo ./install.sh
fi
cd ..
rm -rf wit-v*/
# check if wit is installed now
type wit
ERROR="$?"
echo
if [[ ERROR -ne 0 ]]; then
echo "ERROR: wit still does not seem to be installed. Please make sure that '/usr/local/bin' is on your PATH by running 'echo \$PATH'."
exit 4
fi
fi
# check for image ---------------------------------------------------------------
if [[ ! $1 ]]; then
echo "ERROR: Please start this script with the path to the Mario Kart Wii ISO image to start the patch."
echo "example: ./patch_iso.sh image/RMCE01.wbfs"
exit 7
fi
# check if image exists ---------------------------------------------------------
if [[ ! -f "$1" ]]; then
echo "ERROR: The file specified does not exist."
exit 8
fi
# check for previous image extraction -------------------------------------------
if [[ -d "./RMCE01/" ]]; then
echo "The output directory for the image extraction exists (./RMCE01) and will be DELETED to get a fresh extraction."
echo "Press [ENTER] to DELETE this directory and patch the image. Otherwise, press ^C now."
read
rm -rf ./RMCE01
fi
# start extract -----------------------------------------------------------------
wit extract $1 RMCE01
ERROR="$?"
if [[ ERROR -ne 0 ]]; then
echo "ERROR: wit has returned non-zero exit code $ERROR. Please check that your disc image is authentic and valid."
exit $ERROR
fi
# start patch -------------------------------------------------------------------
echo "Extraction seems to be complete. Patching..."
#set -x
cp V5/Riibalanced/Core/StaticRU.rel RMCE01/DATA/files/rel/StaticR.rel
cp V5/Riibalanced/Core/MainU.dol RMCE01/DATA/sys/main.dol
cp V5/Riibalanced/Tracks/* RMCE01/DATA/files/Race/Course/
cp V5/Riibalanced/Textures/* RMCE01/DATA/files/Race/Kart/
cp V5/Riibalanced/Menus/* RMCE01/DATA/files/Scene/UI/
#cp V5/Riibalanced/Menus/Award.szs RMCE01/DATA/files/Scene/UI/
#cp V5/Riibalanced/Menus/Event.szs RMCE01/DATA/files/Scene/UI/
#cp V5/Riibalanced/Menus/Font.szs RMCE01/DATA/files/Scene/UI/
#cp V5/Riibalanced/Menus/Globe.szs RMCE01/DATA/files/Scene/UI/
#cp V5/Riibalanced/Menus/Present.szs RMCE01/DATA/files/Scene/UI/
#cp V5/Riibalanced/Menus/Race.szs RMCE01/DATA/files/Scene/UI/
#cp V5/Riibalanced/Menus/Title.szs RMCE01/DATA/files/Scene/UI/
#cp V5/Riibalanced/Menus/MenuMulti.szs RMCE01/DATA/files/Scene/UI/
#cp V5/Riibalanced/Menus/MenuOther.szs RMCE01/DATA/files/Scene/UI/
#cp V5/Riibalanced/Menus/MenuSingle.szs RMCE01/DATA/files/Scene/UI/
#music folder skipped to copy manually
cp V5/Riibalanced/Ghosts/ghost1_* RMCE01/DATA/files/Race/TimeAttack/ghost1/
cp V5/Riibalanced/Ghosts/ghost2_* RMCE01/DATA/files/Race/TimeAttack/ghost2/
cp V5/Riibalanced/Music/RKart/revo_kart.brsar RMCE01/DATA/files/sound/revo_kart.brsar
cp V5/Riibalanced/Core/Common.szs RMCE01/DATA/files/Race/Common.szs
#skipping trailer thp since its identical
#there are no remaining thps in the menus folder
#using menusingle inside the menu folder for now since it doesnt exist in the languages folder
#cp V5/Riibalanced/Menus/MenuSingle.szs RMCE01/DATA/files/Scene/UI/
cp V5/Riibalanced/Languages/Title_E.szs RMCE01/DATA/files/Scene/UI/Title_E.szs
cp V5/Riibalanced/Languages/Title_E.szs RMCE01/DATA/files/Scene/UI/Title_I.szs
cp V5/Riibalanced/Languages/Title_E.szs RMCE01/DATA/files/Scene/UI/Title_F.szs
cp V5/Riibalanced/Languages/Title_E.szs RMCE01/DATA/files/Scene/UI/Title_G.szs
cp V5/Riibalanced/Languages/Title_E.szs RMCE01/DATA/files/Scene/UI/Title_S.szs
cp V5/Riibalanced/Languages/Title_E.szs RMCE01/DATA/files/Scene/UI/Title_J.szs
cp V5/Riibalanced/Languages/Title_E.szs RMCE01/DATA/files/Scene/UI/Title_K.szs
cp V5/Riibalanced/Languages/Title_E.szs RMCE01/DATA/files/Scene/UI/Title_U.szs
cp V5/Riibalanced/Languages/Title_E.szs RMCE01/DATA/files/Scene/UI/Title_M.szs
cp V5/Riibalanced/Languages/Title_E.szs RMCE01/DATA/files/Scene/UI/Title_Q.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/Race_E.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/Race_I.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/Race_F.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/Race_G.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/Race_S.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/Race_U.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/Race_M.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/Race_J.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/Race_K.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/Race_Q.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/Globe_E.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/Globe_I.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/Globe_F.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/Globe_G.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/Globe_S.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/Globe_U.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/Globe_M.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/Globe_J.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/Globe_K.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/Globe_Q.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/MenuMulti_E.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/MenuMulti_I.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/MenuMulti_F.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/MenuMulti_G.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/MenuMulti_S.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/MenuMulti_U.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/MenuMulti_M.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/MenuMulti_J.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/MenuMulti_K.szs
cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/MenuMulti_Q.szs
#cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/MenuSingle_E.szs
#cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/MenuSingle_I.szs
#cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/MenuSingle_F.szs
#cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/MenuSingle_G.szs
#cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/MenuSingle_S.szs
#cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/MenuSingle_U.szs
#cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/MenuSingle_M.szs
#cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/MenuSingle_J.szs
#cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/MenuSingle_K.szs
#cp V5/Riibalanced/Languages/Race_E.szs RMCE01/DATA/files/Scene/UI/MenuSingle_Q.szs
#Copy all the music here
cp V5/Riibalanced/Music/n_block_F.brstm RMCE01/DATA/files/sound/strm/
cp V5/Riibalanced/Music/n_block_n.brstm RMCE01/DATA/files/sound/strm/
cp V5/Riibalanced/Music/n_circuit32_f.brstm RMCE01/DATA/files/sound/strm/n_Circuit32_f.brstm
cp V5/Riibalanced/Music/n_circuit32_n.brstm RMCE01/DATA/files/sound/strm/n_Circuit32_n.brstm
cp V5/Riibalanced/Music/n_daisy32_f.brstm RMCE01/DATA/files/sound/strm/n_Daisy32_f.brstm
cp V5/Riibalanced/Music/n_daisy32_n.brstm RMCE01/DATA/files/sound/strm/n_Daisy32_n.brstm
cp V5/Riibalanced/Music/n_farm_f.brstm RMCE01/DATA/files/sound/strm/n_Farm_F.brstm
cp V5/Riibalanced/Music/n_farm_n.brstm RMCE01/DATA/files/sound/strm/n_Farm_n.brstm
cp V5/Riibalanced/Music/n_kinoko_f.brstm RMCE01/DATA/files/sound/strm/n_Kinoko_F.brstm
cp V5/Riibalanced/Music/n_kinoko_n.brstm RMCE01/DATA/files/sound/strm/n_Kinoko_n.brstm
cp V5/Riibalanced/Music/n_maple_f.brstm RMCE01/DATA/files/sound/strm/n_maple_F.brstm
cp V5/Riibalanced/Music/n_maple_n.brstm RMCE01/DATA/files/sound/strm/
cp V5/Riibalanced/Music/n_rainbow32_f.brstm RMCE01/DATA/files/sound/strm/n_Rainbow32_f.brstm
cp V5/Riibalanced/Music/n_rainbow32_n.brstm RMCE01/DATA/files/sound/strm/n_Rainbow32_n.brstm
cp V5/Riibalanced/Music/n_shopping32_f.brstm RMCE01/DATA/files/sound/strm/n_Shopping32_f.brstm
cp V5/Riibalanced/Music/n_shopping32_n.brstm RMCE01/DATA/files/sound/strm/n_Shopping32_n.brstm
cp V5/Riibalanced/Music/n_skate_F.brstm RMCE01/DATA/files/sound/strm/
cp V5/Riibalanced/Music/n_skate_n.brstm RMCE01/DATA/files/sound/strm/
cp V5/Riibalanced/Music/n_snowboard32_f.brstm RMCE01/DATA/files/sound/strm/n_Snowboard32_F.brstm
cp V5/Riibalanced/Music/n_snowboard32_n.brstm RMCE01/DATA/files/sound/strm/n_Snowboard32_n.brstm
cp V5/Riibalanced/Music/r_64_battle_F.brstm RMCE01/DATA/files/sound/strm/
cp V5/Riibalanced/Music/r_64_battle_n.brstm RMCE01/DATA/files/sound/strm/
cp V5/Riibalanced/Music/r_64_jungle32_f.brstm RMCE01/DATA/files/sound/strm/r_64_Jungle32_f.brstm
cp V5/Riibalanced/Music/r_64_kuppa32_f.brstm RMCE01/DATA/files/sound/strm/r_64_Kuppa32_f.brstm
cp V5/Riibalanced/Music/r_64_kuppa32_n.brstm RMCE01/DATA/files/sound/strm/r_64_Kuppa32_n.brstm
cp V5/Riibalanced/Music/r_64_sherbet32_f.brstm RMCE01/DATA/files/sound/strm/r_64_Sherbet32_f.brstm
cp V5/Riibalanced/Music/r_64_sherbet32_n.brstm RMCE01/DATA/files/sound/strm/r_64_Sherbet32_n.brstm
cp V5/Riibalanced/Music/r_agb_battle_F.brstm RMCE01/DATA/files/sound/strm/
cp V5/Riibalanced/Music/r_agb_battle_n.brstm RMCE01/DATA/files/sound/strm/
cp V5/Riibalanced/Music/r_agb_kuppa32_f.brstm RMCE01/DATA/files/sound/strm/r_AGB_Kuppa32_f.brstm
cp V5/Riibalanced/Music/r_agb_kuppa32_n.brstm RMCE01/DATA/files/sound/strm/r_AGB_Kuppa32_n.brstm
cp V5/Riibalanced/Music/r_DS_battle_F.brstm RMCE01/DATA/files/sound/strm/r_ds_battle_F.brstm
cp V5/Riibalanced/Music/r_DS_battle_n.brstm RMCE01/DATA/files/sound/strm/r_ds_battle_n.brstm
cp V5/Riibalanced/Music/r_ds_desert32_f.brstm RMCE01/DATA/files/sound/strm/r_DS_Desert32_f.brstm
cp V5/Riibalanced/Music/r_ds_desert32_n.brstm RMCE01/DATA/files/sound/strm/r_DS_Desert32_n.brstm
cp V5/Riibalanced/Music/r_ds_garden32_f.brstm RMCE01/DATA/files/sound/strm/r_DS_Garden32_f.brstm
cp V5/Riibalanced/Music/r_ds_garden32_n.brstm RMCE01/DATA/files/sound/strm/r_DS_Garden32_n.brstm
cp V5/Riibalanced/Music/r_ds_jungle32_f.brstm RMCE01/DATA/files/sound/strm/r_DS_Jungle32_f.brstm
cp V5/Riibalanced/Music/r_ds_jungle32_n.brstm RMCE01/DATA/files/sound/strm/r_DS_Jungle32_n.brstm
cp V5/Riibalanced/Music/r_ds_town32_f.brstm RMCE01/DATA/files/sound/strm/r_DS_Town32_f.brstm
cp V5/Riibalanced/Music/r_ds_town32_n.brstm RMCE01/DATA/files/sound/strm/r_DS_Town32_n.brstm
cp V5/Riibalanced/Music/r_GC_Battle32_F.brstm RMCE01/DATA/files/sound/strm/
cp V5/Riibalanced/Music/r_GC_Battle32_n.brstm RMCE01/DATA/files/sound/strm/
cp V5/Riibalanced/Music/r_gc_beach32_f.brstm RMCE01/DATA/files/sound/strm/r_GC_Beach32_f.brstm
cp V5/Riibalanced/Music/r_gc_beach32_n.brstm RMCE01/DATA/files/sound/strm/r_GC_Beach32_n.brstm
cp V5/Riibalanced/Music/r_gc_mountain32_f.brstm RMCE01/DATA/files/sound/strm/r_GC_Mountain32_f.brstm
cp V5/Riibalanced/Music/r_gc_mountain32_n.brstm RMCE01/DATA/files/sound/strm/r_GC_Mountain32_n.brstm
cp V5/Riibalanced/Music/r_gc_stadium32_f.brstm RMCE01/DATA/files/sound/strm/r_GC_Stadium32_f.brstm
cp V5/Riibalanced/Music/r_gc_stadium32_n.brstm RMCE01/DATA/files/sound/strm/r_GC_Stadium32_n.brstm
cp V5/Riibalanced/Music/r_sfc_battle_F.brstm RMCE01/DATA/files/sound/strm/
cp V5/Riibalanced/Music/r_sfc_battle_n.brstm RMCE01/DATA/files/sound/strm/
cp V5/Riibalanced/Music/r_sfc_circuit32_f.brstm RMCE01/DATA/files/sound/strm/r_SFC_Circuit32_f.brstm
cp V5/Riibalanced/Music/r_sfc_circuit32_n.brstm RMCE01/DATA/files/sound/strm/r_SFC_Circuit32_n.brstm
cp V5/Riibalanced/Music/r_sfc_obake32_f.brstm RMCE01/DATA/files/sound/strm/r_SFC_Obake32_f.brstm
cp V5/Riibalanced/Music/r_sfc_obake32_n.brstm RMCE01/DATA/files/sound/strm/r_SFC_Obake32_n.brstm
cp V5/Riibalanced/Music/STRM_N_FACTORY_N.brstm RMCE01/DATA/files/sound/strm/
#set +x
echo
echo "Patch complete. wit will now compile the resulting disc image."
# overwrite check ---------------------------------------------------------------
if [[ -f "./riibalanced.wbfs" ]]; then
echo "The file 'riibalanced.wbfs' exists in this directory."
printf "Would you like to overwrite this file? Answering 'n' will move the file to 'riibalanced.wbfs.old' before continuing. [y/n] "
while read -r key; do
case $key in
n) mv riibalanced.wbfs riibalanced.wbfs.old ; echo "Moved 'riibalanced.wbfs' to 'riibalanced.wbfs.old'"; break ;;
y) rm riibalanced.wbfs ; break ;;
esac
printf "\n"
printf "Would you like to overwrite this file? Answering 'n' will move the file to 'riibalanced.wbfs.old' before continuing. [y/n] "
done
fi
# build -------------------------------------------------------------------------
wit mix RMCE01/ -B --dest riibalanced.wbfs
wit edit riibalanced.wbfs --name MarioKartRiibalanced
rm -rf RMCE01/
echo "The patch is now complete. The resulting file is 'riibalanced.wbfs'. Enjoy!"
|