mirror of
https://github.com/CTCaer/hekate.git
synced 2024-11-26 11:42:09 +00:00
nyx: Show status for migration and update main window
This commit is contained in:
parent
a4a056128a
commit
add351289a
3 changed files with 64 additions and 30 deletions
|
@ -1133,7 +1133,7 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa
|
||||||
_get_valid_partition(§or_start, §or_size, &part_idx, false);
|
_get_valid_partition(§or_start, §or_size, &part_idx, false);
|
||||||
if (!part_idx || !sector_size)
|
if (!part_idx || !sector_size)
|
||||||
{
|
{
|
||||||
s_printf(gui->txt_buf, "#FFDD00 Failed to find a partition...#\n");
|
s_printf(gui->txt_buf, "\n#FFDD00 Failed to find a partition...#\n");
|
||||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||||
manual_system_maintenance(true);
|
manual_system_maintenance(true);
|
||||||
|
|
||||||
|
@ -1160,7 +1160,7 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa
|
||||||
// Verify part.
|
// Verify part.
|
||||||
if (_dump_emmc_verify(gui, storage, lbaStartPart, outFilename, part))
|
if (_dump_emmc_verify(gui, storage, lbaStartPart, outFilename, part))
|
||||||
{
|
{
|
||||||
s_printf(gui->txt_buf, "#FFDD00 Please try again...#\n");
|
s_printf(gui->txt_buf, "\n#FFDD00 Please try again...#\n");
|
||||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||||
manual_system_maintenance(true);
|
manual_system_maintenance(true);
|
||||||
|
|
||||||
|
@ -1184,7 +1184,7 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa
|
||||||
res = f_open(&fp, outFilename, FA_READ);
|
res = f_open(&fp, outFilename, FA_READ);
|
||||||
if (res)
|
if (res)
|
||||||
{
|
{
|
||||||
s_printf(gui->txt_buf, "#FF0000 Error (%d) while opening file#\n#FFDD00 %s!#\n", res, outFilename);
|
s_printf(gui->txt_buf, "\n#FF0000 Error (%d) while opening file#\n#FFDD00 %s!#\n", res, outFilename);
|
||||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||||
manual_system_maintenance(true);
|
manual_system_maintenance(true);
|
||||||
|
|
||||||
|
@ -1224,8 +1224,8 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa
|
||||||
while (res)
|
while (res)
|
||||||
{
|
{
|
||||||
s_printf(gui->txt_buf,
|
s_printf(gui->txt_buf,
|
||||||
"#FFDD00 Error reading %d blocks @ LBA %08X,#\n"
|
"\n#FFDD00 Error reading %d blocks @ LBA %08X,#\n"
|
||||||
"#FFDD00 from eMMC (try %d). #",
|
"#FFDD00 from eMMC (try %d).\n#",
|
||||||
num, lba_curr, ++retryCount);
|
num, lba_curr, ++retryCount);
|
||||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||||
manual_system_maintenance(true);
|
manual_system_maintenance(true);
|
||||||
|
|
|
@ -228,7 +228,7 @@ static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_sto
|
||||||
res = f_open(&fp, outFilename, FA_CREATE_ALWAYS | FA_WRITE);
|
res = f_open(&fp, outFilename, FA_CREATE_ALWAYS | FA_WRITE);
|
||||||
if (res)
|
if (res)
|
||||||
{
|
{
|
||||||
s_printf(gui->txt_buf, "#FF0000 Error (%d) while creating#\n#FFDD00 %s#\n", res, outFilename);
|
s_printf(gui->txt_buf, "\n#FF0000 Error (%d) while creating#\n#FFDD00 %s#\n", res, outFilename);
|
||||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||||
manual_system_maintenance(true);
|
manual_system_maintenance(true);
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_sto
|
||||||
// Check for cancellation combo.
|
// Check for cancellation combo.
|
||||||
if (btn_read_vol() == (BTN_VOL_UP | BTN_VOL_DOWN))
|
if (btn_read_vol() == (BTN_VOL_UP | BTN_VOL_DOWN))
|
||||||
{
|
{
|
||||||
s_printf(gui->txt_buf, "#FFDD00 The emuMMC was cancelled!#\n");
|
s_printf(gui->txt_buf, "\n#FFDD00 The emuMMC was cancelled!#\n");
|
||||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||||
manual_system_maintenance(true);
|
manual_system_maintenance(true);
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_sto
|
||||||
while (!sdmmc_storage_read(storage, lba_curr, num, buf))
|
while (!sdmmc_storage_read(storage, lba_curr, num, buf))
|
||||||
{
|
{
|
||||||
s_printf(gui->txt_buf,
|
s_printf(gui->txt_buf,
|
||||||
"#FFDD00 Error reading %d blocks @ LBA %08X,#\n"
|
"\n#FFDD00 Error reading %d blocks @ LBA %08X,#\n"
|
||||||
"#FFDD00 from eMMC (try %d). #",
|
"#FFDD00 from eMMC (try %d). #",
|
||||||
num, lba_curr, ++retryCount);
|
num, lba_curr, ++retryCount);
|
||||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||||
|
@ -283,7 +283,7 @@ static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_sto
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s_printf(gui->txt_buf, "#FFDD00 Retrying...#\n");
|
s_printf(gui->txt_buf, "#FFDD00 Retrying...#");
|
||||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
|
||||||
manual_system_maintenance(true);
|
manual_system_maintenance(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019-2020 CTCaer
|
* Copyright (c) 2019-2021 CTCaer
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
@ -49,12 +49,12 @@ static lv_res_t (*emummc_tools)(lv_obj_t *btn);
|
||||||
static lv_res_t _action_emummc_window_close(lv_obj_t *btn)
|
static lv_res_t _action_emummc_window_close(lv_obj_t *btn)
|
||||||
{
|
{
|
||||||
lv_win_close_action(btn);
|
lv_win_close_action(btn);
|
||||||
lv_obj_del(emummc_manage_window);
|
|
||||||
|
|
||||||
(*emummc_tools)(NULL);
|
|
||||||
|
|
||||||
close_btn = NULL;
|
close_btn = NULL;
|
||||||
|
|
||||||
|
// Delete and relaunch main emuMMC window.
|
||||||
|
lv_obj_del(emummc_manage_window);
|
||||||
|
(*emummc_tools)(NULL);
|
||||||
|
|
||||||
return LV_RES_INV;
|
return LV_RES_INV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,6 +365,38 @@ static void _change_raw_emummc_part_type()
|
||||||
free(mbr);
|
free(mbr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static lv_res_t _save_emummc_cfg_mig_mbox_action(lv_obj_t *btns, const char *txt)
|
||||||
|
{
|
||||||
|
// Delete main emuMMC and popup windows and relaunch main emuMMC window.
|
||||||
|
lv_obj_del(emummc_manage_window);
|
||||||
|
mbox_action(btns, txt);
|
||||||
|
|
||||||
|
(*emummc_tools)(NULL);
|
||||||
|
|
||||||
|
return LV_RES_INV;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _create_emummc_migrated_mbox()
|
||||||
|
{
|
||||||
|
lv_obj_t *dark_bg = lv_obj_create(lv_scr_act(), NULL);
|
||||||
|
lv_obj_set_style(dark_bg, &mbox_darken);
|
||||||
|
lv_obj_set_size(dark_bg, LV_HOR_RES, LV_VER_RES);
|
||||||
|
|
||||||
|
static const char *mbox_btn_map[] = { "\211", "OK", "\211", "" };
|
||||||
|
lv_obj_t * mbox = lv_mbox_create(dark_bg, NULL);
|
||||||
|
lv_mbox_set_recolor_text(mbox, true);
|
||||||
|
lv_obj_set_width(mbox, LV_HOR_RES / 9 * 4);
|
||||||
|
|
||||||
|
lv_mbox_set_text(mbox,
|
||||||
|
"#FF8000 emuMMC Configuration#\n\n"
|
||||||
|
"#96FF00 The emuMMC configuration#\n#96FF00 was saved to sd card!#");
|
||||||
|
|
||||||
|
lv_mbox_add_btns(mbox, mbox_btn_map, _save_emummc_cfg_mig_mbox_action);
|
||||||
|
|
||||||
|
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||||
|
lv_obj_set_top(mbox, true);
|
||||||
|
}
|
||||||
|
|
||||||
static void _migrate_sd_raw_based()
|
static void _migrate_sd_raw_based()
|
||||||
{
|
{
|
||||||
mbr_ctx.sector_start = 2;
|
mbr_ctx.sector_start = 2;
|
||||||
|
@ -380,6 +412,7 @@ static void _migrate_sd_raw_based()
|
||||||
f_close(&fp);
|
f_close(&fp);
|
||||||
|
|
||||||
save_emummc_cfg(1, mbr_ctx.sector_start, "emuMMC/ER00");
|
save_emummc_cfg(1, mbr_ctx.sector_start, "emuMMC/ER00");
|
||||||
|
_create_emummc_migrated_mbox();
|
||||||
sd_unmount();
|
sd_unmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -405,7 +438,7 @@ static void _migrate_sd_raw_emummc_based()
|
||||||
_change_raw_emummc_part_type();
|
_change_raw_emummc_part_type();
|
||||||
|
|
||||||
save_emummc_cfg(mbr_ctx.part_idx, mbr_ctx.sector_start, tmp);
|
save_emummc_cfg(mbr_ctx.part_idx, mbr_ctx.sector_start, tmp);
|
||||||
|
_create_emummc_migrated_mbox();
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
sd_unmount();
|
sd_unmount();
|
||||||
|
@ -444,6 +477,7 @@ static void _migrate_sd_file_based()
|
||||||
free(path2);
|
free(path2);
|
||||||
|
|
||||||
save_emummc_cfg(0, 0, "emuMMC/EF00");
|
save_emummc_cfg(0, 0, "emuMMC/EF00");
|
||||||
|
_create_emummc_migrated_mbox();
|
||||||
sd_unmount();
|
sd_unmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,6 +550,7 @@ static void _migrate_sd_backup_file_based()
|
||||||
free(backup_file_path);
|
free(backup_file_path);
|
||||||
|
|
||||||
save_emummc_cfg(0, 0, "emuMMC/BK00");
|
save_emummc_cfg(0, 0, "emuMMC/BK00");
|
||||||
|
_create_emummc_migrated_mbox();
|
||||||
sd_unmount();
|
sd_unmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -645,41 +680,41 @@ static lv_res_t _create_emummc_migrate_action(lv_obj_t * btns, const char * txt)
|
||||||
if (backup)
|
if (backup)
|
||||||
{
|
{
|
||||||
s_printf(txt_buf,
|
s_printf(txt_buf,
|
||||||
"#C7EA46 Found suitable backup for emuMMC!#\n"
|
"#C7EA46 Found suitable backup for emuMMC!#\n\n"
|
||||||
"#FF8000 Do you want to migrate it?#\n\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);
|
||||||
}
|
}
|
||||||
else if (emummc)
|
else if (emummc)
|
||||||
{
|
{
|
||||||
s_printf(txt_buf,
|
s_printf(txt_buf,
|
||||||
"#C7EA46 Found SD Partition based emuMMC!#\n"
|
"#C7EA46 Found SD Partition based emuMMC!#\n\n"
|
||||||
"#FF8000 Do you want to repair the config for it?#\n\n");
|
"#FF8000 Do you want to repair the config for it?#\n");
|
||||||
lv_mbox_add_btns(mbox, mbox_btn_map, _create_emummc_mig3_action);
|
lv_mbox_add_btns(mbox, mbox_btn_map, _create_emummc_mig3_action);
|
||||||
}
|
}
|
||||||
else if (em_raw && em_file)
|
else if (em_raw && em_file)
|
||||||
{
|
{
|
||||||
s_printf(txt_buf,
|
s_printf(txt_buf,
|
||||||
"#C7EA46 Found both foreign SD File and Partition emunand!#\n"
|
"#C7EA46 Found both foreign SD File and Partition emunand!#\n\n"
|
||||||
"#FF8000 Choose what to migrate:#\n\n");
|
"#FF8000 Choose what to migrate:#\n");
|
||||||
lv_mbox_add_btns(mbox, mbox_btn_map1, _create_emummc_mig1_action);
|
lv_mbox_add_btns(mbox, mbox_btn_map1, _create_emummc_mig1_action);
|
||||||
}
|
}
|
||||||
else if (em_raw)
|
else if (em_raw)
|
||||||
{
|
{
|
||||||
s_printf(txt_buf,
|
s_printf(txt_buf,
|
||||||
"#C7EA46 Found foreign SD Partition emunand!#\n"
|
"#C7EA46 Found foreign SD Partition emunand!#\n\n"
|
||||||
"#FF8000 Do you want to migrate it?#\n\n");
|
"#FF8000 Do you want to migrate it?#\n");
|
||||||
lv_mbox_add_btns(mbox, mbox_btn_map, _create_emummc_mig2_action);
|
lv_mbox_add_btns(mbox, mbox_btn_map, _create_emummc_mig2_action);
|
||||||
}
|
}
|
||||||
else if (em_file)
|
else if (em_file)
|
||||||
{
|
{
|
||||||
s_printf(txt_buf,
|
s_printf(txt_buf,
|
||||||
"#C7EA46 Found foreign SD File emunand!#\n"
|
"#C7EA46 Found foreign SD File emunand!#\n\n"
|
||||||
"#FF8000 Do you want to migrate it?#\n\n");
|
"#FF8000 Do you want to migrate it?#\n");
|
||||||
lv_mbox_add_btns(mbox, mbox_btn_map, _create_emummc_mig0_action);
|
lv_mbox_add_btns(mbox, mbox_btn_map, _create_emummc_mig0_action);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s_printf(txt_buf, "No emuMMC or foreign emunand found!\n\n");
|
s_printf(txt_buf, "No emuMMC or foreign emunand found!\n");
|
||||||
lv_mbox_add_btns(mbox, mbox_btn_map3, mbox_action);
|
lv_mbox_add_btns(mbox, mbox_btn_map3, mbox_action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -825,6 +860,7 @@ static emummc_images_t *emummc_img;
|
||||||
|
|
||||||
static lv_res_t _save_emummc_cfg_mbox_action(lv_obj_t *btns, const char *txt)
|
static lv_res_t _save_emummc_cfg_mbox_action(lv_obj_t *btns, const char *txt)
|
||||||
{
|
{
|
||||||
|
// Free components, delete main emuMMC and popup windows and relaunch main emuMMC window.
|
||||||
free(emummc_img->dirlist);
|
free(emummc_img->dirlist);
|
||||||
lv_obj_del(emummc_img->win);
|
lv_obj_del(emummc_img->win);
|
||||||
lv_obj_del(emummc_manage_window);
|
lv_obj_del(emummc_manage_window);
|
||||||
|
@ -1121,8 +1157,9 @@ out1:
|
||||||
lv_res_t create_win_emummc_tools(lv_obj_t *btn)
|
lv_res_t create_win_emummc_tools(lv_obj_t *btn)
|
||||||
{
|
{
|
||||||
lv_obj_t *win = nyx_create_standard_window(SYMBOL_EDIT" emuMMC Manage");
|
lv_obj_t *win = nyx_create_standard_window(SYMBOL_EDIT" emuMMC Manage");
|
||||||
emummc_manage_window = win;
|
|
||||||
|
|
||||||
|
// Set resources to be managed by other windows.
|
||||||
|
emummc_manage_window = win;
|
||||||
emummc_tools = (void *)create_win_emummc_tools;
|
emummc_tools = (void *)create_win_emummc_tools;
|
||||||
|
|
||||||
sd_mount();
|
sd_mount();
|
||||||
|
@ -1246,7 +1283,6 @@ lv_res_t create_win_emummc_tools(lv_obj_t *btn)
|
||||||
lv_obj_set_style(label_txt4, &hint_small_style);
|
lv_obj_set_style(label_txt4, &hint_small_style);
|
||||||
lv_obj_align(label_txt4, btn3, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3);
|
lv_obj_align(label_txt4, btn3, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3);
|
||||||
|
|
||||||
//! TODO: Move it to a window with multiple choices.
|
|
||||||
// Create Migrate emuMMC button.
|
// Create Migrate emuMMC button.
|
||||||
lv_obj_t *btn4 = lv_btn_create(h2, btn2);
|
lv_obj_t *btn4 = lv_btn_create(h2, btn2);
|
||||||
label_btn = lv_label_create(btn4, NULL);
|
label_btn = lv_label_create(btn4, NULL);
|
||||||
|
@ -1260,8 +1296,6 @@ lv_res_t create_win_emummc_tools(lv_obj_t *btn)
|
||||||
lv_label_set_static_text(label_txt4,
|
lv_label_set_static_text(label_txt4,
|
||||||
"Migrate a backup to a #C7EA46 SD File# or repair existing #C7EA46 SD Raw Partition#.\n"
|
"Migrate a backup to a #C7EA46 SD File# or repair existing #C7EA46 SD Raw Partition#.\n"
|
||||||
"Additionally it allows you to migrate from other emunand\nsolutions.");
|
"Additionally it allows you to migrate from other emunand\nsolutions.");
|
||||||
//"Move between #C7EA46 SD File# and #C7EA46 SD Raw Partition# emuMMC.\n"
|
|
||||||
//"Additionally it allows you to migrate from other emunand\nsolutions.");
|
|
||||||
lv_obj_set_style(label_txt4, &hint_small_style);
|
lv_obj_set_style(label_txt4, &hint_small_style);
|
||||||
lv_obj_align(label_txt4, btn4, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3);
|
lv_obj_align(label_txt4, btn4, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue