Skip to content
This repository has been archived by the owner on Jan 11, 2021. It is now read-only.

Commit

Permalink
3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
44670 committed Feb 10, 2017
1 parent d3026e0 commit 1aaa1d7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
26 changes: 21 additions & 5 deletions source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,13 @@ Result bnPatchAccessCheck() {

Result bnLoadAndExecuteNTR() {
u32 ret;


char pathBuf[64];
sprintf(pathBuf, "sdmc:%s", ntrConfig->ntrFilePath);

// fsInit();
FILE *file = fopen("sdmc:/ntr.bin","rb");
FILE *file = fopen(pathBuf,"rb");
if (file == 0) {
printf("open ntr.bin failed\n");
printf("open %s failed\n", ntrConfig->ntrFilePath);
return RESULT_ERROR;
}
fseek(file,0,SEEK_END);
Expand Down Expand Up @@ -514,6 +515,7 @@ Result bnBootNTR() {

bnInitParamsByHomeMenu();
ntrConfig->HomeMenuVersion = SYSTEM_VERSION(1, 0, 0);

if (validateHomeMenuParams() != 0) {
// Home menu Params is not complete, should be considered as unsupported
ntrConfig->HomeMenuVersion = 0;
Expand All @@ -522,6 +524,20 @@ Result bnBootNTR() {
showMsgPaused("ERROR: unknown Home Menu");
}

ntrConfig->memMode = NTR_MEMMODE_DEFAULT;
if (!ntrConfig->isNew3DS) {
strcpy(ntrConfig->ntrFilePath, "/ntr.o3ds.bin");
if (APP_MEMTYPE != 0) {
ntrConfig->memMode = NTR_MEMMODE_BASE;
}
} else {
strcpy(ntrConfig->ntrFilePath, "/ntr.n3ds.bin");
}





// load and execute ntr.bin, if firmware/home menu is unsupported, it will start ram dumping
if ((ntrConfig->HomeMenuVersion == 0) || (ntrConfig->firmVersion == 0)) {
showMsg("Press X if you want to start ram dumping.");
Expand All @@ -548,7 +564,7 @@ int main() {
consoleInit(GFX_BOTTOM, NULL);


printf("BootNTR 3.0\n");
printf("BootNTR 3.1\n");
ntrConfig = &g_ntrConfig;
bnConfig = &g_bnConfig;
ret = bnBootNTR();
Expand Down
7 changes: 7 additions & 0 deletions source/ntr_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,15 @@ typedef struct _NTR_CONFIG {
u32 arm11BinStart;
u32 arm11BinSize;
u32 ShowDbgFunc;

u32 memMode;
char ntrFilePath[32];
} NTR_CONFIG;

#define NTR_MEMMODE_DEFAULT (0)
#define NTR_MEMMODE_BASE (3)


typedef struct _BOOTNTR_CONFIG {
u32 FSPatchAddr;
u32 SMPatchAddr;
Expand Down

0 comments on commit 1aaa1d7

Please sign in to comment.