1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-22 18:06:40 +00:00

hekate: add bootwait for each entry

Allow overriding global bootwait with the one from boot entry.
This commit is contained in:
CTCaer 2023-07-28 03:23:03 +03:00
parent d3567736c8
commit 317abb2f4e
2 changed files with 26 additions and 22 deletions

View file

@ -119,6 +119,7 @@ There are four possible type of entries. "**[ ]**": Boot entry, "**{ }**": Capti
| uart_port=0 | Enables logging on serial port for L4T uboot/kernel. | | uart_port=0 | Enables logging on serial port for L4T uboot/kernel. |
| Additional keys | Each distro supports more keys. Check README_CONFIG.txt for more info. | | Additional keys | Each distro supports more keys. Check README_CONFIG.txt for more info. |
| ---------------------- | ---------------------------------------------------------- | | ---------------------- | ---------------------------------------------------------- |
| bootwait=3 | Overrides global bootwait from `[config]`. |
| id=IDNAME | Identifies boot entry for forced boot via id. Max 7 chars. | | id=IDNAME | Identifies boot entry for forced boot via id. Max 7 chars. |
| logopath={FILE path} | If it exists, it will load the specified bitmap. Otherwise `bootloader/bootlogo.bmp` will be used if exists | | logopath={FILE path} | If it exists, it will load the specified bitmap. Otherwise `bootloader/bootlogo.bmp` will be used if exists |
| icon={FILE path} | Force Nyx to use the icon defined here. If this is not found, it will check for a bmp named as the boot entry ([Test 2] -> `bootloader/res/Test 2.bmp`). Otherwise defaults will be used. | | icon={FILE path} | Force Nyx to use the icon defined here. If this is not found, it will check for a bmp named as the boot entry ([Test 2] -> `bootloader/res/Test 2.bmp`). Otherwise defaults will be used. |

View file

