Skip to content

Commit

Permalink
Fix o3ds compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
mariohackandglitch committed Aug 1, 2018
1 parent 36627af commit 6107b56
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
2 changes: 1 addition & 1 deletion 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
10 changes: 8 additions & 2 deletions source/firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ Result bnInitParamsByFirmware(void)
else if (kernelVersion == SYSTEM_VERSION(2, 54, 0) || kernelVersion == SYSTEM_VERSION(2, 55, 0))
{
// old3ds 11.4.0 and 11.8
ntrConfig->firmVersion = SYSTEM_VERSION(11, 4, 0);
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 @@ -233,7 +236,10 @@ Result bnInitParamsByFirmware(void)
else if (kernelVersion == SYSTEM_VERSION(2, 54, 0) || kernelVersion == SYSTEM_VERSION(2, 55, 0))
{
// new3ds 11.4 and 11.8
ntrConfig->firmVersion = SYSTEM_VERSION(11, 4, 0);
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 6107b56

Please sign in to comment.