emummc: Add boot entry emuMMC selection
Using the key `emupath` on a boot entry will load the selected emuMMC. This can also be forced by using the correct boot cfg storage bit and writing the path at the emummc path offset. Check readme for these. This can only be used if the emuMMC was created via Nyx. because of the raw_based and file_based files that have emuMMC info. (emupath=emuMMC/RAW1, emupath=emuMMC/SD00, etc)
This commit is contained in:
@@ -38,7 +38,6 @@ extern void sd_unmount();
|
||||
|
||||
void emummc_load_cfg()
|
||||
{
|
||||
sd_mount();
|
||||
emu_cfg.enabled = 0;
|
||||
emu_cfg.path = NULL;
|
||||
emu_cfg.nintendo_path = NULL;
|
||||
@@ -47,7 +46,8 @@ void emummc_load_cfg()
|
||||
emu_cfg.file_based_part_size = 0;
|
||||
emu_cfg.active_part = 0;
|
||||
emu_cfg.fs_ver = 0;
|
||||
emu_cfg.emummc_file_based_path = (char *)malloc(0x80);
|
||||
if (!emu_cfg.emummc_file_based_path)
|
||||
emu_cfg.emummc_file_based_path = (char *)malloc(0x80);
|
||||
|
||||
LIST_INIT(ini_sections);
|
||||
if (ini_parse(&ini_sections, "emuMMC/emummc.ini", false))
|
||||
@@ -78,6 +78,43 @@ void emummc_load_cfg()
|
||||
}
|
||||
}
|
||||
|
||||
void emummc_set_path(char *path)
|
||||
{
|
||||
FIL fp;
|
||||
bool found = false;
|
||||
|
||||
strcpy(emu_cfg.emummc_file_based_path, path);
|
||||
strcat(emu_cfg.emummc_file_based_path, "/raw_based");
|
||||
|
||||
if (!f_open(&fp, emu_cfg.emummc_file_based_path, FA_READ))
|
||||
{
|
||||
if (!f_read(&fp, &emu_cfg.sector, 4, NULL))
|
||||
if (emu_cfg.sector)
|
||||
found = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(emu_cfg.emummc_file_based_path, path);
|
||||
strcat(emu_cfg.emummc_file_based_path, "/file_based");
|
||||
|
||||
if (!f_stat(emu_cfg.emummc_file_based_path, NULL))
|
||||
{
|
||||
emu_cfg.sector = 0;
|
||||
emu_cfg.path = path;
|
||||
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (found)
|
||||
{
|
||||
emu_cfg.enabled = 1;
|
||||
emu_cfg.id = 0;
|
||||
strcpy(emu_cfg.nintendo_path, path);
|
||||
strcpy(emu_cfg.nintendo_path, "/Nintendo");
|
||||
}
|
||||
}
|
||||
|
||||
static int emummc_raw_get_part_off(int part_idx)
|
||||
{
|
||||
switch (part_idx)
|
||||
|
||||
@@ -50,6 +50,7 @@ typedef struct _emummc_cfg_t
|
||||
emummc_cfg_t emu_cfg;
|
||||
|
||||
void emummc_load_cfg();
|
||||
void emummc_set_path(char *path);
|
||||
int emummc_storage_init_mmc(sdmmc_storage_t *storage, sdmmc_t *sdmmc);
|
||||
int emummc_storage_end(sdmmc_storage_t *storage);
|
||||
int emummc_storage_read(sdmmc_storage_t *storage, u32 sector, u32 num_sectors, void *buf);
|
||||
|
||||
Reference in New Issue
Block a user