Free brain massages! Apply now! (If only.)
Edit: Also, you don't need a separate branch for o3ds necessarily, just do something like this (this obviously doesn't fix the offset differences with your thread and stuff):
Code:
//firm.c:
#define PDN_MPCORE_CFG (*(u8*)0x10140FFC)
#define N3DS 1
#define O3DS 0
static u8 console = N3DS;
void loadFirm(void) {
// ...
if (PDN_MPCORE_CFG == 1)
console = O3DS;
if (console == N3DS)
arm9Loader(...);
}
// further on in...
void launchFirm(void) {
// .. memcpys and such
u32 entrypoint = (console == N3DS) ? 0x801B01C : (u32)firm->arm9Entry;
((void(*)())entryPoint)();
}
That register indicates the CPU core configuration, and if it's equal to 1 (i.e. only the first bit is set), then it's obviously an O3DS. The other bits indicate the other two cores I think, but basically, if it's not 1, then it must be an N3DS.