From 78dbc95b6023c52f011728916cf486bd0ec21d1c Mon Sep 17 00:00:00 2001 From: d0k3 Date: Tue, 1 Aug 2017 01:16:15 +0200 Subject: [PATCH] Fix mounting images from drives 8: / 9: --- source/filesys/fsinit.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/filesys/fsinit.c b/source/filesys/fsinit.c index a49296d..b710d0b 100644 --- a/source/filesys/fsinit.c +++ b/source/filesys/fsinit.c @@ -34,13 +34,21 @@ bool InitExtFS() { } bool InitImgFS(const char* path) { + // find drive # of the last image FAT drive + u32 drv_i = NORM_FS - IMGN_FS; + for (; drv_i < NORM_FS; drv_i++) { + char fsname[8]; + snprintf(fsname, 7, "%lu:", drv_i); + if (!(DriveType(fsname)&DRV_IMAGE)) + break; + } // deinit image filesystem DismountDriveType(DRV_IMAGE); // (re)mount image, done if path == NULL MountImage(path); InitVirtualImageDrive(); // reinit image filesystem - for (u32 i = NORM_FS - IMGN_FS; i < NORM_FS; i++) { + for (u32 i = NORM_FS - IMGN_FS; i < drv_i; i++) { char fsname[8]; snprintf(fsname, 7, "%lu:", i); fs_mounted[i] = (f_mount(fs + i, fsname, 1) == FR_OK);