nyx: add OmniNX brand label and tab background fallback

Show hekate-pro | OmniNX pack on the home screen from manifest.ini via boot storage, and support background_etc.bmp for non-Home tabs.
This commit is contained in:
2026-07-09 22:26:32 +02:00
parent bf9c214cef
commit fa9197245c
8 changed files with 105 additions and 24 deletions

View File

@@ -53,6 +53,7 @@ lv_img_dsc_t *icon_payload;
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, btn_transp_ina;
lv_style_t ddlist_transp_bg, ddlist_transp_sel;
@@ -1241,7 +1242,7 @@ static void _create_text_button(lv_theme_t *th, lv_obj_t *parent, lv_obj_t *btn,
btn_onoff_rel_hos_style.body.empty = 1;
lv_style_copy(&btn_onoff_pr_hos_style, &btn_onoff_rel_hos_style);
if (hekate_bg)
if (hekate_bg || hekate_bg_etc)
{
btn_onoff_pr_hos_style.body.main_color = LV_COLOR_HEX(0xFFFFFF);
btn_onoff_pr_hos_style.body.opa = 35;
@@ -1510,7 +1511,7 @@ static lv_res_t _win_launch_close_action(lv_obj_t * btn)
lv_obj_del(win);
if (n_cfg.home_screen && !launch_bg_done && hekate_bg)
if (n_cfg.home_screen && !launch_bg_done && (hekate_bg || hekate_bg_etc))
{
lv_obj_set_opa_scale_enable(launch_bg, true);
lv_obj_set_opa_scale(launch_bg, LV_OPA_TRANSP);
@@ -1532,10 +1533,10 @@ static lv_obj_t *create_window_launch(const char *win_title)
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;
if (n_cfg.home_screen && !launch_bg_done && hekate_bg)
if (n_cfg.home_screen && !launch_bg_done && (hekate_bg || hekate_bg_etc))
{
lv_obj_t *img = lv_img_create(lv_scr_act(), NULL);
lv_img_set_src(img, hekate_bg);
lv_img_set_src(img, hekate_bg ? hekate_bg : hekate_bg_etc);
launch_bg = img;
}
@@ -1545,7 +1546,7 @@ static lv_obj_t *create_window_launch(const char *win_title)
lv_obj_set_size(win, LV_HOR_RES, LV_VER_RES);
if (n_cfg.home_screen && !launch_bg_done && hekate_bg)
if (n_cfg.home_screen && !launch_bg_done && (hekate_bg || hekate_bg_etc))
{
lv_style_copy(&win_header, lv_theme_get_current()->win.header);
win_header.body.opa = LV_OPA_TRANSP;
@@ -1986,18 +1987,82 @@ failed_sd_mount:
return LV_RES_OK;
}
// Fills buf with theme-colored brand text: "hekate-pro | OmniNX <pack>" from manifest.ini, or "hekate-pro" if missing.
static void _get_home_brand_text(char *buf, size_t buf_size)
{
static const char * const manifest_paths[] = {
"config/omninx/manifest.ini",
"bootloader/config/omninx/manifest.ini",
};
if (!boot_storage_mount())
{
s_printf(buf, "%s%s", text_color, " hekate-pro#");
return;
}
link_t ini_sections;
list_init(&ini_sections);
int parsed = 1;
for (u32 p = 0; p < sizeof(manifest_paths) / sizeof(manifest_paths[0]) && parsed; p++)
parsed = ini_parse(&ini_sections, manifest_paths[p], false);
if (parsed)
{
s_printf(buf, "%s%s", text_color, " hekate-pro#");
boot_storage_unmount();
return;
}
const char *pack = NULL;
LIST_FOREACH_ENTRY(ini_sec_t, ini_sec, &ini_sections, link)
{
if (ini_sec->type != INI_CHOICE || !ini_sec->name)
continue;
// Accept [OmniNX] or [omninx] (case-insensitive).
const char *n = ini_sec->name;
if ((n[0] != 'O' && n[0] != 'o') || (n[1] != 'm' && n[1] != 'M') ||
(n[2] != 'n' && n[2] != 'N') || (n[3] != 'i' && n[3] != 'I') ||
(n[4] != 'N' && n[4] != 'n') || (n[5] != 'X' && n[5] != 'x') || n[6] != '\0')
continue;
LIST_FOREACH_ENTRY(ini_kv_t, kv, &ini_sec->kvs, link)
{
if (!strcmp(kv->key, "current_pack"))
pack = kv->val;
else if (!pack && !strcmp(kv->key, "channel_pack"))
pack = kv->val;
}
break;
}
if (!pack)
{
s_printf(buf, "%s%s", text_color, " hekate-pro#");
ini_free(&ini_sections);
boot_storage_unmount();
return;
}
s_printf(buf, "%s hekate-pro | OmniNX %s#", text_color, pack);
ini_free(&ini_sections);
boot_storage_unmount();
}
static void _create_tab_home(lv_theme_t *th, lv_obj_t *parent)
{
lv_page_set_scrl_layout(parent, LV_LAYOUT_OFF);
lv_page_set_scrl_fit(parent, false, false);
lv_page_set_scrl_height(parent, 592);
char btn_colored_text[64];
char btn_colored_text[96];
// Set brand label.
// Set brand label (from OmniNX manifest if present, else "hekate-pro").
lv_obj_t *label_brand = lv_label_create(parent, NULL);
lv_label_set_recolor(label_brand, true);
s_printf(btn_colored_text, "%s%s", text_color, " hekate-pro#");
_get_home_brand_text(btn_colored_text, sizeof(btn_colored_text));
lv_label_set_text(label_brand, btn_colored_text);
lv_obj_set_pos(label_brand, 50, 48);
@@ -2013,7 +2078,7 @@ static void _create_tab_home(lv_theme_t *th, lv_obj_t *parent)
// Launch button.
lv_obj_t *btn_launch = lv_btn_create(parent, NULL);
if (hekate_bg)
if (hekate_bg || hekate_bg_etc)
{
lv_btn_set_style(btn_launch, LV_BTN_STYLE_REL, &btn_transp_rel);
lv_btn_set_style(btn_launch, LV_BTN_STYLE_PR, &btn_transp_pr);
@@ -2243,8 +2308,18 @@ void nyx_check_ini_changes()
}
}
static lv_obj_t *nyx_main_bg_img;
static lv_res_t _show_hide_save_button(lv_obj_t *tv, uint16_t tab_idx)
{
// Swap main background: Home (tab 1) uses background.bmp, others use background_etc.bmp if present.
if (nyx_main_bg_img && (hekate_bg || hekate_bg_etc))
{
lv_img_dsc_t *src = (tab_idx == 1) ? hekate_bg : (hekate_bg_etc ? hekate_bg_etc : hekate_bg);
if (src)
lv_img_set_src(nyx_main_bg_img, src);
}
if (tab_idx == 4) // Options.
{
lv_btn_set_action(status_bar.mid, LV_BTN_ACTION_CLICK, _save_options_action);
@@ -2378,15 +2453,16 @@ static void _nyx_main_menu(lv_theme_t * th)
lv_cont_set_style(cnr, &base_bg_style);
lv_obj_set_size(cnr, LV_HOR_RES, LV_VER_RES);
if (hekate_bg)
if (hekate_bg || hekate_bg_etc)
{
lv_obj_t *img = lv_img_create(cnr, NULL);
lv_img_set_src(img, hekate_bg);
lv_img_set_src(img, hekate_bg ? hekate_bg : hekate_bg_etc);
nyx_main_bg_img = img;
}
// Add tabview page to screen.
lv_obj_t *tv = lv_tabview_create(scr, NULL);
if (hekate_bg)
if (hekate_bg || hekate_bg_etc)
{
lv_tabview_set_style(tv, LV_TABVIEW_STYLE_BTN_PR, &tabview_btn_pr);
lv_tabview_set_style(tv, LV_TABVIEW_STYLE_BTN_TGL_PR, &tabview_btn_tgl_pr);