Skip to content

Commit

Permalink
Merge pull request #10 from Pablomf6/master
Browse files Browse the repository at this point in the history
Add 11.8 support.
  • Loading branch information
mariohackandglitch authored Aug 4, 2018
2 parents e4b3863 + 6107b56 commit 7b9a157
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "buildtools"]
path = buildtools
url = git@github.com:Steveice10/buildtools.git
url = https://github.com/Steveice10/buildtools.git
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ endif
# COMMON CONFIGURATION #

FONZD = 0
PABLOMK7 = 0
PABLOMK7 = 1
EXTENDEDMODE = 0
DEBUG = 0

Expand Down Expand Up @@ -42,7 +42,7 @@ LIBRARY_DIRS := $(PORTLIBS) $(CTRULIB)
LIBRARIES := citro3d ctru png z m

VERSION_MAJOR := 2
VERSION_MINOR := 11
VERSION_MINOR := 12
VERSION_MICRO := 0


Expand Down Expand Up @@ -79,7 +79,7 @@ endif
# 3DS CONFIGURATION #

ifeq ($(TARGET),3DS)
LIBRARY_DIRS += $(DEVKITPRO)/libctru $(DEVKITPRO)/portlibs/armv6k/
LIBRARY_DIRS += $(DEVKITPRO)/libctru $(DEVKITPRO)/portlibs/3ds/
LIBRARIES += citro3d ctru png z m

PRODUCT_CODE := CTR-P-BNTR
Expand Down
2 changes: 1 addition & 1 deletion buildtools
18 changes: 12 additions & 6 deletions source/firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,13 @@ Result bnInitParamsByFirmware(void)
bnConfig->FSPatchAddr = 0x0010F024;
bnConfig->SMPatchAddr = 0x0010189C;
}
else if (kernelVersion == SYSTEM_VERSION(2, 54, 0))
else if (kernelVersion == SYSTEM_VERSION(2, 54, 0) || kernelVersion == SYSTEM_VERSION(2, 55, 0))
{
// old3ds 11.4.0
ntrConfig->firmVersion = SYSTEM_VERSION(11, 4, 0);
// old3ds 11.4.0 and 11.8
if (kernelVersion == SYSTEM_VERSION(2, 54, 0))
ntrConfig->firmVersion = SYSTEM_VERSION(11, 4, 0);
else
ntrConfig->firmVersion = SYSTEM_VERSION(11, 8, 0);
ntrConfig->PMSvcRunAddr = 0x00103154;
ntrConfig->ControlMemoryPatchAddr1 = 0xDFF88514;
ntrConfig->ControlMemoryPatchAddr2 = 0xDFF88518;
Expand Down Expand Up @@ -230,10 +233,13 @@ Result bnInitParamsByFirmware(void)
bnConfig->FSPatchAddr = 0x0010F024;
bnConfig->SMPatchAddr = 0x0010189C;
}
else if (kernelVersion == SYSTEM_VERSION(2, 54, 0))
else if (kernelVersion == SYSTEM_VERSION(2, 54, 0) || kernelVersion == SYSTEM_VERSION(2, 55, 0))
{
// new3ds 11.4
ntrConfig->firmVersion = SYSTEM_VERSION(11, 4, 0);
// new3ds 11.4 and 11.8
if (kernelVersion == SYSTEM_VERSION(2, 54, 0))
ntrConfig->firmVersion = SYSTEM_VERSION(11, 4, 0);
else
ntrConfig->firmVersion = SYSTEM_VERSION(11, 8, 0);
ntrConfig->PMSvcRunAddr = 0x00103150;
ntrConfig->ControlMemoryPatchAddr1 = 0xDFF8862C;
ntrConfig->ControlMemoryPatchAddr2 = 0xDFF88630;
Expand Down
22 changes: 22 additions & 0 deletions source/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ dbgKernelCacheInterface cacheInterface_NEW114 =
(void*)0xFFF20518
};

dbgKernelCacheInterface cacheInterface_NEW118 =
{
//for new 3ds 11.8
(void*)0xFFF27480,
(void*)0xFFF1E1DC,
(void*)0xFFF1DE84,
(void*)0xFFF20518
};

dbgKernelCacheInterface cacheInterface_Old90 =
{
//for old 3ds 9.0
Expand Down Expand Up @@ -167,6 +176,15 @@ dbgKernelCacheInterface cacheInterface_Old114 =
(void*)0xFFF1FF54
};

dbgKernelCacheInterface cacheInterface_Old118 =
{
//for old 3ds 11.8
(void*)0xFFF257B4,
(void*)0xFFF1D9C0,
(void*)0xFFF1D758,
(void*)0xFFF1FEB8
};

void kernelCallback(void)
{
u32 svc_patch_addr = bnConfig->SvcPatchAddr;
Expand Down Expand Up @@ -196,6 +214,8 @@ void kernelCallback(void)
cache = &cacheInterface_NEW113;
else if (firmVersion == SYSTEM_VERSION(11, 4, 0))
cache = &cacheInterface_NEW114;
else if (firmVersion == SYSTEM_VERSION(11, 8, 0))
cache = &cacheInterface_NEW118;
}
else
{
Expand All @@ -213,6 +233,8 @@ void kernelCallback(void)
cache = &cacheInterface_Old113;
else if (firmVersion == SYSTEM_VERSION(11, 4, 0))
cache = &cacheInterface_Old114;
else if (firmVersion == SYSTEM_VERSION(11, 8, 0))
cache = &cacheInterface_Old118;
}
*(int *)(svc_patch_addr + 8) = 0xE1A00000; //NOP
*(int *)(svc_patch_addr) = 0xE1A00000; //NOP
Expand Down

0 comments on commit 7b9a157

Please sign in to comment.