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" == "kr" goto NDEV_KR
29	if /I "%1" == "eu" goto NDEV_EU
30	if /I "%1" == "us" goto NDEV_US
31	if /I "%1" == "jp" goto NDEV_JP
32
33	for %%i in (%REVOLUTION_SDK_ROOT%\x86\bin\rvl*.bin) do %REVOLUTION_SDK_ROOT%\x86\bin\tickleBI3 -o %%i 0x0 5
34	if errorlevel 1 goto failed
35        if not exist %REVOLUTION_SDK_ROOT%\x86\bin\wbi.bin goto MSG_CN
36	%REVOLUTION_SDK_ROOT%\x86\bin\tickleWBI %REVOLUTION_SDK_ROOT%\X86\bin\wbi.bin -c 5
37	if errorlevel 1 goto failed
38:MSG_CN
39	echo Successfully done. Set the country code for the disc to China.
40	goto mesg
41
42:NDEV_KR
43	for %%i in (%REVOLUTION_SDK_ROOT%\x86\bin\rvl*.bin) do %REVOLUTION_SDK_ROOT%\x86\bin\tickleBI3 -o %%i 0x0 4
44	if errorlevel 1 goto failed
45        if not exist %REVOLUTION_SDK_ROOT%\x86\bin\wbi.bin goto MSG_KR
46	%REVOLUTION_SDK_ROOT%\x86\bin\tickleWBI %REVOLUTION_SDK_ROOT%\X86\bin\wbi.bin -c 4
47	if errorlevel 1 goto failed
48:MSG_KR
49	echo Successfully done. Set the country code for the disc to Korea.
50	goto mesg
51
52:NDEV_EU
53	for %%i in (%REVOLUTION_SDK_ROOT%\x86\bin\rvl*.bin) do %REVOLUTION_SDK_ROOT%\x86\bin\tickleBI3 -o %%i 0x0 2
54	if errorlevel 1 goto failed
55        if not exist %REVOLUTION_SDK_ROOT%\x86\bin\wbi.bin goto MSG_EU
56	%REVOLUTION_SDK_ROOT%\x86\bin\tickleWBI %REVOLUTION_SDK_ROOT%\X86\bin\wbi.bin -c 2
57	if errorlevel 1 goto failed
58:MSG_EU
59	echo Successfully done. Set the country code for the disc to Europe.
60	goto mesg
61
62:NDEV_US
63	for %%i in (%REVOLUTION_SDK_ROOT%\x86\bin\rvl*.bin) do %REVOLUTION_SDK_ROOT%\x86\bin\tickleBI3 -o %%i 0x0 1
64	if errorlevel 1 goto failed
65	if not exist %REVOLUTION_SDK_ROOT%\x86\bin\wbi.bin goto MSG_US
66	%REVOLUTION_SDK_ROOT%\x86\bin\tickleWBI %REVOLUTION_SDK_ROOT%\X86\bin\wbi.bin -c 1
67	if errorlevel 1 goto failed
68:MSG_US
69	echo Successfully done. Set the country code for the disc to US.
70	goto mesg
71
72:NDEV_JP
73	for %%i in (%REVOLUTION_SDK_ROOT%\x86\bin\rvl*.bin) do %REVOLUTION_SDK_ROOT%\x86\bin\tickleBI3 -o %%i 0x0 0
74	if errorlevel 1 goto failed
75	if not exist %REVOLUTION_SDK_ROOT%\x86\bin\wbi.bin goto MSG_JP
76	%REVOLUTION_SDK_ROOT%\x86\bin\tickleWBI %REVOLUTION_SDK_ROOT%\X86\bin\wbi.bin -c 0
77	if errorlevel 1 goto failed
78:MSG_JP
79	echo Successfully done. Set the country code for the disc to Japan.
80	goto mesg
81
82:failed
83	echo Failed to set the country code on disc.
84	goto end
85
86:mesg
87echo ******************************************************************************
88echo * If you make master data, you must execute loadrun/odrun before you do so!! *
89echo ******************************************************************************
90
91:end
92
93