-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDrag A Vanilla Mario Kart Wii ISO On Me.bat
358 lines (290 loc) · 8.07 KB
/
Drag A Vanilla Mario Kart Wii ISO On Me.bat
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
@echo off
REM Check if a file was dropped onto the script
echo Running Update.bat...
call "%~dp0%Update.bat" || (
echo Error occurred Updating.
pause
goto :EOF
)
echo Update.bat has finished.
echo Continuing with script1.bat...
if "%~1"=="" (
echo Please drag and drop an ISO file onto this script.
pause
exit /b
)
REM Define the path to WIT Tools and the destination folder
set WIT_PATH="%~dp0Prereqs\wit\wit.exe"
set TRT_PATH="%~dp0Prereqs\szs\wstrt.exe"
set DEST_FOLDER=%~dp0%~n1_extracted
set OUT_FOLDER=%~dp0%out
set BINARY_FOLDER=%~dp0~n1_extracted\DATA\files\Binaries
REM Check if the destination folder exists
if exist "%DEST_FOLDER%" (
echo Folder "%DEST_FOLDER%" already exists.
echo Overwriting existing folder...
rmdir /s /q "%DEST_FOLDER%" || (
echo Error occurred while trying to delete the existing folder.
pause
goto :EOF
)
)
REM Extract the ISO and handle errors
%WIT_PATH% extract "%~1" --dest "%DEST_FOLDER%" || (
echo Error occurred during extraction.
pause
goto :EOF
)
REM Notify the user that extraction is complete
echo Extraction complete! Files are located in "%DEST_FOLDER%"
:TEST
if exist "%DEST_FOLDER%\DATA" (
rmdir /s /q "%DEST_FOLDER%\CHANNEL" || (
echo Error occurred while trying to delete the existing folder.
pause
goto :EOF
)
for /f "delims=" %%D in ('dir "%DEST_FOLDER%\DATA"\.svn /ad /b /s 2^>nul') do (
echo Found: %%D
rd /s /q "%%D" && echo Deleted: %%D || echo Failed to delete: %%D
)
XCOPY /y /s "%DEST_FOLDER%\DATA" "%DEST_FOLDER%" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y /s /t /e "%DEST_FOLDER%\DATA" "%DEST_FOLDER%" || (
echo Error occurred copying files.
pause
goto :EOF
)
rmdir /s /q "%DEST_FOLDER%\DATA" || (
echo Error occurred while trying to delete the existing folder.
pause
goto :EOF
)
REM Patch main.dol (assuming main.dol exists in the extracted folder)
%WIT_PATH% dolpatch "%DEST_FOLDER%\sys\main.dol" xml="%~dp0Prereqs\Patches.xml" --source "%~dp0Patches\Binaries"
REM Notify the user that main.dol has been patched
echo main.dol patched!
REM Copy Files
if exist "%BINARY_FOLDER%" (
echo Binary folder already exists!
) else (
mkdir "%DEST_FOLDER%\files\Binaries" || (
echo Error occurred making the Binary Directory.
pause
goto :EOF
)
)
XCOPY /y "%~dp0Patches\Binaries" "%DEST_FOLDER%\files\Binaries" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\rel\E\StaticR.rel" "%DEST_FOLDER%\files\rel\StaticR.rel" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\Tracks" "%DEST_FOLDER%\files\Race\Course" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\Assets" "%DEST_FOLDER%\files" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\strm" "%DEST_FOLDER%\files\sound\strm" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\UI" "%DEST_FOLDER%\files\Scene\UI" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\Minus\Race" "%DEST_FOLDER%\files\Race" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\Minus\sound" "%DEST_FOLDER%\files\sound" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\Custom Music" "%DEST_FOLDER%\files\sound\strm" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\Character Mods\Race Kart" "%DEST_FOLDER%\files\Race\Kart" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\Character Mods\Scene Kart" "%DEST_FOLDER%\files\Scene\Model\Kart" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\Character Mods\Model" "%DEST_FOLDER%\files\Scene\Model" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\Demo" "%DEST_FOLDER%\files\Demo" || (
echo Error occurred copying files.
pause
goto :EOF
)
%TRT_PATH% patch "%DEST_FOLDER%\sys\main.dol" --add-section "%~dp0Patches\codes\RMCE01.gct"
echo main.dol patched with cheat codes!
if exist "%OUT_FOLDER%" (
echo out folder already exists!
) else (
mkdir "%~dp0out" || (
echo Error occurred making the Binary Directory.
pause
goto :EOF
goto :EOF
)
)
if exist "%OUT_FOLDER%\MKMinus.iso" (
echo iso already exists!
del "%OUT_FOLDER%\MKMinus.iso" || (
echo Error occurred while trying to delete the existing folder.
pause
goto :EOF
)
)
REM Rebuild ISO
%WIT_PATH% copy "%DEST_FOLDER%" --dest "%~dp0out\MKMinus.iso"
REM Remove Extracted Files
rmdir /s /q "%DEST_FOLDER%" || (
echo Error occurred while trying to delete the existing folder.
pause
goto :EOF
)
echo Patching Complete! You May Now Close This Window!
pause
) else (
for /f "delims=" %%D in ('dir "%DEST_FOLDER%"\.svn /ad /b /s 2^>nul') do (
echo Found: %%D
rd /s /q "%%D" && echo Deleted: %%D || echo Failed to delete: %%D
)
REM Patch main.dol (assuming main.dol exists in the extracted folder)
%WIT_PATH% dolpatch "%DEST_FOLDER%\sys\main.dol" xml="%~dp0Prereqs\Patches.xml" --source "%~dp0Patches\Binaries"
REM Notify the user that main.dol has been patched
echo main.dol patched!
REM Copy Files
if exist "%BINARY_FOLDER%" (
echo Binary folder already exists!
) else (
mkdir "%DEST_FOLDER%\files\Binaries" || (
echo Error occurred making the Binary Directory.
pause
goto :EOF
)
)
XCOPY /y "%~dp0Patches\Binaries" "%DEST_FOLDER%\files\Binaries" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\rel\E\StaticR.rel" "%DEST_FOLDER%\files\rel\StaticR.rel" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\Tracks" "%DEST_FOLDER%\files\Race\Course" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\Assets" "%DEST_FOLDER%\files" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\strm" "%DEST_FOLDER%\files\sound\strm" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\UI" "%DEST_FOLDER%\files\Scene\UI" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\Minus\Race" "%DEST_FOLDER%\files\Race" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\Minus\sound" "%DEST_FOLDER%\files\sound" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\Custom Music" "%DEST_FOLDER%\files\sound\strm" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\Character Mods\Race Kart" "%DEST_FOLDER%\files\Race\Kart" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\Character Mods\Scene Kart" "%DEST_FOLDER%\files\Scene\Model\Kart" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\Character Mods\Model" "%DEST_FOLDER%\files\Scene\Model" || (
echo Error occurred copying files.
pause
goto :EOF
)
XCOPY /y "%~dp0Patches\Demo" "%DEST_FOLDER%\files\Demo" || (
echo Error occurred copying files.
pause
goto :EOF
)
%TRT_PATH% patch "%DEST_FOLDER%\sys\main.dol" --add-section "%~dp0Patches\codes\RMCE01.gct"
echo main.dol patched with cheat codes!
if exist "%OUT_FOLDER%" (
echo out folder already exists!
) else (
mkdir "%~dp0out" || (
echo Error occurred making the Binary Directory.
pause
goto :EOF
goto :EOF
)
)
if exist "%OUT_FOLDER%\MKMinus.iso" (
echo iso already exists!
del "%OUT_FOLDER%\MKMinus.iso" || (
echo Error occurred while trying to delete the existing folder.
pause
goto :EOF
)
)
REM Rebuild ISO
%WIT_PATH% copy "%DEST_FOLDER%" --dest "%~dp0out\MKMinus.iso"
REM Remove Extracted Files
rmdir /s /q "%DEST_FOLDER%" || (
echo Error occurred while trying to delete the existing folder.
pause
goto :EOF
)
echo Patching Complete! You May Now Close This Window!
pause
)
:EOF