Changed payload offset, added clearScreen function, etc.
This commit is contained in:
parent
afbdf20d28
commit
4f3761d4a5
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,6 +2,7 @@ build.bat
|
|||||||
data/firmware.bin
|
data/firmware.bin
|
||||||
out
|
out
|
||||||
mset
|
mset
|
||||||
|
rnInstaller
|
||||||
build
|
build
|
||||||
*.bin
|
*.bin
|
||||||
*.3dsx
|
*.3dsx
|
||||||
|
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -1,3 +1,3 @@
|
|||||||
[submodule "mset"]
|
[submodule "mset"]
|
||||||
path = mset
|
path = mset
|
||||||
url = git@github.com:Reisyukaku/mset.git
|
url = https://github.com/Reisyukaku/mset
|
||||||
|
2
Makefile
2
Makefile
@ -54,7 +54,7 @@ clean:
|
|||||||
.PHONY: $(dir_out)/ReiNand.dat
|
.PHONY: $(dir_out)/ReiNand.dat
|
||||||
$(dir_out)/ReiNand.dat: $(dir_build)/main.bin $(dir_out)/rei/
|
$(dir_out)/ReiNand.dat: $(dir_build)/main.bin $(dir_out)/rei/
|
||||||
@$(MAKE) $(FLAGS) -C $(dir_mset) launcher
|
@$(MAKE) $(FLAGS) -C $(dir_mset) launcher
|
||||||
dd if=$(dir_build)/main.bin of=$@ bs=512 seek=256
|
dd if=$(dir_build)/main.bin of=$@ bs=512 seek=144
|
||||||
|
|
||||||
$(dir_out)/3ds/ReiNand:
|
$(dir_out)/3ds/ReiNand:
|
||||||
@mkdir -p "$(dir_out)/3ds/ReiNand"
|
@mkdir -p "$(dir_out)/3ds/ReiNand"
|
||||||
|
@ -15,7 +15,7 @@ Pre-compiled version can still be found on my [pastebin](http://pastebin.com/c5A
|
|||||||
|
|
||||||
**Features:**
|
**Features:**
|
||||||
|
|
||||||
* Ninjhax only (working mset soon)
|
* Ninjhax and MSET support!
|
||||||
|
|
||||||
* Sig checks disabled
|
* Sig checks disabled
|
||||||
|
|
||||||
|
2
mset
2
mset
@ -1 +1 @@
|
|||||||
Subproject commit 46b7209b06c18680766201d76907b9ad8fafb914
|
Subproject commit 5619a453384ab5c914dff0451b8da0f02ee102ce
|
@ -21,7 +21,7 @@ s32 main (void) {
|
|||||||
|
|
||||||
FILE *fp = fopen("/reiNand.dat", "r");
|
FILE *fp = fopen("/reiNand.dat", "r");
|
||||||
if (!fp) goto exit;
|
if (!fp) goto exit;
|
||||||
fseek(fp, 0x20000, SEEK_SET);
|
fseek(fp, 0x12000, SEEK_SET);
|
||||||
fread(payload, payload_size, 1, fp);
|
fread(payload, payload_size, 1, fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
|
@ -6,6 +6,13 @@
|
|||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
|
|
||||||
|
void clearScreen(void){
|
||||||
|
memset(fb->top_left, 0, 0x38400);
|
||||||
|
memset(fb->top_right, 0, 0x38400);
|
||||||
|
memset(fb->bottom, 0, 0x38400);
|
||||||
|
}
|
||||||
|
|
||||||
void loadSplash(void){
|
void loadSplash(void){
|
||||||
|
clearScreen();
|
||||||
fileRead(fb->top_left, "/rei/splash.bin", 0x46500);
|
fileRead(fb->top_left, "/rei/splash.bin", 0x46500);
|
||||||
}
|
}
|
@ -11,4 +11,5 @@ static struct fb {
|
|||||||
u8 *bottom;
|
u8 *bottom;
|
||||||
} *fb = (struct fb *)0x23FFFE00;
|
} *fb = (struct fb *)0x23FFFE00;
|
||||||
|
|
||||||
|
void clearScreen(void);
|
||||||
void loadSplash(void);
|
void loadSplash(void);
|
@ -53,17 +53,18 @@ void patchFirm(void){
|
|||||||
|
|
||||||
void launchFirm(void){
|
void launchFirm(void){
|
||||||
//Set MPU
|
//Set MPU
|
||||||
__asm__ (
|
|
||||||
"msr cpsr_c, #0xDF\n\t"
|
__asm__ (
|
||||||
"ldr r0, =0x10000035\n\t"
|
"msr cpsr_c, #0xDF\n\t" //Set system mode, disable interrupts
|
||||||
"ldr r4, =0x18000035\n\t"
|
"ldr r0, =0x10000035\n\t" //Memory area 0x10000000-0x18000000, enabled, 128MB
|
||||||
"mcr p15, 0, r0, c6, c3, 0\n\t"
|
"ldr r4, =0x18000035\n\t" //Memory area 0x18000000-0x20000000, enabled, 128MB
|
||||||
"mcr p15, 0, r4, c6, c4, 0\n\t"
|
"mcr p15, 0, r0, c6, c3, 0\n\t" //Set memory area 3 (0x10000000-0x18000000)
|
||||||
"mrc p15, 0, r0, c2, c0, 0\n\t"
|
"mcr p15, 0, r4, c6, c4, 0\n\t" //Set memory area 4 (0x18000000-0x20000000)
|
||||||
"mrc p15, 0, r4, c2, c0, 1\n\t"
|
"mrc p15, 0, r0, c2, c0, 0\n\t" //read data cacheable bit
|
||||||
"mrc p15, 0, r1, c3, c0, 0\n\t"
|
"mrc p15, 0, r4, c2, c0, 1\n\t" //read inst cacheable bit
|
||||||
"mrc p15, 0, r2, c5, c0, 2\n\t"
|
"mrc p15, 0, r1, c3, c0, 0\n\t" //read data writeable
|
||||||
"mrc p15, 0, r3, c5, c0, 3\n\t"
|
"mrc p15, 0, r2, c5, c0, 2\n\t" //read data access permission
|
||||||
|
"mrc p15, 0, r3, c5, c0, 3\n\t" //read inst access permission
|
||||||
"orr r0, r0, #0x30\n\t"
|
"orr r0, r0, #0x30\n\t"
|
||||||
"orr r4, r4, #0x30\n\t"
|
"orr r4, r4, #0x30\n\t"
|
||||||
"orr r1, r1, #0x30\n\t"
|
"orr r1, r1, #0x30\n\t"
|
||||||
@ -71,13 +72,14 @@ void launchFirm(void){
|
|||||||
"bic r3, r3, #0xF0000\n\t"
|
"bic r3, r3, #0xF0000\n\t"
|
||||||
"orr r2, r2, #0x30000\n\t"
|
"orr r2, r2, #0x30000\n\t"
|
||||||
"orr r3, r3, #0x30000\n\t"
|
"orr r3, r3, #0x30000\n\t"
|
||||||
"mcr p15, 0, r0, c2, c0, 0\n\t"
|
"mcr p15, 0, r0, c2, c0, 0\n\t" //write data cacheable bit
|
||||||
"mcr p15, 0, r4, c2, c0, 1\n\t"
|
"mcr p15, 0, r4, c2, c0, 1\n\t" //write inst cacheable bit
|
||||||
"mcr p15, 0, r1, c3, c0, 0\n\t"
|
"mcr p15, 0, r1, c3, c0, 0\n\t" //write data writeable
|
||||||
"mcr p15, 0, r2, c5, c0, 2\n\t"
|
"mcr p15, 0, r2, c5, c0, 2\n\t" //write data access permission
|
||||||
"mcr p15, 0, r3, c5, c0, 3\n\t"
|
"mcr p15, 0, r3, c5, c0, 3\n\t" //write inst access permission
|
||||||
::: "r0", "r1", "r2", "r3", "r4"
|
::: "r0", "r1", "r2", "r3", "r4"
|
||||||
);
|
);
|
||||||
|
|
||||||
//Copy firm partitions to respective memory locations
|
//Copy firm partitions to respective memory locations
|
||||||
memcpy(section[0].address, (u8*)firmLocation + section[0].offset, section[0].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[1].address, (u8*)firmLocation + section[1].offset, section[1].size);
|
||||||
|
@ -56,7 +56,7 @@ u32 threadCode = KERNEL9 + (0x0801A6E0 - K9_ADDR);
|
|||||||
u32 threadHook1 = PROC9 + (0x080860B0 - P9_ADDR);
|
u32 threadHook1 = PROC9 + (0x080860B0 - P9_ADDR);
|
||||||
u32 threadHook2 = PROC9 + (0x080860E4 - P9_ADDR);
|
u32 threadHook2 = PROC9 + (0x080860E4 - P9_ADDR);
|
||||||
//Patches
|
//Patches
|
||||||
u8 th1[4] = {0x2C, 0xF0, 0x9F, 0xE5};
|
u8 th1[4] = {0x2C, 0xF0, 0x9F, 0xE5}; //ldr pc, =0x080860E4
|
||||||
u8 th2[4] = {0xE0, 0xA6, 0x01, 0x08};
|
u8 th2[4] = {0xE0, 0xA6, 0x01, 0x08};
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -4,6 +4,7 @@
|
|||||||
extern unsigned int fopen9(void *handle, wchar_t* name, unsigned int flag);
|
extern unsigned int fopen9(void *handle, wchar_t* name, unsigned int flag);
|
||||||
extern void fwrite9(void* handle, unsigned int* bytesWritten, void* dst, unsigned int size);
|
extern void fwrite9(void* handle, unsigned int* bytesWritten, void* dst, unsigned int size);
|
||||||
extern void fread9(void* handle, unsigned int* bytesRead, void *src, unsigned int size);
|
extern void fread9(void* handle, unsigned int* bytesRead, void *src, unsigned int size);
|
||||||
|
extern void fsize9(void *handle, long *size);
|
||||||
extern void fclose9(void *handle);
|
extern void fclose9(void *handle);
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -39,3 +39,13 @@
|
|||||||
blx r4
|
blx r4
|
||||||
pop {r4, pc}
|
pop {r4, pc}
|
||||||
.pool
|
.pool
|
||||||
|
|
||||||
|
.thumb
|
||||||
|
.global fsize9
|
||||||
|
.type fsize9, %function
|
||||||
|
fsize9:
|
||||||
|
push {r4, lr}
|
||||||
|
ldr r4, =0x0805C175
|
||||||
|
blx r4
|
||||||
|
pop {r4, pc}
|
||||||
|
.pool
|
Reference in New Issue
Block a user