Nyx: emuMMC Manage window, Tools UI, and misc updates
- Add gui_emu_tools: emuMMC Manage window with correct positioning (LV_PROTECT_PARENT + re-parent to win) - Tools: single SD button (tap = SD partition manager, 3s hold = eMMC) - Remove emuSD from Nyx UI (tabs, UMS, partition manager); keep bootloader emusd - Shorten Create emuMMC description text by one character - Storage/build/config and dependency updates Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -7,11 +7,39 @@
|
||||
/* storage control modules to the FatFs module with a defined API. */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
#include <string.h>
|
||||
#include "../../storage/emusd.h"
|
||||
#include <storage/sd.h>
|
||||
#include <storage/sdmmc.h>
|
||||
|
||||
#include <bdk.h>
|
||||
|
||||
#include <libs/fatfs/diskio.h> /* FatFs lower layer API */
|
||||
#include <fatfs_cfg.h>
|
||||
|
||||
static bool ensure_partition(BYTE pdrv){
|
||||
u8 part;
|
||||
switch(pdrv){
|
||||
case DRIVE_SD:
|
||||
return true;
|
||||
case DRIVE_BOOT1:
|
||||
case DRIVE_BOOT1_1MB:
|
||||
part = EMMC_BOOT1;
|
||||
break;
|
||||
case DRIVE_EMMC:
|
||||
part = EMMC_GPP;
|
||||
break;
|
||||
case DRIVE_EMUSD:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
if(emmc_storage.partition != part){
|
||||
return emmc_set_partition(part);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Get Drive Status */
|
||||
@@ -43,7 +71,33 @@ DRESULT disk_read (
|
||||
UINT count /* Number of sectors to read */
|
||||
)
|
||||
{
|
||||
return sdmmc_storage_read(&sd_storage, sector, count, buff) ? RES_OK : RES_ERROR;
|
||||
if(!ensure_partition(pdrv)){
|
||||
return RES_ERROR;
|
||||
}
|
||||
|
||||
sdmmc_storage_t *storage = &sd_storage;
|
||||
u32 actual_sector = sector;
|
||||
switch(pdrv){
|
||||
case DRIVE_SD:
|
||||
break;
|
||||
case DRIVE_BOOT1:
|
||||
case DRIVE_EMMC:
|
||||
storage = &emmc_storage;
|
||||
break;
|
||||
case DRIVE_BOOT1_1MB:
|
||||
storage = &emmc_storage;
|
||||
actual_sector = sector + (0x100000 / 512);
|
||||
break;
|
||||
case DRIVE_EMUSD:
|
||||
return emusd_storage_read(sector, count, buff) ? RES_OK : RES_ERROR;
|
||||
break;
|
||||
default:
|
||||
return RES_ERROR;
|
||||
|
||||
}
|
||||
|
||||
|
||||
return sdmmc_storage_read(storage, actual_sector, count, buff) ? RES_OK : RES_ERROR;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
@@ -56,7 +110,32 @@ DRESULT disk_write (
|
||||
UINT count /* Number of sectors to write */
|
||||
)
|
||||
{
|
||||
return sdmmc_storage_write(&sd_storage, sector, count, (void *)buff) ? RES_OK : RES_ERROR;
|
||||
if(!ensure_partition(pdrv)){
|
||||
return RES_ERROR;
|
||||
}
|
||||
|
||||
sdmmc_storage_t *storage = &sd_storage;
|
||||
u32 actual_sector = sector;
|
||||
switch(pdrv){
|
||||
case DRIVE_SD:
|
||||
break;
|
||||
case DRIVE_BOOT1:
|
||||
case DRIVE_EMMC:
|
||||
storage = &emmc_storage;
|
||||
break;
|
||||
case DRIVE_BOOT1_1MB:
|
||||
storage = &emmc_storage;
|
||||
actual_sector = sector + (0x100000 / 512);
|
||||
break;
|
||||
case DRIVE_EMUSD:
|
||||
return emusd_storage_write(sector, count, (void*)buff) ? RES_OK : RES_ERROR;
|
||||
default:
|
||||
return RES_ERROR;
|
||||
|
||||
}
|
||||
|
||||
|
||||
return sdmmc_storage_write(storage, actual_sector, count, (void*)buff) ? RES_OK : RES_ERROR;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user