Merge branch 'master' into developer
Conflicts: source/config.c source/fs.c source/fs.h
This commit is contained in:
commit
3709ac301a
@ -54,13 +54,16 @@ payload_maxsize equ 0x10000 ; Maximum size for the payload (maximum that CakeB
|
|||||||
movne r4, #0
|
movne r4, #0
|
||||||
bne read_payload ; Go read the real payload.
|
bne read_payload ; Go read the real payload.
|
||||||
|
|
||||||
; Copy the last digits of the wanted firm to the 5th byte of the payload
|
; Copy the low TID (in UTF-16) of the wanted firm to the 5th byte of the payload
|
||||||
add r2, sp, #0x3A8 - 0x70
|
add r0, sp, #0x3A8 - 0x70
|
||||||
ldr r0, [r2, #0x27]
|
add r0, 0x1A
|
||||||
ldr r1, =payload_addr + 4
|
add r1, r0, #0x10
|
||||||
str r0, [r1]
|
ldr r2, =payload_addr + 4
|
||||||
ldr r0, [r2, #0x2B]
|
copy_TID_low:
|
||||||
str r0, [r1, #4]
|
ldrh r3, [r0], #2
|
||||||
|
strh r3, [r2], #2
|
||||||
|
cmp r0, r1
|
||||||
|
blo copy_TID_low
|
||||||
|
|
||||||
; Set kernel state
|
; Set kernel state
|
||||||
mov r0, #0
|
mov r0, #0
|
||||||
|
@ -43,7 +43,7 @@ void configureCFW(const char *configPath)
|
|||||||
"( ) Enable region/language emu. and ext. .code",
|
"( ) Enable region/language emu. and ext. .code",
|
||||||
"( ) Show current NAND in System Settings",
|
"( ) Show current NAND in System Settings",
|
||||||
"( ) Show GBA boot screen in patched AGB_FIRM",
|
"( ) Show GBA boot screen in patched AGB_FIRM",
|
||||||
"( ) Enable splash screen with no screen-init",
|
"( ) Display splash screen before payloads",
|
||||||
"( ) Use a PIN",
|
"( ) Use a PIN",
|
||||||
"( ) Disable access checks" };
|
"( ) Disable access checks" };
|
||||||
|
|
||||||
|
@ -42,13 +42,16 @@ static inline int strlen(const char *string)
|
|||||||
|
|
||||||
bool loadSplash(void)
|
bool loadSplash(void)
|
||||||
{
|
{
|
||||||
|
//Don't delay boot nor init the screens if no splash image is on the SD
|
||||||
|
if(getFileSize("/luma/splash.bin") + getFileSize("/luma/splash.bin") == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
initScreens();
|
initScreens();
|
||||||
|
|
||||||
//Don't delay boot if no splash image is on the SD
|
fileRead(fb->top_left, "/luma/splash.bin");
|
||||||
if(fileRead(fb->top_left, "/luma/splash.bin") +
|
fileRead(fb->bottom, "/luma/splashbottom.bin");
|
||||||
fileRead(fb->bottom, "/luma/splashbottom.bin")) return true;
|
|
||||||
|
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawCharacter(char character, int posX, int posY, u32 color)
|
void drawCharacter(char character, int posX, int posY, u32 color)
|
||||||
|
@ -37,6 +37,8 @@
|
|||||||
#include "i2c.h"
|
#include "i2c.h"
|
||||||
#include "../build/injector.h"
|
#include "../build/injector.h"
|
||||||
|
|
||||||
|
extern u16 launchedFirmTIDLow[8]; //defined in start.s
|
||||||
|
|
||||||
static firmHeader *const firm = (firmHeader *)0x24000000;
|
static firmHeader *const firm = (firmHeader *)0x24000000;
|
||||||
static const firmSectionHeader *section;
|
static const firmSectionHeader *section;
|
||||||
|
|
||||||
@ -80,14 +82,14 @@ void main(void)
|
|||||||
installArm9Handlers();
|
installArm9Handlers();
|
||||||
|
|
||||||
//Determine if this is a firmlaunch boot
|
//Determine if this is a firmlaunch boot
|
||||||
if(*(vu8 *)0x23F00005)
|
if(launchedFirmTIDLow[5] != 0)
|
||||||
{
|
{
|
||||||
if(needConfig == CREATE_CONFIGURATION) mcuReboot();
|
if(needConfig == CREATE_CONFIGURATION) mcuReboot();
|
||||||
|
|
||||||
isFirmlaunch = true;
|
isFirmlaunch = true;
|
||||||
|
|
||||||
//'0' = NATIVE_FIRM, '1' = TWL_FIRM, '2' = AGB_FIRM
|
//'0' = NATIVE_FIRM, '1' = TWL_FIRM, '2' = AGB_FIRM
|
||||||
firmType = *(vu8 *)0x23F00009 == '3' ? SAFE_FIRM : (FirmwareType)(*(vu8 *)0x23F00005 - '0');
|
firmType = launchedFirmTIDLow[7] == u'3' ? SAFE_FIRM : (FirmwareType)(launchedFirmTIDLow[5] - u'0');
|
||||||
|
|
||||||
nandType = (FirmwareSource)BOOTCONFIG(0, 3);
|
nandType = (FirmwareSource)BOOTCONFIG(0, 3);
|
||||||
firmSource = (FirmwareSource)BOOTCONFIG(2, 1);
|
firmSource = (FirmwareSource)BOOTCONFIG(2, 1);
|
||||||
@ -181,14 +183,23 @@ void main(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* If L and R/A/Select or one of the single payload buttons are pressed,
|
/* If L and R/A/Select or one of the single payload buttons are pressed,
|
||||||
chainload an external payload (verify the PIN if needed)*/
|
chainload an external payload (the PIN, if any, has been verified)*/
|
||||||
|
|
||||||
|
if(CONFIG(6) && loadSplash())
|
||||||
|
{
|
||||||
|
nbChronoStarted = 2;
|
||||||
|
chrono(0);
|
||||||
|
chrono(3);
|
||||||
|
nbChronoStarted = 0;
|
||||||
|
pressed = HID_PAD;
|
||||||
|
}
|
||||||
|
|
||||||
bool shouldLoadPayload = (pressed & SINGLE_PAYLOAD_BUTTONS) || ((pressed & BUTTON_L1) && (pressed & L_PAYLOAD_BUTTONS));
|
bool shouldLoadPayload = (pressed & SINGLE_PAYLOAD_BUTTONS) || ((pressed & BUTTON_L1) && (pressed & L_PAYLOAD_BUTTONS));
|
||||||
|
|
||||||
if(shouldLoadPayload)
|
if(shouldLoadPayload)
|
||||||
loadPayload(pressed);
|
loadPayload(pressed, nbChronoStarted != 2);
|
||||||
|
|
||||||
//If screens are inited or the corresponding option is set, load splash screen
|
if(!CONFIG(6) && loadSplash())
|
||||||
if((PDN_GPU_CNT != 1 || CONFIG(6)) && loadSplash())
|
|
||||||
{
|
{
|
||||||
nbChronoStarted = 2;
|
nbChronoStarted = 2;
|
||||||
chrono(0);
|
chrono(0);
|
||||||
|
@ -46,7 +46,7 @@ u32 fileRead(void *dest, const char *path)
|
|||||||
{
|
{
|
||||||
unsigned int read;
|
unsigned int read;
|
||||||
size = f_size(&file);
|
size = f_size(&file);
|
||||||
if(dest == NULL) return size;
|
if(dest != NULL)
|
||||||
f_read(&file, dest, size, &read);
|
f_read(&file, dest, size, &read);
|
||||||
f_close(&file);
|
f_close(&file);
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ void createDirectory(const char *path)
|
|||||||
f_mkdir(path);
|
f_mkdir(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadPayload(u32 pressed)
|
void loadPayload(u32 pressed, bool needToInitScreens)
|
||||||
{
|
{
|
||||||
const char *pattern;
|
const char *pattern;
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ void loadPayload(u32 pressed)
|
|||||||
|
|
||||||
if(result == FR_OK && info.fname[0])
|
if(result == FR_OK && info.fname[0])
|
||||||
{
|
{
|
||||||
initScreens();
|
if(needToInitScreens) initScreens();
|
||||||
|
|
||||||
u32 *const loaderAddress = (u32 *)0x24FFFF00;
|
u32 *const loaderAddress = (u32 *)0x24FFFF00;
|
||||||
|
|
||||||
|
@ -29,10 +29,10 @@
|
|||||||
extern bool isN3DS;
|
extern bool isN3DS;
|
||||||
|
|
||||||
void mountFs(void);
|
void mountFs(void);
|
||||||
u32 getFileSize(const char *path);
|
|
||||||
u32 fileRead(void *dest, const char *path);
|
u32 fileRead(void *dest, const char *path);
|
||||||
|
u32 getFileSize(const char *path);
|
||||||
bool fileWrite(const void *buffer, const char *path, u32 size);
|
bool fileWrite(const void *buffer, const char *path, u32 size);
|
||||||
void createDirectory(const char *path);
|
void createDirectory(const char *path);
|
||||||
void findDumpFile(const char *path, char *fileName);
|
void findDumpFile(const char *path, char *fileName);
|
||||||
void loadPayload(u32 pressed);
|
void loadPayload(u32 pressed, bool needToInitScreens);
|
||||||
u32 firmRead(void *dest, u32 firmType);
|
u32 firmRead(void *dest, u32 firmType);
|
@ -26,12 +26,19 @@
|
|||||||
_start:
|
_start:
|
||||||
b start
|
b start
|
||||||
|
|
||||||
.word 0, 0
|
.global launchedFirmTIDLow
|
||||||
|
launchedFirmTIDLow:
|
||||||
|
.hword 0, 0, 0, 0, 0, 0, 0, 0
|
||||||
|
|
||||||
start:
|
start:
|
||||||
@ Change the stack pointer
|
@ Change the stack pointer
|
||||||
mov sp, #0x27000000
|
mov sp, #0x27000000
|
||||||
|
|
||||||
|
@ Disable interrupts
|
||||||
|
mrs r0, cpsr
|
||||||
|
orr r0, #0x1C0
|
||||||
|
msr cpsr_cx, r0
|
||||||
|
|
||||||
@ Disable caches / MPU
|
@ Disable caches / MPU
|
||||||
mrc p15, 0, r0, c1, c0, 0 @ read control register
|
mrc p15, 0, r0, c1, c0, 0 @ read control register
|
||||||
bic r0, #(1<<12) @ - instruction cache disable
|
bic r0, #(1<<12) @ - instruction cache disable
|
||||||
|
Reference in New Issue
Block a user