Fixed stupid mistakes

This commit is contained in:
Aurora 2016-03-06 19:05:41 +01:00
parent 13fd33a61d
commit 478ebeadf8
4 changed files with 15 additions and 15 deletions

View File

@ -250,7 +250,7 @@ void nandFirm0(u8 *outbuf, u32 size, u32 console){
}
//Decrypts the N3DS arm9bin
void decArm9Bin(void *armHdr, u32 mode){
void decArm9Bin(u8 *armHdr, u32 mode){
//Firm keys
u8 keyY[0x10];
@ -284,10 +284,10 @@ void decArm9Bin(void *armHdr, u32 mode){
}
//Sets the N3DS 9.6 KeyXs
void setKeyXs(void *armHdr){
void setKeyXs(u8 *armHdr){
void *keyData = armHdr+0x89814;
void *decKey = keyData+0x10;
u8 *keyData = armHdr+0x89814;
u8 *decKey = keyData+0x10;
//Set keys 0x19..0x1F keyXs
aes_setkey(0x11, key2, AES_KEYNORMAL, AES_INPUT_BE | AES_INPUT_NORMAL);
@ -295,6 +295,6 @@ void setKeyXs(void *armHdr){
for(u8 slot = 0x19; slot < 0x20; slot++){
aes(decKey, keyData, 1, NULL, AES_ECB_DECRYPT_MODE, 0);
aes_setkey(slot, decKey, AES_KEYX, AES_INPUT_BE | AES_INPUT_NORMAL);
*(u8 *)(keyData+0xF) += 1;
*(keyData+0xF) += 1;
}
}

View File

@ -50,7 +50,7 @@
//NAND/FIRM stuff
void nandFirm0(u8 *outbuf, u32 size, u32 console);
void decArm9Bin(void *armHdr, u32 mode);
void setKeyXs(void *armHdr);
void decArm9Bin(u8 *armHdr, u32 mode);
void setKeyXs(u8 *armHdr);
#endif

View File

@ -118,7 +118,7 @@ u32 loadFirm(void){
if((((u32)section[2].address >> 8) & 0xFF) != (console ? 0x60 : 0x68)) return 0;
if(console && !usePatchedFirm)
decArm9Bin((void *)firmLocation + section[2].offset, mode);
decArm9Bin((u8 *)firmLocation + section[2].offset, mode);
return 1;
}
@ -236,12 +236,12 @@ u32 patchFirm(void){
void launchFirm(void){
if(console && mode) setKeyXs((void *)firmLocation + section[2].offset);
if(console && mode) setKeyXs((u8 *)firmLocation + section[2].offset);
//Copy firm partitions to respective memory locations
memcpy(section[0].address, (void *)firmLocation + section[0].offset, section[0].size);
memcpy(section[1].address, (void *)firmLocation + section[1].offset, section[1].size);
memcpy(section[2].address, (void *)firmLocation + section[2].offset, section[2].size);
memcpy(section[0].address, (u8 *)firmLocation + section[0].offset, section[0].size);
memcpy(section[1].address, (u8 *)firmLocation + section[1].offset, section[1].size);
memcpy(section[2].address, (u8 *)firmLocation + section[2].offset, section[2].size);
//Run ARM11 screen stuff
vu32 *arm11 = (vu32 *)0x1FFFFFF8;

View File

@ -48,8 +48,8 @@ void getReboot(void *pos, u32 size, u32 *off){
void getfOpen(void *pos, u32 size, u32 *off){
//Calculate fOpen
u32 p9addr = *(u32*)(memsearch(pos, "ess9", size, 4) + 0xC);
u32 p9off = (u32)(memsearch(pos, "code", size, 4) + 0x1FF);
u32 p9addr = *(u32 *)((u8 *)memsearch(pos, "ess9", size, 4) + 0xC);
u32 p9off = (u32)memsearch(pos, "code", size, 4) + 0x1FF;
unsigned char pattern[] = {0xB0, 0x04, 0x98, 0x0D};
*off = (u32)memsearch(pos, pattern, size, 4) - 2 - p9off + p9addr;
@ -57,7 +57,7 @@ void getfOpen(void *pos, u32 size, u32 *off){
void getFIRMWrite(void *pos, u32 size, u32 *off){
//Look for FIRM writing code
void *firmwrite = memsearch(pos, "exe:", size, 4);
u8 *firmwrite = (u8 *)memsearch(pos, "exe:", size, 4);
unsigned char pattern[] = {0x00, 0x28, 0x01, 0xDA};
*off = (u32)memsearch(firmwrite - 0x100, pattern, 0x100, 4);