Minor stuff

This commit is contained in:
Aurora Wright 2017-05-17 13:36:18 +02:00
parent b9bc41a772
commit ba88ec25f6
3 changed files with 17 additions and 34 deletions

View File

@ -484,26 +484,21 @@ void kernel9Loader(Arm9Bin *arm9Section)
{
//Determine the kernel9loader version
u32 k9lVersion;
if(arm9Section == NULL)
k9lVersion = 2;
else
switch(arm9Section->magic[3])
{
switch(arm9Section->magic[3])
{
case 0xFF:
k9lVersion = 0;
break;
case '1':
k9lVersion = 1;
break;
default:
k9lVersion = 2;
break;
}
case 0xFF:
k9lVersion = 0;
break;
case '1':
k9lVersion = 1;
break;
default:
k9lVersion = 2;
break;
}
u32 *startOfArm9Bin = (u32 *)((u8 *)arm9Section + 0x800);
bool needToDecrypt = arm9Section != NULL && *startOfArm9Bin != 0x47704770 && *startOfArm9Bin != 0xB0862000;
bool needToDecrypt = *startOfArm9Bin != 0x47704770 && *startOfArm9Bin != 0xB0862000;
//Set 0x11 keyslot
__attribute__((aligned(4))) const u8 key1s[2][AES_BLOCK_SIZE] = {
@ -569,6 +564,10 @@ void kernel9Loader(Arm9Bin *arm9Section)
aes_setkey(slot, decKey, AES_KEYX, AES_INPUT_BE | AES_INPUT_NORMAL);
}
if(!ISSIGHAX) return;
twlConsoleInfoInit();
if(k9lVersion == 2)
{
aes_setkey(0x11, key1s[ISDEVUNIT ? 1 : 0], AES_KEYNORMAL, AES_INPUT_BE | AES_INPUT_NORMAL);
@ -576,9 +575,6 @@ void kernel9Loader(Arm9Bin *arm9Section)
aes(decKey, keyBlocks[0], 1, NULL, AES_ECB_DECRYPT_MODE, 0);
aes_setkey(0x18, decKey, AES_KEYX, AES_INPUT_BE | AES_INPUT_NORMAL);
}
if(ISSIGHAX)
twlConsoleInfoInit();
}
void computePinHash(u8 *outbuf, const u8 *inbuf)

View File

@ -128,9 +128,6 @@ u32 patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, boo
//Sets the 7.x NCCH KeyX and the 6.x gamecard save data KeyY on >= 6.0 O3DS FIRMs, if not using A9LH
else if(!ISA9LH && !ISFIRMLAUNCH && firmVersion >= 0x29) set6x7xKeys();
if(!ISN3DS)
kernel9Loader(NULL); //Just set the N3DS 9.6+ keys even on O3DS
//Find the Process9 .code location, size and memory address
u32 process9Size,
process9MemAddr;
@ -230,8 +227,6 @@ u32 patchTwlFirm(u32 firmVersion, bool doUnitinfoPatch)
kernel9Loader((Arm9Bin *)arm9Section);
firm->arm9Entry = (u8 *)0x801301C;
}
else
kernel9Loader(NULL); //Just set the keys
//Find the Process9 .code location, size and memory address
u32 process9Size,
@ -265,8 +260,6 @@ u32 patchAgbFirm(bool doUnitinfoPatch)
kernel9Loader((Arm9Bin *)arm9Section);
firm->arm9Entry = (u8 *)0x801301C;
}
else
kernel9Loader(NULL); //Just set the keys
//Find the Process9 .code location, size and memory address
u32 process9Size,
@ -295,8 +288,6 @@ u32 patch1x2xNativeAndSafeFirm(bool enableExceptionHandlers)
kernel9Loader((Arm9Bin *)arm9Section);
firm->arm9Entry = (u8 *)0x801B01C;
}
else
kernel9Loader(NULL); //Just set the keys
//Find the Process9 .code location, size and memory address
u32 process9Size,
@ -393,7 +384,7 @@ void launchFirm(FirmwareType firmType, bool loadFromStorage)
if(!ISFIRMLAUNCH) deinitScreens();
//Set ARM11 kernel entrypoint
if(ISFIRMLAUNCH | ISSIGHAX)
if(ISFIRMLAUNCH || ISSIGHAX)
ARM11_CORE0_MAILBOX_ENTRYPOINT = (u32)firm->arm11Entry;
else
BRAHMA_ARM11_ENTRYPOINT = (u32)firm->arm11Entry;

View File

@ -164,11 +164,7 @@ void main(void)
pressed = HID_PAD;
}
else if(((pressed & SINGLE_PAYLOAD_BUTTONS) && !(pressed & (BUTTON_L1 | BUTTON_R1 | BUTTON_A))) ||
((pressed & L_PAYLOAD_BUTTONS) && (pressed & BUTTON_L1)))
{
kernel9Loader(NULL);
loadPayload(pressed, NULL);
}
((pressed & L_PAYLOAD_BUTTONS) && (pressed & BUTTON_L1))) loadPayload(pressed, NULL);
if(splashMode == 2) loadSplash();