This is what happens when I don't have a N3DS

This commit is contained in:
TuxSH 2016-06-05 12:08:55 +02:00
parent 35fdd470b3
commit f9d6cdccb0

View File

@ -212,15 +212,6 @@ void main(void)
loadFirm(firmType, !firmType && updatedSys == !firmSource); loadFirm(firmType, !firmType && updatedSys == !firmSource);
if(DEVMODE)
{
u32 arm9SectionNum = 0;
for(; (u32)(section[arm9SectionNum].address) >> 24 != 0x08 && arm9SectionNum < 4; arm9SectionNum++);
patchExceptionHandlersInstall((u8 *)firm + section[arm9SectionNum].offset, section[arm9SectionNum].size);
patchSvcBreak9((u8 *)firm + section[arm9SectionNum].offset, section[arm9SectionNum].size, (u32)(section[arm9SectionNum].address));
}
switch(firmType) switch(firmType)
{ {
case 0: case 0:
@ -339,6 +330,10 @@ static inline void patchNativeFirm(u32 nandType, u32 emuHeader, u32 a9lhMode)
u32 *exceptionsPage = getInfoForArm11ExceptionHandlers(arm11Section1, section[1].size, &stackAddress); u32 *exceptionsPage = getInfoForArm11ExceptionHandlers(arm11Section1, section[1].size, &stackAddress);
installArm11Handlers(exceptionsPage, stackAddress); installArm11Handlers(exceptionsPage, stackAddress);
//Kernel9/Process9 debugging
patchExceptionHandlersInstall(arm9Section, section[2].size);
patchSvcBreak9(arm9Section, section[2].size, (u32)(section[2].address));
//Stub svcBreak11 with "bkpt 255" //Stub svcBreak11 with "bkpt 255"
patchSvcBreak11(arm11Section1, section[1].size); patchSvcBreak11(arm11Section1, section[1].size);
@ -349,13 +344,22 @@ static inline void patchNativeFirm(u32 nandType, u32 emuHeader, u32 a9lhMode)
static inline void patchLegacyFirm(u32 firmType) static inline void patchLegacyFirm(u32 firmType)
{ {
u8 *arm9Section = (u8 *)firm + section[3].offset;
//On N3DS, decrypt ARM9Bin and patch ARM9 entrypoint to skip arm9loader //On N3DS, decrypt ARM9Bin and patch ARM9 entrypoint to skip arm9loader
if(console) if(console)
{ {
arm9Loader((u8 *)firm + section[3].offset, 0); arm9Loader(arm9Section, 0);
firm->arm9Entry = (u8 *)0x801301C; firm->arm9Entry = (u8 *)0x801301C;
} }
if(DEVMODE)
{
//Kernel9/Process9 debugging
patchExceptionHandlersInstall(arm9Section, section[3].size);
patchSvcBreak9(arm9Section, section[3].size, (u32)(section[3].address));
}
applyLegacyFirmPatches((u8 *)firm, firmType, console); applyLegacyFirmPatches((u8 *)firm, firmType, console);
} }
@ -371,6 +375,14 @@ static inline void patchSafeFirm(void)
patchFirmWrites(arm9Section, section[2].size); patchFirmWrites(arm9Section, section[2].size);
} }
if(DEVMODE)
{
//Kernel9/Process9 debugging
patchExceptionHandlersInstall(arm9Section, section[2].size);
patchSvcBreak9(arm9Section, section[2].size, (u32)(section[2].address));
}
else patchFirmWriteSafe(arm9Section, section[2].size); else patchFirmWriteSafe(arm9Section, section[2].size);
} }