Minor changes
This commit is contained in:
parent
09cc7c903c
commit
6707a36ffe
3
Makefile
3
Makefile
@ -58,7 +58,8 @@ loader: $(dir_out)/rei/loader.bin
|
|||||||
clean:
|
clean:
|
||||||
@$(MAKE) $(FLAGS) -C $(dir_mset) clean
|
@$(MAKE) $(FLAGS) -C $(dir_mset) clean
|
||||||
@$(MAKE) $(FLAGS) -C $(dir_ninjhax) clean
|
@$(MAKE) $(FLAGS) -C $(dir_ninjhax) clean
|
||||||
rm -rf $(dir_out) $(dir_build) $(dir_loader)/build $(dir_loader)/loader.elf
|
@rm -rf $(dir_out) $(dir_build)
|
||||||
|
@cd $(dir_loader) && make clean
|
||||||
|
|
||||||
$(dir_out)/$(name).dat: $(dir_build)/main.bin $(dir_out)/rei
|
$(dir_out)/$(name).dat: $(dir_build)/main.bin $(dir_out)/rei
|
||||||
@$(MAKE) $(FLAGS) -C $(dir_mset) launcher
|
@$(MAKE) $(FLAGS) -C $(dir_mset) launcher
|
||||||
|
@ -105,7 +105,7 @@ $(BUILD):
|
|||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
clean:
|
clean:
|
||||||
@echo clean ...
|
@echo clean ...
|
||||||
@rm -fr $(BUILD) $(OUTPUT).elf arm9loaderhax.bin
|
@rm -fr $(BUILD) $(OUTPUT).elf
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
@ -54,7 +54,7 @@ __asm__\
|
|||||||
}
|
}
|
||||||
#endif /*__thumb__*/
|
#endif /*__thumb__*/
|
||||||
|
|
||||||
void aes_setkey(u8 keyslot, const void* key, u32 keyType, u32 mode)
|
static void aes_setkey(u8 keyslot, const void* key, u32 keyType, u32 mode)
|
||||||
{
|
{
|
||||||
if(keyslot <= 0x03) return; // Ignore TWL keys for now
|
if(keyslot <= 0x03) return; // Ignore TWL keys for now
|
||||||
u32 * key32 = (u32 *)key;
|
u32 * key32 = (u32 *)key;
|
||||||
@ -67,7 +67,7 @@ void aes_setkey(u8 keyslot, const void* key, u32 keyType, u32 mode)
|
|||||||
REG_AESKEYFIFO[keyType] = key32[3];
|
REG_AESKEYFIFO[keyType] = key32[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
void aes_use_keyslot(u8 keyslot)
|
static void aes_use_keyslot(u8 keyslot)
|
||||||
{
|
{
|
||||||
if(keyslot > 0x3F)
|
if(keyslot > 0x3F)
|
||||||
return;
|
return;
|
||||||
@ -76,7 +76,7 @@ void aes_use_keyslot(u8 keyslot)
|
|||||||
*REG_AESCNT = *REG_AESCNT | 0x04000000; /* mystery bit */
|
*REG_AESCNT = *REG_AESCNT | 0x04000000; /* mystery bit */
|
||||||
}
|
}
|
||||||
|
|
||||||
void aes_setiv(const void* iv, u32 mode)
|
static void aes_setiv(const void* iv, u32 mode)
|
||||||
{
|
{
|
||||||
const u32 *iv32 = (const u32 *)iv;
|
const u32 *iv32 = (const u32 *)iv;
|
||||||
*REG_AESCNT = (*REG_AESCNT & ~(AES_CNT_INPUT_ENDIAN | AES_CNT_INPUT_ORDER)) | mode;
|
*REG_AESCNT = (*REG_AESCNT & ~(AES_CNT_INPUT_ENDIAN | AES_CNT_INPUT_ORDER)) | mode;
|
||||||
@ -98,7 +98,7 @@ void aes_setiv(const void* iv, u32 mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void aes_advctr(void *ctr, u32 val, u32 mode)
|
static void aes_advctr(void *ctr, u32 val, u32 mode)
|
||||||
{
|
{
|
||||||
u32 *ctr32 = (u32*)ctr;
|
u32 *ctr32 = (u32*)ctr;
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ void aes_advctr(void *ctr, u32 val, u32 mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void aes_change_ctrmode(void *ctr, u32 fromMode, u32 toMode)
|
static void aes_change_ctrmode(void *ctr, u32 fromMode, u32 toMode)
|
||||||
{
|
{
|
||||||
u32 *ctr32 = (u32 *)ctr;
|
u32 *ctr32 = (u32 *)ctr;
|
||||||
int i;
|
int i;
|
||||||
@ -147,7 +147,7 @@ void aes_change_ctrmode(void *ctr, u32 fromMode, u32 toMode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void aes_batch(void *dst, const void *src, u32 blockCount)
|
static void aes_batch(void *dst, const void *src, u32 blockCount)
|
||||||
{
|
{
|
||||||
*REG_AESBLKCNT = blockCount << 16;
|
*REG_AESBLKCNT = blockCount << 16;
|
||||||
*REG_AESCNT |= AES_CNT_START;
|
*REG_AESCNT |= AES_CNT_START;
|
||||||
@ -180,7 +180,7 @@ void aes_batch(void *dst, const void *src, u32 blockCount)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void aes(void *dst, const void *src, u32 blockCount, void *iv, u32 mode, u32 ivMode)
|
static void aes(void *dst, const void *src, u32 blockCount, void *iv, u32 mode, u32 ivMode)
|
||||||
{
|
{
|
||||||
*REG_AESCNT = mode |
|
*REG_AESCNT = mode |
|
||||||
AES_CNT_INPUT_ORDER | AES_CNT_OUTPUT_ORDER |
|
AES_CNT_INPUT_ORDER | AES_CNT_OUTPUT_ORDER |
|
||||||
@ -228,12 +228,12 @@ void aes(void *dst, const void *src, u32 blockCount, void *iv, u32 mode, u32 ivM
|
|||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
//Nand key#2 (0x12C10)
|
//Nand key#2 (0x12C10)
|
||||||
const u8 key2[0x10] = {
|
static const u8 key2[0x10] = {
|
||||||
0x42, 0x3F, 0x81, 0x7A, 0x23, 0x52, 0x58, 0x31, 0x6E, 0x75, 0x8E, 0x3A, 0x39, 0x43, 0x2E, 0xD0
|
0x42, 0x3F, 0x81, 0x7A, 0x23, 0x52, 0x58, 0x31, 0x6E, 0x75, 0x8E, 0x3A, 0x39, 0x43, 0x2E, 0xD0
|
||||||
};
|
};
|
||||||
|
|
||||||
//Get Nand CTR key
|
//Get Nand CTR key
|
||||||
void getNandCTR(u8 *buf, u32 console){
|
static void getNandCTR(u8 *buf, u32 console){
|
||||||
u8 *addr = (console ? (u8 *)0x080D8BBC : (u8 *)0x080D797C) + 0x0F;
|
u8 *addr = (console ? (u8 *)0x080D8BBC : (u8 *)0x080D797C) + 0x0F;
|
||||||
for(u8 keyLen = 0x10; keyLen; keyLen--)
|
for(u8 keyLen = 0x10; keyLen; keyLen--)
|
||||||
*(buf++) = *(addr--);
|
*(buf++) = *(addr--);
|
||||||
|
@ -8,11 +8,15 @@
|
|||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
|
||||||
static struct fb *fb = (struct fb *)0x23FFFE00;
|
static const struct fb {
|
||||||
|
u8 *top_left;
|
||||||
|
u8 *top_right;
|
||||||
|
u8 *bottom;
|
||||||
|
} *const fb = (struct fb *)0x23FFFE00;
|
||||||
|
|
||||||
void shutdownLCD(void){
|
void __attribute__((naked)) shutdownLCD(void){
|
||||||
|
|
||||||
vu32 *arm11 = (vu32 *)0x1FFFFFF8;
|
vu32 *const arm11 = (u32 *)0x1FFFFFF8;
|
||||||
|
|
||||||
//Clear ARM11 entry offset
|
//Clear ARM11 entry offset
|
||||||
*arm11 = 0;
|
*arm11 = 0;
|
||||||
@ -28,7 +32,7 @@ void shutdownLCD(void){
|
|||||||
((void (*)())*arm11)();
|
((void (*)())*arm11)();
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearScreen(void){
|
static void clearScreen(void){
|
||||||
memset(fb->top_left, 0, 0x46500);
|
memset(fb->top_left, 0, 0x46500);
|
||||||
memset(fb->top_right, 0, 0x46500);
|
memset(fb->top_right, 0, 0x46500);
|
||||||
memset(fb->bottom, 0, 0x38400);
|
memset(fb->bottom, 0, 0x38400);
|
||||||
|
@ -9,13 +9,7 @@
|
|||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
struct fb {
|
|
||||||
u8 *top_left;
|
|
||||||
u8 *top_right;
|
|
||||||
u8 *bottom;
|
|
||||||
};
|
|
||||||
|
|
||||||
void loadSplash(void);
|
void loadSplash(void);
|
||||||
void shutdownLCD(void);
|
void __attribute__((naked)) shutdownLCD(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -8,9 +8,9 @@
|
|||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "fatfs/sdmmc/sdmmc.h"
|
#include "fatfs/sdmmc/sdmmc.h"
|
||||||
|
|
||||||
static u8 *temp = (u8 *)0x24300000;
|
|
||||||
|
|
||||||
void getEmunandSect(u32 *off, u32 *head){
|
void getEmunandSect(u32 *off, u32 *head){
|
||||||
|
u8 *const temp = (u8 *)0x24300000;
|
||||||
|
|
||||||
u32 nandSize = getMMCDevice(0)->total_size;
|
u32 nandSize = getMMCDevice(0)->total_size;
|
||||||
if(sdmmc_sdcard_readsectors(nandSize, 1, temp) == 0){
|
if(sdmmc_sdcard_readsectors(nandSize, 1, temp) == 0){
|
||||||
if(*(u32 *)(temp + 0x100) == NCSD_MAGIC){
|
if(*(u32 *)(temp + 0x100) == NCSD_MAGIC){
|
||||||
|
@ -13,17 +13,17 @@
|
|||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
#include "loader.h"
|
#include "loader.h"
|
||||||
|
|
||||||
firmHeader *firmLocation = (firmHeader *)0x24000000;
|
static firmHeader *const firmLocation = (firmHeader *)0x24000000;
|
||||||
firmSectionHeader *section;
|
static const firmSectionHeader *section;
|
||||||
u32 firmSize = 0,
|
static u32 firmSize = 0,
|
||||||
mode = 1,
|
mode = 1,
|
||||||
console = 1,
|
console = 1,
|
||||||
emuNAND = 0,
|
emuNAND = 0,
|
||||||
a9lhSetup = 0,
|
a9lhSetup = 0,
|
||||||
updatedSys = 0,
|
updatedSys = 0,
|
||||||
usePatchedFirm = 0;
|
usePatchedFirm = 0;
|
||||||
u16 pressed;
|
static u16 pressed;
|
||||||
char *firmPathPatched = NULL;
|
static const char *firmPathPatched = NULL;
|
||||||
|
|
||||||
void setupCFW(void){
|
void setupCFW(void){
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ u32 loadFirm(void){
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Nand redirection
|
//Nand redirection
|
||||||
u32 loadEmu(void){
|
static u32 loadEmu(void){
|
||||||
|
|
||||||
u32 emuOffset = 0,
|
u32 emuOffset = 0,
|
||||||
emuHeader = 0,
|
emuHeader = 0,
|
||||||
@ -251,7 +251,7 @@ void launchFirm(void){
|
|||||||
memcpy(section[2].address, (u8 *)firmLocation + section[2].offset, section[2].size);
|
memcpy(section[2].address, (u8 *)firmLocation + section[2].offset, section[2].size);
|
||||||
|
|
||||||
//Run ARM11 screen stuff
|
//Run ARM11 screen stuff
|
||||||
vu32 *arm11 = (vu32 *)0x1FFFFFF8;
|
vu32 *const arm11 = (u32 *)0x1FFFFFF8;
|
||||||
*arm11 = (u32)shutdownLCD;
|
*arm11 = (u32)shutdownLCD;
|
||||||
while(*arm11);
|
while(*arm11);
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ u32 fileSize(const char *path){
|
|||||||
|
|
||||||
u32 fileExists(const char *path){
|
u32 fileExists(const char *path){
|
||||||
FIL fp;
|
FIL fp;
|
||||||
u8 exists = 0;
|
u32 exists = 0;
|
||||||
|
|
||||||
if(f_open(&fp, path, FA_READ) == FR_OK) exists = 1;
|
if(f_open(&fp, path, FA_READ) == FR_OK) exists = 1;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user