diff --git a/arm9/source/driveMenu.cpp b/arm9/source/driveMenu.cpp index 46cd006..4eab364 100644 --- a/arm9/source/driveMenu.cpp +++ b/arm9/source/driveMenu.cpp @@ -335,7 +335,7 @@ void driveMenu (void) { } } else if (dmOperations[dmCursorPosition] == DriveMenuOperation::ndsCard && (sdMounted || flashcardMounted)) { ndsCardDump(); - } else if (dmOperations[dmCursorPosition] == DriveMenuOperation::ramDrive && isDSiMode() && ramdriveMounted) { + } else if (dmOperations[dmCursorPosition] == DriveMenuOperation::ramDrive && ramdriveMounted) { currentDrive = Drive::ramDrive; chdir("ram:/"); screenMode = 1; diff --git a/arm9/source/driveOperations.cpp b/arm9/source/driveOperations.cpp index 466a760..5511872 100644 --- a/arm9/source/driveOperations.cpp +++ b/arm9/source/driveOperations.cpp @@ -323,7 +323,7 @@ void ramdriveMount(bool ram32MB) { if(isDSiMode()) { ramdSectors = ram32MB ? 0xC800 : 0x4800; } else { - ramdSectors = 0x4000; + ramdSectors = 0x8 + 0x4000; } fatMountSimple("ram", &io_ram_drive); diff --git a/arm9/source/ramd.c b/arm9/source/ramd.c index 32dce53..47de021 100644 --- a/arm9/source/ramd.c +++ b/arm9/source/ramd.c @@ -15,12 +15,14 @@ const static u8 bootSector[] = { u32 ramdSectors = 0; u8* ramdLoc = (u8*)NULL; +u8* ramdLocMep = (u8*)NULL; bool ramd_startup() { if(isDSiMode()) { ramdLoc = (u8*)malloc(0x4800 * SECTOR_SIZE); } else { - ramdLoc = (u8*)0x09000000; + ramdLoc = (u8*)malloc(0x8 * SECTOR_SIZE); + ramdLocMep = (u8*)0x09000000; } tonccpy(ramdLoc, bootSector, sizeof(bootSector)); @@ -43,9 +45,12 @@ bool ramd_read_sectors(sec_t sector, sec_t numSectors, void *buffer) { tonccpy(buffer, (void*)0x0D000000 + ((sector - 0x4800) << 9), numSectors << 9); return true; } - } else if(sector < ramdSectors) { + } else if(sector < 0x8) { tonccpy(buffer, ramdLoc + (sector << 9), numSectors << 9); return true; + } else if(sector <= ramdSectors - 0x8) { + tonccpy(buffer, ramdLocMep + ((sector - 0x8) << 9), numSectors << 9); + return true; } return false; @@ -60,9 +65,12 @@ bool ramd_write_sectors(sec_t sector, sec_t numSectors, const void *buffer) { tonccpy((void*)0x0D000000 + ((sector - 0x4800) << 9), buffer, numSectors << 9); return true; } - } else if(sector < ramdSectors) { + } else if(sector < 0x8) { tonccpy(ramdLoc + (sector << 9), buffer, numSectors << 9); return true; + } else if(sector <= ramdSectors - 0x8) { + tonccpy(ramdLocMep + ((sector - 0x8) << 9), buffer, numSectors << 9); + return true; } return false;