1@echo off
2
3if "%1" == "" goto help
4if /I "%1" == "us" goto ok
5if /I "%1" == "jp" goto ok
6if /I "%1" == "eu" goto ok
7
8echo Illegal argument. Do nothing and exit.
9goto end
10
11:help
12	echo usage: setcountrycode [jp-us-eu]
13	echo  Sets the country code on disc.
14	goto end
15
16:ok
17
18if "%NDEV%" NEQ "" goto NDEV
19
20echo NDEV is not found. Do nothing and exit.
21goto end
22
23:NDEV
24	echo NDEV detected
25
26	if /I "%1" == "us" goto NDEV_US
27	if /I "%1" == "jp" goto NDEV_JP
28
29	for %%i in (%REVOLUTION_SDK_ROOT%\x86\bin\rvl*.bin) do %REVOLUTION_SDK_ROOT%\x86\bin\tickleBI3 -o %%i 0x0 2
30	if errorlevel 1 goto failed
31        if not exist %REVOLUTION_SDK_ROOT%\x86\bin\wbi.bin goto MSG_EU
32	%REVOLUTION_SDK_ROOT%\x86\bin\tickleWBI %REVOLUTION_SDK_ROOT%\X86\bin\wbi.bin -c 2
33	if errorlevel 1 goto failed
34:MSG_EU
35	echo Successfully done. Set the country code for the disc to Europe.
36	goto mesg
37
38:NDEV_US
39	for %%i in (%REVOLUTION_SDK_ROOT%\x86\bin\rvl*.bin) do %REVOLUTION_SDK_ROOT%\x86\bin\tickleBI3 -o %%i 0x0 1
40	if errorlevel 1 goto failed
41	if not exist %REVOLUTION_SDK_ROOT%\x86\bin\wbi.bin goto MSG_US
42	%REVOLUTION_SDK_ROOT%\x86\bin\tickleWBI %REVOLUTION_SDK_ROOT%\X86\bin\wbi.bin -c 1
43	if errorlevel 1 goto failed
44:MSG_US
45	echo Successfully done. Set the country code for the disc to US.
46	goto mesg
47
48:NDEV_JP
49	for %%i in (%REVOLUTION_SDK_ROOT%\x86\bin\rvl*.bin) do %REVOLUTION_SDK_ROOT%\x86\bin\tickleBI3 -o %%i 0x0 0
50	if errorlevel 1 goto failed
51	if not exist %REVOLUTION_SDK_ROOT%\x86\bin\wbi.bin goto MSG_JP
52	%REVOLUTION_SDK_ROOT%\x86\bin\tickleWBI %REVOLUTION_SDK_ROOT%\X86\bin\wbi.bin -c 0
53	if errorlevel 1 goto failed
54:MSG_JP
55	echo Successfully done. Set the country code for the disc to Japan.
56	goto mesg
57
58:failed
59	echo Failed to set the country code on disc.
60	goto end
61
62:mesg
63echo ******************************************************************************
64echo * If you make master data, you must execute loadrun/odrun before you do so!! *
65echo ******************************************************************************
66
67:end
68
69