diff --git a/source/arm11/config.c b/source/arm11/config.c index fee3f5b..c048679 100644 --- a/source/arm11/config.c +++ b/source/arm11/config.c @@ -129,6 +129,7 @@ s32 file; u32 fileSize; bool SdPresent; + bool adpotChanges = false; bool createFile = false; if(filebuf) @@ -144,12 +145,19 @@ if(SdPresent) { filepath = SdmcFilepath; - - // does the config file exist? - if(fStat(filepath, &fileStat) != FR_OK) + + // does the config file not exist yet? + if(fStat(SdmcFilepath, &fileStat) != FR_OK) { + if(fStat(NandFilepath, &fileStat) == FR_OK) + { + /* no config on SD, but there is one on the NAND, + so just load it and save it later on. */ + adpotChanges = true; + } + createFile = true; - } + } } else /* use NAND */ { @@ -167,7 +175,13 @@ if(!createConfigFile()) return false; - // does it work now? + if(adpotChanges) + { + // created file on SD, load config from NAND + filepath = NandFilepath; + } + + // retrieve size if(fStat(filepath, &fileStat) != FR_OK) return false; } @@ -212,6 +226,13 @@ if(!parseConfigFile()) goto fail; + // we loaded a file we want to adpot? + if(adpotChanges) + { + filepath = SdmcFilepath; + configDirty = true; + } + return true; fail: diff --git a/source/arm9/fs.c b/source/arm9/fs.c index 7f37b8a..0067764 100644 --- a/source/arm9/fs.c +++ b/source/arm9/fs.c @@ -294,7 +294,7 @@ s32 fCreateDeviceBuffer(u32 size) { - if(!size || size > 0x80000) return -30; + if(!size || size > 0x180000) return -30; if(devBuf.mem) return -31; if(!devBufAllocate(&devBuf, size)) diff --git a/source/arm9/start.s b/source/arm9/start.s index 7bd961e..372abf0 100644 --- a/source/arm9/start.s +++ b/source/arm9/start.s @@ -98,7 +98,13 @@ sub r1, r1, r0 bl clearMem @ Setup newlib heap + mov r0, #IO_MEM_BASE @ CFG9 regs + ldr r1, [r0, #0xFFC] @ REG_CFG9_MPCORECFG + tst r1, #2 @ Test for New 3DS bit + movne r1, #1 + strne r1, [r0, #0x200] @ REG_CFG9_EXTMENTCNT9 mov r0, #A9_HEAP_END + addne r0, #A9_RAM_N3DS_EXT_SIZE ldr r1, =fake_heap_end str r0, [r1] blx __libc_init_array @ Initialize ctors and dtors