@ -786,6 +786,7 @@ static void _auto_launch()
u32 pos_y; u32 pos_y;
}; };
u32 boot_wait = h_cfg.bootwait;
u32 boot_entry_id = 0; u32 boot_entry_id = 0;
ini_sec_t *cfg_sec = NULL; ini_sec_t *cfg_sec = NULL;
char *emummc_path = NULL; char *emummc_path = NULL;
@ -827,28 +828,18 @@ static void _auto_launch()
else if (!strcmp("autoboot_list", kv->key)) else if (!strcmp("autoboot_list", kv->key))
h_cfg.autoboot_list = atoi(kv->val); h_cfg.autoboot_list = atoi(kv->val);
else if (!strcmp("bootwait", kv->key)) else if (!strcmp("bootwait", kv->key))
{ boot_wait = atoi(kv->val);
h_cfg.bootwait = atoi(kv->val); else if (!strcmp("backlight", kv->key))
/*
* Clamp value to default if it exceeds 20s to protect against corruption.
* Allow up to 20s though for use in cases where user needs lots of time.
* For example dock-only use and r2p with enough time to reach dock and cancel it.
*/
if (h_cfg.bootwait > 20)
h_cfg.bootwait = 3;
}
else if (!strcmp("backlight", kv->key))
h_cfg.backlight = atoi(kv->val); h_cfg.backlight = atoi(kv->val);
else if (!strcmp("noticker", kv->key)) else if (!strcmp("noticker", kv->key))
h_cfg.noticker = atoi(kv->val); h_cfg.noticker = atoi(kv->val);
else if (!strcmp("autohosoff", kv->key)) else if (!strcmp("autohosoff", kv->key))
h_cfg.autohosoff = atoi(kv->val); h_cfg.autohosoff = atoi(kv->val);
else if (!strcmp("autonogc", kv->key)) else if (!strcmp("autonogc", kv->key))
h_cfg.autonogc = atoi(kv->val); h_cfg.autonogc = atoi(kv->val);
else if (!strcmp("updater2p", kv->key)) else if (!strcmp("updater2p", kv->key))
h_cfg.updater2p = atoi(kv->val); h_cfg.updater2p = atoi(kv->val);
else if (!strcmp("bootprotect", kv->key)) else if (!strcmp("bootprotect", kv->key))
h_cfg.bootprotect = atoi(kv->val); h_cfg.bootprotect = atoi(kv->val);
} }
boot_entry_id++; boot_entry_id++;
@ -856,13 +847,17 @@ static void _auto_launch()
// Override autoboot. // Override autoboot.
if (b_cfg.boot_cfg & BOOT_CFG_AUTOBOOT_EN) if (b_cfg.boot_cfg & BOOT_CFG_AUTOBOOT_EN)
{ {
h_cfg.autoboot = b_cfg.autoboot; h_cfg.autoboot = b_cfg.autoboot;
h_cfg.autoboot_list = b_cfg.autoboot_list; h_cfg.autoboot_list = b_cfg.autoboot_list;
} }
// Apply bootloader protection against corruption. // Apply bootloader protection against corruption.
_bootloader_corruption_protect(); _bootloader_corruption_protect();
// If ini list, exit here.
if (!boot_from_id && h_cfg.autoboot_list)
break;
continue; continue;
} }
@ -879,6 +874,8 @@ static void _auto_launch()
emummc_path = kv->val; emummc_path = kv->val;
else if (!strcmp("emummc_force_disable", kv->key)) else if (!strcmp("emummc_force_disable", kv->key))
h_cfg.emummc_force_disable = atoi(kv->val); h_cfg.emummc_force_disable = atoi(kv->val);
else if (!strcmp("bootwait", kv->key))
boot_wait = atoi(kv->val);
} }
} }
if (cfg_sec) if (cfg_sec)
@ -924,6 +921,8 @@ static void _auto_launch()
emummc_path = kv->val; emummc_path = kv->val;
else if (!strcmp("emummc_force_disable", kv->key)) else if (!strcmp("emummc_force_disable", kv->key))
h_cfg.emummc_force_disable = atoi(kv->val); h_cfg.emummc_force_disable = atoi(kv->val);
else if (!strcmp("bootwait", kv->key))
boot_wait = atoi(kv->val);
} }
} }
if (cfg_sec) if (cfg_sec)
@ -939,8 +938,8 @@ skip_list:
// Check if entry is payload or l4t special case. // Check if entry is payload or l4t special case.
char *special_path = ini_check_special_section(cfg_sec); char *special_path = ini_check_special_section(cfg_sec);
if ((!(b_cfg.boot_cfg & BOOT_CFG_FROM_LAUNCH) && h_cfg.bootwait) || // Conditional for HOS/Payload. if ((!(b_cfg.boot_cfg & BOOT_CFG_FROM_LAUNCH) && boot_wait) || // Conditional for HOS/Payload.
(special_path && special_path == (char *)-1)) // Always show for L4T. (special_path && special_path == (char *)-1)) // Always show for L4T.
{ {
u32 fsize; u32 fsize;
u8 *logo_buf = NULL; u8 *logo_buf = NULL;
@ -994,6 +993,10 @@ skip_list:
free(bitmap); free(bitmap);
} }
// Clamp value to default if it exceeds 20s to protect against corruption.
if (boot_wait > 20)
boot_wait = 3;
// Render boot logo. // Render boot logo.
if (bootlogoFound) if (bootlogoFound)
{ {
@ -1002,13 +1005,13 @@ skip_list:
free(logo_buf); free(logo_buf);
// Do animated waiting before booting. If VOL- is pressed go into bootloader menu. // Do animated waiting before booting. If VOL- is pressed go into bootloader menu.
if (render_ticker(h_cfg.bootwait, h_cfg.backlight, h_cfg.noticker)) if (render_ticker(boot_wait, h_cfg.backlight, h_cfg.noticker))
goto out; goto out;
} }
else else
{ {
// Do animated waiting before booting. If VOL- is pressed go into bootloader menu. // Do animated waiting before booting. If VOL- is pressed go into bootloader menu.
if (render_ticker_logo(h_cfg.bootwait, h_cfg.backlight)) if (render_ticker_logo(boot_wait, h_cfg.backlight))
goto out; goto out;
} }
} }