Revert "Minor stuff"

This reverts commit ba88ec25f6.

Conflicts:
	source/firm.c
This commit is contained in:
TuxSH 2017-05-18 01:07:29 +02:00
parent 3b766de306
commit 8636a74ba4
3 changed files with 33 additions and 16 deletions

View File

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

View File

@ -125,6 +125,9 @@ u32 patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, boo
firm->arm9Entry = (u8 *)0x801B01C; firm->arm9Entry = (u8 *)0x801B01C;
} }
if(!ISN3DS)
kernel9Loader(NULL); //Just set the N3DS 9.6+ keys even on O3DS
//Find the Process9 .code location, size and memory address //Find the Process9 .code location, size and memory address
u32 process9Size, u32 process9Size,
process9MemAddr; process9MemAddr;
@ -224,6 +227,8 @@ u32 patchTwlFirm(u32 firmVersion, bool doUnitinfoPatch)
kernel9Loader((Arm9Bin *)arm9Section); kernel9Loader((Arm9Bin *)arm9Section);
firm->arm9Entry = (u8 *)0x801301C; firm->arm9Entry = (u8 *)0x801301C;
} }
else
kernel9Loader(NULL); //Just set the keys
//Find the Process9 .code location, size and memory address //Find the Process9 .code location, size and memory address
u32 process9Size, u32 process9Size,
@ -257,6 +262,8 @@ u32 patchAgbFirm(bool doUnitinfoPatch)
kernel9Loader((Arm9Bin *)arm9Section); kernel9Loader((Arm9Bin *)arm9Section);
firm->arm9Entry = (u8 *)0x801301C; firm->arm9Entry = (u8 *)0x801301C;
} }
else
kernel9Loader(NULL); //Just set the keys
//Find the Process9 .code location, size and memory address //Find the Process9 .code location, size and memory address
u32 process9Size, u32 process9Size,
@ -285,6 +292,8 @@ u32 patch1x2xNativeAndSafeFirm(bool enableExceptionHandlers)
kernel9Loader((Arm9Bin *)arm9Section); kernel9Loader((Arm9Bin *)arm9Section);
firm->arm9Entry = (u8 *)0x801B01C; firm->arm9Entry = (u8 *)0x801B01C;
} }
else
kernel9Loader(NULL); //Just set the keys
//Find the Process9 .code location, size and memory address //Find the Process9 .code location, size and memory address
u32 process9Size, u32 process9Size,

View File

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