From 478ebeadf865aee322d249b6a8b72633d38a7167 Mon Sep 17 00:00:00 2001 From: Aurora Date: Sun, 6 Mar 2016 19:05:41 +0100 Subject: [PATCH] Fixed stupid mistakes --- source/crypto.c | 10 +++++----- source/crypto.h | 4 ++-- source/firm.c | 10 +++++----- source/patches.c | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/source/crypto.c b/source/crypto.c index 5007c2d..64902f5 100755 --- a/source/crypto.c +++ b/source/crypto.c @@ -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; } } \ No newline at end of file diff --git a/source/crypto.h b/source/crypto.h index f4bd4ed..b18c0fc 100755 --- a/source/crypto.h +++ b/source/crypto.h @@ -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 \ No newline at end of file diff --git a/source/firm.c b/source/firm.c index 2110d90..6994b60 100755 --- a/source/firm.c +++ b/source/firm.c @@ -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; diff --git a/source/patches.c b/source/patches.c index df1edfa..9e472a4 100644 --- a/source/patches.c +++ b/source/patches.c @@ -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);