This commit is contained in:
2026-03-20 14:31:26 +01:00
115 changed files with 5715 additions and 3969 deletions

View File

@@ -65,12 +65,12 @@ int create_config_entry()
{
char lbuf[64];
FIL fp;
bool mainIniFound = false;
bool ini_found = false;
LIST_INIT(ini_sections);
if (ini_parse(&ini_sections, "bootloader/hekate_ipl.ini", false))
mainIniFound = true;
if (!ini_parse(&ini_sections, "bootloader/hekate_ipl.ini", false))
ini_found = true;
else
{
u8 res = f_open(&fp, "bootloader/hekate_ipl.ini", FA_READ);
@@ -137,7 +137,7 @@ int create_config_entry()
f_puts("\n", &fp);
if (mainIniFound)
if (ini_found)
{
// Re-construct existing entries.
LIST_FOREACH_ENTRY(ini_sec_t, ini_sec, &ini_sections, link)
@@ -188,7 +188,7 @@ int create_nyx_config_entry(bool force_unmount)
{
bool sd_mounted = sd_get_card_mounted();
if (!sd_mount())
if (sd_mount())
return 1;
char lbuf[64];

View File

@@ -45,7 +45,7 @@ typedef struct _hekate_config
typedef struct _nyx_config
{
u32 theme_bg;
u32 theme_bg; // COLOR_BG_BASE_MIN - COLOR_BG_BASE_MAX.
u32 theme_color;
u32 entries_5_col;
u32 timeoffset;

View File

@@ -1,7 +1,7 @@
/*
* Copyright (c) 2018 naehrwert
* Copyright (c) 2018 Rajko Stojadinovic
* Copyright (c) 2018-2025 CTCaer
* Copyright (c) 2018-2026 CTCaer
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -122,7 +122,7 @@ static lv_obj_t *create_mbox_text(const char *text, bool button_ok)
lv_mbox_set_text(mbox, text);
if (button_ok)
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
@@ -211,7 +211,7 @@ static int _emmc_sd_copy_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage,
// Full provides all that, plus protection from extremely rare I/O corruption.
if ((n_cfg.verification >= 2) || !(sparseShouldVerify % 4))
{
if (!sdmmc_storage_read(storage, lba_curr, num, bufEm))
if (sdmmc_storage_read(storage, lba_curr, num, bufEm))
{
s_printf(gui->txt_buf,
"\n#FF0000 Failed to read %d blocks (@LBA %08X),#\n"
@@ -380,7 +380,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
sd_sector_off = sector_start + (0x2000 * active_part);
if (active_part == 2)
@@ -424,7 +424,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
}
// Check if we are continuing a previous raw eMMC or USER partition backup in progress.
@@ -447,7 +447,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
// Increase maxSplitParts to accommodate previously backed up parts.
@@ -485,7 +485,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
if (!(btn_wait() & BTN_POWER))
{
lv_obj_del(warn_mbox_bg);
return 0;
return 1;
}
lv_obj_del(warn_mbox_bg);
}
@@ -502,7 +502,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
u8 *buf = (u8 *)MIXD_BUF_ALIGNED;
@@ -553,7 +553,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
strcpy(gui->txt_buf, "\n#FFDD00 Please try again...#\n");
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
case VERIF_STATUS_ABORT:
verification = 0;
break;
@@ -580,7 +580,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
// More parts to backup that do not currently fit the sd card free space or fatal error.
@@ -596,7 +596,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
partial_sd_full_unmount = true;
return 1;
return 0;
}
}
@@ -615,7 +615,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
bytesWritten = 0;
@@ -629,9 +629,9 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
int res_read;
if (!gui->raw_emummc)
res_read = !sdmmc_storage_read(storage, lba_curr, num, buf);
res_read = sdmmc_storage_read(storage, lba_curr, num, buf);
else
res_read = !sdmmc_storage_read(&sd_storage, lba_curr + sd_sector_off, num, buf);
res_read = sdmmc_storage_read(&sd_storage, lba_curr + sd_sector_off, num, buf);
while (res_read)
{
@@ -663,7 +663,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
free(clmt);
f_unlink(outFilename);
return 0;
return 1;
}
else
{
@@ -671,8 +671,13 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
}
if (!gui->raw_emummc)
res_read = sdmmc_storage_read(storage, lba_curr, num, buf);
else
res_read = sdmmc_storage_read(&sd_storage, lba_curr + sd_sector_off, num, buf);
manual_system_maintenance(false);
}
manual_system_maintenance(false);
res = f_write_fast(&fp, buf, EMMC_BLOCKSIZE * num);
@@ -686,7 +691,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
free(clmt);
f_unlink(outFilename);
return 0;
return 1;
}
manual_system_maintenance(false);
@@ -725,7 +730,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
free(clmt);
f_unlink(outFilename);
return 0;
return 1;
}
}
lv_bar_set_value(gui->bar, 100);
@@ -745,7 +750,7 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
lv_bar_set_value(gui->bar, 100);
lv_label_set_text(gui->label_pct, " "SYMBOL_DOT" 100%");
@@ -764,12 +769,12 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
partial_sd_full_unmount = true;
}
return 1;
return 0;
}
void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui)
{
int res = 0;
int res = 1;
u32 timer = 0;
char *txt_buf = (char *)malloc(SZ_16K);
@@ -781,7 +786,7 @@ void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui)
lv_label_set_text(gui->label_info, "Checking for available free space...");
manual_system_maintenance(true);
if (!sd_mount())
if (sd_mount())
{
lv_label_set_text(gui->label_info, "#FFDD00 Failed to init SD!#");
goto out;
@@ -790,7 +795,7 @@ void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui)
// Get SD Card free space for Partial Backup.
f_getfree("", &sd_fs.free_clst, NULL);
if (!emmc_initialize(false))
if (emmc_initialize(false))
{
lv_label_set_text(gui->label_info, "#FFDD00 Failed to init eMMC!#");
goto out;
@@ -844,7 +849,7 @@ void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui)
res = _dump_emmc_part(gui, sdPath, i, &emmc_storage, &bootPart);
if (!res)
if (res)
strcpy(txt_buf, "#FFDD00 Failed!#\n");
else
strcpy(txt_buf, "Done!\n");
@@ -884,7 +889,7 @@ void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui)
emmcsn_path_impl(sdPath, "/partitions", part->name, &emmc_storage);
res = _dump_emmc_part(gui, sdPath, 0, &emmc_storage, part);
// If a part failed, don't continue.
if (!res)
if (res)
{
strcpy(txt_buf, "#FFDD00 Failed!#\n");
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
@@ -927,7 +932,7 @@ void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui)
res = _dump_emmc_part(gui, sdPath, 2, &emmc_storage, &rawPart);
if (!res)
if (res)
strcpy(txt_buf, "#FFDD00 Failed!#\n");
else
strcpy(txt_buf, "Done!\n");
@@ -941,9 +946,9 @@ void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui)
timer = get_tmr_s() - timer;
emmc_end();
if (res && n_cfg.verification && !gui->raw_emummc)
if (!res && n_cfg.verification && !gui->raw_emummc)
s_printf(txt_buf, "Time taken: %dm %ds.\n#96FF00 Finished and verified!#", timer / 60, timer % 60);
else if (res)
else if (!res)
s_printf(txt_buf, "Time taken: %dm %ds.\nFinished!", timer / 60, timer % 60);
else
s_printf(txt_buf, "Time taken: %dm %ds.", timer / 60, timer % 60);
@@ -1027,13 +1032,13 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
else if (f_stat(outFilename, &fno))
{
if (!gui->raw_emummc)
{
s_printf(gui->txt_buf, "\n#FFDD00 Error (%d) file not found#\n#FFDD00 %s.#\n\n", res, outFilename);
s_printf(gui->txt_buf, "\n#FFDD00 Error file not found#\n#FFDD00 %s.#\n\n", outFilename);
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
@@ -1056,7 +1061,7 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
}
else
@@ -1069,7 +1074,7 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
check_4MB_aligned = false;
@@ -1097,7 +1102,7 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
lv_obj_del(warn_mbox_bg);
@@ -1143,7 +1148,7 @@ multipart_not_allowed:
manual_system_maintenance(true);
}
return -1;
return 2;
}
else if (!use_multipart && (((u32)((u64)f_size(&fp) >> (u64)9)) != totalSectors)) // Check total restore size vs emmc size.
{
@@ -1155,7 +1160,7 @@ multipart_not_allowed:
f_close(&fp);
return 0;
return 1;
}
else if (!gui->raw_emummc)
{
@@ -1174,7 +1179,7 @@ multipart_not_allowed:
f_close(&fp);
return 0;
return 1;
}
lv_obj_del(warn_mbox_bg);
}
@@ -1216,7 +1221,7 @@ multipart_not_allowed:
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
sd_sector_off = sector_start + (0x2000 * active_part);
}
@@ -1246,7 +1251,7 @@ multipart_not_allowed:
strcpy(gui->txt_buf, "\n#FFDD00 Please try again...#\n");
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
case VERIF_STATUS_ABORT:
verification = 0;
break;
@@ -1275,7 +1280,7 @@ multipart_not_allowed:
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
fileSize = (u64)f_size(&fp);
bytesWritten = 0;
@@ -1299,12 +1304,12 @@ multipart_not_allowed:
f_close(&fp);
free(clmt);
return 0;
return 1;
}
if (!gui->raw_emummc)
res = !sdmmc_storage_write(storage, lba_curr, num, buf);
res = sdmmc_storage_write(storage, lba_curr, num, buf);
else
res = !sdmmc_storage_write(&sd_storage, lba_curr + sd_sector_off, num, buf);
res = sdmmc_storage_write(&sd_storage, lba_curr + sd_sector_off, num, buf);
manual_system_maintenance(false);
@@ -1328,7 +1333,7 @@ multipart_not_allowed:
f_close(&fp);
free(clmt);
return 0;
return 1;
}
else
{
@@ -1337,9 +1342,9 @@ multipart_not_allowed:
manual_system_maintenance(true);
}
if (!gui->raw_emummc)
res = !sdmmc_storage_write(storage, lba_curr, num, buf);
res = sdmmc_storage_write(storage, lba_curr, num, buf);
else
res = !sdmmc_storage_write(&sd_storage, lba_curr + sd_sector_off, num, buf);
res = sdmmc_storage_write(&sd_storage, lba_curr + sd_sector_off, num, buf);
manual_system_maintenance(false);
}
pct = (u64)((u64)(lba_curr - part->lba_start) * 100u) / (u64)(lba_end - part->lba_start);
@@ -1373,7 +1378,7 @@ multipart_not_allowed:
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
lv_bar_set_value(gui->bar, 100);
lv_label_set_text(gui->label_pct, " "SYMBOL_DOT" 100%");
@@ -1397,7 +1402,7 @@ multipart_not_allowed:
save_emummc_cfg(part_idx, sector_start, sdPath);
}
return 1;
return 0;
}
void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
@@ -1457,13 +1462,13 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
lv_obj_del(warn_mbox_bg);
manual_system_maintenance(true);
if (!sd_mount())
if (sd_mount())
{
lv_label_set_text(gui->label_info, "#FFDD00 Failed to init SD!#");
goto out;
}
if (!emmc_initialize(false))
if (emmc_initialize(false))
{
lv_label_set_text(gui->label_info, "#FFDD00 Failed to init eMMC!#");
goto out;
@@ -1512,15 +1517,14 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
emmcsn_path_impl(sdPath, "/restore/emummc", bootPart.name, &emmc_storage);
res = _restore_emmc_part(gui, sdPath, i, &emmc_storage, &bootPart, false);
if (!res)
if (res == 1)
strcpy(txt_buf, "#FFDD00 Failed!#\n");
else if (res > 0)
else if (!res)
strcpy(txt_buf, "Done!\n");
if (res >= 0)
if (res <= 1)
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
else
res = 0;
manual_system_maintenance(true);
}
}
@@ -1548,15 +1552,14 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
emmcsn_path_impl(sdPath, "/restore/partitions", part->name, &emmc_storage);
res = _restore_emmc_part(gui, sdPath, 0, &emmc_storage, part, false);
if (!res)
if (res == 1)
strcpy(txt_buf, "#FFDD00 Failed!#\n");
else if (res > 0)
else if (!res)
strcpy(txt_buf, "Done!\n");
if (res >= 0)
if (res <= 1)
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
else
res = 0;
manual_system_maintenance(true);
}
emmc_gpt_free(&gpt);
@@ -1587,15 +1590,14 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
emmcsn_path_impl(sdPath, "/restore/emummc", rawPart.name, &emmc_storage);
res = _restore_emmc_part(gui, sdPath, 2, &emmc_storage, &rawPart, true);
if (!res)
if (res == 1)
strcpy(txt_buf, "#FFDD00 Failed!#\n");
else if (res > 0)
else if (!res)
strcpy(txt_buf, "Done!\n");
if (res >= 0)
if (res <= 1)
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
else
res = 0;
manual_system_maintenance(true);
}
}
@@ -1603,9 +1605,9 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
timer = get_tmr_s() - timer;
emmc_end();
if (res && n_cfg.verification && !gui->raw_emummc)
if (!res && n_cfg.verification && !gui->raw_emummc)
s_printf(txt_buf, "Time taken: %dm %ds.\n#96FF00 Finished and verified!#", timer / 60, timer % 60);
else if (res)
else if (!res)
s_printf(txt_buf, "Time taken: %dm %ds.\nFinished!", timer / 60, timer % 60);
else
s_printf(txt_buf, "Time taken: %dm %ds.", timer / 60, timer % 60);

View File

@@ -1,7 +1,7 @@
/*
* Copyright (c) 2018 naehrwert
* Copyright (c) 2018 Rajko Stojadinovic
* Copyright (c) 2018-2025 CTCaer
* Copyright (c) 2018-2026 CTCaer
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -33,15 +33,13 @@
#define OUT_FILENAME_SZ 128
#define NUM_SECTORS_PER_ITER 8192 // 4MB Cache.
extern volatile boot_cfg_t *b_cfg;
void load_emummc_cfg(emummc_cfg_t *emu_info)
{
memset(emu_info, 0, sizeof(emummc_cfg_t));
// Parse emuMMC configuration.
LIST_INIT(ini_sections);
if (!ini_parse(&ini_sections, "emuMMC/emummc.ini", false))
if (ini_parse(&ini_sections, "emuMMC/emummc.ini", false))
return;
LIST_FOREACH_ENTRY(ini_sec_t, ini_sec, &ini_sections, link)
@@ -172,7 +170,7 @@ static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_sto
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
// Check if filesystem is FAT32 or the free space is smaller and dump in parts.
@@ -198,7 +196,7 @@ static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_sto
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
u8 *buf = (u8 *)MIXD_BUF_ALIGNED;
@@ -244,7 +242,7 @@ static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_sto
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
bytesWritten = 0;
@@ -266,13 +264,13 @@ static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_sto
msleep(1000);
return 0;
return 1;
}
retryCount = 0;
num = MIN(totalSectors, NUM_SECTORS_PER_ITER);
while (!sdmmc_storage_read(storage, lba_curr, num, buf))
while (sdmmc_storage_read(storage, lba_curr, num, buf))
{
s_printf(gui->txt_buf,
"\n#FFDD00 Error reading %d blocks @ LBA %08X,#\n"
@@ -292,7 +290,7 @@ static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_sto
free(clmt);
f_unlink(outFilename);
return 0;
return 1;
}
else
{
@@ -318,7 +316,7 @@ static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_sto
free(clmt);
f_unlink(outFilename);
return 0;
return 1;
}
pct = (u64)((u64)(lba_curr - part->lba_start) * 100u) / (u64)(part->lba_end - part->lba_start);
if (pct != prevPct)
@@ -352,12 +350,12 @@ static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_sto
f_close(&fp);
free(clmt);
return 1;
return 0;
}
void dump_emummc_file(emmc_tool_gui_t *gui)
{
int res = 0;
int res = 1;
int base_len = 0;
u32 timer = 0;
@@ -370,7 +368,7 @@ void dump_emummc_file(emmc_tool_gui_t *gui)
manual_system_maintenance(true);
if (!sd_mount())
if (sd_mount())
{
lv_label_set_text(gui->label_info, "#FFDD00 Failed to init SD!#");
goto out;
@@ -382,7 +380,7 @@ void dump_emummc_file(emmc_tool_gui_t *gui)
// Get SD Card free space for file based emuMMC.
f_getfree("", &sd_fs.free_clst, NULL);
if (!emmc_initialize(false))
if (emmc_initialize(false))
{
lv_label_set_text(gui->label_info, "#FFDD00 Failed to init eMMC!#");
goto out;
@@ -434,7 +432,7 @@ void dump_emummc_file(emmc_tool_gui_t *gui)
strcat(sdPath, bootPart.name);
res = _dump_emummc_file_part(gui, sdPath, &emmc_storage, &bootPart);
if (!res)
if (res)
{
s_printf(txt_buf, "#FFDD00 Failed!#\n");
goto out_failed;
@@ -469,7 +467,7 @@ void dump_emummc_file(emmc_tool_gui_t *gui)
res = _dump_emummc_file_part(gui, sdPath, &emmc_storage, &rawPart);
if (!res)
if (res)
s_printf(txt_buf, "#FFDD00 Failed!#\n");
else
s_printf(txt_buf, "Done!\n");
@@ -481,7 +479,7 @@ out_failed:
timer = get_tmr_s() - timer;
emmc_end();
if (res)
if (!res)
{
s_printf(txt_buf, "Time taken: %dm %ds.\nFinished!", timer / 60, timer % 60);
gui->base_path[strlen(gui->base_path) - 5] = '\0';
@@ -545,7 +543,7 @@ static int _dump_emummc_raw_part(emmc_tool_gui_t *gui, int active_part, int part
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
user_offset = user_part->lba_start;
@@ -559,20 +557,20 @@ static int _dump_emummc_raw_part(emmc_tool_gui_t *gui, int active_part, int part
// Check for cancellation combo.
if (btn_read_vol() == (BTN_VOL_UP | BTN_VOL_DOWN))
{
s_printf(gui->txt_buf, "\n#FFDD00 The emuMMC was cancelled!#\n");
s_printf(gui->txt_buf, "\n#FFDD00 emuMMC creation was cancelled!#\n");
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
msleep(1000);
return 0;
return 1;
}
retryCount = 0;
num = MIN(totalSectors, NUM_SECTORS_PER_ITER);
// Read data from eMMC.
while (!sdmmc_storage_read(&emmc_storage, lba_curr, num, buf))
while (sdmmc_storage_read(&emmc_storage, lba_curr, num, buf))
{
s_printf(gui->txt_buf,
"\n#FFDD00 Error reading %d blocks @LBA %08X,#\n"
@@ -588,7 +586,7 @@ static int _dump_emummc_raw_part(emmc_tool_gui_t *gui, int active_part, int part
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
else
{
@@ -602,7 +600,7 @@ static int _dump_emummc_raw_part(emmc_tool_gui_t *gui, int active_part, int part
// Write data to SD card.
retryCount = 0;
while (!sdmmc_storage_write(&sd_storage, sd_sector_off + lba_curr, num, buf))
while (sdmmc_storage_write(&sd_storage, sd_sector_off + lba_curr, num, buf))
{
s_printf(gui->txt_buf,
"\n#FFDD00 Error writing %d blocks @LBA %08X,#\n"
@@ -618,7 +616,7 @@ static int _dump_emummc_raw_part(emmc_tool_gui_t *gui, int active_part, int part
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
return 1;
}
else
{
@@ -690,7 +688,7 @@ static int _dump_emummc_raw_part(emmc_tool_gui_t *gui, int active_part, int part
s_printf(gui->txt_buf, "#FF0000 Failed (%d)!#\nPlease try again...\n", mkfs_error);
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
return 0;
return 1;
}
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, "Done!\n");
@@ -722,7 +720,7 @@ static int _dump_emummc_raw_part(emmc_tool_gui_t *gui, int active_part, int part
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
free(gpt);
return 0;
return 1;
}
// Set new emuMMC size and USER size.
@@ -763,16 +761,17 @@ static int _dump_emummc_raw_part(emmc_tool_gui_t *gui, int active_part, int part
free(gpt);
}
return 1;
return 0;
}
int emummc_raw_derive_bis_keys()
{
// Generate BIS keys.
hos_bis_keygen();
u8 *cal0_buff = malloc(SZ_64K);
// Generate BIS keys.
if (hos_bis_keygen())
goto error;
// Read and decrypt CAL0 for validation of working BIS keys.
emmc_set_partition(EMMC_GPP);
LIST_INIT(gpt);
@@ -788,6 +787,7 @@ int emummc_raw_derive_bis_keys()
// Check keys validity.
if (memcmp(&cal0->magic, "CAL0", 4))
{
error:
// Clear EKS keys.
hos_eks_clear(HOS_MKEY_VER_MAX);
@@ -809,7 +809,7 @@ int emummc_raw_derive_bis_keys()
lv_obj_set_width(lb_desc, LV_HOR_RES / 9 * 4);
lv_label_set_text(lb_desc, "#FFDD00 BIS keys validation failed!#\n");
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
@@ -825,7 +825,7 @@ int emummc_raw_derive_bis_keys()
void dump_emummc_raw(emmc_tool_gui_t *gui, int part_idx, u32 sector_start, u32 resized_count)
{
int res = 0;
int res = 1;
u32 timer = 0;
char *txt_buf = (char *)malloc(SZ_16K);
@@ -837,13 +837,13 @@ void dump_emummc_raw(emmc_tool_gui_t *gui, int part_idx, u32 sector_start, u32 r
manual_system_maintenance(true);
if (!sd_mount())
if (sd_mount())
{
lv_label_set_text(gui->label_info, "#FFDD00 Failed to init SD!#");
goto out;
}
if (!emmc_initialize(false))
if (emmc_initialize(false))
{
lv_label_set_text(gui->label_info, "#FFDD00 Failed to init eMMC!#");
goto out;
@@ -896,7 +896,7 @@ void dump_emummc_raw(emmc_tool_gui_t *gui, int part_idx, u32 sector_start, u32 r
strcat(sdPath, bootPart.name);
res = _dump_emummc_raw_part(gui, i, part_idx, sector_start, &bootPart, 0);
if (!res)
if (res)
{
s_printf(txt_buf, "#FFDD00 Failed!#\n");
goto out_failed;
@@ -930,7 +930,7 @@ void dump_emummc_raw(emmc_tool_gui_t *gui, int part_idx, u32 sector_start, u32 r
res = _dump_emummc_raw_part(gui, 2, part_idx, sector_start, &rawPart, resized_count);
if (!res)
if (res)
s_printf(txt_buf, "#FFDD00 Failed!#\n");
else
s_printf(txt_buf, "Done!\n");
@@ -943,7 +943,7 @@ out_failed:
timer = get_tmr_s() - timer;
emmc_end();
if (res)
if (!res)
{
s_printf(txt_buf, "Time taken: %dm %ds.\nFinished!", timer / 60, timer % 60);
strcpy(sdPath, gui->base_path);

View File

@@ -53,7 +53,7 @@ lv_img_dsc_t *icon_lakka;
lv_img_dsc_t *hekate_bg;
lv_img_dsc_t *hekate_bg_etc;
lv_style_t btn_transp_rel, btn_transp_pr, btn_transp_tgl_rel, btn_transp_tgl_pr;
lv_style_t btn_transp_rel, btn_transp_pr, btn_transp_tgl_rel, btn_transp_tgl_pr, btn_transp_ina;
lv_style_t ddlist_transp_bg, ddlist_transp_sel;
lv_style_t tabview_btn_pr, tabview_btn_tgl_pr;
@@ -105,6 +105,7 @@ static void _nyx_disp_init()
// Rotate and copy the first frame.
vic_compose();
vic_wait_idle();
// Switch to new window configuration.
display_init_window_a_pitch_vic();
@@ -328,19 +329,19 @@ static void _disp_fb_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const
lv_flush_ready();
}
static touch_event touchpad;
static touch_event_t touchpad;
static bool touch_enabled;
static bool console_enabled = false;
static bool _fts_touch_read(lv_indev_data_t *data)
{
if (touch_enabled)
touch_poll(&touchpad);
else
if (!touch_enabled)
return false;
// Take a screenshot if 3 fingers.
if (touchpad.fingers > 2)
int res = touch_poll(&touchpad);
// Take a screenshot if 3rd finger.
if (touchpad.finger > 2)
{
_save_fb_to_bmp();
@@ -350,14 +351,18 @@ static bool _fts_touch_read(lv_indev_data_t *data)
if (console_enabled)
{
// If no event, keep last debug message.
if (res)
return false;
// Print input debugging in console.
gfx_con_getpos(&gfx_con.savedx, &gfx_con.savedy, &gfx_con.savedcol);
gfx_con_setpos(32, 638, GFX_COL_AUTO);
gfx_con.fntsz = 8;
gfx_printf("x: %4d, y: %4d | z: %3d | ", touchpad.x, touchpad.y, touchpad.z);
gfx_printf("1: %02X, 2: %02X, 3: %02X, ", touchpad.raw[1], touchpad.raw[2], touchpad.raw[3]);
gfx_printf("4: %02X, 5: %02X, 6: %02X, 7: %02X",
touchpad.raw[4], touchpad.raw[5], touchpad.raw[6], touchpad.raw[7]);
gfx_printf("0: %02X, 1: %02X, 2: %02X, ", touchpad.raw[0], touchpad.raw[1], touchpad.raw[2]);
gfx_printf("3: %02X, 4: %02X, 5: %02X, 6: %02X",
touchpad.raw[3], touchpad.raw[4], touchpad.raw[5], touchpad.raw[6]);
gfx_con_setpos(gfx_con.savedx, gfx_con.savedy, gfx_con.savedcol);
gfx_con.fntsz = 16;
@@ -369,23 +374,10 @@ static bool _fts_touch_read(lv_indev_data_t *data)
data->point.y = touchpad.y;
// Decide touch enable.
switch (touchpad.type & STMFTS_MASK_EVENT_ID)
{
case STMFTS_EV_MULTI_TOUCH_ENTER:
case STMFTS_EV_MULTI_TOUCH_MOTION:
if (touchpad.touch)
data->state = LV_INDEV_STATE_PR;
break;
case STMFTS_EV_MULTI_TOUCH_LEAVE:
else
data->state = LV_INDEV_STATE_REL;
break;
case STMFTS_EV_NO_EVENT:
default:
if (touchpad.touch)
data->state = LV_INDEV_STATE_PR;
else
data->state = LV_INDEV_STATE_REL;
break;
}
return false; // No buffering so no more data read.
}
@@ -702,7 +694,7 @@ lv_img_dsc_t *bmp_to_lvimg_obj(const char *path)
}
lv_img_dsc_t *img_desc = (lv_img_dsc_t *)bitmap;
u32 offset_copy = ALIGN((u32)bitmap + sizeof(lv_img_dsc_t), 0x10);
uptr offset_copy = ALIGN((uptr)bitmap + sizeof(lv_img_dsc_t), 0x10);
img_desc->header.always_zero = 0;
img_desc->header.w = bmpData.size_x;
@@ -782,7 +774,7 @@ lv_res_t nyx_generic_onoff_toggle(lv_obj_t *btn)
return LV_RES_OK;
}
lv_res_t mbox_action(lv_obj_t *btns, const char *txt)
lv_res_t nyx_mbox_action(lv_obj_t *btns, const char *txt)
{
lv_obj_t *mbox = lv_mbox_get_from_btn(btns);
lv_obj_t *dark_bg = lv_obj_get_parent(mbox);
@@ -817,7 +809,7 @@ bool nyx_emmc_check_battery_enough()
"#FFDD00 with selected operation!#\n\n"
"Charge to at least #C7EA46 3650 mV#, and try again!");
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
lv_obj_set_width(mbox, LV_HOR_RES / 9 * 5);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
@@ -844,7 +836,7 @@ static void _nyx_sd_card_issues_warning(void *param)
"#FFDD00 This might mean detached or broken connector!#\n\n"
"You might want to check\n#C7EA46 Console Info# -> #C7EA46 microSD#");
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
lv_obj_set_width(mbox, LV_HOR_RES / 9 * 5);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
@@ -879,14 +871,14 @@ void nyx_window_toggle_buttons(lv_obj_t *win, bool disable)
}
}
lv_res_t nyx_win_close_action_custom(lv_obj_t * btn)
lv_res_t nyx_win_close_action(lv_obj_t * btn)
{
close_btn = NULL;
return lv_win_close_action(btn);
}
lv_obj_t *nyx_create_standard_window(const char *win_title)
lv_obj_t *nyx_create_standard_window(const char *win_title, lv_action_t close_action)
{
static lv_style_t win_bg_style;
@@ -899,25 +891,10 @@ lv_obj_t *nyx_create_standard_window(const char *win_title)
lv_win_set_style(win, LV_WIN_STYLE_BG, &win_bg_style);
lv_obj_set_size(win, LV_HOR_RES, LV_VER_RES);
close_btn = lv_win_add_btn(win, NULL, SYMBOL_CLOSE" Close", nyx_win_close_action_custom);
return win;
}
lv_obj_t *nyx_create_window_custom_close_btn(const char *win_title, lv_action_t rel_action)
{
static lv_style_t win_bg_style;
lv_style_copy(&win_bg_style, &lv_style_plain);
win_bg_style.body.main_color = lv_theme_get_current()->bg->body.main_color;
win_bg_style.body.grad_color = win_bg_style.body.main_color;
lv_obj_t *win = lv_win_create(lv_scr_act(), NULL);
lv_win_set_title(win, win_title);
lv_win_set_style(win, LV_WIN_STYLE_BG, &win_bg_style);
lv_obj_set_size(win, LV_HOR_RES, LV_VER_RES);
close_btn = lv_win_add_btn(win, NULL, SYMBOL_CLOSE" Close", rel_action);
if (!close_action)
close_btn = lv_win_add_btn(win, NULL, SYMBOL_CLOSE" Close", nyx_win_close_action);
else
close_btn = lv_win_add_btn(win, NULL, SYMBOL_CLOSE" Close", close_action);
return win;
}
@@ -981,7 +958,7 @@ static lv_res_t reload_action(lv_obj_t *btns, const char *txt)
if (!lv_btnm_get_pressed(btns))
reload_nyx(NULL, false);
return mbox_action(btns, txt);
return nyx_mbox_action(btns, txt);
}
static lv_res_t _removed_sd_action(lv_obj_t *btns, const char *txt)
@@ -1005,7 +982,7 @@ static lv_res_t _removed_sd_action(lv_obj_t *btns, const char *txt)
break;
}
return mbox_action(btns, txt);
return nyx_mbox_action(btns, txt);
}
static void _check_sd_card_removed(void *params)
@@ -1063,7 +1040,7 @@ static void _nyx_emmc_issues_warning(void *params)
"#FFDD00 This might mean hardware issues!#\n\n"
"You might want to check\n#C7EA46 Console Info# -> #C7EA46 eMMC#");
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
lv_obj_set_width(mbox, LV_HOR_RES / 9 * 5);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
@@ -1075,7 +1052,7 @@ static lv_res_t _reboot_ofw_action(lv_obj_t *btns, const char *txt)
if (!lv_btnm_get_pressed(btns))
power_set_state(REBOOT_BYPASS_FUSES);
return mbox_action(btns, txt);
return nyx_mbox_action(btns, txt);
}
static lv_res_t _create_mbox_reboot_ofw()
@@ -1133,7 +1110,7 @@ static lv_res_t _reboot_action(lv_obj_t *btns, const char *txt)
break;
}
return mbox_action(btns, txt);
return nyx_mbox_action(btns, txt);
}
static lv_res_t _poweroff_action(lv_obj_t *btns, const char *txt)
@@ -1141,7 +1118,7 @@ static lv_res_t _poweroff_action(lv_obj_t *btns, const char *txt)
if (!lv_btnm_get_pressed(btns))
power_set_state(POWER_OFF_RESET);
return mbox_action(btns, txt);
return nyx_mbox_action(btns, txt);
}
static lv_res_t _create_mbox_reload(lv_obj_t *btn)
@@ -1236,7 +1213,7 @@ void nyx_create_onoff_button(lv_theme_t *th, lv_obj_t *parent, lv_obj_t *btn, co
btn_onoff_pr_hos_style.body.opa = 35;
}
else
btn_onoff_pr_hos_style.body.main_color = LV_COLOR_HEX(theme_bg_color ? (theme_bg_color + 0x101010) : 0x2D2D2D);
btn_onoff_pr_hos_style.body.main_color = LV_COLOR_HEX(theme_bg_color ? (theme_bg_color + 0x101010) : 0x2D2D2D); // COLOR_HOS_BG_LIGHT.
btn_onoff_pr_hos_style.body.grad_color = btn_onoff_pr_hos_style.body.main_color;
btn_onoff_pr_hos_style.text.color = th->btn.pr->text.color;
btn_onoff_pr_hos_style.body.empty = 0;
@@ -1286,7 +1263,7 @@ static void _create_text_button(lv_theme_t *th, lv_obj_t *parent, lv_obj_t *btn,
btn_onoff_pr_hos_style.body.opa = 35;
}
else
btn_onoff_pr_hos_style.body.main_color = LV_COLOR_HEX(theme_bg_color ? (theme_bg_color + 0x101010) : 0x2D2D2D);
btn_onoff_pr_hos_style.body.main_color = LV_COLOR_HEX(theme_bg_color ? (theme_bg_color + 0x101010) : 0x2D2D2D); // COLOR_HOS_BG_LIGHT
btn_onoff_pr_hos_style.body.grad_color = btn_onoff_pr_hos_style.body.main_color;
btn_onoff_pr_hos_style.text.color = th->btn.pr->text.color;
btn_onoff_pr_hos_style.body.empty = 0;
@@ -1472,7 +1449,7 @@ static lv_res_t _create_mbox_payloads(lv_obj_t *btn)
lv_obj_set_size(list, LV_HOR_RES * 3 / 7, LV_VER_RES * 3 / 7);
lv_list_set_single_mode(list, true);
if (!sd_mount())
if (sd_mount())
{
lv_mbox_set_text(mbox, "#FFDD00 Failed to init SD!#");
@@ -1496,7 +1473,7 @@ static lv_res_t _create_mbox_payloads(lv_obj_t *btn)
}
out_end:
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
@@ -1736,7 +1713,7 @@ static lv_res_t _create_window_home_launch(lv_obj_t *btn)
lv_obj_t *boot_entry_label;
bool no_boot_entries = false;
// Create CFW buttons.
// Create Boot Entry buttons.
// Buttons are 200 x 200 with 4 pixel borders.
// Icons must be <= 192 x 192.
// Create first Button.
@@ -1776,7 +1753,7 @@ static lv_res_t _create_window_home_launch(lv_obj_t *btn)
// Create colorized icon style based on its parent style.
static lv_style_t img_style;
lv_style_copy(&img_style, &lv_style_plain);
img_style.image.color = lv_color_hsv_to_rgb(n_cfg.theme_color, 100, 100);
img_style.image.color = COLOR_HOS_TURQUOISE_EX(n_cfg.theme_color);
img_style.image.intense = LV_OPA_COVER;
// Parse ini boot entries and set buttons/icons.
@@ -1784,7 +1761,7 @@ static lv_res_t _create_window_home_launch(lv_obj_t *btn)
u32 curr_btn_idx = 0; // Active buttons.
LIST_INIT(ini_sections);
if (!sd_mount())
if (sd_mount())
goto failed_sd_mount;
// Check if we use custom system icons.
@@ -1794,15 +1771,15 @@ static lv_res_t _create_window_home_launch(lv_obj_t *btn)
// Choose what to parse.
bool ini_parse_success = false;
if (!more_cfg)
ini_parse_success = ini_parse(&ini_sections, "bootloader/hekate_ipl.ini", false);
ini_parse_success = !ini_parse(&ini_sections, "bootloader/hekate_ipl.ini", false);
else
ini_parse_success = ini_parse(&ini_sections, "bootloader/ini", true);
ini_parse_success = !ini_parse(&ini_sections, "bootloader/ini", true);
if (combined_cfg && !ini_parse_success)
{
ini_parsing:
list_init(&ini_sections);
ini_parse_success = ini_parse(&ini_sections, "bootloader/ini", true);
ini_parse_success = !ini_parse(&ini_sections, "bootloader/ini", true);
more_cfg = true;
}
@@ -1931,11 +1908,20 @@ ini_parsing:
btn_height = 200;
lv_btn_set_style(launch_ctxt.btn[curr_btn_idx], LV_BTN_STYLE_REL, &btn_home_noborder_rel);
lv_btn_set_style(launch_ctxt.btn[curr_btn_idx], LV_BTN_STYLE_PR, &btn_home_noborder_rel);
lv_btn_set_style(launch_ctxt.btn[curr_btn_idx], LV_BTN_STYLE_PR, &btn_home_noborder_rel);
}
lv_obj_set_size(btns, btn_width, btn_height);
lv_btn_set_style(btns, LV_BTN_STYLE_REL, img_noborder ? &btn_home_noborder_rel : &btn_home_transp_rel);
lv_btn_set_style(btns, LV_BTN_STYLE_PR, &btn_home_transp_pr);
// Button transparency if custom background, but loses color.
// if (!btn && hekate_bg && !img_noborder)
// {
// lv_btn_set_style(launch_ctxt.btn[curr_btn_idx], LV_BTN_STYLE_REL, &btn_transp_rel);
// lv_btn_set_style(launch_ctxt.btn[curr_btn_idx], LV_BTN_STYLE_PR, &btn_transp_pr);
// lv_btn_set_style(btns, LV_BTN_STYLE_REL, &btn_home_noborder_rel);
// }
if (img)
lv_obj_align(img, NULL, LV_ALIGN_CENTER, 0, 0);
if (img_noborder)
@@ -1957,9 +1943,13 @@ ini_parsing:
lv_label_set_text(launch_ctxt.label[curr_btn_idx], ini_sec->name);
lv_obj_set_opa_scale(launch_ctxt.label[curr_btn_idx], LV_OPA_COVER);
// Set rolling text if name is big.
if (strlen(ini_sec->name) > 22)
// Set rolling text if name is too big.
int max_label_size = 238 - (n_cfg.entries_5_col ? 12 : 0);
if (lv_obj_get_width(launch_ctxt.label[curr_btn_idx]) > max_label_size)
{
lv_label_set_long_mode(launch_ctxt.label[curr_btn_idx], LV_LABEL_LONG_ROLL);
lv_obj_set_width(launch_ctxt.label[curr_btn_idx], max_label_size);
}
entry_idx++;
curr_btn_idx++;
@@ -2115,6 +2105,12 @@ static void _create_tab_home(lv_theme_t *th, lv_obj_t *parent)
// lv_obj_set_width(btn_quick_launch, 256);
// lv_obj_set_pos(btn_quick_launch, 343, 448);
// lv_btn_set_action(btn_quick_launch, LV_BTN_ACTION_CLICK, NULL);
// if (hekate_bg)
// {
// lv_btn_set_style(btn_quick_launch, LV_BTN_STYLE_REL, &btn_transp_rel);
// lv_btn_set_style(btn_quick_launch, LV_BTN_STYLE_PR, &btn_transp_pr);
// lv_btn_set_style(btn_quick_launch, LV_BTN_STYLE_INA, &btn_transp_ina);
// }
lv_obj_t *btn_nyx_options = lv_btn_create(parent, NULL);
_create_text_button(th, NULL, btn_nyx_options, SYMBOL_SETTINGS" Nyx Settings", NULL);
@@ -2179,10 +2175,10 @@ static lv_res_t _save_options_action(lv_obj_t *btn)
int res = 0;
if (sd_mount())
res = !create_config_entry();
if (!sd_mount())
res = create_config_entry();
if (res)
if (!res)
lv_mbox_set_text(mbox, "#FF8000 hekate Configuration#\n\n#96FF00 The configuration was saved to sd card!#");
else
lv_mbox_set_text(mbox, "#FF8000 hekate Configuration#\n\n#FFDD00 Failed to save the configuration#\n#FFDD00 to sd card!#");
@@ -2250,7 +2246,7 @@ static void _create_status_bar(lv_theme_t * th)
lv_obj_t *btn_mid = lv_btn_create(status_bar_bg, NULL);
lv_obj_t *lbl_mid = lv_label_create(btn_mid, NULL);
lv_label_set_static_text(lbl_mid, "Save Options");
lv_obj_set_size(btn_mid, LV_DPI * 5 / 2, LV_DPI / 2);
lv_obj_set_size(btn_mid, LV_DPI * 17 / 8, LV_DPI / 2);
lv_obj_align(btn_mid, NULL, LV_ALIGN_CENTER, 0, 0);
status_bar.mid = btn_mid;
lv_obj_set_opa_scale(btn_mid, LV_OPA_0);
@@ -2263,7 +2259,7 @@ static lv_res_t _create_mbox_save_changes_action(lv_obj_t *btns, const char * tx
{
int btn_idx = lv_btnm_get_pressed(btns);
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
if (!btn_idx)
_save_options_action(NULL);
@@ -2342,9 +2338,9 @@ static void _nyx_set_default_styles(lv_theme_t * th)
hint_small_style_white.text.font = &interui_20;
lv_style_copy(&monospace_text, &lv_style_plain);
monospace_text.body.main_color = LV_COLOR_HEX(0x1B1B1B);
monospace_text.body.grad_color = LV_COLOR_HEX(0x1B1B1B);
monospace_text.body.border.color = LV_COLOR_HEX(0x1B1B1B);
monospace_text.body.main_color = COLOR_HOS_BG_DARKER;
monospace_text.body.grad_color = COLOR_HOS_BG_DARKER;
monospace_text.body.border.color = COLOR_HOS_BG_DARKER;
monospace_text.body.border.width = 0;
monospace_text.body.opa = LV_OPA_TRANSP;
monospace_text.text.color = LV_COLOR_HEX(0xD8D8D8);
@@ -2355,44 +2351,55 @@ static void _nyx_set_default_styles(lv_theme_t * th)
lv_style_copy(&btn_transp_rel, th->btn.rel);
btn_transp_rel.body.main_color = LV_COLOR_HEX(0x444444);
btn_transp_rel.body.grad_color = btn_transp_rel.body.main_color;
btn_transp_rel.body.shadow.color = LV_COLOR_HEX(0x0F0F0F);
btn_transp_rel.body.opa = LV_OPA_50;
lv_style_copy(&btn_transp_pr, th->btn.pr);
btn_transp_pr.body.main_color = LV_COLOR_HEX(0x888888);
btn_transp_pr.body.grad_color = btn_transp_pr.body.main_color;
btn_transp_pr.body.shadow.color = LV_COLOR_HEX(0x0F0F0F);
btn_transp_pr.body.opa = LV_OPA_50;
lv_style_copy(&btn_transp_tgl_rel, th->btn.tgl_rel);
btn_transp_tgl_rel.body.main_color = LV_COLOR_HEX(0x444444);
btn_transp_tgl_rel.body.grad_color = btn_transp_tgl_rel.body.main_color;
btn_transp_tgl_rel.body.shadow.color = LV_COLOR_HEX(0x0F0F0F);
btn_transp_tgl_rel.body.opa = LV_OPA_50;
lv_style_copy(&btn_transp_tgl_pr, th->btn.tgl_pr);
btn_transp_tgl_pr.body.main_color = LV_COLOR_HEX(0x888888);
btn_transp_tgl_pr.body.grad_color = btn_transp_tgl_pr.body.main_color;
btn_transp_tgl_pr.body.shadow.color = LV_COLOR_HEX(0x0F0F0F);
btn_transp_tgl_pr.body.opa = LV_OPA_50;
lv_style_copy(&btn_transp_ina, th->btn.ina);
btn_transp_ina.body.main_color = LV_COLOR_HEX(0x292929);
btn_transp_ina.body.grad_color = btn_transp_ina.body.main_color;
btn_transp_ina.body.border.color = LV_COLOR_HEX(0x444444);
btn_transp_ina.body.shadow.color = LV_COLOR_HEX(0x0F0F0F);
btn_transp_ina.body.opa = LV_OPA_50;
lv_style_copy(&ddlist_transp_bg, th->ddlist.bg);
ddlist_transp_bg.body.main_color = LV_COLOR_HEX(0x2D2D2D);
ddlist_transp_bg.body.grad_color = ddlist_transp_bg.body.main_color;
ddlist_transp_bg.body.opa = 180;
ddlist_transp_bg.body.opa = 180; // 70.6%.
lv_style_copy(&ddlist_transp_sel, th->ddlist.sel);
ddlist_transp_sel.body.main_color = LV_COLOR_HEX(0x4D4D4D);
ddlist_transp_sel.body.grad_color = ddlist_transp_sel.body.main_color;
ddlist_transp_sel.body.opa = 180;
ddlist_transp_sel.body.opa = 180; // 70.6%.
lv_style_copy(&tabview_btn_pr, th->tabview.btn.pr);
tabview_btn_pr.body.main_color = LV_COLOR_HEX(0xFFFFFF);
tabview_btn_pr.body.grad_color = tabview_btn_pr.body.main_color;
tabview_btn_pr.body.opa = 35;
tabview_btn_pr.body.opa = 35; // 13.7%.
lv_style_copy(&tabview_btn_tgl_pr, th->tabview.btn.tgl_pr);
tabview_btn_tgl_pr.body.main_color = LV_COLOR_HEX(0xFFFFFF);
tabview_btn_tgl_pr.body.grad_color = tabview_btn_tgl_pr.body.main_color;
tabview_btn_tgl_pr.body.opa = 35;
tabview_btn_tgl_pr.body.opa = 35; // 13.7%.
lv_color_t tmp_color = lv_color_hsv_to_rgb(n_cfg.theme_color, 100, 100);
lv_color_t tmp_color = COLOR_HOS_TURQUOISE_EX(n_cfg.theme_color);
text_color = malloc(32);
s_printf(text_color, "#%06X", (u32)(tmp_color.full & 0xFFFFFF));
}
@@ -2451,8 +2458,9 @@ static void _nyx_main_menu(lv_theme_t * th)
// Add all tabs content.
char version[32];
char rel = (nyx_str->version >> 24) & 0xFF;
s_printf(version, "hekate %s%d.%d.%d%c",
rel ? "v" : "", nyx_str->version & 0xFF, (nyx_str->version >> 8) & 0xFF, (nyx_str->version >> 16) & 0xFF, rel > 'A' ? rel : 0);
s_printf(version, "hekate %s%d.%d.%d%c%c",
rel ? "v" : "", nyx_str->version & 0xFF, (nyx_str->version >> 8) & 0xFF, (nyx_str->version >> 16) & 0xFF, rel > 'a' ? rel : 0,
(nyx_str->info_ex.rsvd_flags & RSVD_FLAG_DRAM_8GB) ? '*' : 0);
lv_obj_t *tab_about = lv_tabview_add_tab(tv, version);
lv_obj_t *tab_home = lv_tabview_add_tab(tv, SYMBOL_HOME" Home");
@@ -2561,7 +2569,7 @@ void nyx_load_and_run()
close_btn = NULL;
// Initialize touch.
touch_enabled = touch_power_on();
touch_enabled = !touch_power_on();
lv_indev_drv_t indev_drv_touch;
lv_indev_drv_init(&indev_drv_touch);
indev_drv_touch.type = LV_INDEV_TYPE_POINTER;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2025 CTCaer
* Copyright (c) 2018-2026 CTCaer
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -63,7 +63,7 @@ extern lv_img_dsc_t *icon_lakka;
extern lv_img_dsc_t *hekate_bg;
extern lv_img_dsc_t *hekate_bg_etc;
extern lv_style_t btn_transp_rel, btn_transp_pr, btn_transp_tgl_rel, btn_transp_tgl_pr;
extern lv_style_t btn_transp_rel, btn_transp_pr, btn_transp_tgl_rel, btn_transp_tgl_pr, btn_transp_ina;
extern lv_style_t ddlist_transp_bg, ddlist_transp_sel;
extern lv_style_t tabview_btn_pr, tabview_btn_tgl_pr;
@@ -73,14 +73,13 @@ extern char *text_color;
extern gui_status_bar_ctx status_bar;
void reload_nyx();
void reload_nyx(lv_obj_t *obj, bool force);
lv_img_dsc_t *bmp_to_lvimg_obj(const char *path);
lv_res_t mbox_action(lv_obj_t * btns, const char * txt);
bool nyx_emmc_check_battery_enough();
lv_res_t nyx_win_close_action_custom(lv_obj_t * btn);
lv_res_t nyx_mbox_action(lv_obj_t * btns, const char * txt);
lv_res_t nyx_win_close_action(lv_obj_t * btn);
void nyx_window_toggle_buttons(lv_obj_t *win, bool disable);
lv_obj_t *nyx_create_standard_window(const char *win_title);
lv_obj_t *nyx_create_window_custom_close_btn(const char *win_title, lv_action_t rel_action);
lv_obj_t *nyx_create_standard_window(const char *win_title, lv_action_t close_action);
void nyx_create_onoff_button(lv_theme_t *th, lv_obj_t *parent, lv_obj_t *btn, const char *btn_name, lv_action_t action, bool transparent);
lv_res_t nyx_generic_onoff_toggle(lv_obj_t *btn);
void manual_system_maintenance(bool refresh);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2025 CTCaer
* Copyright (c) 2018-2026 CTCaer
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -28,8 +28,6 @@
#include "../hos/hos.h"
#include <libs/fatfs/ff.h>
extern boot_cfg_t b_cfg;
extern char *emmcsn_path_impl(char *path, char *sub_dir, char *filename, sdmmc_storage_t *storage);
typedef struct _emmc_backup_buttons_t
@@ -54,7 +52,7 @@ static void _create_window_backup_restore(emmcPartType_t type, const char* win_l
s_printf(win_label_full, "%s%s", emmc_btn_ctxt.restore ? SYMBOL_DOWNLOAD" Restore " : SYMBOL_UPLOAD" Backup ", win_label+3);
lv_obj_t *win = nyx_create_standard_window(win_label_full);
lv_obj_t *win = nyx_create_standard_window(win_label_full, NULL);
//Disable buttons.
nyx_window_toggle_buttons(win, true);
@@ -285,9 +283,9 @@ lv_res_t create_window_backup_restore_tool(lv_obj_t *btn)
emmc_btn_ctxt.restore = true;
if (!emmc_btn_ctxt.restore)
win = nyx_create_standard_window(SYMBOL_SD" Backup");
win = nyx_create_standard_window(SYMBOL_SD" Backup", NULL);
else
win = nyx_create_standard_window(SYMBOL_SD" Restore");
win = nyx_create_standard_window(SYMBOL_SD" Restore", NULL);
static lv_style_t h_style;
lv_style_copy(&h_style, &lv_style_transp);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2025 CTCaer
* Copyright (c) 2019-2026 CTCaer
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -42,7 +42,7 @@ static lv_res_t (*emummc_tools)(lv_obj_t *btn);
static lv_res_t _action_emummc_window_close(lv_obj_t *btn)
{
nyx_win_close_action_custom(btn);
nyx_win_close_action(btn);
// Delete and relaunch main emuMMC window.
lv_obj_del(emummc_manage_window);
@@ -57,9 +57,9 @@ static void _create_window_emummc()
lv_obj_t *win;
if (!mbr_ctx.part_idx)
win = nyx_create_window_custom_close_btn(SYMBOL_DRIVE" Create SD File emuMMC", _action_emummc_window_close);
win = nyx_create_standard_window(SYMBOL_DRIVE" Create SD File emuMMC", _action_emummc_window_close);
else
win = nyx_create_window_custom_close_btn(SYMBOL_DRIVE" Create SD Partition emuMMC", _action_emummc_window_close);
win = nyx_create_standard_window(SYMBOL_DRIVE" Create SD Partition emuMMC", _action_emummc_window_close);
//Disable buttons.
nyx_window_toggle_buttons(win, true);
@@ -144,7 +144,7 @@ static lv_res_t _create_emummc_raw_format(lv_obj_t * btns, const char * txt)
int btn_idx = lv_btnm_get_pressed(btns);
// Delete parent mbox.
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
// Create partition window.
if (!btn_idx)
@@ -190,7 +190,7 @@ static lv_res_t _create_emummc_raw_action(lv_obj_t * btns, const char * txt)
mbr_ctx.part_idx = 0;
mbr_ctx.sector_start = 0;
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
return LV_RES_INV;
}
@@ -328,7 +328,7 @@ static lv_res_t _create_emummc_action(lv_obj_t * btns, const char * txt)
break;
}
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
return LV_RES_INV;
}
@@ -374,7 +374,7 @@ 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);
nyx_mbox_action(btns, txt);
(*emummc_tools)(NULL);
@@ -402,25 +402,6 @@ static void _create_emummc_migrated_mbox()
lv_obj_set_top(mbox, true);
}
static void _migrate_sd_raw_based()
{
mbr_ctx.sector_start = 2;
sd_mount();
f_mkdir("emuMMC");
f_mkdir("emuMMC/ER00");
f_rename("Emutendo", "emuMMC/ER00/Nintendo");
FIL fp;
f_open(&fp, "emuMMC/ER00/raw_based", FA_CREATE_ALWAYS | FA_WRITE);
f_write(&fp, &mbr_ctx.sector_start, 4, NULL);
f_close(&fp);
save_emummc_cfg(1, mbr_ctx.sector_start, "emuMMC/ER00");
_create_emummc_migrated_mbox();
sd_unmount();
}
static void _migrate_sd_raw_emummc_based()
{
char *tmp = (char *)malloc(0x80);
@@ -449,43 +430,6 @@ static void _migrate_sd_raw_emummc_based()
sd_unmount();
}
static void _migrate_sd_file_based()
{
sd_mount();
f_mkdir("emuMMC");
f_mkdir("emuMMC/EF00");
f_rename("Emutendo", "emuMMC/EF00/Nintendo");
FIL fp;
f_open(&fp, "emuMMC/EF00/file_based", FA_CREATE_ALWAYS | FA_WRITE);
f_close(&fp);
char *path = (char *)malloc(128);
char *path2 = (char *)malloc(128);
s_printf(path, "%c%c%c%c%s", 's', 'x', 'o', 's', "/emunand");
f_rename(path, "emuMMC/EF00/eMMC");
for (int i = 0; i < 2; i++)
{
s_printf(path, "emuMMC/EF00/eMMC/boot%d.bin", i);
s_printf(path2, "emuMMC/EF00/eMMC/BOOT%d", i);
f_rename(path, path2);
}
for (int i = 0; i < 8; i++)
{
s_printf(path, "emuMMC/EF00/eMMC/full.%02d.bin", i);
s_printf(path2, "emuMMC/EF00/eMMC/%02d", i);
f_rename(path, path2);
}
free(path);
free(path2);
save_emummc_cfg(0, 0, "emuMMC/EF00");
_create_emummc_migrated_mbox();
sd_unmount();
}
static void _migrate_sd_backup_file_based()
{
char *emu_path = (char *)malloc(128);
@@ -566,61 +510,7 @@ static void _migrate_sd_backup_file_based()
sd_unmount();
}
static lv_res_t _create_emummc_mig1_action(lv_obj_t * btns, const char * txt)
{
switch (lv_btnm_get_pressed(btns))
{
case 0:
_migrate_sd_file_based();
break;
case 1:
_migrate_sd_raw_based();
break;
}
mbr_ctx.part_idx = 0;
mbr_ctx.sector_start = 0;
mbox_action(btns, txt);
return LV_RES_INV;
}
static lv_res_t _create_emummc_mig0_action(lv_obj_t * btns, const char * txt)
{
switch (lv_btnm_get_pressed(btns))
{
case 0:
_migrate_sd_file_based();
break;
}
mbr_ctx.part_idx = 0;
mbr_ctx.sector_start = 0;
mbox_action(btns, txt);
return LV_RES_INV;
}
static lv_res_t _create_emummc_mig2_action(lv_obj_t * btns, const char * txt)
{
switch (lv_btnm_get_pressed(btns))
{
case 0:
_migrate_sd_raw_based();
break;
}
mbr_ctx.part_idx = 0;
mbr_ctx.sector_start = 0;
mbox_action(btns, txt);
return LV_RES_INV;
}
static lv_res_t _create_emummc_mig3_action(lv_obj_t * btns, const char * txt)
{
switch (lv_btnm_get_pressed(btns))
{
@@ -632,12 +522,12 @@ static lv_res_t _create_emummc_mig3_action(lv_obj_t * btns, const char * txt)
mbr_ctx.part_idx = 0;
mbr_ctx.sector_start = 0;
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
return LV_RES_INV;
}
static lv_res_t _create_emummc_mig4_action(lv_obj_t * btns, const char * txt)
static lv_res_t _create_emummc_mig1_action(lv_obj_t * btns, const char * txt)
{
switch (lv_btnm_get_pressed(btns))
{
@@ -649,13 +539,11 @@ static lv_res_t _create_emummc_mig4_action(lv_obj_t * btns, const char * txt)
mbr_ctx.part_idx = 0;
mbr_ctx.sector_start = 0;
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
return LV_RES_INV;
}
bool em_raw;
bool em_file;
static lv_res_t _create_emummc_migrate_action(lv_obj_t * btns, const char * txt)
{
bool backup = false;
@@ -670,9 +558,7 @@ static lv_res_t _create_emummc_migrate_action(lv_obj_t * btns, const char * txt)
emummc = true;
break;
case 2:
break;
case 3:
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
return LV_RES_INV;
}
@@ -681,8 +567,7 @@ static lv_res_t _create_emummc_migrate_action(lv_obj_t * btns, const char * txt)
lv_obj_set_size(dark_bg, LV_HOR_RES, LV_VER_RES);
static const char *mbox_btn_map[] = { "\222Continue", "\222Cancel", "" };
static const char *mbox_btn_map1[] = { "\222SD File", "\222SD Partition", "\222Cancel", "" };
static const char *mbox_btn_map3[] = { "\251", "OK", "\251", "" };
static const char *mbox_btn_map1[] = { "\251", "OK", "\251", "" };
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 * 6);
@@ -699,40 +584,19 @@ static lv_res_t _create_emummc_migrate_action(lv_obj_t * btns, const char * txt)
s_printf(txt_buf,
"#C7EA46 Found suitable emuMMC backup!#\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_mig1_action);
}
else if (emummc)
{
s_printf(txt_buf,
"#C7EA46 Found SD Partition based emuMMC!#\n\n"
"#FF8000 Do you want to repair the config and partition type for it?#\n");
lv_mbox_add_btns(mbox, mbox_btn_map, _create_emummc_mig3_action);
}
else if (em_raw && em_file)
{
s_printf(txt_buf,
"#C7EA46 Found both foreign SD File and Partition emunand!#\n\n"
"#FF8000 Choose what to migrate:#\n");
lv_mbox_add_btns(mbox, mbox_btn_map1, _create_emummc_mig1_action);
}
else if (em_raw)
{
s_printf(txt_buf,
"#C7EA46 Found foreign SD Partition emunand!#\n\n"
"#FF8000 Do you want to migrate it?#\n");
lv_mbox_add_btns(mbox, mbox_btn_map, _create_emummc_mig2_action);
}
else if (em_file)
{
s_printf(txt_buf,
"#C7EA46 Found foreign SD File emunand!#\n\n"
"#FF8000 Do you want to migrate it?#\n");
lv_mbox_add_btns(mbox, mbox_btn_map, _create_emummc_mig0_action);
}
else
{
s_printf(txt_buf, "No emuMMC or foreign emunand found!\n");
lv_mbox_add_btns(mbox, mbox_btn_map3, mbox_action);
s_printf(txt_buf, "No emuMMC found!\n");
lv_mbox_add_btns(mbox, mbox_btn_map1, nyx_mbox_action);
}
lv_mbox_set_text(mbox, txt_buf);
@@ -741,7 +605,7 @@ static lv_res_t _create_emummc_migrate_action(lv_obj_t * btns, const char * txt)
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
return LV_RES_INV;
}
@@ -762,7 +626,7 @@ static lv_res_t _create_mbox_emummc_migrate(lv_obj_t *btn)
lv_obj_set_style(dark_bg, &mbox_darken);
lv_obj_set_size(dark_bg, LV_HOR_RES, LV_VER_RES);
static char *mbox_btn_map[] = { "\262Backup", "\262Fix RAW", "\262Emunand", "\222Cancel", "" };
static char *mbox_btn_map[] = { "\262Backup", "\262Fix RAW", "\222Cancel", "" };
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 * 6);
@@ -781,8 +645,6 @@ static lv_res_t _create_mbox_emummc_migrate(lv_obj_t *btn)
emmc_initialize(false);
em_raw = false;
em_file = false;
bool backup = false;
bool emummc = false;
bool rawnand_backup = false;
@@ -818,18 +680,6 @@ static lv_res_t _create_mbox_emummc_migrate(lv_obj_t *btn)
}
}
if (!mbr_ctx.part_idx)
{
sdmmc_storage_read(&sd_storage, 0x4003, 1, efi_part);
if (!memcmp(efi_part, "EFI PART", 8))
em_raw = true;
}
s_printf(path_buf, "%c%c%c%c%s", 's', 'x', 'o','s', "/emunand/boot0.bin");
if (!f_stat(path_buf, NULL))
em_file = true;
emummc_backup = false;
emmcsn_path_impl(path_buf, "", "BOOT0", &emmc_storage);
@@ -878,10 +728,6 @@ static lv_res_t _create_mbox_emummc_migrate(lv_obj_t *btn)
mbox_btn_map[1][0] = '\222';
else
mbox_btn_map[1][0] = '\262';
if (em_raw || em_file)
mbox_btn_map[2][0] = '\222';
else
mbox_btn_map[2][0] = '\262';
free(path_buf);
free(mbr);
@@ -905,7 +751,7 @@ static lv_res_t _save_emummc_cfg_mbox_action(lv_obj_t *btns, const char *txt)
free(emummc_img->dirlist);
free(emummc_img);
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
(*emummc_tools)(NULL);
@@ -978,12 +824,12 @@ static lv_res_t _action_win_change_emummc_close(lv_obj_t *btn)
free(emummc_img->dirlist);
free(emummc_img);
return nyx_win_close_action_custom(btn);
return nyx_win_close_action(btn);
}
static lv_res_t _create_change_emummc_window(lv_obj_t *btn_caller)
{
lv_obj_t *win = nyx_create_window_custom_close_btn(SYMBOL_SETTINGS" Change emuMMC", _action_win_change_emummc_close);
lv_obj_t *win = nyx_create_standard_window(SYMBOL_SETTINGS" Change emuMMC", _action_win_change_emummc_close);
lv_win_add_btn(win, NULL, SYMBOL_POWER" Disable", _save_disable_emummc_cfg_action);
sd_mount();
@@ -1204,7 +1050,7 @@ out1:
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", NULL);
// Set resources to be managed by other windows.
emummc_manage_window = win;
@@ -1237,7 +1083,7 @@ lv_res_t create_win_emummc_tools(lv_obj_t *btn)
lv_obj_t *label_txt = lv_label_create(h1, NULL);
lv_label_set_static_text(label_txt, "emuMMC Info & Selection");
lv_obj_set_style(label_txt, lv_theme_get_current()->label.prim);
lv_obj_align(label_txt, label_sep, LV_ALIGN_OUT_BOTTOM_LEFT, LV_DPI / 4, -LV_DPI / 9);
lv_obj_align(label_txt, label_sep, LV_ALIGN_OUT_BOTTOM_LEFT, LV_DPI / 4, LV_DPI / 11);
lv_obj_t *line_sep = lv_line_create(h1, NULL);
static const lv_point_t line_pp[] = { {0, 0}, { LV_HOR_RES - (LV_DPI - (LV_DPI / 4)) * 2, 0} };
@@ -1258,17 +1104,17 @@ lv_res_t create_win_emummc_tools(lv_obj_t *btn)
if (emu_info.enabled)
{
if (emu_info.sector)
s_printf(txt_buf, "#00DDFF Type:# SD Raw Partition\n#00DDFF Sector:# 0x%08X\n#00DDFF Nintendo folder:# %s",
s_printf(txt_buf, "#00DDFF Type:# SD Raw Partition\n#00DDFF Sector:# 0x%08X\n#00DDFF Nintendo folder:# %s\n",
emu_info.sector, emu_info.nintendo_path ? emu_info.nintendo_path : "");
else
s_printf(txt_buf, "#00DDFF Type:# SD File\n#00DDFF Base folder:# %s\n#00DDFF Nintendo folder:# %s",
s_printf(txt_buf, "#00DDFF Type:# SD File\n#00DDFF Base folder:# %s\n#00DDFF Nintendo folder:# %s\n",
emu_info.path ? emu_info.path : "", emu_info.nintendo_path ? emu_info.nintendo_path : "");
lv_label_set_text(label_txt2, txt_buf);
}
else
{
lv_label_set_static_text(label_txt2, "emuMMC is disabled and eMMC will be used for boot.\n\n");
lv_label_set_static_text(label_txt2, "emuMMC is disabled and eMMC will be used for boot.\n\n\n");
}
if (emu_info.path)
@@ -1313,7 +1159,7 @@ lv_res_t create_win_emummc_tools(lv_obj_t *btn)
lv_obj_t *label_txt3 = lv_label_create(h2, NULL);
lv_label_set_static_text(label_txt3, "emuMMC Tools");
lv_obj_set_style(label_txt3, lv_theme_get_current()->label.prim);
lv_obj_align(label_txt3, label_sep, LV_ALIGN_OUT_BOTTOM_LEFT, LV_DPI / 4, 0);
lv_obj_align(label_txt3, label_sep, LV_ALIGN_OUT_BOTTOM_LEFT, LV_DPI / 4, LV_DPI / 5);
line_sep = lv_line_create(h2, line_sep);
lv_obj_align(line_sep, label_txt3, LV_ALIGN_OUT_BOTTOM_LEFT, -(LV_DPI / 4), LV_DPI / 8);
@@ -1330,7 +1176,7 @@ lv_res_t create_win_emummc_tools(lv_obj_t *btn)
lv_label_set_recolor(label_txt4, true);
lv_label_set_static_text(label_txt4,
"Allows you to create a new #C7EA46 SD File# or #C7EA46 SD Raw Partition#\n"
"emuMMC. You can create it from eMMC or a eMMC Backup.");
"emuMMC. You can create it from eMMC or a eMMC Backup.\n");
lv_obj_set_style(label_txt4, &hint_small_style);
lv_obj_align(label_txt4, btn3, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3);
@@ -1346,8 +1192,7 @@ lv_res_t create_win_emummc_tools(lv_obj_t *btn)
label_txt4 = lv_label_create(h2, NULL);
lv_label_set_recolor(label_txt4, true);
lv_label_set_static_text(label_txt4,
"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.");
"Migrate a backup to a #C7EA46 SD File emuMMC# or repair an existing\n#C7EA46 SD Raw Partition emuMMC#.\n");
lv_obj_set_style(label_txt4, &hint_small_style);
lv_obj_align(label_txt4, btn4, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3);

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2018 naehrwert
* Copyright (c) 2018-2025 CTCaer
* Copyright (c) 2018-2026 CTCaer
* Copyright (c) 2018 balika011
*
* This program is free software; you can redistribute it and/or modify it
@@ -30,7 +30,6 @@
static const char base36[37] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
extern volatile boot_cfg_t *b_cfg;
extern volatile nyx_storage_t *nyx_str;
extern lv_res_t launch_payload(lv_obj_t *list);
@@ -59,7 +58,7 @@ static lv_res_t _create_window_dump_done(int error, char *dump_filenames)
lv_mbox_set_text(mbox, txt_buf);
free(txt_buf);
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); // Important. After set_text.
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); // Important. After set_text.
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
@@ -71,11 +70,11 @@ static lv_res_t _cal0_dump_window_action(lv_obj_t *btns, const char * txt)
{
int btn_idx = lv_btnm_get_pressed(btns);
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
if (btn_idx == 1)
{
int error = !sd_mount();
int error = sd_mount();
if (!error)
{
@@ -95,7 +94,7 @@ static lv_res_t _cal0_dump_window_action(lv_obj_t *btns, const char * txt)
static lv_res_t _battery_dump_window_action(lv_obj_t * btn)
{
int error = !sd_mount();
int error = sd_mount();
if (!error)
{
@@ -119,7 +118,7 @@ static lv_res_t _bootrom_dump_window_action(lv_obj_t * btn)
{
static const u32 BOOTROM_SIZE = 0x18000;
int error = !sd_mount();
int error = sd_mount();
if (!error)
{
char path[64];
@@ -180,7 +179,7 @@ static void _unlock_reserved_odm_fuses(bool lock)
static lv_res_t _fuse_dump_window_action(lv_obj_t * btn)
{
int error = !sd_mount();
int error = sd_mount();
if (!error)
{
char path[128];
@@ -228,10 +227,10 @@ static lv_res_t _fuse_dump_window_action(lv_obj_t * btn)
static lv_res_t _kfuse_dump_window_action(lv_obj_t * btn)
{
u32 buf[KFUSE_NUM_WORDS];
int error = !kfuse_read(buf);
int error = kfuse_read(buf);
if (!error)
error = !sd_mount();
error = sd_mount();
if (!error)
{
@@ -388,7 +387,7 @@ u32 wafer16nm[] =
0x1FFFFFFF, 0x1FFFFFFF, 0x0FFFFFFE, 0x0FFFFFFE,
0x0FFFFFFE, 0x07FFFFFC, 0x07FFFFFC, 0x03FFFFF8,
0x01FFFFF0, 0x00FFFFE0, 0x007FFFC0, 0x001FFF00,
0x00000000
0x0000E000
};
u32 wafer20nm[] =
@@ -422,7 +421,7 @@ hw_info_t *hw_info = NULL;
#define WAFER_16NM_X_MIN -11
#define WAFER_16NM_X_MAX 17
#define WAFER_16NM_Y_MIN 0
#define WAFER_16NM_Y_MAX 27
#define WAFER_16NM_Y_MAX 28
void _hw_info_wafer(int die_x, int die_y)
{
@@ -470,8 +469,8 @@ void _hw_info_wafer(int die_x, int die_y)
int pos_y = y * die_line * die_side + die_line;
for (int x = 0; x < diameter; x++)
{
bool in_wafer = wafer_row & (1u << x);
bool die_found = x == die_x && die_y == y;
bool in_wafer = wafer_row & (1u << x);
u32 die_column = x * die_side;
// Paint street rows;
@@ -542,14 +541,14 @@ static lv_res_t _action_win_hw_info_status_close(lv_obj_t *btn)
hw_info = NULL;
}
return nyx_win_close_action_custom(btn);
return nyx_win_close_action(btn);
}
static lv_res_t _create_window_hw_info_status(lv_obj_t *btn)
{
u32 uptime_s = get_tmr_s();
lv_obj_t *win = nyx_create_window_custom_close_btn(SYMBOL_CHIP" HW & Fuses Info", _action_win_hw_info_status_close);
lv_obj_t *win = nyx_create_standard_window(SYMBOL_CHIP" HW & Fuses Info", _action_win_hw_info_status_close);
lv_win_add_btn(win, NULL, SYMBOL_DOWNLOAD" Dump fuses", _fuse_dump_window_action);
lv_win_add_btn(win, NULL, SYMBOL_INFO" CAL0 Info", _create_mbox_cal0);
@@ -562,7 +561,7 @@ static lv_res_t _create_window_hw_info_status(lv_obj_t *btn)
lv_label_set_style(lb_desc, &monospace_text);
char version[32];
s_printf(version, "%s%d.%d.%d%c", NYX_VER_RL ? "v" : "", NYX_VER_MJ, NYX_VER_MN, NYX_VER_HF, NYX_VER_RL > 'A' ? NYX_VER_RL : 0);
s_printf(version, "%s%d.%d.%d%c", NYX_VER_RL ? "v" : "", NYX_VER_MJ, NYX_VER_MN, NYX_VER_HF, NYX_VER_RL > 'a' ? NYX_VER_RL : 0);
lv_obj_t * lbl_ver = lv_label_create(lv_scr_act(), NULL);
lv_label_set_style(lbl_ver, &hint_small_style_white);
lv_label_set_text(lbl_ver, version);
@@ -808,7 +807,10 @@ static lv_res_t _create_window_hw_info_status(lv_obj_t *btn)
strcpy(fuses_hos_version, "20.0.0 - 20.5.0");
break;
case 22:
strcpy(fuses_hos_version, "21.0.0+");
strcpy(fuses_hos_version, "21.0.0 - 21.2.0");
break;
case 23:
strcpy(fuses_hos_version, "22.0.0+");
break;
case 255:
strcpy(fuses_hos_version, "#FFD000 Overburnt#");
@@ -1090,6 +1092,12 @@ static lv_res_t _create_window_hw_info_status(lv_obj_t *btn)
u8 display_rev = (nyx_str->info.panel_id >> 8) & 0xFF;
u32 display_id = ((nyx_str->info.panel_id >> 8) & 0xFF00) | (nyx_str->info.panel_id & 0xFF);
// For OLED LCD 7" OEM clone use touch to identify it.
touch_info_t *touch_info = touch_get_chip_info();
bool touch_clone_oled = touch_info->chip_id == FTS4_I2C_CHIP_ID && touch_info->clone;
if (touch_clone_oled)
display_id = 0x10000;
strcat(txt_buf, "#00DDFF Display Panel:#\n#FF8000 Model:# ");
switch (display_id)
@@ -1097,9 +1105,11 @@ static lv_res_t _create_window_hw_info_status(lv_obj_t *btn)
case PANEL_JDI_LAM062M109A:
strcat(txt_buf, "JDI LAM062M109A");
break;
case PANEL_JDI_LPM062M326A:
strcat(txt_buf, "JDI LPM062M326A");
break;
case PANEL_INL_P062CCA_AZ1:
strcat(txt_buf, "InnoLux P062CCA");
switch (display_rev)
@@ -1127,6 +1137,7 @@ static lv_res_t _create_window_hw_info_status(lv_obj_t *btn)
break;
}
break;
case PANEL_AUO_A062TAN01:
strcat(txt_buf, "AUO A062TAN");
switch (display_rev)
@@ -1154,31 +1165,44 @@ static lv_res_t _create_window_hw_info_status(lv_obj_t *btn)
break;
}
break;
case PANEL_INL_2J055IA_27A:
strcat(txt_buf, "InnoLux 2J055IA-27A");
break;
case PANEL_AUO_A055TAN01:
strcat(txt_buf, "AUO A055TAN");
s_printf(txt_buf + strlen(txt_buf), "%02d", display_rev - 0x92);
break;
case PANEL_SHP_LQ055T1SW10:
strcat(txt_buf, "Sharp LQ055T1SW10");
break;
case PANEL_SAM_AMS699VC01:
strcat(txt_buf, "Samsung AMS699VC01");
break;
case PANEL_OEM_CLONE_6_2:
strcat(txt_buf, "#FFDD00 OEM Clone 6.2\"#");
break;
case PANEL_OEM_CLONE_5_5:
strcat(txt_buf, "#FFDD00 OEM Clone 5.5\"#");
break;
case PANEL_OEM_CLONE:
strcat(txt_buf, "#FFDD00 OEM Clone#");
break;
case 0xCCCC:
strcat(txt_buf, "#FFDD00 Failed to get info!#");
break;
case 0x10000: // Custom ID for LCD OEM Clone for Switch OLED.
strcat(txt_buf, "#FFDD00 LCD OEM Clone 7\"#");
break;
default:
switch (display_id & 0xFF)
{
@@ -1202,17 +1226,16 @@ static lv_res_t _create_window_hw_info_status(lv_obj_t *btn)
s_printf(txt_buf + strlen(txt_buf), "\n#FF8000 ID:# #96FF00 %02X# %02X #96FF00 %02X#",
nyx_str->info.panel_id & 0xFF, (nyx_str->info.panel_id >> 8) & 0xFF, (nyx_str->info.panel_id >> 16) & 0xFF);
touch_fw_info_t touch_fw;
touch_panel_info_t *touch_panel;
bool panel_ic_paired = false;
// Prepare touch panel/ic info.
touch_fw_info_t touch_fw;
if (!touch_get_fw_info(&touch_fw))
{
strcat(txt_buf, "\n\n#00DDFF Touch Panel:#\n#FF8000 Model:# ");
touch_panel = touch_get_panel_vendor();
if (touch_panel)
touch_panel_info_t *touch_panel = touch_get_panel_vendor();
if (touch_clone_oled)
strcat(txt_buf, "#FFDD00 OEM Clone TSP#");
else if (touch_panel)
{
if ((u8)touch_panel->idx == (u8)-2) // Touch panel not found, print gpios.
{
@@ -1229,7 +1252,11 @@ static lv_res_t _create_window_hw_info_status(lv_obj_t *btn)
s_printf(txt_buf + strlen(txt_buf), "\n#FF8000 ID:# %02X.%02X.%02X.%02X (",
(touch_fw.fw_id >> 24) & 0xFF, (touch_fw.fw_id >> 16) & 0xFF, (touch_fw.fw_id >> 8) & 0xFF, touch_fw.fw_id & 0xFF);
if (touch_clone_oled)
touch_fw.fw_id = 0xFFFFFFFF;
// Check panel pair info.
bool panel_ic_paired = false;
switch (touch_fw.fw_id)
{
case 0x00100100:
@@ -1237,6 +1264,7 @@ static lv_res_t _create_window_hw_info_status(lv_obj_t *btn)
if (touch_panel)
panel_ic_paired = (u8)touch_panel->idx == (u8)-1;
break;
case 0x00100200: // 4CD 1602.
case 0x00120100:
case 0x32000001:
@@ -1244,6 +1272,7 @@ static lv_res_t _create_window_hw_info_status(lv_obj_t *btn)
if (touch_panel)
panel_ic_paired = touch_panel->idx == 0; // NISSHA NFT-K12D.
break;
// case 0x98000004: // New 6.2" panel?
// case 0x50000001:
// case 0x50000002:
@@ -1251,24 +1280,28 @@ static lv_res_t _create_window_hw_info_status(lv_obj_t *btn)
// if (touch_panel)
// panel_ic_paired = touch_panel->idx == 0;
// break;
case 0x001A0300:
case 0x32000102:
strcat(txt_buf, "4CD60D/2");
if (touch_panel)
panel_ic_paired = touch_panel->idx == 1; // GiS GGM6 B2X.
break;
case 0x00290100:
case 0x32000302:
strcat(txt_buf, "4CD60D/3");
if (touch_panel)
panel_ic_paired = touch_panel->idx == 2; // NISSHA NBF-K9A.
break;
case 0x31051820:
case 0x32000402:
strcat(txt_buf, "4CD60D/4");
if (touch_panel)
panel_ic_paired = touch_panel->idx == 3; // GiS 5.5".
break;
case 0x32000501:
case 0x33000502:
case 0x33000503:
@@ -1277,6 +1310,12 @@ static lv_res_t _create_window_hw_info_status(lv_obj_t *btn)
if (touch_panel)
panel_ic_paired = touch_panel->idx == 4; // Samsung BH2109.
break;
case 0xFFFFFFFF: // Custom for OLED clone.
strcat(txt_buf, "Clone");
panel_ic_paired = true;
break;
default:
strcat(txt_buf, "#FF8000 Contact me#");
break;
@@ -1328,7 +1367,7 @@ static void _ipatch_process(u32 offset, u32 value)
static lv_res_t _create_window_bootrom_info_status(lv_obj_t *btn)
{
lv_obj_t *win = nyx_create_standard_window(SYMBOL_CHIP" Bootrom Info");
lv_obj_t *win = nyx_create_standard_window(SYMBOL_CHIP" Bootrom Info", NULL);
lv_win_add_btn(win, NULL, SYMBOL_DOWNLOAD" Dump Bootrom", _bootrom_dump_window_action);
lv_obj_t *desc = lv_cont_create(win, NULL);
@@ -1360,7 +1399,7 @@ static lv_res_t _launch_lockpick_action(lv_obj_t *btns, const char * txt)
{
int btn_idx = lv_btnm_get_pressed(btns);
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
if (btn_idx == 1)
{
@@ -1445,7 +1484,7 @@ static lv_res_t _create_mbox_emmc_sandisk_report(lv_obj_t * btn)
lv_obj_align(lb_desc2, lb_desc, LV_ALIGN_OUT_RIGHT_TOP, 0, 0);
if (!emmc_initialize(false))
if (emmc_initialize(false))
{
lv_label_set_text(lb_desc, "#FFDD00 Failed to init eMMC!#");
@@ -1455,7 +1494,7 @@ static lv_res_t _create_mbox_emmc_sandisk_report(lv_obj_t * btn)
int res = sdmmc_storage_vendor_sandisk_report(&emmc_storage, buf);
emmc_end();
if (!res)
if (res)
{
lv_label_set_text(lb_desc, "#FFDD00 Device Report not supported!#");
lv_label_set_text(lb_desc2, " ");
@@ -1582,7 +1621,7 @@ out:
free (txt_buf);
free (txt_buf2);
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); // Important. After set_text.
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); // Important. After set_text.
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
@@ -1639,12 +1678,12 @@ static lv_res_t _create_mbox_benchmark(bool sd_bench)
// Re-initialize to update trimmers.
sd_end();
res = !sd_mount();
res = sd_mount();
}
else
{
storage = &emmc_storage;
res = !emmc_initialize(false);
res = emmc_initialize(false);
if (!res)
emmc_set_partition(EMMC_GPP);
}
@@ -1708,7 +1747,7 @@ static lv_res_t _create_mbox_benchmark(bool sd_bench)
while (data_remaining)
{
u32 time_taken = get_tmr_us();
error = !sdmmc_storage_read(storage, sector_off + lba_curr, sector_num, (u8 *)MIXD_BUF_ALIGNED);
error = sdmmc_storage_read(storage, sector_off + lba_curr, sector_num, (u8 *)MIXD_BUF_ALIGNED);
time_taken = get_tmr_us() - time_taken;
timer += time_taken;
@@ -1755,7 +1794,7 @@ static lv_res_t _create_mbox_benchmark(bool sd_bench)
while (data_remaining)
{
u32 time_taken = get_tmr_us();
error = !sdmmc_storage_read(storage, sector_off + lba_curr, sector_num, (u8 *)MIXD_BUF_ALIGNED);
error = sdmmc_storage_read(storage, sector_off + lba_curr, sector_num, (u8 *)MIXD_BUF_ALIGNED);
time_taken = get_tmr_us() - time_taken;
timer += time_taken;
@@ -1811,7 +1850,7 @@ static lv_res_t _create_mbox_benchmark(bool sd_bench)
for (u32 i = 0; i < rnd_off_cnt; i += 4)
{
// Generate new random numbers.
while (!se_rng_pseudo(random_numbers, SE_RNG_BLOCK_SIZE))
while (se_rng_pseudo(random_numbers, SE_RNG_BLOCK_SIZE))
;
// Clamp offsets to 256MB range.
random_offsets[i + 0] = random_numbers[0] % sct_rem_4kb;
@@ -1830,7 +1869,7 @@ static lv_res_t _create_mbox_benchmark(bool sd_bench)
while (data_remaining)
{
u32 time_taken = get_tmr_us();
error = !sdmmc_storage_read(storage, sector_off + random_offsets[lba_idx], sector_num, (u8 *)MIXD_BUF_ALIGNED);
error = sdmmc_storage_read(storage, sector_off + random_offsets[lba_idx], sector_num, (u8 *)MIXD_BUF_ALIGNED);
time_taken = get_tmr_us() - time_taken;
timer += time_taken;
@@ -1890,9 +1929,9 @@ error:
if (error)
{
if (error == -1)
s_printf(txt_buf + strlen(txt_buf), "\n#FFDD00 Aborted!#");
s_printf(txt_buf + strlen(txt_buf), "\n#FFDD00 Aborted! #");
else
s_printf(txt_buf + strlen(txt_buf), "\n#FFDD00 IO Error occurred!#");
s_printf(txt_buf + strlen(txt_buf), "\n#FFDD00 IO Error occurred! #");
lv_label_set_text(lbl_status, txt_buf);
lv_obj_align(lbl_status, NULL, LV_ALIGN_CENTER, 0, 0);
@@ -1929,7 +1968,7 @@ out:
free(txt_buf);
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); // Important. After set_text.
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); // Important. After set_text.
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
return LV_RES_OK;
@@ -1951,7 +1990,7 @@ static lv_res_t _create_mbox_sd_bench(lv_obj_t * btn)
static lv_res_t _create_window_emmc_info_status(lv_obj_t *btn)
{
lv_obj_t *win = nyx_create_standard_window(SYMBOL_CHIP" Internal eMMC Info");
lv_obj_t *win = nyx_create_standard_window(SYMBOL_CHIP" Internal eMMC Info", NULL);
lv_win_add_btn(win, NULL, SYMBOL_CHIP" Benchmark", _create_mbox_emmc_bench);
lv_obj_t *desc = lv_cont_create(win, NULL);
@@ -1966,7 +2005,7 @@ static lv_res_t _create_window_emmc_info_status(lv_obj_t *btn)
txt_buf[1] = 0;
u16 *emmc_errors;
if (!emmc_initialize(false))
if (emmc_initialize(false))
{
lv_label_set_text(lb_desc, "#FFDD00 Failed to init eMMC!#");
lv_obj_set_width(lb_desc, lv_obj_get_width(desc));
@@ -1975,16 +2014,16 @@ static lv_res_t _create_window_emmc_info_status(lv_obj_t *btn)
goto out_error;
}
u32 speed = 0;
u32 bus_clock = 0;
char *rsvd_blocks;
char life_a_txt[8];
char life_b_txt[8];
char bkops[64];
u32 cache = emmc_storage.ext_csd.cache_size;
u32 life_a = emmc_storage.ext_csd.dev_life_est_a;
u32 life_b = emmc_storage.ext_csd.dev_life_est_b;
u16 card_type = emmc_storage.ext_csd.card_type;
char card_type_support[96];
card_type_support[0] = 0;
char *max_bus_support = "Unknown";
// Identify manufacturer. Only official eMMCs.
switch (emmc_storage.cid.manfid)
@@ -2018,50 +2057,69 @@ static lv_res_t _create_window_emmc_info_status(lv_obj_t *btn)
emmc_storage.cid.prv & 0xF, emmc_storage.cid.prv >> 4,
emmc_storage.cid.serial, emmc_storage.cid.month, emmc_storage.cid.year);
if (card_type & EXT_CSD_CARD_TYPE_HS_26)
{
strcat(card_type_support, "HS26");
speed = (26 << 16) | 26;
}
if (card_type & EXT_CSD_CARD_TYPE_HS_52)
{
strcat(card_type_support, ", HS52");
speed = (52 << 16) | 52;
}
if (card_type & EXT_CSD_CARD_TYPE_DDR_1_8V)
{
strcat(card_type_support, ", DDR52 1.8V");
speed = (52 << 16) | 104;
}
if (card_type & EXT_CSD_CARD_TYPE_HS200_1_8V)
{
strcat(card_type_support, ", HS200 1.8V");
speed = (200 << 16) | 200;
}
if (card_type & EXT_CSD_CARD_TYPE_HS400_1_8V)
max_bus_support = "HS400";
else if (card_type & EXT_CSD_CARD_TYPE_HS200_1_8V)
max_bus_support = "HS200";
else if (card_type & EXT_CSD_CARD_TYPE_DDR_1_8V)
max_bus_support = "DDR52";
else if (card_type & EXT_CSD_CARD_TYPE_HS_52)
max_bus_support = "HS52";
else if (card_type & EXT_CSD_CARD_TYPE_HS_26)
max_bus_support = "HS26";
if (emmc_storage.csd.busspeed == 400)
bus_clock = 200;
else
bus_clock = emmc_storage.csd.busspeed; // Except DDR52 where it's 26 MHz.
strcpy(bkops, "-");
if (emmc_storage.ext_csd.bkops)
{
strcat(card_type_support, ", HS400 1.8V");
speed = (200 << 16) | 400;
if (emmc_storage.ext_csd.bkops_en & EXT_CSD_BKOPS_AUTO)
{
strcpy(bkops, "Auto");
if (emmc_storage.ext_csd.bkops_en & EXT_CSD_BKOPS_MANUAL)
strcat(bkops, " + Manual");
}
else
strcpy(bkops, "Off");
strcat(bkops, ": ");
switch (emmc_storage.raw_ext_csd[EXT_CSD_BKOPS_STATUS])
{
case 0:
strcat(bkops, "OK");
break;
case 1:
strcat(bkops, "Minor");
break;
case 2:
strcat(bkops, "#FFDD00 Degraded#");
break;
case 3:
strcat(bkops, "#FFDD00 Critical#");
break;
}
}
strcpy(life_a_txt, "-");
strcpy(life_b_txt, "-");
// Normalize cells life.
if (life_a) // SK Hynix is 0 (undefined).
// Normalize cells life (Used -> Left).
if (life_a) // If 0 no NAND Type A.
{
life_a--;
life_a = (10 - life_a) * 10;
life_a = (10 - (life_a - 1)) * 10;
s_printf(life_a_txt, "%d%%", life_a);
}
if (life_b) // Toshiba is 0 (undefined).
if (life_b) // If 0 no NAND Type B.
{
life_b--;
life_b = (10 - life_b) * 10;
life_b = (10 - (life_b - 1)) * 10;
s_printf(life_b_txt, "%d%%", life_b);
}
// Reserved blocks used.
switch (emmc_storage.ext_csd.pre_eol_info)
{
case 1:
@@ -2079,12 +2137,13 @@ static lv_res_t _create_window_emmc_info_status(lv_obj_t *btn)
}
s_printf(txt_buf + strlen(txt_buf),
"#00DDFF V1.%d (rev 1.%d)#\n%02X\n%d MB/s (%d MHz)\n%d MB/s\n%s\n%d %s\n%d MiB\nA: %s, B: %s\n%s",
"#00DDFF V1.%d (rev 1.%d)#\n%02X\n%s\n%d MB/s (%d MHz)\n%d MiB\n%d %s\n\n%s\nA: %s, B: %s\n%s",
emmc_storage.ext_csd.ext_struct, emmc_storage.ext_csd.rev,
emmc_storage.csd.cmdclass, speed & 0xFFFF, (speed >> 16) & 0xFFFF,
emmc_storage.csd.busspeed, card_type_support,
!(cache % 1024) ? (cache / 1024) : cache, !(cache % 1024) ? "MiB" : "KiB",
emmc_storage.csd.cmdclass, max_bus_support,
emmc_storage.csd.busspeed, bus_clock,
emmc_storage.ext_csd.max_enh_mult * EMMC_BLOCKSIZE / 1024,
!(cache % 1024) ? (cache / 1024) : cache, !(cache % 1024) ? "MiB" : "KiB",
bkops,
life_a_txt, life_b_txt, rsvd_blocks);
lv_label_set_static_text(lb_desc,
@@ -2096,25 +2155,25 @@ static lv_res_t _create_window_emmc_info_status(lv_obj_t *btn)
"Month/Year:\n\n"
"#00DDFF Ext CSD:#\n"
"Cmd Classes:\n"
"Max Rate:\n"
"Max Bus Rate:\n"
"Current Rate:\n"
"Type Support:\n\n"
"Write Cache:\n"
"Enhanced Area:\n"
"Write Cache:\n\n"
"Maintenance:\n"
"Estimated Life:\n"
"Reserved Used:"
);
lv_obj_set_width(lb_desc, lv_obj_get_width(desc));
lv_obj_t *val = lv_cont_create(win, NULL);
lv_obj_set_size(val, LV_HOR_RES / 11 * 3, LV_VER_RES - (LV_DPI * 11 / 7) - 5);
lv_obj_t *info = lv_cont_create(win, NULL);
lv_obj_set_size(info, LV_HOR_RES / 11 * 3, LV_VER_RES - (LV_DPI * 11 / 7) - 5);
lv_obj_t * lb_val = lv_label_create(val, lb_desc);
lv_obj_t * lb_val = lv_label_create(info, lb_desc);
lv_label_set_text(lb_val, txt_buf);
lv_obj_set_width(lb_val, lv_obj_get_width(val));
lv_obj_align(val, desc, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
lv_obj_set_width(lb_val, lv_obj_get_width(info));
lv_obj_align(info, desc, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
lv_obj_t *desc2 = lv_cont_create(win, NULL);
lv_obj_set_size(desc2, LV_HOR_RES / 2 / 4 * 4, LV_VER_RES - (LV_DPI * 11 / 7) - 5);
@@ -2170,7 +2229,7 @@ static lv_res_t _create_window_emmc_info_status(lv_obj_t *btn)
lv_label_set_text(lb_desc2, txt_buf);
lv_obj_set_width(lb_desc2, lv_obj_get_width(desc2));
lv_obj_align(desc2, val, LV_ALIGN_OUT_RIGHT_MID, LV_DPI / 6, 0);
lv_obj_align(desc2, info, LV_ALIGN_OUT_RIGHT_MID, LV_DPI / 6, 0);
emmc_errors = emmc_get_error_count();
if (emmc_get_mode() < EMMC_MMC_HS400 ||
@@ -2203,7 +2262,7 @@ out_error:
emmc_errors[EMMC_ERROR_RW_RETRY]);
lv_mbox_set_text(mbox, txt_buf);
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
lv_obj_set_width(mbox, LV_HOR_RES / 9 * 5);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
@@ -2217,7 +2276,7 @@ out_error:
static lv_res_t _create_window_sdcard_info_status(lv_obj_t *btn)
{
lv_obj_t *win = nyx_create_standard_window(SYMBOL_SD" microSD Card Info");
lv_obj_t *win = nyx_create_standard_window(SYMBOL_SD" microSD Card Info", NULL);
lv_win_add_btn(win, NULL, SYMBOL_SD" Benchmark", _create_mbox_sd_bench);
lv_obj_t *desc = lv_cont_create(win, NULL);
@@ -2235,7 +2294,7 @@ static lv_res_t _create_window_sdcard_info_status(lv_obj_t *btn)
manual_system_maintenance(true);
if (!sd_mount())
if (sd_mount())
{
lv_label_set_text(lb_desc, "#FFDD00 Failed to init SD!#");
goto failed;
@@ -2622,7 +2681,7 @@ failed:
static lv_res_t _create_window_battery_status(lv_obj_t *btn)
{
lv_obj_t *win = nyx_create_standard_window(SYMBOL_BATTERY_FULL" Battery Info");
lv_obj_t *win = nyx_create_standard_window(SYMBOL_BATTERY_FULL" Battery Info", NULL);
lv_win_add_btn(win, NULL, SYMBOL_DOWNLOAD" Dump Fuel Regs", _battery_dump_window_action);
lv_obj_t *desc = lv_cont_create(win, NULL);
@@ -2834,7 +2893,7 @@ static lv_res_t _create_window_battery_status(lv_obj_t *btn)
bool inserted;
u32 wattage = 0;
usb_pd_objects_t usb_pd;
bm92t36_get_sink_info(&inserted, &usb_pd);
bm92t36_get_source_info(&inserted, &usb_pd);
strcat(txt_buf, inserted ? "Connected" : "Disconnected");
// Select 5V is no PD contract.
@@ -2845,9 +2904,8 @@ static lv_res_t _create_window_battery_status(lv_obj_t *btn)
if (!usb_pd.pdo_no)
strcat(txt_buf, "\nNon PD");
// Limit to 6 profiles so it can fit.
// Show 6 profiles max so they can fit.
usb_pd.pdo_no = MIN(usb_pd.pdo_no, 6);
for (u32 i = 0; i < usb_pd.pdo_no; i++)
{
bool selected =
@@ -2881,7 +2939,7 @@ static bool _lockpick_exists_check()
bool found = false;
void *buf = malloc(0x200);
if (sd_mount())
if (!sd_mount())
{
FIL fp;
if (f_open(&fp, "bootloader/payloads/Lockpick_RCM.bin", FA_READ))
@@ -2948,7 +3006,8 @@ void create_tab_info(lv_theme_t *th, lv_obj_t *parent)
if (hekate_bg || hekate_bg_etc)
{
lv_btn_set_style(btn, LV_BTN_STYLE_REL, &btn_transp_rel);
lv_btn_set_style(btn, LV_BTN_STYLE_PR, &btn_transp_pr);
lv_btn_set_style(btn, LV_BTN_STYLE_PR, &btn_transp_pr);
lv_btn_set_style(btn, LV_BTN_STYLE_INA, &btn_transp_ina);
}
lv_obj_t *label_btn = lv_label_create(btn, NULL);
lv_btn_set_fit(btn, true, true);
@@ -2988,13 +3047,13 @@ void create_tab_info(lv_theme_t *th, lv_obj_t *parent)
static lv_style_t line_style;
lv_style_copy(&line_style, th->line.decor);
line_style.line.color = LV_COLOR_HEX(0x444444);
line_style.line.color = LV_COLOR_HEX(theme_bg_color ? (theme_bg_color + 0x171717) : 0x343434);
line_sep = lv_line_create(h1, line_sep);
lv_obj_align(line_sep, label_txt2, LV_ALIGN_OUT_BOTTOM_LEFT, -(LV_DPI / 4), LV_DPI / 16);
lv_line_set_style(line_sep, &line_style);
// Create Fuses button.
// Create HW info button.
lv_obj_t *btn3 = lv_btn_create(h1, btn);
label_btn = lv_label_create(btn3, NULL);
lv_btn_set_fit(btn3, true, true);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2025 CTCaer
* Copyright (c) 2018-2026 CTCaer
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -228,7 +228,7 @@ static void _create_autoboot_window()
// Parse hekate main configuration.
LIST_INIT(ini_sections);
if (ini_parse(&ini_sections, "bootloader/hekate_ipl.ini", false))
if (!ini_parse(&ini_sections, "bootloader/hekate_ipl.ini", false))
{
LIST_FOREACH_ENTRY(ini_sec_t, ini_sec, &ini_sections, link)
{
@@ -272,7 +272,7 @@ static void _create_autoboot_window()
// Parse all .ini files in ini folder.
LIST_INIT(ini_list_sections);
if (ini_parse(&ini_list_sections, "bootloader/ini", true))
if (!ini_parse(&ini_list_sections, "bootloader/ini", true))
{
LIST_FOREACH_ENTRY(ini_sec_t, ini_sec, &ini_list_sections, link)
{
@@ -373,31 +373,40 @@ static lv_res_t _save_nyx_options_action(lv_obj_t *btn)
return LV_RES_OK;
}
void create_flat_button(lv_obj_t *parent, lv_obj_t *btn, lv_color_t color, lv_action_t action)
void create_flat_button(lv_obj_t *btn, int color_idx, lv_action_t action)
{
lv_color_t color = color_idx ? lv_color_hsv_to_rgb(color_idx, 100, 100) : lv_color_hsv_to_rgb(53, 8, 90);
lv_style_t *btn_onoff_rel_hos_style = malloc(sizeof(lv_style_t));
lv_style_t *btn_onoff_pr_hos_style = malloc(sizeof(lv_style_t));
lv_style_t *btn_onoff_pr_hos_style = malloc(sizeof(lv_style_t));
lv_style_copy(btn_onoff_rel_hos_style, lv_theme_get_current()->btn.rel);
btn_onoff_rel_hos_style->body.main_color = color;
btn_onoff_rel_hos_style->body.grad_color = btn_onoff_rel_hos_style->body.main_color;
btn_onoff_rel_hos_style->body.main_color = color;
btn_onoff_rel_hos_style->body.grad_color = btn_onoff_rel_hos_style->body.main_color;
btn_onoff_rel_hos_style->body.padding.hor = 0;
btn_onoff_rel_hos_style->body.radius = 0;
btn_onoff_rel_hos_style->body.radius = 0;
if (color_idx == 167)
{
btn_onoff_rel_hos_style->body.border.color = LV_COLOR_HEX(0x000000);
btn_onoff_rel_hos_style->body.border.opa = LV_OPA_20;
btn_onoff_rel_hos_style->body.border.width = 3;
}
lv_style_copy(btn_onoff_pr_hos_style, lv_theme_get_current()->btn.pr);
btn_onoff_pr_hos_style->body.main_color = color;
btn_onoff_pr_hos_style->body.grad_color = btn_onoff_pr_hos_style->body.main_color;
btn_onoff_pr_hos_style->body.padding.hor = 0;
btn_onoff_pr_hos_style->body.border.color = LV_COLOR_GRAY;
btn_onoff_pr_hos_style->body.main_color = color;
btn_onoff_pr_hos_style->body.grad_color = btn_onoff_pr_hos_style->body.main_color;
btn_onoff_pr_hos_style->body.padding.hor = 0;
btn_onoff_pr_hos_style->body.border.color = LV_COLOR_HEX(0xFFFFFF);
btn_onoff_pr_hos_style->body.border.opa = LV_OPA_50;
btn_onoff_pr_hos_style->body.border.width = 4;
btn_onoff_pr_hos_style->body.radius = 0;
btn_onoff_pr_hos_style->body.radius = 0;
lv_btn_set_style(btn, LV_BTN_STYLE_REL, btn_onoff_rel_hos_style);
lv_btn_set_style(btn, LV_BTN_STYLE_PR, btn_onoff_pr_hos_style);
lv_btn_set_style(btn, LV_BTN_STYLE_REL, btn_onoff_rel_hos_style);
lv_btn_set_style(btn, LV_BTN_STYLE_PR, btn_onoff_pr_hos_style);
lv_btn_set_style(btn, LV_BTN_STYLE_TGL_REL, btn_onoff_rel_hos_style);
lv_btn_set_style(btn, LV_BTN_STYLE_TGL_PR, btn_onoff_pr_hos_style);
lv_btn_set_style(btn, LV_BTN_STYLE_TGL_PR, btn_onoff_pr_hos_style);
lv_btn_set_fit(btn, false, true);
lv_obj_set_width(btn, lv_obj_get_height(btn));
lv_btn_set_fit(btn, false, false);
lv_obj_set_size(btn, LV_DPI * 7 / 11, LV_DPI * 7 / 11);
lv_btn_set_toggle(btn, true);
if (action)
@@ -408,6 +417,10 @@ typedef struct _color_test_ctxt
{
u32 bg;
u16 hue;
u8 r;
u8 g;
u8 b;
lv_obj_t *window;
lv_obj_t *header1;
lv_obj_t *header2;
@@ -417,11 +430,25 @@ typedef struct _color_test_ctxt
lv_obj_t *button;
lv_obj_t *hue_slider;
lv_obj_t *hue_label;
lv_obj_t *r_slider;
lv_obj_t *r_label;
lv_obj_t *g_slider;
lv_obj_t *g_label;
lv_obj_t *b_slider;
lv_obj_t *b_label;
lv_style_t box_style;
lv_obj_t *box;
lv_obj_t *btn_reset;
lv_obj_t *btn_apply;
lv_obj_t *btn_black;
} color_test_ctxt;
color_test_ctxt color_test;
static lv_res_t _save_theme_color_action(lv_obj_t *btn)
static lv_res_t _action_win_nyx_colors_save(lv_obj_t *btn)
{
n_cfg.theme_bg = color_test.bg;
n_cfg.theme_color = color_test.hue;
@@ -434,12 +461,23 @@ static lv_res_t _save_theme_color_action(lv_obj_t *btn)
return LV_RES_OK;
}
static void _show_new_nyx_color(u32 bg, u16 hue, bool update_bg)
static void _show_new_nyx_color(bool update_bg)
{
lv_color_t bgc = LV_COLOR_HEX(bg);
lv_color_t bgc_light = LV_COLOR_HEX(bg ? (bg + 0x101010) : 0x2D2D2D);
lv_color_t bg_border = LV_COLOR_HEX(bg ? (bg + 0x202020) : 0x3D3D3D);
lv_color_t color = lv_color_hsv_to_rgb(hue, 100, 100);
u32 bg = color_test.bg;
u16 hue = color_test.hue;
lv_color_t bgc = LV_COLOR_HEX(bg); // COLOR_HOS_BG.
lv_color_t bgc_light = LV_COLOR_HEX(bg ? (bg + 0x101010) : 0x2D2D2D); // COLOR_HOS_BG_LIGHT.
lv_color_t bgc_press = LV_COLOR_HEX(bg ? (bg + 0x232323) : 0x404040); // 0x505050.
lv_color_t bg_border = LV_COLOR_HEX(bg ? (bg + 0x202020) : 0x3D3D3D); // COLOR_HOS_BG_LIGHTER.
lv_color_t color = hue ? lv_color_hsv_to_rgb(hue, 100, 100) : lv_color_hsv_to_rgb(53, 8, 90);
static lv_style_t btn_tgl_pr_test;
lv_style_copy(&btn_tgl_pr_test, lv_btn_get_style(color_test.button, LV_BTN_STATE_TGL_PR));
btn_tgl_pr_test.body.main_color = bgc_press;
btn_tgl_pr_test.body.grad_color = btn_tgl_pr_test.body.main_color;
btn_tgl_pr_test.body.border.color = color;
btn_tgl_pr_test.text.color = color;
if (update_bg)
{
@@ -466,6 +504,27 @@ static void _show_new_nyx_color(u32 bg, u16 hue, bool update_bg)
hdr2_bg_test.body.main_color = bgc;
hdr2_bg_test.body.grad_color = hdr2_bg_test.body.main_color;
lv_cont_set_style(color_test.header2, &hdr2_bg_test);
static lv_style_t btn_tgl_rel_test;
lv_style_copy(&btn_tgl_rel_test, lv_btn_get_style(color_test.btn_reset, LV_BTN_STATE_REL));
btn_tgl_rel_test.body.main_color = bgc_light;
btn_tgl_rel_test.body.grad_color = btn_tgl_rel_test.body.main_color;
lv_btn_set_style(color_test.btn_reset, LV_BTN_STATE_REL, &btn_tgl_rel_test);
lv_btn_set_style(color_test.btn_reset, LV_BTN_STATE_PR, &btn_tgl_pr_test);
lv_btn_set_style(color_test.btn_apply, LV_BTN_STATE_REL, &btn_tgl_rel_test);
lv_btn_set_style(color_test.btn_apply, LV_BTN_STATE_PR, &btn_tgl_pr_test);
lv_btn_set_style(color_test.btn_black, LV_BTN_STATE_REL, &btn_tgl_rel_test);
lv_btn_set_style(color_test.btn_black, LV_BTN_STATE_PR, &btn_tgl_pr_test);
static lv_style_t slider_bg;
lv_style_copy(&slider_bg, lv_slider_get_style(color_test.slider, LV_SLIDER_STYLE_BG));
slider_bg.body.main_color = bg_border;
slider_bg.body.grad_color = slider_bg.body.main_color;
lv_slider_set_style(color_test.hue_slider, LV_SLIDER_STYLE_BG, &slider_bg);
lv_slider_set_style(color_test.slider, LV_SLIDER_STYLE_BG, &slider_bg);
lv_slider_set_style(color_test.r_slider, LV_SLIDER_STYLE_BG, &slider_bg);
lv_slider_set_style(color_test.g_slider, LV_SLIDER_STYLE_BG, &slider_bg);
lv_slider_set_style(color_test.b_slider, LV_SLIDER_STYLE_BG, &slider_bg);
}
else
{
@@ -474,29 +533,29 @@ static void _show_new_nyx_color(u32 bg, u16 hue, bool update_bg)
txt_test.text.color = color;
lv_obj_set_style(color_test.label, &txt_test);
lv_obj_set_style(color_test.icons, &txt_test);
static lv_style_t slider_knb;
lv_style_copy(&slider_knb, lv_slider_get_style(color_test.slider, LV_SLIDER_STYLE_KNOB));
slider_knb.body.main_color = color;
slider_knb.body.grad_color = slider_knb.body.main_color;
lv_slider_set_style(color_test.hue_slider, LV_SLIDER_STYLE_KNOB, &slider_knb);
lv_slider_set_style(color_test.slider, LV_SLIDER_STYLE_KNOB, &slider_knb);
lv_slider_set_style(color_test.r_slider, LV_SLIDER_STYLE_KNOB, &slider_knb);
lv_slider_set_style(color_test.g_slider, LV_SLIDER_STYLE_KNOB, &slider_knb);
lv_slider_set_style(color_test.b_slider, LV_SLIDER_STYLE_KNOB, &slider_knb);
static lv_style_t slider_ind;
lv_style_copy(&slider_ind, lv_slider_get_style(color_test.slider, LV_SLIDER_STYLE_INDIC));
slider_ind.body.main_color = hue ? lv_color_hsv_to_rgb(hue, 100, 72) : lv_color_hsv_to_rgb(53, 8, 65);
slider_ind.body.grad_color = slider_ind.body.main_color;
lv_slider_set_style(color_test.hue_slider, LV_SLIDER_STYLE_INDIC, &slider_ind);
lv_slider_set_style(color_test.slider, LV_SLIDER_STYLE_INDIC, &slider_ind);
lv_slider_set_style(color_test.r_slider, LV_SLIDER_STYLE_INDIC, &slider_ind);
lv_slider_set_style(color_test.g_slider, LV_SLIDER_STYLE_INDIC, &slider_ind);
lv_slider_set_style(color_test.b_slider, LV_SLIDER_STYLE_INDIC, &slider_ind);
}
static lv_style_t btn_tgl_pr_test;
lv_style_copy(&btn_tgl_pr_test, lv_btn_get_style(color_test.button, LV_BTN_STATE_TGL_PR));
btn_tgl_pr_test.body.main_color = bgc_light;
btn_tgl_pr_test.body.grad_color = btn_tgl_pr_test.body.main_color;
btn_tgl_pr_test.body.border.color = color;
btn_tgl_pr_test.text.color = color;
lv_btn_set_style(color_test.button, LV_BTN_STATE_TGL_PR, &btn_tgl_pr_test);
static lv_style_t slider_bg, slider_test, slider_ind;
lv_style_copy(&slider_bg, lv_slider_get_style(color_test.slider, LV_SLIDER_STYLE_BG));
lv_style_copy(&slider_test, lv_slider_get_style(color_test.slider, LV_SLIDER_STYLE_KNOB));
lv_style_copy(&slider_ind, lv_slider_get_style(color_test.slider, LV_SLIDER_STYLE_INDIC));
slider_bg.body.main_color = bg_border;
slider_bg.body.grad_color = slider_bg.body.main_color;
slider_test.body.main_color = color;
slider_test.body.grad_color = slider_test.body.main_color;
slider_ind.body.main_color = lv_color_hsv_to_rgb(hue, 100, 72);
slider_ind.body.grad_color = slider_ind.body.main_color;
lv_slider_set_style(color_test.slider, LV_SLIDER_STYLE_BG, &slider_bg);
lv_slider_set_style(color_test.slider, LV_SLIDER_STYLE_KNOB, &slider_test);
lv_slider_set_style(color_test.slider, LV_SLIDER_STYLE_INDIC, &slider_ind);
}
static lv_res_t _slider_hue_action(lv_obj_t *slider)
@@ -504,7 +563,9 @@ static lv_res_t _slider_hue_action(lv_obj_t *slider)
if (color_test.hue != lv_slider_get_value(slider))
{
color_test.hue = lv_slider_get_value(slider);
_show_new_nyx_color(color_test.bg, color_test.hue, false);
_show_new_nyx_color(false);
char hue[8];
s_printf(hue, "%03d", color_test.hue);
lv_label_set_text(color_test.hue_label, hue);
@@ -513,14 +574,97 @@ static lv_res_t _slider_hue_action(lv_obj_t *slider)
return LV_RES_OK;
}
static lv_res_t _preset_bg_action(lv_obj_t *btn)
static lv_res_t _slider_r_action(lv_obj_t *slider)
{
//! TODO: Support a range?
if (color_test.bg)
color_test.bg = 0;
else
color_test.bg = COLOR_HOS_BG;
_show_new_nyx_color(color_test.bg, color_test.hue, true);
if (color_test.r != lv_slider_get_value(slider))
{
color_test.r = lv_slider_get_value(slider);
color_test.box_style.body.main_color = LV_COLOR_HEX((color_test.r << 16) | (color_test.g << 8) | color_test.b);
color_test.box_style.body.grad_color = color_test.box_style.body.main_color;
lv_obj_set_style(color_test.box, &color_test.box_style);
char shade[8];
s_printf(shade, "%03d", color_test.r);
lv_label_set_text(color_test.r_label, shade);
}
return LV_RES_OK;
}
static lv_res_t _slider_g_action(lv_obj_t *slider)
{
if (color_test.g != lv_slider_get_value(slider))
{
color_test.g = lv_slider_get_value(slider);
color_test.box_style.body.main_color = LV_COLOR_HEX((color_test.r << 16) | (color_test.g << 8) | color_test.b);
color_test.box_style.body.grad_color = color_test.box_style.body.main_color;
lv_obj_set_style(color_test.box, &color_test.box_style);
char shade[8];
s_printf(shade, "%03d", color_test.g);
lv_label_set_text(color_test.g_label, shade);
}
return LV_RES_OK;
}
static lv_res_t _slider_b_action(lv_obj_t *slider)
{
if (color_test.b != lv_slider_get_value(slider))
{
color_test.b = lv_slider_get_value(slider);
color_test.box_style.body.main_color = LV_COLOR_HEX((color_test.r << 16) | (color_test.g << 8) | color_test.b);
color_test.box_style.body.grad_color = color_test.box_style.body.main_color;
lv_obj_set_style(color_test.box, &color_test.box_style);
char shade[8];
s_printf(shade, "%03d", color_test.b);
lv_label_set_text(color_test.b_label, shade);
}
return LV_RES_OK;
}
static lv_res_t _preset_bg_apply(lv_obj_t *btn)
{
color_test.bg = (color_test.r << 16) | (color_test.g << 8) | color_test.b;
_show_new_nyx_color(true);
return LV_RES_OK;
}
static lv_res_t _preset_bg_black(lv_obj_t *btn)
{
color_test.bg = 0;
_show_new_nyx_color(true);
return LV_RES_OK;
}
static lv_res_t _preset_bg_reset(lv_obj_t *btn)
{
color_test.r = 0x2D;
color_test.g = 0x2D;
color_test.b = 0x2D;
color_test.bg = 0x2D2D2D;
color_test.box_style.body.main_color = LV_COLOR_HEX(color_test.bg);
color_test.box_style.body.grad_color = color_test.box_style.body.main_color;
lv_obj_set_style(color_test.box, &color_test.box_style);
lv_bar_set_value(color_test.r_slider, color_test.r);
lv_bar_set_value(color_test.g_slider, color_test.g);
lv_bar_set_value(color_test.b_slider, color_test.b);
char shade[8];
s_printf(shade, "%03d", color_test.r);
lv_label_set_text(color_test.r_label, shade);
lv_label_set_text(color_test.g_label, shade);
lv_label_set_text(color_test.b_label, shade);
_show_new_nyx_color(true);
return LV_RES_OK;
}
@@ -532,95 +676,194 @@ static lv_res_t _preset_hue_action(lv_obj_t *btn)
if (color_test.hue != ext->idx)
{
color_test.hue = ext->idx;
_show_new_nyx_color(color_test.bg, color_test.hue, false);
char hue[8];
s_printf(hue, "%03d", color_test.hue);
lv_label_set_text(color_test.hue_label, hue);
lv_bar_set_value(color_test.hue_slider, color_test.hue);
_show_new_nyx_color(false);
}
return LV_RES_OK;
}
static const u16 theme_colors[17] = {
4, 13, 23, 33, 43, 54, 66, 89, 124, 167, 187, 200, 208, 231, 261, 291, 341
static const u16 theme_colors[18] = {
0, 4, 13, 23, 33, 43, 54, 66, 89, 124, 167, 187, 200, 208, 231, 261, 291, 341
};
lv_res_t _action_win_nyx_colors_close(lv_obj_t * btn)
{
lv_obj_set_opa_scale(status_bar.mid, LV_OPA_COVER);
lv_obj_set_click(status_bar.mid, true);
return nyx_win_close_action(btn);
}
static lv_res_t _create_window_nyx_colors(lv_obj_t *btn)
{
lv_obj_t *win = nyx_create_standard_window(SYMBOL_COPY" Nyx Color Theme");
lv_win_add_btn(win, NULL, SYMBOL_HINT" Toggle Background", _preset_bg_action);
lv_win_add_btn(win, NULL, SYMBOL_SAVE" Save & Reload", _save_theme_color_action);
lv_obj_t *win = nyx_create_standard_window(SYMBOL_COPY" Nyx Color Theme", _action_win_nyx_colors_close);
lv_win_add_btn(win, NULL, SYMBOL_SAVE" Save & Reload", _action_win_nyx_colors_save);
color_test.window = win;
// Set current theme colors.
color_test.bg = n_cfg.theme_bg;
color_test.hue = n_cfg.theme_color;
u32 bg = n_cfg.theme_bg ? n_cfg.theme_bg : 0x2D2D2D;
color_test.r = (bg >> 16) & 0xFF;
color_test.g = (bg >> 8) & 0xFF;
color_test.b = (bg >> 0) & 0xFF;
lv_obj_t *sep = lv_label_create(win, NULL);
lv_label_set_static_text(sep, "");
lv_obj_align(sep, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);
lv_style_copy(&color_test.box_style, &lv_style_plain_color);
color_test.box_style.body.main_color = LV_COLOR_HEX(color_test.bg);
color_test.box_style.body.grad_color = color_test.box_style.body.main_color;
color_test.box_style.body.border.color = LV_COLOR_HEX(0xFFFFFF);
color_test.box_style.body.border.opa = LV_OPA_20;
color_test.box_style.body.border.width = 2;
// Create container to keep content inside.
lv_obj_t *h1 = lv_cont_create(win, NULL);
lv_obj_set_size(h1, LV_HOR_RES - (LV_DPI * 8 / 10), LV_VER_RES / 7);
lv_obj_set_size(h1, LV_DPI * 299 / 25, LV_DPI * 27 / 26);
color_test.header1 = h1;
lv_obj_t *acc_label = lv_label_create(h1, NULL);
lv_label_set_static_text(acc_label, "Accent color:");
// Create color preset buttons.
lv_obj_t *color_btn = lv_btn_create(h1, NULL);
lv_btn_ext_t *ext = lv_obj_get_ext_attr(color_btn);
ext->idx = theme_colors[0];
create_flat_button(h1, color_btn, lv_color_hsv_to_rgb(theme_colors[0], 100, 100), _preset_hue_action);
create_flat_button(color_btn, ext->idx, _preset_hue_action);
lv_obj_align(color_btn, acc_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 10);
lv_obj_t *color_btn2;
for (u32 i = 1; i < 17; i++)
for (u32 i = 1; i < ARRAY_SIZE(theme_colors); i++)
{
color_btn2 = lv_btn_create(h1, NULL);
ext = lv_obj_get_ext_attr(color_btn2);
ext->idx = theme_colors[i];
create_flat_button(h1, color_btn2, lv_color_hsv_to_rgb(theme_colors[i], 100, 100), _preset_hue_action);
create_flat_button(color_btn2, ext->idx, _preset_hue_action);
lv_obj_align(color_btn2, color_btn, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
color_btn = color_btn2;
}
lv_obj_align(h1, sep, LV_ALIGN_OUT_BOTTOM_MID, 0, LV_DPI / 4);
lv_obj_align(h1, NULL, LV_ALIGN_IN_TOP_MID, 0, LV_DPI / 5);
// Create hue slider.
lv_obj_t * slider = lv_slider_create(win, NULL);
lv_obj_set_width(slider, 1070);
lv_obj_set_height(slider, LV_DPI * 4 / 10);
lv_bar_set_range(slider, 0, 359);
lv_bar_set_value(slider, color_test.hue);
lv_slider_set_action(slider, _slider_hue_action);
lv_obj_align(slider, h1, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
color_test.hue_slider = slider;
lv_obj_t *h_slider = lv_slider_create(win, NULL);
lv_obj_set_width(h_slider, LV_DPI * 213 / 20);
lv_obj_set_height(h_slider, LV_DPI * 4 / 10);
lv_bar_set_range(h_slider, 0, 359);
lv_bar_set_value(h_slider, color_test.hue);
lv_slider_set_action(h_slider, _slider_hue_action);
lv_obj_align(h_slider, h1, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 5);
color_test.hue_slider = h_slider;
// Create hue label.
lv_obj_t *hue_text_label = lv_label_create(win, NULL);
lv_obj_align(hue_text_label, slider, LV_ALIGN_OUT_RIGHT_MID, LV_DPI * 24 / 100, 0);
char hue[8];
s_printf(hue, "%03d", color_test.hue);
lv_label_set_text(hue_text_label, hue);
lv_obj_align(hue_text_label, h_slider, LV_ALIGN_OUT_RIGHT_MID, LV_DPI * 24 / 100, 0);
char txt[8];
s_printf(txt, "%03d", color_test.hue);
lv_label_set_text(hue_text_label, txt);
color_test.hue_label = hue_text_label;
lv_obj_t *bg_label = lv_label_create(win, NULL);
lv_label_set_static_text(bg_label, "Theme color:");
lv_obj_align(bg_label, h_slider, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI * 6 / 25);
// Create red slider.
lv_obj_t *r_slider = lv_slider_create(win, NULL);
lv_obj_set_width(r_slider, LV_DPI * 85 / 16);
lv_obj_set_height(r_slider, LV_DPI * 4 / 10);
lv_bar_set_range(r_slider, 11, 100);
lv_bar_set_value(r_slider, color_test.r);
lv_slider_set_action(r_slider, _slider_r_action);
lv_obj_align(r_slider, bg_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 21);
color_test.r_slider = r_slider;
// Create red label.
lv_obj_t *r_text_label = lv_label_create(win, NULL);
lv_obj_align(r_text_label, r_slider, LV_ALIGN_OUT_RIGHT_MID, LV_DPI * 24 / 100, 0);
s_printf(txt, "%03d", color_test.r);
lv_label_set_text(r_text_label, txt);
color_test.r_label = r_text_label;
// Create green slider.
lv_obj_t *g_slider = lv_slider_create(win, r_slider);
lv_bar_set_value(g_slider, color_test.g);
lv_slider_set_action(g_slider, _slider_g_action);
lv_obj_align(g_slider, r_slider, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 7);
color_test.g_slider = g_slider;
// Create green label.
lv_obj_t *g_text_label = lv_label_create(win, NULL);
lv_obj_align(g_text_label, g_slider, LV_ALIGN_OUT_RIGHT_MID, LV_DPI * 24 / 100, 0);
s_printf(txt, "%03d", color_test.g);
lv_label_set_text(g_text_label, txt);
color_test.g_label = g_text_label;
// Create blue slider.
lv_obj_t *b_slider = lv_slider_create(win, r_slider);
lv_bar_set_value(b_slider, color_test.b);
lv_slider_set_action(b_slider, _slider_b_action);
lv_obj_align(b_slider, g_slider, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 7);
color_test.b_slider = b_slider;
// Create blue label.
lv_obj_t *b_text_label = lv_label_create(win, NULL);
lv_obj_align(b_text_label, b_slider, LV_ALIGN_OUT_RIGHT_MID, LV_DPI * 24 / 100, 0);
s_printf(txt, "%03d", color_test.b);
lv_label_set_text(b_text_label, txt);
color_test.b_label = b_text_label;
// Create theme color box.
lv_obj_t * bg_box = lv_obj_create(win, NULL);
lv_obj_set_size(bg_box, LV_DPI * 10 / 7, LV_DPI * 18 / 13);
lv_obj_align(bg_box, r_text_label, LV_ALIGN_OUT_RIGHT_TOP, LV_DPI / 4, 0);
lv_obj_set_style(bg_box, &color_test.box_style);
color_test.box = bg_box;
// Create theme color buttons.
lv_obj_t *btn_reset = lv_btn_create(win, NULL);
lv_obj_t *label_btn = lv_label_create(btn_reset, NULL);
lv_label_set_static_text(label_btn, SYMBOL_REFRESH" Grey");
lv_btn_set_fit(btn_reset, false, true);
lv_obj_set_width(btn_reset, LV_DPI * 5 / 3);
lv_btn_set_action(btn_reset, LV_BTN_ACTION_CLICK, _preset_bg_reset);
lv_obj_align(btn_reset, bg_box, LV_ALIGN_OUT_RIGHT_TOP, LV_DPI / 5, 0);
color_test.btn_reset = btn_reset;
lv_obj_t *btn_black = lv_btn_create(win, btn_reset);
label_btn = lv_label_create(btn_black, NULL);
lv_label_set_static_text(label_btn, SYMBOL_BRIGHTNESS" Black");
lv_btn_set_action(btn_black, LV_BTN_ACTION_CLICK, _preset_bg_black);
lv_obj_align(btn_black, btn_reset, LV_ALIGN_OUT_RIGHT_TOP, LV_DPI / 5, 0);
color_test.btn_black = btn_black;
lv_obj_t *btn_apply = lv_btn_create(win, btn_reset);
label_btn = lv_label_create(btn_apply, NULL);
lv_label_set_static_text(label_btn, SYMBOL_LIST" Custom Color");
lv_obj_set_width(btn_apply, LV_DPI * 10 / 3 + LV_DPI / 5);
lv_btn_set_action(btn_apply, LV_BTN_ACTION_CLICK, _preset_bg_apply);
lv_obj_align(btn_apply, btn_reset, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 7);
color_test.btn_apply = btn_apply;
// Create sample text.
lv_obj_t *h2 = lv_cont_create(win, NULL);
lv_obj_set_size(h2, LV_HOR_RES - (LV_DPI * 8 / 10), LV_VER_RES / 3);
lv_obj_align(h2, slider, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI);
lv_obj_set_size(h2, LV_DPI * 12, LV_DPI * 18 / 10);
lv_obj_align(h2, b_slider, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI * 6 / 25);
color_test.header2 = h2;
lv_obj_t *lbl_sample = lv_label_create(h2, NULL);
lv_label_set_static_text(lbl_sample, "Sample:");
lv_label_set_static_text(lbl_sample, "Accent sample:");
lv_obj_t *lbl_test = lv_label_create(h2, NULL);
lv_label_set_long_mode(lbl_test, LV_LABEL_LONG_BREAK);
lv_label_set_static_text(lbl_test,
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, "
"sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. "
"Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris "
"nisi ut aliquip ex ea commodo consequat.");
lv_obj_set_width(lbl_test, lv_obj_get_width(h2) - LV_DPI * 6 / 10);
lv_obj_align(lbl_test, lbl_sample, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 5);
"sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
lv_obj_set_width(lbl_test, LV_DPI * 261 / 23);
lv_obj_align(lbl_test, lbl_sample, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 34);
color_test.label = lbl_test;
// Create sample icons.
@@ -628,12 +871,12 @@ static lv_res_t _create_window_nyx_colors(lv_obj_t *btn)
lv_label_set_static_text(lbl_icons,
SYMBOL_BRIGHTNESS SYMBOL_CHARGE SYMBOL_FILE SYMBOL_DRIVE SYMBOL_FILE_CODE
SYMBOL_EDIT SYMBOL_HINT SYMBOL_DRIVE SYMBOL_KEYBOARD SYMBOL_POWER);
lv_obj_align(lbl_icons, lbl_test, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI * 2 / 5);
lv_obj_align(lbl_icons, lbl_test, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 5);
color_test.icons = lbl_icons;
// Create sample slider.
lv_obj_t *slider_test = lv_slider_create(h2, NULL);
lv_obj_align(slider_test, lbl_test, LV_ALIGN_OUT_BOTTOM_MID, 0, LV_DPI * 2 / 5);
lv_obj_align(slider_test, lbl_test, LV_ALIGN_OUT_BOTTOM_MID, 0, LV_DPI / 5);
lv_obj_set_click(slider_test, false);
lv_bar_set_value(slider_test, 60);
color_test.slider = slider_test;
@@ -641,12 +884,17 @@ static lv_res_t _create_window_nyx_colors(lv_obj_t *btn)
// Create sample button.
lv_obj_t *btn_test = lv_btn_create(h2, NULL);
lv_btn_set_state(btn_test, LV_BTN_STATE_TGL_PR);
lv_obj_align(btn_test, lbl_test, LV_ALIGN_OUT_BOTTOM_RIGHT, 0, LV_DPI / 5);
lv_label_create(btn_test, NULL);
lv_btn_set_fit(btn_test, false, true);
lv_obj_set_width(btn_test, LV_DPI * 5 / 3);
lv_obj_align(btn_test, lbl_test, LV_ALIGN_OUT_BOTTOM_RIGHT, 0, LV_DPI / 20);
lv_obj_set_click(btn_test, false);
color_test.button = btn_test;
_show_new_nyx_color(color_test.bg, color_test.hue, false);
_show_new_nyx_color(false);
lv_obj_set_opa_scale(status_bar.mid, LV_OPA_0);
lv_obj_set_click(status_bar.mid, false);
return LV_RES_OK;
}
@@ -722,7 +970,7 @@ static lv_res_t _action_clock_edit(lv_obj_t *btns, const char * txt)
nyx_changes_made = true;
}
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
return LV_RES_INV;
}
@@ -944,7 +1192,7 @@ static lv_res_t _joycon_info_dump_action(lv_obj_t * btn)
jc_pad->bt_conn_r.type = is_r_hos ? jc_pad->bt_conn_r.type : 0;
save_data:
error = !sd_mount() ? 5 : 0;
error = sd_mount() ? 5 : 0;
if (!error)
{
@@ -1157,7 +1405,7 @@ disabled_or_cal0_issue:;
lv_mbox_set_text(mbox, txt_buf);
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); // Important. After set_text.
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); // Important. After set_text.
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
@@ -1184,7 +1432,7 @@ static lv_res_t _action_nyx_options_save(lv_obj_t *btns, const char * txt)
{
int btn_idx = lv_btnm_get_pressed(btns);
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
if (!btn_idx)
_save_nyx_options_action(NULL);
@@ -1224,7 +1472,7 @@ static lv_res_t _action_win_nyx_options_close(lv_obj_t *btn)
lv_obj_set_opa_scale(status_bar.mid, LV_OPA_0);
lv_obj_set_click(status_bar.mid, false);
lv_res_t res = nyx_win_close_action_custom(btn);
lv_res_t res = nyx_win_close_action(btn);
_check_nyx_changes();
@@ -1235,7 +1483,7 @@ lv_res_t create_win_nyx_options(lv_obj_t *parrent_btn)
{
lv_theme_t *th = lv_theme_get_current();
lv_obj_t *win = nyx_create_window_custom_close_btn(SYMBOL_HOME" Nyx Settings", _action_win_nyx_options_close);
lv_obj_t *win = nyx_create_standard_window(SYMBOL_HOME" Nyx Settings", _action_win_nyx_options_close);
static lv_style_t h_style;
lv_style_copy(&h_style, &lv_style_transp);
@@ -1279,7 +1527,7 @@ lv_res_t create_win_nyx_options(lv_obj_t *parrent_btn)
lv_obj_t *label_txt2 = lv_label_create(sw_h2, NULL);
lv_label_set_recolor(label_txt2, true);
lv_label_set_static_text(label_txt2, "Select a color for all #00FFC8 highlights# in Nyx.\n");
lv_label_set_static_text(label_txt2, "Customize #C7EA46 Theme# and #C7EA46 Accent# colors in Nyx.\n");
lv_obj_set_style(label_txt2, &hint_small_style);
lv_obj_align(label_txt2, btn, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3 - 8);

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2018 naehrwert
* Copyright (c) 2018-2025 CTCaer
* Copyright (c) 2018-2026 CTCaer
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -31,8 +31,6 @@
#include <libs/compr/blz.h>
#include <libs/fatfs/ff.h>
extern volatile boot_cfg_t *b_cfg;
lv_obj_t *ums_mbox;
extern char *emmcsn_path_impl(char *path, char *sub_dir, char *filename, sdmmc_storage_t *storage);
@@ -158,7 +156,7 @@ static lv_res_t _create_mbox_autorcm_status(lv_obj_t *btn)
"The boot process is now normal and you need the #FF8000 VOL+# + #FF8000 HOME# (jig) combo to enter RCM.\n");
}
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
lv_obj_set_width(mbox, LV_HOR_RES / 9 * 5);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
@@ -178,8 +176,8 @@ static lv_res_t _create_mbox_hid(usb_ctxt_t *usbs)
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[] = { "\251", "\262Close", "\251", "" };
static const char *mbox_btn_map2[] = { "\251", "\222Close", "\251", "" };
static const char *mbox_btn_map_dis[] = { "\251", "\262Close", "\251", "" };
static const char *mbox_btn_map[] = { "\251", "\222Close", "\251", "" };
lv_obj_t *mbox = lv_mbox_create(dark_bg, NULL);
lv_mbox_set_recolor_text(mbox, true);
@@ -205,14 +203,14 @@ static lv_res_t _create_mbox_hid(usb_ctxt_t *usbs)
lv_label_set_static_text(lbl_tip, "Note: To end it, press #C7EA46 L3# + #C7EA46 HOME# or remove the cable.");
lv_obj_set_style(lbl_tip, &hint_small_style);
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
lv_mbox_add_btns(mbox, mbox_btn_map_dis, nyx_mbox_action);
lv_obj_set_width(mbox, LV_HOR_RES / 9 * 5);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
usb_device_gadget_hid(usbs);
lv_mbox_add_btns(mbox, mbox_btn_map2, mbox_action);
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
return LV_RES_OK;
}
@@ -223,8 +221,8 @@ static lv_res_t _create_mbox_ums(usb_ctxt_t *usbs)
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[] = { "\251", "\262Close", "\251", "" };
static const char *mbox_btn_map2[] = { "\251", "\222Close", "\251", "" };
static const char *mbox_btn_map_dis[] = { "\251", "\262Close", "\251", "" };
static const char *mbox_btn_map[] = { "\251", "\222Close", "\251", "" };
lv_obj_t *mbox = lv_mbox_create(dark_bg, NULL);
lv_mbox_set_recolor_text(mbox, true);
@@ -299,7 +297,7 @@ static lv_res_t _create_mbox_ums(usb_ctxt_t *usbs)
}
lv_obj_set_style(lbl_tip, &hint_small_style);
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
lv_mbox_add_btns(mbox, mbox_btn_map_dis, nyx_mbox_action);
lv_obj_set_width(mbox, LV_HOR_RES / 9 * 5);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
@@ -312,7 +310,7 @@ static lv_res_t _create_mbox_ums(usb_ctxt_t *usbs)
// Restore backlight.
display_backlight_brightness(h_cfg.backlight - 20, 1000);
lv_mbox_add_btns(mbox, mbox_btn_map2, mbox_action);
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
ums_mbox = dark_bg;
@@ -342,7 +340,7 @@ static lv_res_t _create_mbox_ums_error(int error)
break;
}
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
lv_obj_set_width(mbox, LV_HOR_RES / 9 * 5);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
@@ -485,7 +483,7 @@ static lv_res_t _action_ums_emuemmc_boot0(lv_obj_t *btn)
usb_ctxt_t usbs;
int error = !sd_mount();
int error = sd_mount();
if (!error)
{
emummc_cfg_t emu_info;
@@ -532,7 +530,7 @@ static lv_res_t _action_ums_emuemmc_boot1(lv_obj_t *btn)
usb_ctxt_t usbs;
int error = !sd_mount();
int error = sd_mount();
if (!error)
{
emummc_cfg_t emu_info;
@@ -579,7 +577,7 @@ static lv_res_t _action_ums_emuemmc_gpp(lv_obj_t *btn)
usb_ctxt_t usbs;
int error = !sd_mount();
int error = sd_mount();
if (!error)
{
emummc_cfg_t emu_info;
@@ -595,7 +593,7 @@ static lv_res_t _action_ums_emuemmc_gpp(lv_obj_t *btn)
usbs.offset = emu_info.sector + 0x4000;
u8 *gpt = malloc(SD_BLOCKSIZE);
if (sdmmc_storage_read(&sd_storage, usbs.offset + 1, 1, gpt))
if (!sdmmc_storage_read(&sd_storage, usbs.offset + 1, 1, gpt))
{
if (!memcmp(gpt, "EFI PART", 8))
{
@@ -675,7 +673,7 @@ static lv_res_t _emmc_read_only_toggle(lv_obj_t *btn)
static lv_res_t _create_window_usb_tools(lv_obj_t *parent)
{
lv_obj_t *win = nyx_create_standard_window(SYMBOL_USB" USB Tools");
lv_obj_t *win = nyx_create_standard_window(SYMBOL_USB" USB Tools", NULL);
static lv_style_t h_style;
lv_style_copy(&h_style, &lv_style_transp);
@@ -928,7 +926,7 @@ out:
static lv_res_t _create_window_unset_abit_tool(lv_obj_t *btn)
{
lv_obj_t *win = nyx_create_standard_window(SYMBOL_COPY" Fix Archive Bit (All folders)");
lv_obj_t *win = nyx_create_standard_window(SYMBOL_COPY" Fix Archive Bit (All folders)", NULL);
// Disable buttons.
nyx_window_toggle_buttons(win, true);
@@ -940,7 +938,7 @@ static lv_res_t _create_window_unset_abit_tool(lv_obj_t *btn)
lv_label_set_long_mode(lb_desc, LV_LABEL_LONG_BREAK);
lv_label_set_recolor(lb_desc, true);
if (!sd_mount())
if (sd_mount())
{
lv_label_set_text(lb_desc, "#FFDD00 Failed to init SD!#");
lv_obj_set_width(lb_desc, lv_obj_get_width(desc));
@@ -1001,7 +999,7 @@ static lv_res_t _create_window_unset_abit_tool(lv_obj_t *btn)
static lv_res_t _create_mbox_fix_touchscreen(lv_obj_t *btn)
{
int res = 0;
int res = 1;
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);
@@ -1041,13 +1039,13 @@ static lv_res_t _create_mbox_fix_touchscreen(lv_obj_t *btn)
}
u8 err[2];
if (!touch_panel_ito_test(err))
if (touch_panel_ito_test(err))
goto ito_failed;
if (!err[0] && !err[1])
{
res = touch_execute_autotune();
if (res)
if (!res)
goto out;
}
else
@@ -1105,13 +1103,13 @@ ito_failed:
touch_sense_enable();
out:
if (res)
if (!res)
lv_mbox_set_text(mbox, "#C7EA46 The touchscreen calibration finished!");
else
lv_mbox_set_text(mbox, "#FFFF00 The touchscreen calibration failed!");
out2:
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
free(txt_buf);
@@ -1120,7 +1118,7 @@ out2:
static lv_res_t _create_window_dump_pk12_tool(lv_obj_t *btn)
{
lv_obj_t *win = nyx_create_standard_window(SYMBOL_MODULES" Dump package1/2");
lv_obj_t *win = nyx_create_standard_window(SYMBOL_MODULES" Dump package1/2", NULL);
// Disable buttons.
nyx_window_toggle_buttons(win, true);
@@ -1143,7 +1141,7 @@ static lv_res_t _create_window_dump_pk12_tool(lv_obj_t *btn)
lv_obj_align(lb_desc2, lb_desc, LV_ALIGN_OUT_RIGHT_TOP, 0, 0);
if (!sd_mount())
if (sd_mount())
{
lv_label_set_text(lb_desc, "#FFDD00 Failed to init SD!#");
@@ -1161,7 +1159,7 @@ static lv_res_t _create_window_dump_pk12_tool(lv_obj_t *btn)
char *txt_buf = (char *)malloc(SZ_16K);
if (!emmc_initialize(false))
if (emmc_initialize(false))
{
lv_label_set_text(lb_desc, "#FFDD00 Failed to init eMMC!#");
@@ -1515,7 +1513,7 @@ out_end:
return LV_RES_OK;
}
static void _create_tab_tools_emmc_pkg12(lv_theme_t *th, lv_obj_t *parent)
static void _create_tab_tools_emmc_sd_usb(lv_theme_t *th, lv_obj_t *parent)
{
lv_page_set_scrl_layout(parent, LV_LAYOUT_PRETTY);
@@ -1613,10 +1611,6 @@ static void _create_tab_tools_emmc_pkg12(lv_theme_t *th, lv_obj_t *parent)
lv_obj_set_style(label_txt4, &hint_small_style);
lv_obj_align(label_txt4, btn3, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3);
label_sep = lv_label_create(h2, NULL);
lv_label_set_static_text(label_sep, "");
lv_obj_align(label_sep, label_txt4, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI * 11 / 7);
// Create USB Tools button.
lv_obj_t *btn4 = lv_btn_create(h2, btn3);
label_btn = lv_label_create(btn4, NULL);
@@ -1634,7 +1628,7 @@ static void _create_tab_tools_emmc_pkg12(lv_theme_t *th, lv_obj_t *parent)
lv_obj_align(label_txt4, btn4, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3);
}
static void _create_tab_tools_arc_autorcm(lv_theme_t *th, lv_obj_t *parent)
static void _create_tab_tools_arc_rcm_pkg12(lv_theme_t *th, lv_obj_t *parent)
{
lv_page_set_scrl_layout(parent, LV_LAYOUT_PRETTY);
@@ -1671,8 +1665,8 @@ static void _create_tab_tools_arc_autorcm(lv_theme_t *th, lv_obj_t *parent)
lv_obj_t *label_txt2 = lv_label_create(h1, NULL);
lv_label_set_recolor(label_txt2, true);
lv_label_set_static_text(label_txt2,
"Allows you to fix the archive bit for all folders including\n"
"the root and emuMMC \'Nintendo\' folders.\n"
"Allows you to fix the archive bit for all folders including the\n"
"root and emuMMC \'Nintendo\' folders.\n"
"#C7EA46 It sets the archive bit to folders named with ##FF8000 .[ext]#\n"
"#FF8000 Use that option when you have corruption messages.#");
lv_obj_set_style(label_txt2, &hint_small_style);
@@ -1689,7 +1683,7 @@ static void _create_tab_tools_arc_autorcm(lv_theme_t *th, lv_obj_t *parent)
lv_label_set_recolor(label_txt2, true);
lv_label_set_static_text(label_txt2,
"Allows you to calibrate the touchscreen module.\n"
"#FF8000 This fixes any issues with touchscreen in Nyx and HOS.#");
"#FF8000 This can fix any issues with touchscreen in Nyx and HOS.#");
lv_obj_set_style(label_txt2, &hint_small_style);
lv_obj_align(label_txt2, btn2, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3);
@@ -1712,10 +1706,11 @@ static void _create_tab_tools_arc_autorcm(lv_theme_t *th, lv_obj_t *parent)
lv_obj_t *btn3 = lv_btn_create(h2, NULL);
if (hekate_bg || hekate_bg_etc)
{
lv_btn_set_style(btn3, LV_BTN_STYLE_REL, &btn_transp_rel);
lv_btn_set_style(btn3, LV_BTN_STYLE_PR, &btn_transp_pr);
lv_btn_set_style(btn3, LV_BTN_STYLE_REL, &btn_transp_rel);
lv_btn_set_style(btn3, LV_BTN_STYLE_PR, &btn_transp_pr);
lv_btn_set_style(btn3, LV_BTN_STYLE_TGL_REL, &btn_transp_tgl_rel);
lv_btn_set_style(btn3, LV_BTN_STYLE_TGL_PR, &btn_transp_tgl_pr);
lv_btn_set_style(btn3, LV_BTN_STYLE_TGL_PR, &btn_transp_tgl_pr);
lv_btn_set_style(btn3, LV_BTN_STYLE_INA, &btn_transp_ina);
}
label_btn = lv_label_create(btn3, NULL);
lv_btn_set_fit(btn3, true, true);
@@ -1806,8 +1801,8 @@ void create_tab_tools(lv_theme_t *th, lv_obj_t *parent)
lv_line_set_style(line_sep, lv_theme_get_current()->line.decor);
lv_obj_align(line_sep, tv, LV_ALIGN_IN_BOTTOM_MID, -1, -LV_DPI * 2 / 12);
_create_tab_tools_emmc_pkg12(th, tab1);
_create_tab_tools_arc_autorcm(th, tab2);
_create_tab_tools_emmc_sd_usb(th, tab1);
_create_tab_tools_arc_rcm_pkg12(th, tab2);
lv_tabview_set_tab_act(tv, 0, false);
}

View File

@@ -317,7 +317,7 @@ static void _create_gpt_partition(gpt_t *gpt, u8 *gpt_idx, u32 *curr_part_lba, u
memcpy(gpt->entries[*gpt_idx].name, name_utf16, name_lenth * sizeof(u16));
// Wipe the first 1MB to sanitize it as raw-empty partition.
sdmmc_storage_write(part_info.storage, *curr_part_lba, 0x800, (void *)SDMMC_UPPER_BUFFER);
sdmmc_storage_write(part_info.storage, *curr_part_lba, 0x800, (void *)SDMMC_ALT_DMA_BUFFER);
// Prepare for next.
(*curr_part_lba) += size_lba;
@@ -339,8 +339,8 @@ static void _sd_prepare_and_flash_mbr_gpt()
memcpy(&mbr.bootstrap[0xE0], &part_info.mbr_old.bootstrap[0xE0], 208);
// Clear the first 16MB.
memset((void *)SDMMC_UPPER_BUFFER, 0, AU_ALIGN_BYTES);
sdmmc_storage_write(&sd_storage, 0, AU_ALIGN_SECTORS, (void *)SDMMC_UPPER_BUFFER);
memset((void *)SDMMC_ALT_DMA_BUFFER, 0, AU_ALIGN_BYTES);
sdmmc_storage_write(&sd_storage, 0, AU_ALIGN_SECTORS, (void *)SDMMC_ALT_DMA_BUFFER);
// Set disk signature.
se_rng_pseudo(random_number, sizeof(u32));
@@ -355,7 +355,7 @@ static void _sd_prepare_and_flash_mbr_gpt()
mbr.partitions[mbr_idx].type = 0x83; // Linux system partition.
mbr.partitions[mbr_idx].start_sct = AU_ALIGN_SECTORS + ((u32)part_info.hos_size << 11);
mbr.partitions[mbr_idx].size_sct = part_info.l4t_size << 11;
sdmmc_storage_write(&sd_storage, mbr.partitions[mbr_idx].start_sct, 0x800, (void *)SDMMC_UPPER_BUFFER); // Clear the first 1MB.
sdmmc_storage_write(&sd_storage, mbr.partitions[mbr_idx].start_sct, 0x800, (void *)SDMMC_ALT_DMA_BUFFER); // Clear the first 1MB.
mbr_idx++;
}
@@ -471,7 +471,7 @@ static void _sd_prepare_and_flash_mbr_gpt()
// Android Encryption partition. 16MB.
// Note: 16MB size is for aligning UDA. If any other tiny partition must be added, it should split the MDA one.
sdmmc_storage_write(&sd_storage, curr_part_lba, 0x8000, (void *)SDMMC_UPPER_BUFFER); // Clear the whole of it.
sdmmc_storage_write(&sd_storage, curr_part_lba, 0x8000, (void *)SDMMC_ALT_DMA_BUFFER); // Clear the whole of it.
_create_gpt_partition(gpt, &gpt_idx, &curr_part_lba, 0x8000, "MDA", 6);
// Android Cache partition. 700MB.
@@ -552,6 +552,8 @@ static int _emmc_prepare_and_flash_mbr_gpt()
gpt_t *gpt = zalloc(sizeof(gpt_t));
gpt_header_t gpt_hdr_backup = { 0 };
memset((void *)SDMMC_ALT_DMA_BUFFER, 0, AU_ALIGN_BYTES);
// Read main GPT.
sdmmc_storage_read(&emmc_storage, 1, sizeof(gpt_t) >> 9, gpt);
@@ -638,7 +640,7 @@ static int _emmc_prepare_and_flash_mbr_gpt()
// Android Encryption partition. 16MB.
// Note: 16MB size is for aligning UDA. If any other tiny partition must be added, it should split the MDA one.
sdmmc_storage_write(&emmc_storage, curr_part_lba, 0x8000, (void *)SDMMC_UPPER_BUFFER); // Clear the whole of it.
sdmmc_storage_write(&emmc_storage, curr_part_lba, 0x8000, (void *)SDMMC_ALT_DMA_BUFFER); // Clear the whole of it.
_create_gpt_partition(gpt, &gpt_idx, &curr_part_lba, 0x8000, "MDA", 6);
// Android Cache partition. 700MB.
@@ -711,7 +713,7 @@ static lv_res_t _action_delete_linux_installer_files(lv_obj_t * btns, const char
int btn_idx = lv_btnm_get_pressed(btns);
// Delete parent mbox.
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
// Flash Linux.
if (!btn_idx)
@@ -755,7 +757,7 @@ static lv_res_t _action_flash_linux_data(lv_obj_t * btns, const char * txt)
int btn_idx = lv_btnm_get_pressed(btns);
// Delete parent mbox.
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
bool succeeded = false;
@@ -885,7 +887,7 @@ static lv_res_t _action_flash_linux_data(lv_obj_t * btns, const char * txt)
}
// Write data block to L4T partition.
res = !sdmmc_storage_write(part_info.storage, lba_curr + l4t_flash_ctxt.offset_sct, num, buf);
res = sdmmc_storage_write(part_info.storage, lba_curr + l4t_flash_ctxt.offset_sct, num, buf);
manual_system_maintenance(false);
@@ -905,7 +907,7 @@ static lv_res_t _action_flash_linux_data(lv_obj_t * btns, const char * txt)
goto exit;
}
res = !sdmmc_storage_write(part_info.storage, lba_curr + l4t_flash_ctxt.offset_sct, num, buf);
res = sdmmc_storage_write(part_info.storage, lba_curr + l4t_flash_ctxt.offset_sct, num, buf);
manual_system_maintenance(false);
}
@@ -939,7 +941,7 @@ exit:
free(txt_buf);
if (!succeeded)
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
else
lv_mbox_add_btns(mbox, mbox_btn_map2, _action_delete_linux_installer_files);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
@@ -1141,7 +1143,7 @@ static lv_res_t _action_check_flash_linux(lv_obj_t *btn)
goto exit;
error:
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
exit:
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
@@ -1158,7 +1160,7 @@ static lv_res_t _action_reboot_recovery(lv_obj_t * btns, const char * txt)
int btn_idx = lv_btnm_get_pressed(btns);
// Delete parent mbox.
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
if (!btn_idx)
{
@@ -1190,7 +1192,7 @@ static lv_res_t _action_flash_android_data(lv_obj_t * btns, const char * txt)
bool boot_recovery = false;
// Delete parent mbox.
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
if (btn_idx)
return LV_RES_INV;
@@ -1436,7 +1438,7 @@ error:
lv_mbox_add_btns(mbox, mbox_btn_map2, _action_reboot_recovery);
}
else
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
@@ -1480,6 +1482,8 @@ static lv_res_t _action_flash_android(lv_obj_t *btn)
static lv_res_t _action_part_manager_flash_options0(lv_obj_t *btns, const char *txt)
{
int btn_idx = lv_btnm_get_pressed(btns);
if (part_info.emmc)
btn_idx++;
switch (btn_idx)
{
@@ -1494,7 +1498,7 @@ static lv_res_t _action_part_manager_flash_options0(lv_obj_t *btns, const char *
_action_flash_android(NULL);
break;
case 3:
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
return LV_RES_INV;
}
@@ -1504,6 +1508,8 @@ static lv_res_t _action_part_manager_flash_options0(lv_obj_t *btns, const char *
static lv_res_t _action_part_manager_flash_options1(lv_obj_t *btns, const char *txt)
{
int btn_idx = lv_btnm_get_pressed(btns);
if (part_info.emmc)
btn_idx++;
switch (btn_idx)
{
@@ -1512,11 +1518,11 @@ static lv_res_t _action_part_manager_flash_options1(lv_obj_t *btns, const char *
lv_obj_del(ums_mbox);
break;
case 1:
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
_action_check_flash_linux(NULL);
return LV_RES_INV;
case 2:
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
return LV_RES_INV;
}
@@ -1526,6 +1532,8 @@ static lv_res_t _action_part_manager_flash_options1(lv_obj_t *btns, const char *
static lv_res_t _action_part_manager_flash_options2(lv_obj_t *btns, const char *txt)
{
int btn_idx = lv_btnm_get_pressed(btns);
if (part_info.emmc)
btn_idx++;
switch (btn_idx)
{
@@ -1534,11 +1542,11 @@ static lv_res_t _action_part_manager_flash_options2(lv_obj_t *btns, const char *
lv_obj_del(ums_mbox);
break;
case 1:
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
_action_flash_android(NULL);
return LV_RES_INV;
case 2:
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
return LV_RES_INV;
}
@@ -1844,7 +1852,7 @@ out:
lv_obj_del(lbl_paths[1]);
exit:
if (!buttons_set)
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
@@ -1920,7 +1928,7 @@ static lv_res_t _emmc_create_mbox_start_partitioning()
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
manual_system_maintenance(true);
if (!emmc_initialize(false))
if (emmc_initialize(false))
{
lv_label_set_text(lbl_extra, "#FFDD00 Failed to init eMMC!#");
goto exit;
@@ -2044,7 +2052,7 @@ exit:
free(txt_buf);
if (!buttons_set)
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
@@ -2065,11 +2073,11 @@ static lv_res_t _create_mbox_partitioning_option0(lv_obj_t *btns, const char *tx
action_ums_sd(NULL);
return LV_RES_OK;
case 1:
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
_sd_create_mbox_start_partitioning();
break;
case 2:
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
break;
}
@@ -2080,11 +2088,10 @@ static lv_res_t _create_mbox_partitioning_option1(lv_obj_t *btns, const char *tx
{
int btn_idx = lv_btnm_get_pressed(btns);
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
if (!btn_idx)
{
mbox_action(btns, txt);
if (!part_info.emmc)
_sd_create_mbox_start_partitioning();
else
@@ -2102,7 +2109,7 @@ static lv_res_t _create_mbox_partitioning_warn()
lv_obj_set_size(dark_bg, LV_HOR_RES, LV_VER_RES);
static const char *mbox_btn_map[] = { "\222SD UMS", "\222Start", "\222Cancel", "" };
static const char *mbox_btn_map2[] = { "\222Start", "\222Cancel", "" };
static const char *mbox_btn_map1[] = { "\222Start", "\222Cancel", "" };
lv_obj_t * mbox = lv_mbox_create(dark_bg, NULL);
lv_mbox_set_recolor_text(mbox, true);
@@ -2132,7 +2139,7 @@ static lv_res_t _create_mbox_partitioning_warn()
lv_label_set_text(lbl_status, txt_buf);
if (part_info.backup_possible)
lv_mbox_add_btns(mbox, mbox_btn_map2, _create_mbox_partitioning_option1);
lv_mbox_add_btns(mbox, mbox_btn_map1, _create_mbox_partitioning_option1);
else
lv_mbox_add_btns(mbox, mbox_btn_map, _create_mbox_partitioning_option0);
}
@@ -2141,7 +2148,7 @@ static lv_res_t _create_mbox_partitioning_warn()
s_printf(txt_buf, "#FFDD00 Warning: This will partition the eMMC!#\n\n"
"#FFDD00 The USER partition will also be formatted!#");
lv_label_set_text(lbl_status, txt_buf);
lv_mbox_add_btns(mbox, mbox_btn_map2, _create_mbox_partitioning_option1);
lv_mbox_add_btns(mbox, mbox_btn_map1, _create_mbox_partitioning_option1);
}
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
@@ -2154,11 +2161,10 @@ static lv_res_t _create_mbox_partitioning_warn()
static lv_res_t _create_mbox_partitioning_android(lv_obj_t *btns, const char *txt)
{
int btn_idx = lv_btnm_get_pressed(btns);
part_info.and_dynamic = lv_btnm_get_pressed(btns);
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
part_info.and_dynamic = !btn_idx;
_create_mbox_partitioning_warn();
return LV_RES_INV;
@@ -2170,7 +2176,7 @@ static lv_res_t _create_mbox_partitioning_andr_part()
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[] = { "\222Dynamic", "\222Legacy", "" };
static const char *mbox_btn_map[] = { "\222Legacy", "\222Dynamic", "" };
lv_obj_t * mbox = lv_mbox_create(dark_bg, NULL);
lv_mbox_set_recolor_text(mbox, true);
@@ -2182,8 +2188,8 @@ static lv_res_t _create_mbox_partitioning_andr_part()
lv_label_set_text(lbl_status,
"Please select a partition scheme:\n\n"
"#C7EA46 Dynamic:# Android 13+\n"
"#C7EA46 Legacy:# Android 10-11\n");
"#C7EA46 Dynamic:# Android 13+ (Preferred)\n"
"#C7EA46 Legacy:# Android 11\n");
lv_mbox_add_btns(mbox, mbox_btn_map, _create_mbox_partitioning_android);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
@@ -2445,7 +2451,7 @@ static lv_res_t _mbox_check_files_total_size_option(lv_obj_t *btns, const char *
if (!lv_btnm_get_pressed(btns))
part_info.backup_possible = false;
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
return LV_RES_INV;
}
@@ -2624,7 +2630,7 @@ static void _create_mbox_check_files_total_size()
lv_obj_align(lbl_table, h1, LV_ALIGN_IN_TOP_MID, 0, LV_DPI);
if (!part_info.backup_possible)
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
else
lv_mbox_add_btns(mbox, mbox_btn_map2, _mbox_check_files_total_size_option);
@@ -2661,7 +2667,7 @@ static lv_res_t _action_fix_mbr_gpt(lv_obj_t *btn)
int gpt_emummc_migrate_no = 0;
// Try to init sd card. No need for valid MBR.
if (!sd_mount() && !sd_get_card_initialized())
if (sd_mount() && !sd_get_card_initialized())
{
lv_label_set_text(lbl_status, "#FFDD00 Failed to init SD!#");
goto out;
@@ -2957,7 +2963,7 @@ check_changes:
out:
free(gpt);
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
@@ -2971,11 +2977,11 @@ lv_res_t create_window_partition_manager(bool emmc)
if (!emmc)
{
win = nyx_create_standard_window(SYMBOL_SD" SD Partition Manager");
win = nyx_create_standard_window(SYMBOL_SD" SD Partition Manager", NULL);
lv_win_add_btn(win, NULL, SYMBOL_MODULES_ALT" Fix Hybrid MBR/GPT", _action_fix_mbr_gpt);
}
else
win = nyx_create_standard_window(SYMBOL_CHIP" eMMC Partition Manager");
win = nyx_create_standard_window(SYMBOL_CHIP" eMMC Partition Manager", NULL);
static lv_style_t bar_hos_bg, bar_emu_bg, bar_l4t_bg, bar_and_bg;
static lv_style_t bar_hos_ind, bar_emu_ind, bar_l4t_ind, bar_and_ind;
@@ -3044,7 +3050,7 @@ lv_res_t create_window_partition_manager(bool emmc)
u32 emmc_size = 0;
if (!emmc)
{
if (!sd_mount())
if (sd_mount())
{
lv_obj_t *lbl = lv_label_create(h1, NULL);
lv_label_set_recolor(lbl, true);
@@ -3052,7 +3058,7 @@ lv_res_t create_window_partition_manager(bool emmc)
return LV_RES_OK;
}
if (emmc_initialize(false))
if (!emmc_initialize(false))
{
emmc_set_partition(EMMC_GPP);
emmc_size = emmc_storage.sec_cnt >> 11;
@@ -3061,7 +3067,7 @@ lv_res_t create_window_partition_manager(bool emmc)
}
else
{
if (!emmc_initialize(false))
if (emmc_initialize(false))
{
lv_obj_t *lbl = lv_label_create(h1, NULL);
lv_label_set_recolor(lbl, true);
@@ -3342,8 +3348,8 @@ lv_res_t create_window_partition_manager(bool emmc)
lv_obj_set_click(btn_flash_android, false);
lv_btn_set_state(btn_flash_android, LV_BTN_STATE_INA);
break;
case 1: // Android 10/11.
lv_label_set_static_text(label_btn, SYMBOL_DOWNLOAD" Flash Android 10/11");
case 1: // Android 11.
lv_label_set_static_text(label_btn, SYMBOL_DOWNLOAD" Flash Android 11");
break;
case 2: // Android 13+
lv_label_set_static_text(label_btn, SYMBOL_DOWNLOAD" Flash Android 13+");

View File

@@ -26,7 +26,6 @@
#include "../config.h"
u8 *cal0_buf = NULL;
static u8 *bis_keys = NULL;
static const u8 eks_keyseeds[HOS_MKEY_VER_600 - HOS_MKEY_VER_100 + 1][SE_KEY_128_SIZE] = {
{ 0xDF, 0x20, 0x6F, 0x59, 0x44, 0x54, 0xEF, 0xDC, 0x70, 0x74, 0x48, 0x3B, 0x0D, 0xED, 0x9F, 0xD3 }, // 1.0.0.
@@ -52,7 +51,7 @@ static const u8 master_kekseed_620[SE_KEY_128_SIZE] =
//!TODO: Update on mkey changes.
static const u8 master_kekseed_t210_max[SE_KEY_128_SIZE] =
{ 0x66, 0xC8, 0xCB, 0x3D, 0xEC, 0xF4, 0x59, 0x73, 0x54, 0x88, 0xE1, 0x2E, 0xE6, 0x3D, 0x68, 0x46 }; // 21.0.0.
{ 0x15, 0xAC, 0x96, 0x34, 0xF5, 0x32, 0x56, 0x68, 0xFE, 0x5B, 0x9D, 0xD7, 0xED, 0x19, 0xB7, 0x8E }; // 22.0.0.
//!TODO: Update on mkey changes.
static const u8 master_kekseed_t210b01[HOS_MKEY_VER_MAX - HOS_MKEY_VER_600 + 1][SE_KEY_128_SIZE] = {
@@ -72,6 +71,7 @@ static const u8 master_kekseed_t210b01[HOS_MKEY_VER_MAX - HOS_MKEY_VER_600 + 1][
{ 0x31, 0xBE, 0x25, 0xFB, 0xDB, 0xB4, 0xEE, 0x49, 0x5C, 0x77, 0x05, 0xC2, 0x36, 0x9F, 0x34, 0x80 }, // 19.0.0.
{ 0x1A, 0x31, 0x62, 0x87, 0xA8, 0x09, 0xCA, 0xF8, 0x69, 0x15, 0x45, 0xC2, 0x6B, 0xAA, 0x5A, 0x8A }, // 20.0.0.
{ 0xEB, 0xF3, 0x5B, 0x2D, 0x4A, 0x2D, 0xCE, 0x45, 0x3A, 0x6F, 0x61, 0x38, 0x0B, 0x00, 0x3B, 0x46 }, // 21.0.0.
{ 0x82, 0xE2, 0x0A, 0x59, 0x67, 0xDF, 0xBF, 0x51, 0x47, 0x62, 0x11, 0xF2, 0x41, 0xD3, 0xEE, 0x13 }, // 22.0.0.
};
static const u8 console_keyseed[SE_KEY_128_SIZE] =
@@ -106,6 +106,7 @@ static const u8 mkey_vectors[HOS_MKEY_VER_MAX + 1][SE_KEY_128_SIZE] = {
{ 0x4A, 0x01, 0x3B, 0xC7, 0x44, 0x6E, 0x45, 0xBD, 0xE6, 0x5E, 0x2B, 0xEC, 0x07, 0x37, 0x52, 0x86 }, // Mkey 17 encrypted with mkey 18.
{ 0x97, 0xE4, 0x11, 0xAB, 0x22, 0x72, 0x1A, 0x1F, 0x70, 0x5C, 0x00, 0xB3, 0x96, 0x30, 0x05, 0x28 }, // Mkey 18 encrypted with mkey 19.
{ 0xF7, 0x92, 0xC0, 0xEC, 0xF3, 0xA4, 0x8C, 0xB7, 0x0D, 0xB3, 0xF3, 0xAB, 0x10, 0x9B, 0x18, 0xBA }, // Mkey 19 encrypted with mkey 20.
{ 0x14, 0xCB, 0x60, 0x29, 0x3D, 0xE0, 0xFB, 0xF2, 0x5B, 0x60, 0xB6, 0xC5, 0x2E, 0x77, 0x8F, 0x98 }, // Mkey 20 encrypted with mkey 21.
};
//!TODO: Update on mkey changes.
@@ -128,6 +129,7 @@ static const u8 new_console_keyseed[HOS_MKEY_VER_MAX - HOS_MKEY_VER_400 + 1][SE_
{ 0x07, 0x38, 0x9A, 0xEC, 0x9C, 0xBD, 0x50, 0x4A, 0x4C, 0x1F, 0x04, 0xDA, 0x40, 0x68, 0x29, 0xE3 }, // 19.0.0 New Device Key Source.
{ 0xA3, 0x6B, 0x0A, 0xB5, 0x6F, 0x57, 0x4C, 0x5E, 0x00, 0xFD, 0x56, 0x21, 0xF5, 0x06, 0x6B, 0xD1 }, // 20.0.0 New Device Key Source.
{ 0xF9, 0x62, 0x05, 0x99, 0xE0, 0xB9, 0xA6, 0x9B, 0x9D, 0xAA, 0xB4, 0x12, 0x0B, 0x0F, 0xF5, 0x8F }, // 21.0.0 New Device Key Source.
{ 0xF8, 0xF4, 0x22, 0xA4, 0x34, 0xAE, 0x0E, 0x0C, 0x4D, 0x5C, 0x5B, 0xA1, 0x1B, 0x46, 0x1C, 0x78 }, // 22.0.0 New Device Key Source.
};
//!TODO: Update on mkey changes.
@@ -150,6 +152,7 @@ static const u8 new_console_kekseed[HOS_MKEY_VER_MAX - HOS_MKEY_VER_400 + 1][SE_
{ 0x9B, 0xA5, 0xFD, 0x74, 0x7F, 0xCD, 0x23, 0xD1, 0xD9, 0xBD, 0x6C, 0x51, 0x72, 0x5F, 0x3D, 0x1F }, // 19.0.0 New Device Keygen Source.
{ 0xDA, 0xFB, 0x61, 0x39, 0x48, 0x2D, 0xC2, 0x7E, 0x0D, 0x8E, 0x8F, 0x98, 0x57, 0x20, 0xB8, 0x15 }, // 20.0.0 New Device Keygen Source.
{ 0x92, 0xBF, 0x37, 0x80, 0x0E, 0x79, 0x56, 0x8C, 0x57, 0x75, 0x72, 0x0A, 0x48, 0xD8, 0x15, 0x39 }, // 21.0.0 New Device Keygen Source.
{ 0xC4, 0x6F, 0x0E, 0x72, 0x43, 0xCE, 0x87, 0xFC, 0x38, 0x95, 0x9B, 0xC9, 0x31, 0x44, 0x97, 0x63 }, // 22.0.0 New Device Keygen Source.
};
static const u8 gen_keyseed[SE_KEY_128_SIZE] =
@@ -173,23 +176,23 @@ static const u8 bis_keyseed[][SE_KEY_128_SIZE] = {
{ 0x4D, 0x12, 0xE1, 0x4B, 0x2A, 0x47, 0x4C, 0x1C, 0x09, 0xCB, 0x03, 0x59, 0xF0, 0x15, 0xF4, 0xE4 } // BIS 2/3 Tweak seed.
};
bool hos_eks_rw_try(u8 *buf, bool write)
static int _hos_eks_rw_try(u8 *buf, bool write)
{
for (u32 i = 0; i < 3; i++)
{
if (!write)
{
if (sdmmc_storage_read(&sd_storage, 0, 1, buf))
return true;
if (!sdmmc_storage_read(&sd_storage, 0, 1, buf))
return 0;
}
else
{
if (sdmmc_storage_write(&sd_storage, 0, 1, buf))
return true;
if (!sdmmc_storage_write(&sd_storage, 0, 1, buf))
return 0;
}
}
return false;
return 1;
}
static void _hos_eks_get()
@@ -203,7 +206,7 @@ static void _hos_eks_get()
{
// Read EKS blob.
u8 *mbr = malloc(SD_BLOCKSIZE);
if (!hos_eks_rw_try(mbr, false))
if (_hos_eks_rw_try(mbr, false))
goto out;
// Decrypt EKS blob.
@@ -241,7 +244,7 @@ static void _hos_eks_save()
{
// Read EKS blob.
u8 *mbr = malloc(SD_BLOCKSIZE);
if (!hos_eks_rw_try(mbr, false))
if (_hos_eks_rw_try(mbr, false))
{
if (new_eks)
{
@@ -273,7 +276,7 @@ static void _hos_eks_save()
// Write EKS blob to SD.
memcpy(mbr + 0x80, eks, sizeof(hos_eks_mbr_t));
hos_eks_rw_try(mbr, true);
_hos_eks_rw_try(mbr, true);
free(eks);
free(keys);
@@ -295,7 +298,7 @@ void hos_eks_clear(u32 mkey)
{
// Read EKS blob.
u8 *mbr = malloc(SD_BLOCKSIZE);
if (!hos_eks_rw_try(mbr, false))
if (_hos_eks_rw_try(mbr, false))
goto out;
// Disable current Master key version.
@@ -308,7 +311,7 @@ void hos_eks_clear(u32 mkey)
// Write EKS blob to SD.
memcpy(mbr + 0x80, eks, sizeof(hos_eks_mbr_t));
hos_eks_rw_try(mbr, true);
_hos_eks_rw_try(mbr, true);
free(eks);
out:
@@ -331,7 +334,7 @@ int hos_keygen(pkg1_eks_t *eks, u32 mkey, tsec_ctxt_t *tsec_ctxt)
tsec_keys_t tsec_keys;
if (mkey > HOS_MKEY_VER_MAX)
return 0;
return 1;
// Do Mariko keygen.
if (h_cfg.t210b01)
@@ -346,7 +349,7 @@ int hos_keygen(pkg1_eks_t *eks, u32 mkey, tsec_ctxt_t *tsec_ctxt)
// Derive latest pkg2 key.
se_aes_unwrap_key(8, 7, package2_keyseed);
return 1;
return 0;
}
// Do Erista keygen.
@@ -385,7 +388,7 @@ int hos_keygen(pkg1_eks_t *eks, u32 mkey, tsec_ctxt_t *tsec_ctxt)
if (!tsec_ctxt->fw)
{
EPRINTF("\nFailed to load thk.bin");
return 0;
return 1;
}
tsec_ctxt->size = 0x1F00;
@@ -409,7 +412,7 @@ int hos_keygen(pkg1_eks_t *eks, u32 mkey, tsec_ctxt_t *tsec_ctxt)
if (retries > 15)
{
EPRINTF("\nFailed to get TSEC keys. Please try again.");
return 0;
return 1;
}
}
@@ -480,7 +483,7 @@ int hos_keygen(pkg1_eks_t *eks, u32 mkey, tsec_ctxt_t *tsec_ctxt)
se_aes_unwrap_key(11, 13, cmac_keyseed);
se_aes_hash_cmac(cmac, SE_KEY_128_SIZE, 11, (void *)eks->ctr, sizeof(eks->ctr) + sizeof(eks->keys));
if (!memcmp(eks->cmac, cmac, SE_KEY_128_SIZE))
return 0;
return 1;
*/
se_aes_crypt_ecb(13, DECRYPT, tsec_keys.tsec, cmac_keyseed, SE_KEY_128_SIZE);
@@ -521,7 +524,7 @@ int hos_keygen(pkg1_eks_t *eks, u32 mkey, tsec_ctxt_t *tsec_ctxt)
se_aes_unwrap_key(8, 12, package2_keyseed);
}
return 1;
return 0;
}
static void _hos_validate_mkey()
@@ -568,11 +571,9 @@ int hos_bis_keygen()
u32 console_key_slot = 15; // HOS_MKEY_VER_MAX. Only for Erista.
tsec_ctxt_t tsec_ctxt = {0};
if (!bis_keys)
bis_keys = malloc(SE_KEY_128_SIZE * 6);
// Run initial keygen.
hos_keygen(NULL, HOS_MKEY_VER_MAX, &tsec_ctxt);
if (hos_keygen(NULL, HOS_MKEY_VER_MAX, &tsec_ctxt))
return 1;
// All Mariko use new device keygen. New keygen was introduced in 4.0.0.
// We check unconditionally in order to support downgrades.
@@ -613,6 +614,7 @@ int hos_bis_keygen()
se_aes_unwrap_key(2, console_key_slot, gen_keyseed_retail);
// Clear bis keys storage.
u8 *bis_keys = malloc(SE_KEY_128_SIZE * 6);
memset(bis_keys, 0, SE_KEY_128_SIZE * 6);
// Generate BIS 0 Keys.
@@ -655,7 +657,7 @@ int hos_bis_keygen()
se_aes_key_set(4, bis_keys + (4 * SE_KEY_128_SIZE), SE_KEY_128_SIZE);
se_aes_key_set(5, bis_keys + (5 * SE_KEY_128_SIZE), SE_KEY_128_SIZE);
return 1;
return 0;
}
void hos_bis_keys_clear()
@@ -668,11 +670,12 @@ void hos_bis_keys_clear()
int hos_dump_cal0()
{
// Init eMMC.
if (!emmc_initialize(false))
if (emmc_initialize(false))
return 1;
// Generate BIS keys
hos_bis_keygen();
if (hos_bis_keygen())
return 2;
if (!cal0_buf)
cal0_buf = malloc(SZ_64K);

View File

@@ -48,7 +48,8 @@ enum {
HOS_MKEY_VER_1900 = 18,
HOS_MKEY_VER_2000 = 19,
HOS_MKEY_VER_2100 = 20,
HOS_MKEY_VER_MAX = HOS_MKEY_VER_2100
HOS_MKEY_VER_2200 = 21,
HOS_MKEY_VER_MAX = HOS_MKEY_VER_2200
};
#define HOS_TSEC_VERSION 4 //! TODO: Update on TSEC Root Key changes.

View File

@@ -67,7 +67,8 @@ static const pkg1_id_t _pkg1_ids[] = {
{ "20240207", 17, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000 }, // 18.0.0 - 18.1.0.
{ "20240808", 18, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000 }, // 19.0.0 - 19.0.1.
{ "20250206", 19, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000 }, // 20.0.0 - 20.5.0.
{ "20251009", 20, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000 }, // 21.0.0+
{ "20251009", 20, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000 }, // 21.0.0 - 21.2.0.
{ "20260123", 21, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000 }, // 22.0.0+
};
const pkg1_id_t *pkg1_identify(u8 *pkg1, char *build_date)
@@ -86,7 +87,7 @@ const pkg1_id_t *pkg1_identify(u8 *pkg1, char *build_date)
return NULL;
}
int pkg1_decrypt(const pkg1_id_t *id, u8 *pkg1)
bool pkg1_decrypt(const pkg1_id_t *id, u8 *pkg1)
{
pk11_hdr_t *hdr;

View File

@@ -94,7 +94,7 @@ typedef struct _pk11_hdr_t
} pk11_hdr_t;
const pkg1_id_t *pkg1_identify(u8 *pkg1, char *build_date);
int pkg1_decrypt(const pkg1_id_t *id, u8 *pkg1);
bool pkg1_decrypt(const pkg1_id_t *id, u8 *pkg1);
const u8 *pkg1_unpack(void *wm_dst, void *sm_dst, void *ldr_dst, const pkg1_id_t *id, u8 *pkg1);
#endif

View File

@@ -118,6 +118,8 @@ static const u8 mkey_vector_7xx[HOS_MKEY_VER_MAX - HOS_MKEY_VER_810 + 1][SE_KEY_
{ 0x97, 0xE4, 0x11, 0xAB, 0x22, 0x72, 0x1A, 0x1F, 0x70, 0x5C, 0x00, 0xB3, 0x96, 0x30, 0x05, 0x28 },
// Master key 19 encrypted with 20. (20.0.0 with 21.0.0)
{ 0xF7, 0x92, 0xC0, 0xEC, 0xF3, 0xA4, 0x8C, 0xB7, 0x0D, 0xB3, 0xF3, 0xAB, 0x10, 0x9B, 0x18, 0xBA },
// Master key 20 encrypted with 21. (21.0.0 with 22.0.0)
{ 0x14, 0xCB, 0x60, 0x29, 0x3D, 0xE0, 0xFB, 0xF2, 0x5B, 0x60, 0xB6, 0xC5, 0x2E, 0x77, 0x8F, 0x98 },
};
static bool _pkg2_key_unwrap_validate(pkg2_hdr_t *tmp_test, pkg2_hdr_t *hdr, u8 src_slot, u8 *mkey, const u8 *key_seed)

View File

@@ -55,14 +55,14 @@ DRESULT disk_read (
switch (pdrv)
{
case DRIVE_SD:
return sdmmc_storage_read(&sd_storage, sector, count, (void *)buff) ? RES_OK : RES_ERROR;
return sdmmc_storage_read(&sd_storage, sector, count, (void *)buff);
case DRIVE_RAM:
return ram_disk_read(sector, count, (void *)buff);
case DRIVE_EMMC:
return sdmmc_storage_read(&emmc_storage, sector, count, (void *)buff) ? RES_OK : RES_ERROR;
return sdmmc_storage_read(&emmc_storage, sector, count, (void *)buff);
case DRIVE_BIS:
case DRIVE_EMU:
return nx_emmc_bis_read(sector, count, (void *)buff) ? RES_OK : RES_ERROR;
return nx_emmc_bis_read(sector, count, (void *)buff);
}
return RES_ERROR;
@@ -81,7 +81,7 @@ DRESULT disk_write (
switch (pdrv)
{
case DRIVE_SD:
return sdmmc_storage_write(&sd_storage, sector, count, (void *)buff) ? RES_OK : RES_ERROR;
return sdmmc_storage_write(&sd_storage, sector, count, (void *)buff);
case DRIVE_RAM:
return ram_disk_write(sector, count, (void *)buff);
case DRIVE_EMMC:
@@ -90,7 +90,7 @@ DRESULT disk_write (
case DRIVE_EMU:
if (pdrv == DRIVE_BIS && !bis_write_allowed)
return RES_WRPRT;
return nx_emmc_bis_write(sector, count, (void *)buff) ? RES_OK : RES_ERROR;
return nx_emmc_bis_write(sector, count, (void *)buff);
}
return RES_ERROR;

View File

@@ -52,7 +52,7 @@ char *emmcsn_path_impl(char *path, char *sub_dir, char *filename, sdmmc_storage_
// Get actual eMMC S/N.
if (!storage)
{
if (!emmc_initialize(false))
if (emmc_initialize(false))
strcpy(emmc_sn, "00000000");
else
{
@@ -121,7 +121,7 @@ lv_res_t launch_payload(lv_obj_t *list)
strcpy(path,"bootloader/payloads/");
strcat(path, filename);
if (!sd_mount())
if (sd_mount())
goto out;
// Read payload.
@@ -167,7 +167,7 @@ static void _load_saved_configuration()
LIST_INIT(ini_sections);
LIST_INIT(ini_nyx_sections);
if (!ini_parse(&ini_sections, "bootloader/hekate_ipl.ini", false))
if (ini_parse(&ini_sections, "bootloader/hekate_ipl.ini", false))
{
create_config_entry();
goto skip_main_cfg_parse;
@@ -212,7 +212,7 @@ static void _load_saved_configuration()
ini_free(&ini_sections);
skip_main_cfg_parse:
if (!ini_parse(&ini_nyx_sections, "bootloader/nyx.ini", false))
if (ini_parse(&ini_nyx_sections, "bootloader/nyx.ini", false))
return;
// Load Nyx configuration.
@@ -306,14 +306,14 @@ static void nyx_load_bg_icons()
hekate_bg_etc = bmp_to_lvimg_obj("bootloader/res/background_etc.bmp");
}
#define EXCP_EN_ADDR 0x4003FFFC
#define EXCP_EN_ADDR 0x4003FF1C
#define EXCP_MAGIC 0x30505645 // EVP0
#define EXCP_TYPE_ADDR 0x4003FFF8
#define EXCP_TYPE_ADDR 0x4003FF18
#define EXCP_TYPE_RESET 0x545352 // RST
#define EXCP_TYPE_UNDEF 0x464455 // UDF
#define EXCP_TYPE_PABRT 0x54424150 // PABT
#define EXCP_TYPE_DABRT 0x54424144 // DABT
#define EXCP_LR_ADDR 0x4003FFF4
#define EXCP_LR_ADDR 0x4003FF14
enum {
SD_NO_ERROR = 0,
@@ -427,13 +427,13 @@ void nyx_init_load_res()
_show_errors(SD_NO_ERROR);
// Try 2 times to mount SD card.
if (!sd_mount())
if (sd_mount())
{
// Restore speed to SDR104.
sd_end();
// Retry.
if (!sd_mount())
if (sd_mount())
_show_errors(SD_MOUNT_ERROR); // Fatal.
}