mirror of
https://github.com/rvtr/GodMode9i.git
synced 2025-11-02 00:11:07 -04:00
Properly allocate memory for RAM drive 1
This commit is contained in:
parent
7750ab47c0
commit
b9fcd7fa54
@ -339,7 +339,8 @@ void flashcardUnmount(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TWL_CODE void ramdrive1Mount(void) {
|
TWL_CODE void ramdrive1Mount(void) {
|
||||||
LZ77_Decompress((u8*)__9MB_lz77, (u8*)0x02500000);
|
ramdLoc = new u8[0x900200];
|
||||||
|
LZ77_Decompress((u8*)__9MB_lz77, ramdLoc);
|
||||||
fatMountSimple("ram1", &io_ram_drive);
|
fatMountSimple("ram1", &io_ram_drive);
|
||||||
ramdrive1Mounted = (access("ram1:/", F_OK) == 0);
|
ramdrive1Mounted = (access("ram1:/", F_OK) == 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
|
|
||||||
#include <nds.h>
|
#include <nds.h>
|
||||||
|
#include <nds/ndstypes.h>
|
||||||
#include <nds/disc_io.h>
|
#include <nds/disc_io.h>
|
||||||
#include "tonccpy.h"
|
#include "tonccpy.h"
|
||||||
|
|
||||||
#define SECTOR_SIZE 512
|
#define SECTOR_SIZE 512
|
||||||
|
|
||||||
|
u8* ramdLoc = (u8*)NULL;
|
||||||
|
|
||||||
bool ramd_startup() {
|
bool ramd_startup() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -14,12 +17,12 @@ bool ramd_is_inserted() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ramd_read_sectors(sec_t sector, sec_t numSectors, void *buffer) {
|
bool ramd_read_sectors(sec_t sector, sec_t numSectors, void *buffer) {
|
||||||
tonccpy(buffer, (void*)0x02500000+(sector << 9), numSectors << 9);
|
tonccpy(buffer, ramdLoc+(sector << 9), numSectors << 9);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ramd_write_sectors(sec_t sector, sec_t numSectors, const void *buffer) {
|
bool ramd_write_sectors(sec_t sector, sec_t numSectors, const void *buffer) {
|
||||||
tonccpy((void*)0x02500000+(sector << 9), buffer, numSectors << 9);
|
tonccpy(ramdLoc+(sector << 9), buffer, numSectors << 9);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <nds.h>
|
#include <nds.h>
|
||||||
|
#include <nds/ndstypes.h>
|
||||||
#include <nds/disc_io.h>
|
#include <nds/disc_io.h>
|
||||||
|
|
||||||
|
extern u8* ramdLoc;
|
||||||
|
|
||||||
extern const DISC_INTERFACE io_ram_drive;
|
extern const DISC_INTERFACE io_ram_drive;
|
||||||
extern const DISC_INTERFACE io_ram_drive2;
|
extern const DISC_INTERFACE io_ram_drive2;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user