mirror of
https://github.com/CTCaer/hekate.git
synced 2024-12-29 00:26:15 +00:00
nyx: emummc: allow migrating emummc backup
Now if an eMMC backup is not found, emuMMC backup will be used.
This commit is contained in:
parent
6de29094fe
commit
187b6d843e
@ -35,8 +35,8 @@ typedef struct _mbr_ctxt_t
|
|||||||
u32 sector_start;
|
u32 sector_start;
|
||||||
} mbr_ctxt_t;
|
} mbr_ctxt_t;
|
||||||
|
|
||||||
|
static bool emummc_backup;
|
||||||
static mbr_ctxt_t mbr_ctx;
|
static mbr_ctxt_t mbr_ctx;
|
||||||
|
|
||||||
static lv_obj_t *emummc_manage_window;
|
static lv_obj_t *emummc_manage_window;
|
||||||
static lv_res_t (*emummc_tools)(lv_obj_t *btn);
|
static lv_res_t (*emummc_tools)(lv_obj_t *btn);
|
||||||
|
|
||||||
@ -518,7 +518,10 @@ static void _migrate_sd_backup_file_based()
|
|||||||
f_open(&fp, "emuMMC/BK00/file_based", FA_CREATE_ALWAYS | FA_WRITE);
|
f_open(&fp, "emuMMC/BK00/file_based", FA_CREATE_ALWAYS | FA_WRITE);
|
||||||
f_close(&fp);
|
f_close(&fp);
|
||||||
|
|
||||||
|
if (!emummc_backup)
|
||||||
emmcsn_path_impl(backup_path, "", "", NULL);
|
emmcsn_path_impl(backup_path, "", "", NULL);
|
||||||
|
else
|
||||||
|
emmcsn_path_impl(backup_path, "/emummc", "", NULL);
|
||||||
|
|
||||||
// Move BOOT0.
|
// Move BOOT0.
|
||||||
s_printf(backup_file_path, "%s/BOOT0", backup_path);
|
s_printf(backup_file_path, "%s/BOOT0", backup_path);
|
||||||
@ -689,8 +692,13 @@ static lv_res_t _create_emummc_migrate_action(lv_obj_t * btns, const char * txt)
|
|||||||
|
|
||||||
if (backup)
|
if (backup)
|
||||||
{
|
{
|
||||||
|
if (!emummc_backup)
|
||||||
s_printf(txt_buf,
|
s_printf(txt_buf,
|
||||||
"#C7EA46 Found suitable backup for emuMMC!#\n\n"
|
"#C7EA46 Found suitable eMMC backup!#\n\n"
|
||||||
|
"#FF8000 Do you want to migrate it?#\n");
|
||||||
|
else
|
||||||
|
s_printf(txt_buf,
|
||||||
|
"#C7EA46 Found suitable emuMMC backup!#\n\n"
|
||||||
"#FF8000 Do you want to migrate it?#\n");
|
"#FF8000 Do you want to migrate it?#\n");
|
||||||
lv_mbox_add_btns(mbox, mbox_btn_map, _create_emummc_mig4_action);
|
lv_mbox_add_btns(mbox, mbox_btn_map, _create_emummc_mig4_action);
|
||||||
}
|
}
|
||||||
@ -823,6 +831,8 @@ static lv_res_t _create_mbox_emummc_migrate(lv_obj_t *btn)
|
|||||||
if (!f_stat(path_buf, NULL))
|
if (!f_stat(path_buf, NULL))
|
||||||
em_file = true;
|
em_file = true;
|
||||||
|
|
||||||
|
emummc_backup = false;
|
||||||
|
|
||||||
emmcsn_path_impl(path_buf, "", "BOOT0", &emmc_storage);
|
emmcsn_path_impl(path_buf, "", "BOOT0", &emmc_storage);
|
||||||
if (!f_stat(path_buf, NULL))
|
if (!f_stat(path_buf, NULL))
|
||||||
backup = true;
|
backup = true;
|
||||||
@ -837,6 +847,26 @@ static lv_res_t _create_mbox_emummc_migrate(lv_obj_t *btn)
|
|||||||
|
|
||||||
backup = backup && rawnand_backup;
|
backup = backup && rawnand_backup;
|
||||||
|
|
||||||
|
if (!backup)
|
||||||
|
{
|
||||||
|
rawnand_backup = false;
|
||||||
|
emummc_backup = true;
|
||||||
|
|
||||||
|
emmcsn_path_impl(path_buf, "/emummc", "BOOT0", &emmc_storage);
|
||||||
|
if (!f_stat(path_buf, NULL))
|
||||||
|
backup = true;
|
||||||
|
|
||||||
|
emmcsn_path_impl(path_buf, "/emummc", "rawnand.bin", &emmc_storage);
|
||||||
|
if (!f_stat(path_buf, NULL))
|
||||||
|
rawnand_backup = true;
|
||||||
|
|
||||||
|
emmcsn_path_impl(path_buf, "/emummc", "rawnand.bin.00", &emmc_storage);
|
||||||
|
if (!f_stat(path_buf, NULL))
|
||||||
|
rawnand_backup = true;
|
||||||
|
|
||||||
|
backup = backup && rawnand_backup;
|
||||||
|
}
|
||||||
|
|
||||||
sd_unmount();
|
sd_unmount();
|
||||||
emmc_end();
|
emmc_end();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user