@echo off
if "%~dpnx1"=="" goto error1
echo _____________________________________________________________________
echo Uncompressing 00000001...
set wwpacker_cxflag=0
"%~dp0wwcxtool" /u 00000001.app 00000001.dol
if errorlevel 1 (
echo 00000001 has no compression.
copy /Y /b 00000001.app 00000001.dol
) else (
if %wwpacker_plus% NEQ 3 set wwpacker_cxflag=1
)
if not exist "00000001_org.app" ren 00000001.app 00000001_org.app
echo _____________________________________________________________________
echo Patching language / video type of 00000001 with WiiGF...
echo.
echo ****************************************
echo ** Press 'X' to bypass the step below **
echo ****************************************
echo.
"%~dp0WiiGF" /n /e /l 00000001.dol
if errorlevel 0 set wwpacker_label=%wwpacker_label%[Lang]
echo _____________________________________________________________________
echo Patching region(country) string of 00000001 with WiiGF...
echo.
echo ****************************************
echo ** Press 'X' to bypass the step below **
echo ****************************************
echo.
"%~dp0WiiGF" /n /e /s 00000001.dol
if errorlevel 0 set wwpacker_label=%wwpacker_label%[RString]
echo _____________________________________________________________________
echo Patching video mode of 00000001 with WiiGF...
echo.
echo ****************************************
echo ** Press 'X' to bypass the step below **
echo ****************************************
echo.
"%~dp0WiiGF" /n /e /v 00000001.dol
if errorlevel 0 set wwpacker_label=%wwpacker_label%[Video]
echo _____________________________________________________________________
echo Patching 001 check of 00000001 with WiiGF...
echo.
echo ****************************************
echo ** Press 'X' to bypass the step below **
echo ****************************************
echo.
"%~dp0WiiGF" /n /e /1 00000001.dol
if errorlevel 0 set wwpacker_label=%wwpacker_label%[001Fix]
echo _____________________________________________________________________
echo Patching 002 check of 00000001 with WiiGF...
echo.
echo ****************************************
echo ** Press 'X' to bypass the step below **
echo ****************************************
echo.
"%~dp0WiiGF" /n /e /2 00000001.dol
if errorlevel 0 set wwpacker_label=%wwpacker_label%[002Fix]
echo _____________________________________________________________________
echo Patching JAP WiiFit save conflict of 00000001 with WiiGF...
echo.
echo ****************************************
echo ** Press 'X' to bypass the step below **
echo ****************************************
echo.
"%~dp0WiiGF" /n /e /b 00000001.dol
if errorlevel 0 set wwpacker_label=%wwpacker_label%[BBFix]
echo _____________________________________________________________________
echo Patching with other programs, e.g. 'Generic Wii Patcher'...
echo.
echo *********************  OPTIONAL  ************************
echo ** Now launch other program(s) to patch the below file
echo ** %~dpnx1\00000001.dol
echo **
echo ** Press any key in this window when the patching ends
echo ** or if you want to bypass this step.
echo *********************************************************
echo.
pause
echo _____________________________________________________________________
if %wwpacker_cxflag% EQU 1 (
echo Compressing 00000001...
"%~dp0wwcxtool" /cr 00000001_org.app 00000001.dol 00000001.app
	if errorlevel 1 (
	echo Restoring original file...
	copy /Y /b 00000001_org.app 00000001.app
	echo ********************
	echo Error occur!! Press 'CTRL-C' to break the batch process or
	pause
	)
) else (
if %wwpacker_plus% NEQ 3 echo No compression is needed for 00000001.
move /Y 00000001.dol 00000001.app
)
set wwpacker_cxflag=
goto end

:error1
echo Error! Not enough parameters.
echo You should use the _wwpacker scripts instead of this one.
echo.
pause
goto end

:end
echo.
