hekate/nyx: adjust handling of sdmmc return values
This commit is contained in:
@@ -65,7 +65,7 @@ void print_mmc_info()
|
||||
|
||||
static const u32 SECTORS_TO_MIB_COEFF = 11;
|
||||
|
||||
if (!emmc_initialize(false))
|
||||
if (emmc_initialize(false))
|
||||
{
|
||||
EPRINTF("Failed to init eMMC.");
|
||||
goto out;
|
||||
@@ -194,7 +194,7 @@ void print_sdcard_info()
|
||||
gfx_clear_partial_grey(0x1B, 0, 1256);
|
||||
gfx_con_setpos(0, 0);
|
||||
|
||||
if (sd_initialize(false))
|
||||
if (!sd_initialize(false))
|
||||
{
|
||||
gfx_printf("%kCard IDentification:%k\n", TXT_CLR_CYAN_L, TXT_CLR_DEFAULT);
|
||||
gfx_printf(
|
||||
|
||||
@@ -110,7 +110,7 @@ void menu_autorcm()
|
||||
return;
|
||||
}
|
||||
|
||||
if (!emmc_initialize(false))
|
||||
if (emmc_initialize(false))
|
||||
{
|
||||
EPRINTF("Failed to init eMMC.");
|
||||
btn_wait();
|
||||
|
||||
@@ -137,12 +137,12 @@ static int _hos_eks_rw_try(u8 *buf, bool write)
|
||||
{
|
||||
if (!write)
|
||||
{
|
||||
if (sdmmc_storage_read(&sd_storage, 0, 1, buf))
|
||||
if (!sdmmc_storage_read(&sd_storage, 0, 1, buf))
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sdmmc_storage_write(&sd_storage, 0, 1, buf))
|
||||
if (!sdmmc_storage_write(&sd_storage, 0, 1, buf))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ DRESULT disk_read (
|
||||
UINT count /* Number of sectors to read */
|
||||
)
|
||||
{
|
||||
return sdmmc_storage_read(&sd_storage, sector, count, buff) ? RES_OK : RES_ERROR;
|
||||
return sdmmc_storage_read(&sd_storage, sector, count, buff);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
@@ -56,7 +56,7 @@ DRESULT disk_write (
|
||||
UINT count /* Number of sectors to write */
|
||||
)
|
||||
{
|
||||
return sdmmc_storage_write(&sd_storage, sector, count, (void *)buff) ? RES_OK : RES_ERROR;
|
||||
return sdmmc_storage_write(&sd_storage, sector, count, (void *)buff);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
@@ -228,7 +228,7 @@ static void _launch_payloads()
|
||||
gfx_clear_grey(0x1B);
|
||||
gfx_con_setpos(0, 0);
|
||||
|
||||
if (!sd_mount())
|
||||
if (sd_mount())
|
||||
goto failed_sd_mount;
|
||||
|
||||
ments = (ment_t *)malloc(sizeof(ment_t) * (max_entries + 3));
|
||||
@@ -310,7 +310,7 @@ static void _launch_ini_list()
|
||||
gfx_clear_grey(0x1B);
|
||||
gfx_con_setpos(0, 0);
|
||||
|
||||
if (!sd_mount())
|
||||
if (sd_mount())
|
||||
goto parse_failed;
|
||||
|
||||
// Check that ini files exist and parse them.
|
||||
@@ -440,7 +440,7 @@ static void _launch_config()
|
||||
gfx_clear_grey(0x1B);
|
||||
gfx_con_setpos(0, 0);
|
||||
|
||||
if (!sd_mount())
|
||||
if (sd_mount())
|
||||
goto parse_failed;
|
||||
|
||||
// Load emuMMC configuration.
|
||||
@@ -1466,7 +1466,7 @@ void ipl_main()
|
||||
bpmp_clk_rate_set(h_cfg.t210b01 ? ipl_ver.rcfg.bclk_t210b01 : ipl_ver.rcfg.bclk_t210);
|
||||
|
||||
// Mount SD Card.
|
||||
if (!sd_mount())
|
||||
if (sd_mount())
|
||||
h_cfg.errors |= ERR_SD_BOOT_EN;
|
||||
|
||||
// Check if watchdog was fired previously.
|
||||
|
||||
@@ -137,13 +137,13 @@ int emummc_storage_init_mmc()
|
||||
emu_cfg.active_part = 0;
|
||||
|
||||
// Always init eMMC even when in emuMMC. eMMC is needed from the emuMMC driver anyway.
|
||||
if (!emmc_initialize(false))
|
||||
if (emmc_initialize(false))
|
||||
return 2;
|
||||
|
||||
if (!emu_cfg.enabled || h_cfg.emummc_force_disable)
|
||||
return 0;
|
||||
|
||||
if (!sd_mount())
|
||||
if (sd_mount())
|
||||
goto out;
|
||||
|
||||
if (!emu_cfg.sector)
|
||||
@@ -180,7 +180,7 @@ int emummc_storage_end()
|
||||
else
|
||||
sd_end();
|
||||
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int emummc_storage_read(u32 sector, u32 num_sectors, void *buf)
|
||||
@@ -211,21 +211,19 @@ int emummc_storage_read(u32 sector, u32 num_sectors, void *buf)
|
||||
if (f_open(&fp, emu_cfg.emummc_file_based_path, FA_READ))
|
||||
{
|
||||
EPRINTF("Failed to open emuMMC image.");
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
f_lseek(&fp, (u64)sector << 9);
|
||||
if (f_read(&fp, buf, (u64)num_sectors << 9, NULL))
|
||||
{
|
||||
EPRINTF("Failed to read emuMMC image.");
|
||||
f_close(&fp);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
f_close(&fp);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int emummc_storage_write(u32 sector, u32 num_sectors, void *buf)
|
||||
@@ -255,17 +253,17 @@ int emummc_storage_write(u32 sector, u32 num_sectors, void *buf)
|
||||
}
|
||||
|
||||
if (f_open(&fp, emu_cfg.emummc_file_based_path, FA_WRITE))
|
||||
return 0;
|
||||
return 1;
|
||||
|
||||
f_lseek(&fp, (u64)sector << 9);
|
||||
if (f_write(&fp, buf, (u64)num_sectors << 9, NULL))
|
||||
{
|
||||
f_close(&fp);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
f_close(&fp);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,7 +273,7 @@ int emummc_storage_set_mmc_partition(u32 partition)
|
||||
emmc_set_partition(partition);
|
||||
|
||||
if (!emu_cfg.enabled || h_cfg.emummc_force_disable || emu_cfg.sector)
|
||||
return 1;
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
strcpy(emu_cfg.emummc_file_based_path, emu_cfg.path);
|
||||
@@ -294,8 +292,6 @@ int emummc_storage_set_mmc_partition(u32 partition)
|
||||
break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user