Equalize hekate main and Nyx sd based functions

This commit is contained in:
CTCaer
2020-06-13 18:32:40 +03:00
parent 7dd3178d48
commit 21548545fc
29 changed files with 167 additions and 103 deletions

View File

@@ -120,7 +120,7 @@ bool sd_initialize(bool power_cycle)
}
else
{
sd_errors[0]++; // Increment init errors.
sd_errors[SD_ERROR_INIT_FAIL]++;
if (sd_mode == SD_INIT_FAIL)
break;
@@ -146,6 +146,7 @@ bool sd_mount()
if (res)
{
gfx_con.mute = false;
EPRINTF("Failed to init SD card.");
if (!sdmmc_get_sd_inserted())
EPRINTF("Make sure that it is inserted.");
@@ -163,6 +164,7 @@ bool sd_mount()
}
else
{
gfx_con.mute = false;
EPRINTFARGS("Failed to mount SD card (FatFS Error %d).\nMake sure that a FAT partition exists..", res);
}
}
@@ -170,7 +172,7 @@ bool sd_mount()
return false;
}
void sd_unmount(bool deinit)
static void _sd_deinit(bool deinit)
{
if (sd_mode == SD_INIT_FAIL)
sd_mode = SD_UHS_SDR104;
@@ -187,6 +189,9 @@ void sd_unmount(bool deinit)
}
}
void sd_unmount() { _sd_deinit(false); }
void sd_end() { _sd_deinit(true); }
void *sd_file_read(const char *path, u32 *fsize)
{
FIL fp;

View File

@@ -49,7 +49,8 @@ u32 sd_get_mode();
int sd_init_retry(bool power_cycle);
bool sd_initialize(bool power_cycle);
bool sd_mount();
void sd_unmount(bool deinit);
void sd_unmount();
void sd_end();
void *sd_file_read(const char *path, u32 *fsize);
int sd_save_to_file(void *buf, u32 size, const char *filename);