forked from Mirror/GodMode9
Always format the RAM drive on reboots
This commit is contained in:
parent
3671e2eb8e
commit
b63de24c26
@ -17,18 +17,21 @@ bool InitSDCardFS() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool InitExtFS() {
|
bool InitExtFS() {
|
||||||
|
static bool ramdrv_ready = false;
|
||||||
|
|
||||||
for (u32 i = 1; i < NORM_FS; i++) {
|
for (u32 i = 1; i < NORM_FS; i++) {
|
||||||
char fsname[8];
|
char fsname[8];
|
||||||
snprintf(fsname, 7, "%lu:", i);
|
snprintf(fsname, 7, "%lu:", i);
|
||||||
if (fs_mounted[i]) continue;
|
if (fs_mounted[i]) continue;
|
||||||
fs_mounted[i] = (f_mount(fs + i, fsname, 1) == FR_OK);
|
fs_mounted[i] = (f_mount(fs + i, fsname, 1) == FR_OK);
|
||||||
if (!fs_mounted[i] && (i == NORM_FS - 1) && !(GetMountState() & IMG_NAND)) {
|
if ((!fs_mounted[i] || !ramdrv_ready) && (i == NORM_FS - 1) && !(GetMountState() & IMG_NAND)) {
|
||||||
u8* buffer = (u8*) malloc(STD_BUFFER_SIZE);
|
u8* buffer = (u8*) malloc(STD_BUFFER_SIZE);
|
||||||
if (!buffer) bkpt; // whatever, this won't go wrong anyways
|
if (!buffer) bkpt; // whatever, this won't go wrong anyways
|
||||||
f_mkfs(fsname, FM_ANY, 0, buffer, STD_BUFFER_SIZE); // format ramdrive if required
|
f_mkfs(fsname, FM_ANY, 0, buffer, STD_BUFFER_SIZE); // format ramdrive if required
|
||||||
free(buffer);
|
free(buffer);
|
||||||
f_mount(NULL, fsname, 1);
|
f_mount(NULL, fsname, 1);
|
||||||
fs_mounted[i] = (f_mount(fs + i, fsname, 1) == FR_OK);
|
fs_mounted[i] = (f_mount(fs + i, fsname, 1) == FR_OK);
|
||||||
|
ramdrv_ready = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SetupNandSdDrive("A:", "0:", "1:/private/movable.sed", 0);
|
SetupNandSdDrive("A:", "0:", "1:/private/movable.sed", 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user