fusee: read from emuSD, if enabled

This commit is contained in:
Christoph Baumann
2025-05-15 13:32:40 +02:00
parent 40bb434a64
commit 6f3f468a5b
24 changed files with 747 additions and 404 deletions

View File

@@ -63,7 +63,8 @@ DRESULT disk_read (
return diskio_read_boot1(buff, count * 512, sector, count) ? RES_OK : RES_ERROR;
case DRIVE_BOOT1_OFF:
return diskio_read_boot1(buff, count * 512, sector + BOOT1_OFFSET_SCT_1MB, count) ? RES_OK : RES_ERROR;
case DRIVE_EMUSD:
return diskio_read_emusd(buff, count * 512, sector, count) ? RES_OK : RES_ERROR;
default:
return RES_PARERR;
}
@@ -93,6 +94,8 @@ DRESULT disk_write (
return diskio_write_boot1(sector, count, buff, count * 512) ? RES_OK : RES_ERROR;
case DRIVE_BOOT1_OFF:
return diskio_write_boot1(sector + DRIVE_BOOT1_OFF, count, buff, count * 512) ? RES_OK : RES_ERROR;
case DRIVE_EMUSD:
return diskio_write_emusd(sector, count, buff, count * 512) ? RES_OK : RES_ERROR;
default:
return RES_PARERR;
}

View File

@@ -27,6 +27,7 @@ typedef enum {
DRIVE_SYS,
DRIVE_BOOT1,
DRIVE_BOOT1_OFF,
DRIVE_EMUSD,
} DDRIVE;

View File

@@ -22,6 +22,9 @@ extern "C" {
bool diskio_read_sd_card(void *dst, size_t size, size_t sector_index, size_t sector_count);
bool diskio_write_sd_card(size_t sector_index, size_t sector_count, const void *src, size_t size);
bool diskio_read_emusd(void *dst, size_t size, size_t sector_index, size_t sector_count);
bool diskio_write_emusd(size_t sector_index, size_t sector_count, const void *src, size_t size);
bool diskio_read_system(void *dst, size_t size, size_t sector_index, size_t sector_count);
bool diskio_write_system(size_t sector_index, size_t sector_count, const void *src, size_t size);

View File

@@ -163,12 +163,12 @@
/ Drive/Volume Configurations
/---------------------------------------------------------------------------*/
#define FF_VOLUMES 4
#define FF_VOLUMES 5
/* Number of volumes (logical drives) to be used. (1-10) */
#define FF_STR_VOLUME_ID 1
#define FF_VOLUME_STRS "sdmc","sys","boot1","boot1_off"
#define FF_VOLUME_STRS "sdmc","sys","boot1","boot1_off","emusd"
/* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings.
/ When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive
/ number in the path name. FF_VOLUME_STRS defines the volume ID strings for each

View File

@@ -17,6 +17,7 @@
#include "diskio_cpp.h"
#include "../fusee_sd_card.hpp"
#include "../fusee_mmc.hpp"
#include "../fusee_emusd.hpp"
bool diskio_read_sd_card(void *dst, size_t size, size_t sector_index, size_t sector_count) {
return R_SUCCEEDED(::ams::nxboot::ReadSdCard(dst, size, sector_index, sector_count));
@@ -42,4 +43,12 @@ bool diskio_read_boot1(void *dst, size_t size, size_t sector_index, size_t secto
bool diskio_write_boot1(size_t sector_index, size_t sector_count, const void *src, size_t size) {
/* Don't allow writes to eMMC BOOT1 */
return false;
}
}
bool diskio_read_emusd(void *dst, size_t size, size_t sector_index, size_t sector_count) {
return R_SUCCEEDED(::ams::nxboot::ReadEmuSd(dst, size, sector_index, sector_count));
}
bool diskio_write_emusd(size_t sector_index, size_t sector_count, const void *src, size_t size) {
return R_SUCCEEDED(::ams::nxboot::WriteEmuSd(sector_index, sector_count, src, size));
}