Skip to content
This repository was archived by the owner on Jan 11, 2021. It is now read-only.

Commit d3026e0

Browse files
committed
3.0
1 parent fda3b50 commit d3026e0

12 files changed

+614
-607
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ CMakeLists.txt
44
build
55

66
ctrcommon.tar.bz2
7+
8+
*.cia

build-mode0.bat

+4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
copy template-cia-0.rsf template-cia.rsf
22
cd resources
33
copy AppInfo-0 AppInfo
4+
copy icon-0.png icon.png
45
cd ..
6+
7+
echo #define APP_MEMTYPE (0) > source\gen.h
8+
59
make clean
610

711
make

build-mode3.bat

+4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
copy template-cia-3.rsf template-cia.rsf
22
cd resources
33
copy AppInfo-3 AppInfo
4+
copy icon-3.png icon.png
45
cd ..
6+
7+
echo #define APP_MEMTYPE (3) > source\gen.h
8+
59
make clean
610

711
make

release/BootNTR-Mode3.cia

-539 KB
Binary file not shown.

release/BootNTR.cia

-540 KB
Binary file not shown.

resources/icon-0.png

3.26 KB
Loading

resources/icon-3.png

3.32 KB
Loading

source/firmware.c

+229
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
#include "main.h"
2+
3+
4+
extern NTR_CONFIG *ntrConfig;
5+
extern BOOTNTR_CONFIG *bnConfig;
6+
extern u8 *tmpBuffer;
7+
8+
Result bnInitParamsByFirmware(void)
9+
{
10+
u32 kernelVersion = osGetKernelVersion();
11+
bool isNew3DS = false;
12+
13+
APT_CheckNew3DS(&isNew3DS);
14+
ntrConfig->isNew3DS = isNew3DS ? 1 : 0;
15+
ntrConfig->PMPid = 2;
16+
ntrConfig->HomeMenuPid = 0xF;
17+
bnConfig->SMPid = 3;
18+
bnConfig->FSPid = 0;
19+
if (!isNew3DS)
20+
{
21+
ntrConfig->IoBasePad = 0xfffc6000;
22+
ntrConfig->IoBaseLcd = 0xfffc8000;
23+
ntrConfig->IoBasePdc = 0xfffc0000;
24+
ntrConfig->KMMUHaxAddr = 0xfffbe000;
25+
ntrConfig->KMMUHaxSize = 0x00010000;
26+
ntrConfig->KProcessHandleDataOffset = 0xD4;
27+
ntrConfig->KProcessPIDOffset = 0xB4;
28+
ntrConfig->KProcessCodesetOffset = 0xB0;
29+
if (kernelVersion == SYSTEM_VERSION(2, 44, 6))
30+
{
31+
//TODO: add old3ds 8.0.0 firmware support
32+
ntrConfig->firmVersion = SYSTEM_VERSION(8, 0, 0);
33+
bnConfig->SvcPatchAddr = 0xDFF82294;
34+
goto unsupported;
35+
}
36+
else if (kernelVersion == SYSTEM_VERSION(2, 46, 0))
37+
{
38+
// old3ds 9.0.0
39+
ntrConfig->firmVersion = SYSTEM_VERSION(9, 0, 0);
40+
ntrConfig->PMSvcRunAddr = 0x00102FC0;
41+
ntrConfig->ControlMemoryPatchAddr1 = 0xdff882cc;
42+
ntrConfig->ControlMemoryPatchAddr2 = 0xdff882d0;
43+
bnConfig->SvcPatchAddr = 0xDFF82290;
44+
bnConfig->FSPatchAddr = 0x0010ED64;
45+
bnConfig->SMPatchAddr = 0x00101838;
46+
}
47+
else if (kernelVersion == SYSTEM_VERSION(2, 50, 1))
48+
{
49+
// old3ds 9.6.0
50+
ntrConfig->firmVersion = SYSTEM_VERSION(9, 6, 0);
51+
ntrConfig->PMSvcRunAddr = 0x00103184;
52+
ntrConfig->ControlMemoryPatchAddr1 = 0xdff882D8;
53+
ntrConfig->ControlMemoryPatchAddr2 = 0xdff882DC;
54+
bnConfig->SvcPatchAddr = 0xDFF82284;
55+
bnConfig->FSPatchAddr = 0x0010EFAC;
56+
bnConfig->SMPatchAddr = 0x0010189C;
57+
}
58+
else if (kernelVersion == SYSTEM_VERSION(2, 51, 0))
59+
{
60+
// old3ds 11.0.0
61+
ntrConfig->firmVersion = SYSTEM_VERSION(11, 0, 0);
62+
ntrConfig->PMSvcRunAddr = 0x00103154;
63+
ntrConfig->ControlMemoryPatchAddr1 = 0xDFF88468;
64+
ntrConfig->ControlMemoryPatchAddr2 = 0xDFF8846C;
65+
bnConfig->SvcPatchAddr = 0xDFF82288;
66+
bnConfig->FSPatchAddr = 0x0010EED4;
67+
bnConfig->SMPatchAddr = 0x0010189C;
68+
}
69+
else if (kernelVersion == SYSTEM_VERSION(2, 51, 2))
70+
{
71+
// old3ds 11.1.0
72+
ntrConfig->firmVersion = SYSTEM_VERSION(11, 1, 0);
73+
ntrConfig->PMSvcRunAddr = 0x00103154;
74+
ntrConfig->ControlMemoryPatchAddr1 = 0xDFF88468;
75+
ntrConfig->ControlMemoryPatchAddr2 = 0xDFF8846C;
76+
bnConfig->SvcPatchAddr = 0xDFF82288;
77+
bnConfig->FSPatchAddr = 0x0010F024;
78+
bnConfig->SMPatchAddr = 0x0010189C;
79+
}
80+
else if (kernelVersion == SYSTEM_VERSION(2, 52, 0))
81+
{
82+
// old3ds 11.2.0
83+
ntrConfig->firmVersion = SYSTEM_VERSION(11, 2, 0);
84+
ntrConfig->PMSvcRunAddr = 0x00103154;
85+
ntrConfig->ControlMemoryPatchAddr1 = 0xDFF88468;
86+
ntrConfig->ControlMemoryPatchAddr2 = 0xDFF8846C;
87+
bnConfig->SvcPatchAddr = 0xDFF82288;
88+
bnConfig->FSPatchAddr = 0x0010F024;
89+
bnConfig->SMPatchAddr = 0x0010189C;
90+
}
91+
else if (kernelVersion == SYSTEM_VERSION(2, 53, 0))
92+
{
93+
// old3ds 11.3.0
94+
ntrConfig->firmVersion = SYSTEM_VERSION(11, 3, 0);
95+
ntrConfig->PMSvcRunAddr = 0x00103154;
96+
ntrConfig->ControlMemoryPatchAddr1 = 0xDFF884E4;
97+
ntrConfig->ControlMemoryPatchAddr2 = 0xDFF884E8;
98+
bnConfig->SvcPatchAddr = 0xDFF82288;
99+
bnConfig->FSPatchAddr = 0x0010F024;
100+
bnConfig->SMPatchAddr = 0x0010189C;
101+
}
102+
else
103+
goto unsupported;
104+
}
105+
else
106+
{
107+
ntrConfig->IoBasePad = 0xfffc2000;
108+
ntrConfig->IoBaseLcd = 0xfffc4000;
109+
ntrConfig->IoBasePdc = 0xfffbc000;
110+
ntrConfig->KMMUHaxAddr = 0xfffba000;
111+
ntrConfig->KMMUHaxSize = 0x00010000;
112+
ntrConfig->KProcessHandleDataOffset = 0xdc;
113+
ntrConfig->KProcessPIDOffset = 0xBC;
114+
ntrConfig->KProcessCodesetOffset = 0xB8;
115+
if (kernelVersion == SYSTEM_VERSION(2, 45, 5))
116+
{
117+
// new3ds 8.1
118+
ntrConfig->firmVersion = SYSTEM_VERSION(8, 1, 0);
119+
ntrConfig->PMSvcRunAddr = 0x0010308C;
120+
ntrConfig->ControlMemoryPatchAddr1 = 0xdff88158;
121+
ntrConfig->ControlMemoryPatchAddr2 = 0xdff8815C;
122+
bnConfig->SvcPatchAddr = 0xDFF82264;
123+
bnConfig->FSPatchAddr = 0x0010ED64;
124+
bnConfig->SMPatchAddr = 0x00101838;
125+
}
126+
else if (kernelVersion == SYSTEM_VERSION(2, 46, 0))
127+
{
128+
// new3ds 9.0
129+
ntrConfig->firmVersion = SYSTEM_VERSION(9, 0, 0);
130+
ntrConfig->PMSvcRunAddr = 0x00102FEC;
131+
ntrConfig->ControlMemoryPatchAddr1 = 0xdff884ec;
132+
ntrConfig->ControlMemoryPatchAddr2 = 0xdff884f0;
133+
bnConfig->SvcPatchAddr = 0xDFF82260;
134+
bnConfig->FSPatchAddr = 0x0010ED64;
135+
bnConfig->SMPatchAddr = 0x00101838;
136+
}
137+
else if (kernelVersion == SYSTEM_VERSION(2, 49, 0))
138+
{
139+
// new3ds 9.5
140+
ntrConfig->firmVersion = SYSTEM_VERSION(9, 5, 0);
141+
ntrConfig->PMSvcRunAddr = 0x001030F8;
142+
ntrConfig->ControlMemoryPatchAddr1 = 0xdff884F8;
143+
ntrConfig->ControlMemoryPatchAddr2 = 0xdff884FC;
144+
bnConfig->SvcPatchAddr = 0xDFF8226c;
145+
bnConfig->FSPatchAddr = 0x0010ED64;
146+
bnConfig->SMPatchAddr = 0x00101838;
147+
}
148+
else if (kernelVersion == SYSTEM_VERSION(2, 50, 1))
149+
{
150+
//new3ds 9.6
151+
ntrConfig->firmVersion = SYSTEM_VERSION(9, 6, 0);
152+
ntrConfig->PMSvcRunAddr = 0x001030D8;
153+
ntrConfig->ControlMemoryPatchAddr1 = 0xdff8850C;
154+
ntrConfig->ControlMemoryPatchAddr2 = 0xdff88510;
155+
bnConfig->SvcPatchAddr = 0xDFF82268;
156+
bnConfig->FSPatchAddr = 0x0010EFAC;
157+
bnConfig->SMPatchAddr = 0x0010189C;
158+
}
159+
else if (kernelVersion == SYSTEM_VERSION(2, 50, 7))
160+
{
161+
// new3ds 10.0
162+
//TODO: add new3ds 10.0 firmware support
163+
ntrConfig->firmVersion = SYSTEM_VERSION(10, 0, 0);
164+
goto unsupported;
165+
}
166+
else if (kernelVersion == SYSTEM_VERSION(2, 50, 9))
167+
{
168+
// new3ds 10.2
169+
ntrConfig->firmVersion = SYSTEM_VERSION(10, 2, 0);
170+
ntrConfig->PMSvcRunAddr = 0x001031E4;
171+
ntrConfig->ControlMemoryPatchAddr1 = 0xdff884E4;
172+
ntrConfig->ControlMemoryPatchAddr2 = 0xdff884E8;
173+
bnConfig->SvcPatchAddr = 0xDFF82270;
174+
bnConfig->FSPatchAddr = 0x0010EED4;
175+
bnConfig->SMPatchAddr = 0x0010189C;
176+
}
177+
else if (kernelVersion == SYSTEM_VERSION(2, 51, 0))
178+
{
179+
// new3ds 11.0
180+
ntrConfig->firmVersion = SYSTEM_VERSION(11, 0, 0);
181+
ntrConfig->PMSvcRunAddr = 0x00103150;
182+
ntrConfig->ControlMemoryPatchAddr1 = 0xDFF88598;
183+
ntrConfig->ControlMemoryPatchAddr2 = 0xDFF8859C;
184+
bnConfig->SvcPatchAddr = 0xDFF8226C;
185+
bnConfig->FSPatchAddr = 0x0010EED4;
186+
bnConfig->SMPatchAddr = 0x0010189C;
187+
}
188+
else if (kernelVersion == SYSTEM_VERSION(2, 51, 2))
189+
{
190+
// new3ds 11.1
191+
ntrConfig->firmVersion = SYSTEM_VERSION(11, 1, 0);
192+
ntrConfig->PMSvcRunAddr = 0x00103150;
193+
ntrConfig->ControlMemoryPatchAddr1 = 0xDFF88598;
194+
ntrConfig->ControlMemoryPatchAddr2 = 0xDFF8859C;
195+
bnConfig->SvcPatchAddr = 0xDFF8226C;
196+
bnConfig->FSPatchAddr = 0x0010F024;
197+
bnConfig->SMPatchAddr = 0x0010189C;
198+
}
199+
else if (kernelVersion == SYSTEM_VERSION(2, 52, 0))
200+
{
201+
// new3ds 11.2
202+
ntrConfig->firmVersion = SYSTEM_VERSION(11, 2, 0);
203+
ntrConfig->PMSvcRunAddr = 0x00103150;
204+
ntrConfig->ControlMemoryPatchAddr1 = 0xDFF88598;
205+
ntrConfig->ControlMemoryPatchAddr2 = 0xDFF8859C;
206+
bnConfig->SvcPatchAddr = 0xDFF8226C;
207+
bnConfig->FSPatchAddr = 0x0010F024;
208+
bnConfig->SMPatchAddr = 0x0010189C;
209+
}
210+
else if (kernelVersion == SYSTEM_VERSION(2, 53, 0))
211+
{
212+
// new3ds 11.3
213+
ntrConfig->firmVersion = SYSTEM_VERSION(11, 3, 0);
214+
ntrConfig->PMSvcRunAddr = 0x00103150;
215+
ntrConfig->ControlMemoryPatchAddr1 = 0xDFF885FC;
216+
ntrConfig->ControlMemoryPatchAddr2 = 0xDFF88600;
217+
bnConfig->SvcPatchAddr = 0xDFF8226C;
218+
bnConfig->FSPatchAddr = 0x0010F024;
219+
bnConfig->SMPatchAddr = 0x0010189C;
220+
}
221+
else
222+
goto unsupported;
223+
}
224+
bnConfig->requireKernelHax = 0;
225+
return (0);
226+
unsupported:
227+
ntrConfig->firmVersion = 0;
228+
return (RESULT_ERROR);
229+
}

source/gen.h

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#define APP_MEMTYPE (0)

0 commit comments

Comments
 (0)