mirror of
https://github.com/CTCaer/hekate
synced 2024-12-22 19:31:12 +00:00
tools: Force sparse verification on TUI
Additionally, because the tool relies 100% on sd card, it will become a Nyx only. Remove the config also, as it will be moved to nyx configuration.
This commit is contained in:
parent
dc9c7fd95c
commit
52c506af9a
4 changed files with 23 additions and 103 deletions
|
@ -37,7 +37,6 @@ void set_default_configuration()
|
||||||
h_cfg.autoboot = 0;
|
h_cfg.autoboot = 0;
|
||||||
h_cfg.autoboot_list = 0;
|
h_cfg.autoboot_list = 0;
|
||||||
h_cfg.bootwait = 3;
|
h_cfg.bootwait = 3;
|
||||||
h_cfg.verification = 1;
|
|
||||||
h_cfg.se_keygen_done = 0;
|
h_cfg.se_keygen_done = 0;
|
||||||
h_cfg.sbar_time_keeping = 0;
|
h_cfg.sbar_time_keeping = 0;
|
||||||
h_cfg.backlight = 100;
|
h_cfg.backlight = 100;
|
||||||
|
@ -97,9 +96,6 @@ int create_config_entry()
|
||||||
f_puts("\nbootwait=", &fp);
|
f_puts("\nbootwait=", &fp);
|
||||||
itoa(h_cfg.bootwait, lbuf, 10);
|
itoa(h_cfg.bootwait, lbuf, 10);
|
||||||
f_puts(lbuf, &fp);
|
f_puts(lbuf, &fp);
|
||||||
f_puts("\nverification=", &fp);
|
|
||||||
itoa(h_cfg.verification, lbuf, 10);
|
|
||||||
f_puts(lbuf, &fp);
|
|
||||||
f_puts("\nbacklight=", &fp);
|
f_puts("\nbacklight=", &fp);
|
||||||
itoa(h_cfg.backlight, lbuf, 10);
|
itoa(h_cfg.backlight, lbuf, 10);
|
||||||
f_puts(lbuf, &fp);
|
f_puts(lbuf, &fp);
|
||||||
|
@ -451,61 +447,6 @@ void config_bootdelay()
|
||||||
btn_wait();
|
btn_wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
void config_verification()
|
|
||||||
{
|
|
||||||
gfx_clear_grey(0x1B);
|
|
||||||
gfx_con_setpos(0, 0);
|
|
||||||
|
|
||||||
u32 vr_text_size = 64;
|
|
||||||
|
|
||||||
ment_t *ments = (ment_t *)malloc(sizeof(ment_t) * 6);
|
|
||||||
u32 *vr_values = (u32 *)malloc(sizeof(u32) * 3);
|
|
||||||
char *vr_text = (char *)malloc(vr_text_size * 3);
|
|
||||||
|
|
||||||
for (u32 j = 0; j < 3; j++)
|
|
||||||
{
|
|
||||||
vr_values[j] = j;
|
|
||||||
ments[j + 2].type = MENT_DATA;
|
|
||||||
ments[j + 2].data = &vr_values[j];
|
|
||||||
}
|
|
||||||
|
|
||||||
ments[0].type = MENT_BACK;
|
|
||||||
ments[0].caption = "Back";
|
|
||||||
|
|
||||||
ments[1].type = MENT_CHGLINE;
|
|
||||||
|
|
||||||
strcpy(vr_text, " Disable (Fastest - Unsafe)");
|
|
||||||
strcpy(vr_text + 64, " Sparse (Fast - Safe)");
|
|
||||||
strcpy(vr_text + 128, " Full (Slow - Safe)");
|
|
||||||
|
|
||||||
for (u32 i = 0; i < 3; i++)
|
|
||||||
{
|
|
||||||
if (h_cfg.verification != i)
|
|
||||||
vr_text[vr_text_size * i] = ' ';
|
|
||||||
else
|
|
||||||
vr_text[vr_text_size * i] = '*';
|
|
||||||
ments[2 + i].caption = vr_text + (i * vr_text_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(&ments[5], 0, sizeof(ment_t));
|
|
||||||
menu_t menu = {ments, "Backup & Restore verification", 0, 0};
|
|
||||||
|
|
||||||
u32 *temp_verification = (u32 *)tui_do_menu(&menu);
|
|
||||||
if (temp_verification != NULL)
|
|
||||||
{
|
|
||||||
h_cfg.verification = *(u32 *)temp_verification;
|
|
||||||
_save_config();
|
|
||||||
}
|
|
||||||
|
|
||||||
free(ments);
|
|
||||||
free(vr_values);
|
|
||||||
free(vr_text);
|
|
||||||
|
|
||||||
if (temp_verification == NULL)
|
|
||||||
return;
|
|
||||||
btn_wait();
|
|
||||||
}
|
|
||||||
|
|
||||||
void config_backlight()
|
void config_backlight()
|
||||||
{
|
{
|
||||||
gfx_clear_grey(0x1B);
|
gfx_clear_grey(0x1B);
|
||||||
|
|
|
@ -25,7 +25,6 @@ typedef struct _hekate_config
|
||||||
u32 autoboot;
|
u32 autoboot;
|
||||||
u32 autoboot_list;
|
u32 autoboot_list;
|
||||||
u32 bootwait;
|
u32 bootwait;
|
||||||
u32 verification;
|
|
||||||
u32 backlight;
|
u32 backlight;
|
||||||
u32 autohosoff;
|
u32 autohosoff;
|
||||||
u32 autonogc;
|
u32 autonogc;
|
||||||
|
@ -45,7 +44,6 @@ void set_default_configuration();
|
||||||
int create_config_entry();
|
int create_config_entry();
|
||||||
void config_autoboot();
|
void config_autoboot();
|
||||||
void config_bootdelay();
|
void config_bootdelay();
|
||||||
void config_verification();
|
|
||||||
void config_backlight();
|
void config_backlight();
|
||||||
void config_auto_hos_poweroff();
|
void config_auto_hos_poweroff();
|
||||||
void config_nogc();
|
void config_nogc();
|
||||||
|
|
|
@ -78,7 +78,7 @@ static int _dump_emmc_verify(sdmmc_storage_t *storage, u32 lba_curr, char *outFi
|
||||||
// Check every time or every 4.
|
// Check every time or every 4.
|
||||||
// Every 4 protects from fake sd, sector corruption and frequent I/O corruption.
|
// Every 4 protects from fake sd, sector corruption and frequent I/O corruption.
|
||||||
// Full provides all that, plus protection from extremely rare I/O corruption.
|
// Full provides all that, plus protection from extremely rare I/O corruption.
|
||||||
if ((h_cfg.verification >= 2) || !(sparseShouldVerify % 4))
|
if (!(sparseShouldVerify % 4))
|
||||||
{
|
{
|
||||||
if (!sdmmc_storage_read(storage, lba_curr, num, bufEm))
|
if (!sdmmc_storage_read(storage, lba_curr, num, bufEm))
|
||||||
{
|
{
|
||||||
|
@ -307,8 +307,6 @@ static int _dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t
|
||||||
memset(&fp, 0, sizeof(fp));
|
memset(&fp, 0, sizeof(fp));
|
||||||
currPartIdx++;
|
currPartIdx++;
|
||||||
|
|
||||||
if (h_cfg.verification)
|
|
||||||
{
|
|
||||||
// Verify part.
|
// Verify part.
|
||||||
if (_dump_emmc_verify(storage, lbaStartPart, outFilename, part))
|
if (_dump_emmc_verify(storage, lbaStartPart, outFilename, part))
|
||||||
{
|
{
|
||||||
|
@ -316,7 +314,6 @@ static int _dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
_update_filename(outFilename, sdPathLen, numSplitParts, currPartIdx);
|
_update_filename(outFilename, sdPathLen, numSplitParts, currPartIdx);
|
||||||
|
|
||||||
|
@ -441,8 +438,6 @@ static int _dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t
|
||||||
// Backup operation ended successfully.
|
// Backup operation ended successfully.
|
||||||
f_close(&fp);
|
f_close(&fp);
|
||||||
|
|
||||||
if (h_cfg.verification)
|
|
||||||
{
|
|
||||||
// Verify last part or single file backup.
|
// Verify last part or single file backup.
|
||||||
if (_dump_emmc_verify(storage, lbaStartPart, outFilename, part))
|
if (_dump_emmc_verify(storage, lbaStartPart, outFilename, part))
|
||||||
{
|
{
|
||||||
|
@ -452,7 +447,6 @@ static int _dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tui_pbar(0, gfx_con.y, 100, 0xFF96FF00, 0xFF155500);
|
tui_pbar(0, gfx_con.y, 100, 0xFF96FF00, 0xFF155500);
|
||||||
}
|
|
||||||
|
|
||||||
gfx_con.fntsz = 16;
|
gfx_con.fntsz = 16;
|
||||||
// Remove partial backup index file if no fatal errors occurred.
|
// Remove partial backup index file if no fatal errors occurred.
|
||||||
|
@ -580,10 +574,8 @@ static void _dump_emmc_selected(emmcPartType_t dumpType)
|
||||||
timer = get_tmr_s() - timer;
|
timer = get_tmr_s() - timer;
|
||||||
gfx_printf("Time taken: %dm %ds.\n", timer / 60, timer % 60);
|
gfx_printf("Time taken: %dm %ds.\n", timer / 60, timer % 60);
|
||||||
sdmmc_storage_end(&storage);
|
sdmmc_storage_end(&storage);
|
||||||
if (res && h_cfg.verification)
|
if (res)
|
||||||
gfx_printf("\n%kFinished and verified!%k\nPress any key...\n", 0xFF96FF00, 0xFFCCCCCC);
|
gfx_printf("\n%kFinished and verified!%k\nPress any key...\n", 0xFF96FF00, 0xFFCCCCCC);
|
||||||
else if (res)
|
|
||||||
gfx_printf("\nFinished! Press any key...\n");
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
sd_unmount();
|
sd_unmount();
|
||||||
|
@ -713,8 +705,6 @@ static int _restore_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part
|
||||||
memset(&fp, 0, sizeof(fp));
|
memset(&fp, 0, sizeof(fp));
|
||||||
currPartIdx++;
|
currPartIdx++;
|
||||||
|
|
||||||
if (h_cfg.verification)
|
|
||||||
{
|
|
||||||
// Verify part.
|
// Verify part.
|
||||||
if (_dump_emmc_verify(storage, lbaStartPart, outFilename, part))
|
if (_dump_emmc_verify(storage, lbaStartPart, outFilename, part))
|
||||||
{
|
{
|
||||||
|
@ -722,7 +712,6 @@ static int _restore_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
_update_filename(outFilename, sdPathLen, numSplitParts, currPartIdx);
|
_update_filename(outFilename, sdPathLen, numSplitParts, currPartIdx);
|
||||||
|
|
||||||
|
@ -791,8 +780,6 @@ static int _restore_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part
|
||||||
// Restore operation ended successfully.
|
// Restore operation ended successfully.
|
||||||
f_close(&fp);
|
f_close(&fp);
|
||||||
|
|
||||||
if (h_cfg.verification)
|
|
||||||
{
|
|
||||||
// Verify restored data.
|
// Verify restored data.
|
||||||
if (_dump_emmc_verify(storage, lbaStartPart, outFilename, part))
|
if (_dump_emmc_verify(storage, lbaStartPart, outFilename, part))
|
||||||
{
|
{
|
||||||
|
@ -802,7 +789,6 @@ static int _restore_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tui_pbar(0, gfx_con.y, 100, 0xFF96FF00, 0xFF155500);
|
tui_pbar(0, gfx_con.y, 100, 0xFF96FF00, 0xFF155500);
|
||||||
}
|
|
||||||
|
|
||||||
gfx_con.fntsz = 16;
|
gfx_con.fntsz = 16;
|
||||||
gfx_puts("\n\n");
|
gfx_puts("\n\n");
|
||||||
|
@ -925,10 +911,8 @@ static void _restore_emmc_selected(emmcPartType_t restoreType)
|
||||||
timer = get_tmr_s() - timer;
|
timer = get_tmr_s() - timer;
|
||||||
gfx_printf("Time taken: %dm %ds.\n", timer / 60, timer % 60);
|
gfx_printf("Time taken: %dm %ds.\n", timer / 60, timer % 60);
|
||||||
sdmmc_storage_end(&storage);
|
sdmmc_storage_end(&storage);
|
||||||
if (res && h_cfg.verification)
|
if (res)
|
||||||
gfx_printf("\n%kFinished and verified!%k\nPress any key...\n", 0xFF96FF00, 0xFFCCCCCC);
|
gfx_printf("\n%kFinished and verified!%k\nPress any key...\n", 0xFF96FF00, 0xFFCCCCCC);
|
||||||
else if (res)
|
|
||||||
gfx_printf("\nFinished! Press any key...\n");
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
sd_unmount();
|
sd_unmount();
|
||||||
|
|
|
@ -862,8 +862,6 @@ static void _auto_launch_firmware()
|
||||||
h_cfg.autoboot_list = atoi(kv->val);
|
h_cfg.autoboot_list = atoi(kv->val);
|
||||||
else if (!strcmp("bootwait", kv->key))
|
else if (!strcmp("bootwait", kv->key))
|
||||||
h_cfg.bootwait = atoi(kv->val);
|
h_cfg.bootwait = atoi(kv->val);
|
||||||
else if (!strcmp("verification", kv->key))
|
|
||||||
h_cfg.verification = atoi(kv->val);
|
|
||||||
else if (!strcmp("backlight", kv->key))
|
else if (!strcmp("backlight", kv->key))
|
||||||
h_cfg.backlight = atoi(kv->val);
|
h_cfg.backlight = atoi(kv->val);
|
||||||
else if (!strcmp("autohosoff", kv->key))
|
else if (!strcmp("autohosoff", kv->key))
|
||||||
|
@ -1270,7 +1268,6 @@ ment_t ment_tools[] = {
|
||||||
MDEF_CAPTION("-- Backup & Restore --", 0xFF0AB9E6),
|
MDEF_CAPTION("-- Backup & Restore --", 0xFF0AB9E6),
|
||||||
MDEF_MENU("Backup", &menu_backup),
|
MDEF_MENU("Backup", &menu_backup),
|
||||||
MDEF_MENU("Restore", &menu_restore),
|
MDEF_MENU("Restore", &menu_restore),
|
||||||
MDEF_HANDLER("Verification options", config_verification),
|
|
||||||
MDEF_CHGLINE(),
|
MDEF_CHGLINE(),
|
||||||
MDEF_CAPTION("-------- Misc --------", 0xFF0AB9E6),
|
MDEF_CAPTION("-------- Misc --------", 0xFF0AB9E6),
|
||||||
MDEF_HANDLER("Dump package1/2", dump_packages12),
|
MDEF_HANDLER("Dump package1/2", dump_packages12),
|
||||||
|
|
Loading…
Reference in a new issue