Const for all
Probably useless, but for the sake of readability
This commit is contained in:
parent
478ebeadf8
commit
04978ebb01
@ -228,7 +228,7 @@ void aes(void *dst, const void *src, u32 blockCount, void *iv, u32 mode, u32 ivM
|
||||
****************************************************************/
|
||||
|
||||
//Nand key#2 (0x12C10)
|
||||
u8 key2[0x10] = {
|
||||
const u8 key2[0x10] = {
|
||||
0x42, 0x3F, 0x81, 0x7A, 0x23, 0x52, 0x58, 0x31, 0x6E, 0x75, 0x8E, 0x3A, 0x39, 0x43, 0x2E, 0xD0
|
||||
};
|
||||
|
||||
|
@ -22,7 +22,7 @@ void getEmunandSect(u32 *off, u32 *head){
|
||||
|
||||
void getSDMMC(void *pos, u32 *off, u32 size){
|
||||
//Look for struct code
|
||||
unsigned char pattern[] = {0x21, 0x20, 0x18, 0x20};
|
||||
const unsigned char pattern[] = {0x21, 0x20, 0x18, 0x20};
|
||||
*off = (u32)memsearch(pos, pattern, size, 4) - 1;
|
||||
|
||||
//Get DCD values
|
||||
@ -41,7 +41,7 @@ void getSDMMC(void *pos, u32 *off, u32 size){
|
||||
|
||||
void getEmuRW(void *pos, u32 size, u32 *readOff, u32 *writeOff){
|
||||
//Look for read/write code
|
||||
unsigned char pattern[] = {0x1E, 0x00, 0xC8, 0x05};
|
||||
const unsigned char pattern[] = {0x1E, 0x00, 0xC8, 0x05};
|
||||
|
||||
*writeOff = (u32)memsearch(pos, pattern, size, 4) - 6;
|
||||
*readOff = (u32)memsearch((void *)(*writeOff - 0x1000), pattern, 0x1000, 4) - 6;
|
||||
@ -49,7 +49,7 @@ void getEmuRW(void *pos, u32 size, u32 *readOff, u32 *writeOff){
|
||||
|
||||
void getMPU(void *pos, u32 *off, u32 size){
|
||||
//Look for MPU pattern
|
||||
unsigned char pattern[] = {0x03, 0x00, 0x24, 0x00};
|
||||
const unsigned char pattern[] = {0x03, 0x00, 0x24, 0x00};
|
||||
|
||||
*off = (u32)memsearch(pos, pattern, size, 4);
|
||||
}
|
@ -29,7 +29,7 @@ int memcmp(const void *buf1, const void *buf2, u32 size){
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *memsearch(void *start_pos, void *search, u32 size, u32 size_search){
|
||||
void *memsearch(void *start_pos, const void *search, u32 size, u32 size_search){
|
||||
for(void *pos = start_pos + size - size_search; pos >= start_pos; pos--){
|
||||
if(memcmp(pos, search, size_search) == 0) return pos;
|
||||
}
|
||||
|
@ -12,6 +12,6 @@
|
||||
void memcpy(void *dest, const void *src, u32 size);
|
||||
void memset(void *dest, int filler, u32 size);
|
||||
int memcmp(const void *buf1, const void *buf2, u32 size);
|
||||
void *memsearch(void *start_pos, void *search, u32 size, u32 size_search);
|
||||
void *memsearch(void *start_pos, const void *search, u32 size, u32 size_search);
|
||||
|
||||
#endif
|
@ -11,7 +11,7 @@
|
||||
* Patches
|
||||
**************************************************/
|
||||
|
||||
u8 mpu[0x2C] = { //MPU shit
|
||||
const u8 mpu[0x2C] = { //MPU shit
|
||||
0x03, 0x00, 0x36, 0x00, 0x00, 0x00, 0x10, 0x10, 0x01, 0x00, 0x00, 0x01, 0x03, 0x00, 0x36, 0x00,
|
||||
0x00, 0x00, 0x00, 0x20, 0x01, 0x01, 0x01, 0x01, 0x03, 0x06, 0x20, 0x00, 0x00, 0x00, 0x00, 0x08,
|
||||
0x01, 0x01, 0x01, 0x01, 0x03, 0x06, 0x1C, 0x00, 0x00, 0x00, 0x02, 0x08
|
||||
@ -19,12 +19,12 @@ u8 mpu[0x2C] = { //MPU shit
|
||||
|
||||
u8 nandRedir[0x08] = {0x00, 0x4C, 0xA0, 0x47, 0xC0, 0xA5, 0x01, 0x08}; //Branch to emunand function
|
||||
|
||||
u8 sigPat1[2] = {0x00, 0x20};
|
||||
u8 sigPat2[4] = {0x00, 0x20, 0x70, 0x47};
|
||||
const u8 sigPat1[2] = {0x00, 0x20};
|
||||
const u8 sigPat2[4] = {0x00, 0x20, 0x70, 0x47};
|
||||
|
||||
u8 FIRMblock[4] = {0x00, 0x20, 0xC0, 0x46};
|
||||
const u8 FIRMblock[4] = {0x00, 0x20, 0xC0, 0x46};
|
||||
|
||||
u8 emuInstr[5] = {0xA5, 0x01, 0x08, 0x30, 0xA5};
|
||||
const u8 emuInstr[5] = {0xA5, 0x01, 0x08, 0x30, 0xA5};
|
||||
|
||||
/**************************************************
|
||||
* Functions
|
||||
@ -32,8 +32,8 @@ u8 emuInstr[5] = {0xA5, 0x01, 0x08, 0x30, 0xA5};
|
||||
|
||||
void getSignatures(void *pos, u32 size, u32 *off, u32 *off2){
|
||||
//Look for signature checks
|
||||
unsigned char pattern[] = {0xC0, 0x1C, 0x76, 0xE7};
|
||||
unsigned char pattern2[] = {0xB5, 0x22, 0x4D, 0x0C};
|
||||
const unsigned char pattern[] = {0xC0, 0x1C, 0x76, 0xE7};
|
||||
const unsigned char pattern2[] = {0xB5, 0x22, 0x4D, 0x0C};
|
||||
|
||||
*off = (u32)memsearch(pos, pattern, size, 4);
|
||||
*off2 = (u32)memsearch(pos, pattern2, size, 4) - 1;
|
||||
@ -41,7 +41,7 @@ void getSignatures(void *pos, u32 size, u32 *off, u32 *off2){
|
||||
|
||||
void getReboot(void *pos, u32 size, u32 *off){
|
||||
//Look for FIRM reboot code
|
||||
unsigned char pattern[] = {0xDE, 0x1F, 0x8D, 0xE2};
|
||||
const unsigned char pattern[] = {0xDE, 0x1F, 0x8D, 0xE2};
|
||||
|
||||
*off = (u32)memsearch(pos, pattern, size, 4) - 0x10;
|
||||
}
|
||||
@ -50,7 +50,7 @@ void getfOpen(void *pos, u32 size, u32 *off){
|
||||
//Calculate fOpen
|
||||
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};
|
||||
const unsigned char pattern[] = {0xB0, 0x04, 0x98, 0x0D};
|
||||
|
||||
*off = (u32)memsearch(pos, pattern, size, 4) - 2 - p9off + p9addr;
|
||||
}
|
||||
@ -58,7 +58,7 @@ void getfOpen(void *pos, u32 size, u32 *off){
|
||||
void getFIRMWrite(void *pos, u32 size, u32 *off){
|
||||
//Look for FIRM writing code
|
||||
u8 *firmwrite = (u8 *)memsearch(pos, "exe:", size, 4);
|
||||
unsigned char pattern[] = {0x00, 0x28, 0x01, 0xDA};
|
||||
const unsigned char pattern[] = {0x00, 0x28, 0x01, 0xDA};
|
||||
|
||||
*off = (u32)memsearch(firmwrite - 0x100, pattern, 0x100, 4);
|
||||
}
|
@ -12,12 +12,12 @@
|
||||
/**************************************************
|
||||
* Patches
|
||||
**************************************************/
|
||||
u8 mpu[0x2C];
|
||||
const u8 mpu[0x2C];
|
||||
u8 nandRedir[0x08];
|
||||
u8 sigPat1[2];
|
||||
u8 sigPat2[4];
|
||||
u8 FIRMblock[4];
|
||||
u8 emuInstr[5];
|
||||
const u8 sigPat1[2];
|
||||
const u8 sigPat2[4];
|
||||
const u8 FIRMblock[4];
|
||||
const u8 emuInstr[5];
|
||||
|
||||
/**************************************************
|
||||
* Functions
|
||||
|
Reference in New Issue
Block a user