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
7if /I "%1" == "kr" goto ok
8if /I "%1" == "cn" goto ok
9
10echo Illegal argument. Do nothing and exit.
11goto end
12
13:help
14	echo usage: setcountrycode [jp-us-eu-kr-cn]
15	echo  Sets the country code on disc.
16	goto end
17
18:ok
19
20if "%NDEV%" NEQ "" goto NDEV
21
22echo NDEV is not found. Do nothing and exit.
23goto end
24
25:NDEV
26	echo NDEV detected
27
28	if /I "%1" == "cn" goto NDEV_CN
29	if /I "%1" == "kr" goto NDEV_KR
30	if /I "%1" == "eu" goto NDEV_EU
31	if /I "%1" == "us" goto NDEV_US
32	if /I "%1" == "jp" goto NDEV_JP
33
34:NDEV_CN
35	for %%i in (%REVOLUTION_SDK_ROOT%\x86\bin\rvl*.bin) do %REVOLUTION_SDK_ROOT%\x86\bin\tickleBI3 -o %%i 0x0 5
36	if errorlevel 1 goto failed
37        if not exist %REVOLUTION_SDK_ROOT%\x86\bin\wbi.bin goto MSG_CN
38	%REVOLUTION_SDK_ROOT%\x86\bin\tickleWBI %REVOLUTION_SDK_ROOT%\X86\bin\wbi.bin -c 5
39	if errorlevel 1 goto failed
40:MSG_CN
41	echo Successfully done. Set the country code for the disc to China.
42	goto mesg
43
44:NDEV_KR
45	for %%i in (%REVOLUTION_SDK_ROOT%\x86\bin\rvl*.bin) do %REVOLUTION_SDK_ROOT%\x86\bin\tickleBI3 -o %%i 0x0 4
46	if errorlevel 1 goto failed
47        if not exist %REVOLUTION_SDK_ROOT%\x86\bin\wbi.bin goto MSG_KR
48	%REVOLUTION_SDK_ROOT%\x86\bin\tickleWBI %REVOLUTION_SDK_ROOT%\X86\bin\wbi.bin -c 4
49	if errorlevel 1 goto failed
50:MSG_KR
51	echo Successfully done. Set the country code for the disc to Korea.
52	goto mesg
53
54:NDEV_EU
55	for %%i in (%REVOLUTION_SDK_ROOT%\x86\bin\rvl*.bin) do %REVOLUTION_SDK_ROOT%\x86\bin\tickleBI3 -o %%i 0x0 2
56	if errorlevel 1 goto failed
57        if not exist %REVOLUTION_SDK_ROOT%\x86\bin\wbi.bin goto MSG_EU
58	%REVOLUTION_SDK_ROOT%\x86\bin\tickleWBI %REVOLUTION_SDK_ROOT%\X86\bin\wbi.bin -c 2
59	if errorlevel 1 goto failed
60:MSG_EU
61	echo Successfully done. Set the country code for the disc to Europe.
62	goto mesg
63
64:NDEV_US
65	for %%i in (%REVOLUTION_SDK_ROOT%\x86\bin\rvl*.bin) do %REVOLUTION_SDK_ROOT%\x86\bin\tickleBI3 -o %%i 0x0 1
66	if errorlevel 1 goto failed
67	if not exist %REVOLUTION_SDK_ROOT%\x86\bin\wbi.bin goto MSG_US
68	%REVOLUTION_SDK_ROOT%\x86\bin\tickleWBI %REVOLUTION_SDK_ROOT%\X86\bin\wbi.bin -c 1
69	if errorlevel 1 goto failed
70:MSG_US
71	echo Successfully done. Set the country code for the disc to US.
72	goto mesg
73
74:NDEV_JP
75	for %%i in (%REVOLUTION_SDK_ROOT%\x86\bin\rvl*.bin) do %REVOLUTION_SDK_ROOT%\x86\bin\tickleBI3 -o %%i 0x0 0
76	if errorlevel 1 goto failed
77	if not exist %REVOLUTION_SDK_ROOT%\x86\bin\wbi.bin goto MSG_JP
78	%REVOLUTION_SDK_ROOT%\x86\bin\tickleWBI %REVOLUTION_SDK_ROOT%\X86\bin\wbi.bin -c 0
79	if errorlevel 1 goto failed
80:MSG_JP
81	echo Successfully done. Set the country code for the disc to Japan.
82	goto mesg
83
84:failed
85	echo Failed to set the country code on disc.
86	goto end
87
88:mesg
89echo ******************************************************************************
90echo * If you make master data, you must execute loadrun/odrun before you do so!! *
91echo ******************************************************************************
92
93:end
94
95