@echo off
title Insane Kart Wii ISO Patcher for v2
:start
IF EXIST *.iso (
SET FORMAT=iso
goto run
)
IF EXIST *.wbfs (
SET FORMAT=wbfs
goto run
)
echo Be sure there is a copy of Mario Kart Wii in this scripts directory.
pause
test&cls
goto start
:run
IF EXIST IKWInstallation\IKWv2\mainP.dol (
goto copyfiles
)
echo Insane Kart Wii installation not found. Please download the Riivolution version from
echo "https://wiki.tockdom.com/wiki/Insane_Kart_Wii" and extract it to ".\IKWInstallation"
pause
test&cls
goto start
:copyfiles
wit\wit.exe extract -s *.%FORMAT% -1 -n RMC.01 . tmp --psel=DATA -ovv
IF EXIST tmp\files\Boot\Strap\eu\English.szs (
xcopy IKWInstallation\IKWv2\strap\eu\ tmp\files\Boot\strap\eu\ /y
copy IKWInstallation\IKWv2\mainP.dol tmp\sys\main.dol
)
IF EXIST tmp\files\Boot\Strap\us\English.szs (
xcopy IKWInstallation\IKWv2\strap\us\ tmp\files\Boot\strap\us\ /y
copy IKWInstallation\IKWv2\mainE.dol tmp\sys\main.dol
)
IF EXIST tmp\files\Boot\Strap\jp\jp.szs (
xcopy IKWInstallation\IKWv2\strap\jp\ tmp\files\Boot\strap\jp\ /y
copy IKWInstallation\IKWv2\mainJ.dol tmp\sys\main.dol
)
IF EXIST tmp\files\Boot\Strap\kr\Korean.szs (
xcopy IKWInstallation\IKWv2\strap\kr\ tmp\files\Boot\strap\kr\ /y
copy IKWInstallation\IKWv2\mainK.dol tmp\sys\main.dol
)

xcopy IKWInstallation\IKWv2\Tracks\ tmp\files\Race\Course\ /y
xcopy IKWInstallation\IKWv2\CTBRSTM\ tmp\files\sound\strm\ /y
mkdir tmp\files\Binaries
copy IKWInstallation\IKWv2\Binaries\Config.pul tmp\files\Binaries\Config.pul
copy IKWInstallation\IKWv2\Binaries\Code.pul tmp\files\Binaries\Code.pul
xcopy IKWInstallation\IKWv2\Assets\ tmp\files\ /y
xcopy IKWInstallation\IKWv2\MiiOutfitC\Kart\ tmp\files\Race\Kart\ /y
xcopy IKWInstallation\IKWv2\MiiOutfitC\Model\ tmp\files\Scene\Model\ /y
xcopy IKWInstallation\IKWv2\MiiOutfitC\Model\Kart tmp\files\Scene\Model\Kart\ /y
xcopy IKWInstallation\IKWv2\Ghosts\Experts\ tmp\files\Experts\ /y
mkdir tmp\files\bin
xcopy IKWInstallation\IKWv2\maincode\ tmp\files\bin\ /y
xcopy IKWInstallation\IKWv2\MissionMode\ tmp\files\Race\MissionRun\ /y
xcopy IKWInstallation\IKWv2\rel\ tmp\files\rel /y
xcopy IKWInstallation\IKWv2\Themes tmp\files\Scene\UI\ /y
mkdir tmp\files\Race\Battle
xcopy IKWInstallation\IKWv2\Battle tmp\files\Race\Battle /y
del tmp\files\thp\*.* /q /s
:split_image
test&cls
echo Please note that settings and ghosts will not save when played on console via an USB Loader.
echo This ISO Patcher is not intended to support piracy.
set /p split="Do you want to split the WBFS (Y/N)? >"
if %split%==Y goto splitting_yes
if %split%==N goto splitting_no
echo Invalid answer. Try again
pause
goto split_image
:splitting_yes
wit\wit.exe copy tmp "PatchedWBFS\Insane Kart Wii.wbfs" -ovv --id=....69 --name="Insane Kart Wii" --split
goto end
:splitting_no
wit\wit.exe copy tmp "PatchedWBFS\Insane Kart Wii.wbfs" -ovv --id=....69 --name="Insane Kart Wii"
goto end
:end
pause