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. |
| 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. |
| 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. |

View file

@ -786,6 +786,7 @@ static void _auto_launch()
u32 pos_y;
};
u32 boot_wait = h_cfg.bootwait;
u32 boot_entry_id = 0;
ini_sec_t *cfg_sec = NULL;
char *emummc_path = NULL;
@ -827,17 +828,7 @@ static void _auto_launch()
else if (!strcmp("autoboot_list", kv->key))
h_cfg.autoboot_list = atoi(kv->val);
else if (!strcmp("bootwait", kv->key))
{
h_cfg.bootwait = atoi(kv->val);
/*
* 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;
}
boot_wait = atoi(kv->val);
else if (!strcmp("backlight", kv->key))
h_cfg.backlight = atoi(kv->val);
else if (!strcmp("noticker", kv->key))
@ -863,6 +854,10 @@ static void _auto_launch()
// Apply bootloader protection against corruption.
_bootloader_corruption_protect();
// If ini list, exit here.
if (!boot_from_id && h_cfg.autoboot_list)
break;
continue;
}
@ -879,6 +874,8 @@ static void _auto_launch()
emummc_path = kv->val;
else if (!strcmp("emummc_force_disable", kv->key))
h_cfg.emummc_force_disable = atoi(kv->val);
else if (!strcmp("bootwait", kv->key))
boot_wait = atoi(kv->val);
}
}
if (cfg_sec)
@ -924,6 +921,8 @@ static void _auto_launch()
emummc_path = kv->val;
else if (!strcmp("emummc_force_disable", kv->key))
h_cfg.emummc_force_disable = atoi(kv->val);
else if (!strcmp("bootwait", kv->key))
boot_wait = atoi(kv->val);
}
}
if (cfg_sec)
@ -939,7 +938,7 @@ skip_list:
// Check if entry is payload or l4t special case.
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.
{
u32 fsize;
@ -994,6 +993,10 @@ skip_list:
free(bitmap);
}
// Clamp value to default if it exceeds 20s to protect against corruption.
if (boot_wait > 20)
boot_wait = 3;
// Render boot logo.
if (bootlogoFound)
{
@ -1002,13 +1005,13 @@ skip_list:
free(logo_buf);
// 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;
}
else
{
// 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;
}
}