diff --git a/arm9/source/driveOperations.cpp b/arm9/source/driveOperations.cpp index 621dd02..bc295f6 100644 --- a/arm9/source/driveOperations.cpp +++ b/arm9/source/driveOperations.cpp @@ -497,8 +497,7 @@ void flashcardUnmount(void) { void ramdriveMount(bool ram32MB) { if (isDSiMode() || REG_SCFG_EXT != 0) { - ramdSectors = ram32MB ? 0xE000 : 0x6000; // Main Memory - ramdSectors += 0x40; // Shared WRAM + ramdSectors = 0x8 + (ram32MB ? 0xE000 : 0x6000) + 0x40; // Main Memory + Shared WRAM WRAM_CR = 3; @@ -510,7 +509,7 @@ void ramdriveMount(bool ram32MB) { } else { ramdSectors += 0x400; - REG_MBK6=0x080037C0; + REG_MBK6 = 0x080037C0; *((vu32*)REG_MBK1) = 0x8C888480; *(vu32*)0x037C0000 = 0x49394D47; diff --git a/arm9/source/ramd.c b/arm9/source/ramd.c index 30f1752..a6b064d 100644 --- a/arm9/source/ramd.c +++ b/arm9/source/ramd.c @@ -25,7 +25,7 @@ void ramd_setSize(const bool ram32MB) { bool ramd_startup() { if(isDSiMode() || REG_SCFG_EXT != 0) { - ramdLoc = (u8*)malloc(0x6000 * SECTOR_SIZE); + ramdLoc = (u8*)malloc(0x6008 * SECTOR_SIZE); } else { ramdLoc = (u8*)calloc(0x8 * SECTOR_SIZE, 1); toncset(ramdLocMep, 0, (ramdSectors - 0x8) * SECTOR_SIZE); // Fill MEP with 00 to avoid displaying weird files @@ -46,20 +46,20 @@ bool ramd_read_sectors(sec_t sector, sec_t numSectors, void *buffer) { for(int i = 0; i < numSectors; i++, sector++) { if(isDSiMode() || REG_SCFG_EXT != 0) { if (largeSize) { - if(sector >= 0xE440) { - tonccpy(buffer + (i * SECTOR_SIZE), (void*)0x037C0000 + ((sector - 0xE440) * SECTOR_SIZE), SECTOR_SIZE); - } else if(sector >= 0xE000) { - tonccpy(buffer + (i * SECTOR_SIZE), (void*)0x036F8000 + ((sector - 0xE000) * SECTOR_SIZE), SECTOR_SIZE); - } else if(sector >= 0x6000) { - tonccpy(buffer + (i * SECTOR_SIZE), (void*)0x0D000000 + ((sector - 0x6000) * SECTOR_SIZE), SECTOR_SIZE); + if(sector >= 0xE448) { + tonccpy(buffer + (i * SECTOR_SIZE), (void*)0x037C0000 + ((sector - 0xE448) * SECTOR_SIZE), SECTOR_SIZE); + } else if(sector >= 0xE008) { + tonccpy(buffer + (i * SECTOR_SIZE), (void*)0x036F8000 + ((sector - 0xE008) * SECTOR_SIZE), SECTOR_SIZE); + } else if(sector >= 0x6008) { + tonccpy(buffer + (i * SECTOR_SIZE), (void*)0x0D000000 + ((sector - 0x6008) * SECTOR_SIZE), SECTOR_SIZE); } else { tonccpy(buffer + (i * SECTOR_SIZE), ramdLoc + (sector * SECTOR_SIZE), SECTOR_SIZE); } } else { - if(sector >= 0x6440) { - tonccpy(buffer + (i * SECTOR_SIZE), (void*)0x037C0000 + ((sector - 0x6440) * SECTOR_SIZE), SECTOR_SIZE); - } else if(sector >= 0x6000) { - tonccpy(buffer + (i * SECTOR_SIZE), (void*)0x036F8000 + ((sector - 0x6000) * SECTOR_SIZE), SECTOR_SIZE); + if(sector >= 0x6448) { + tonccpy(buffer + (i * SECTOR_SIZE), (void*)0x037C0000 + ((sector - 0x6448) * SECTOR_SIZE), SECTOR_SIZE); + } else if(sector >= 0x6008) { + tonccpy(buffer + (i * SECTOR_SIZE), (void*)0x036F8000 + ((sector - 0x6008) * SECTOR_SIZE), SECTOR_SIZE); } else { tonccpy(buffer + (i * SECTOR_SIZE), ramdLoc + (sector * SECTOR_SIZE), SECTOR_SIZE); } @@ -80,20 +80,20 @@ bool ramd_write_sectors(sec_t sector, sec_t numSectors, const void *buffer) { for(int i = 0; i < numSectors; i++, sector++) { if(isDSiMode() || REG_SCFG_EXT != 0) { if (largeSize) { - if(sector >= 0xE440) { - tonccpy((void*)0x037C0000 + ((sector - 0xE440) * SECTOR_SIZE), buffer + (i * SECTOR_SIZE), SECTOR_SIZE); - } else if(sector >= 0xE000) { - tonccpy((void*)0x036F8000 + ((sector - 0xE000) * SECTOR_SIZE), buffer + (i * SECTOR_SIZE), SECTOR_SIZE); - } else if(sector >= 0x6000) { - tonccpy((void*)0x0D000000 + ((sector - 0x6000) * SECTOR_SIZE), buffer + (i * SECTOR_SIZE), SECTOR_SIZE); + if(sector >= 0xE448) { + tonccpy((void*)0x037C0000 + ((sector - 0xE448) * SECTOR_SIZE), buffer + (i * SECTOR_SIZE), SECTOR_SIZE); + } else if(sector >= 0xE008) { + tonccpy((void*)0x036F8000 + ((sector - 0xE008) * SECTOR_SIZE), buffer + (i * SECTOR_SIZE), SECTOR_SIZE); + } else if(sector >= 0x6008) { + tonccpy((void*)0x0D000000 + ((sector - 0x6008) * SECTOR_SIZE), buffer + (i * SECTOR_SIZE), SECTOR_SIZE); } else { tonccpy(ramdLoc + (sector * SECTOR_SIZE), buffer + (i * SECTOR_SIZE), SECTOR_SIZE); } } else { - if(sector >= 0x6440) { - tonccpy((void*)0x037C0000 + ((sector - 0x6440) * SECTOR_SIZE), buffer + (i * SECTOR_SIZE), SECTOR_SIZE); - } else if(sector >= 0x6000) { - tonccpy((void*)0x036F8000 + ((sector - 0x6000) * SECTOR_SIZE), buffer + (i * SECTOR_SIZE), SECTOR_SIZE); + if(sector >= 0x6448) { + tonccpy((void*)0x037C0000 + ((sector - 0x6448) * SECTOR_SIZE), buffer + (i * SECTOR_SIZE), SECTOR_SIZE); + } else if(sector >= 0x6008) { + tonccpy((void*)0x036F8000 + ((sector - 0x6008) * SECTOR_SIZE), buffer + (i * SECTOR_SIZE), SECTOR_SIZE); } else { tonccpy(ramdLoc + (sector * SECTOR_SIZE), buffer + (i * SECTOR_SIZE), SECTOR_SIZE); }