From 1aaa1d71a49c2cfa4f5d897991b5edd3099f44d9 Mon Sep 17 00:00:00 2001 From: 44670 <44670@44670.org> Date: Fri, 10 Feb 2017 21:39:00 +0800 Subject: [PATCH] 3.1 --- source/main.c | 26 +++++++++++++++++++++----- source/ntr_config.h | 7 +++++++ 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/source/main.c b/source/main.c index 2a18edb..c09486c 100644 --- a/source/main.c +++ b/source/main.c @@ -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); @@ -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; @@ -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."); @@ -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(); diff --git a/source/ntr_config.h b/source/ntr_config.h index 1b71e1e..02f30cb 100644 --- a/source/ntr_config.h +++ b/source/ntr_config.h @@ -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;