From fa9197245c7d97511b301e19e4b3f0bb1ef6e0ca Mon Sep 17 00:00:00 2001 From: niklascfw Date: Thu, 9 Jul 2026 22:26:32 +0200 Subject: [PATCH] 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. --- nyx/README_RES.md | 2 + nyx/nyx_gui/frontend/gui.c | 100 +++++++++++++++++++++++---- nyx/nyx_gui/frontend/gui.h | 1 + nyx/nyx_gui/frontend/gui_emu_tools.c | 2 +- nyx/nyx_gui/frontend/gui_info.c | 6 +- nyx/nyx_gui/frontend/gui_options.c | 4 +- nyx/nyx_gui/frontend/gui_tools.c | 12 ++-- nyx/nyx_gui/nyx.c | 2 + 8 files changed, 105 insertions(+), 24 deletions(-) diff --git a/nyx/README_RES.md b/nyx/README_RES.md index f4f54e37..efb8f287 100644 --- a/nyx/README_RES.md +++ b/nyx/README_RES.md @@ -17,4 +17,6 @@ The default system icons (`icon_switch.bmp` and `icon_payload.bmp`) can be repla The background must go to /bootloader/res/background.bmp +An optional second background, **background_etc.bmp**, can be placed in /bootloader/res/. If present, it is used for the About, Tools, Console Info, and Options tabs. The Home tab always uses background.bmp (or the theme color if no custom background). Same 1280 x 720 32-bit BMP format as the main background. + The icons can be utilized either via `[boot entries names]` -> `boot entries names.bmp` or by using `icon={sd path}` (preferred method), which should point at a bmp. diff --git a/nyx/nyx_gui/frontend/gui.c b/nyx/nyx_gui/frontend/gui.c index f8e8a0c8..a1676963 100644 --- a/nyx/nyx_gui/frontend/gui.c +++ b/nyx/nyx_gui/frontend/gui.c @@ -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 " 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); diff --git a/nyx/nyx_gui/frontend/gui.h b/nyx/nyx_gui/frontend/gui.h index b5a2faea..c55d7adc 100644 --- a/nyx/nyx_gui/frontend/gui.h +++ b/nyx/nyx_gui/frontend/gui.h @@ -61,6 +61,7 @@ extern lv_img_dsc_t *icon_payload; 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, btn_transp_ina; extern lv_style_t ddlist_transp_bg, ddlist_transp_sel; diff --git a/nyx/nyx_gui/frontend/gui_emu_tools.c b/nyx/nyx_gui/frontend/gui_emu_tools.c index 32e98583..f6fb454a 100644 --- a/nyx/nyx_gui/frontend/gui_emu_tools.c +++ b/nyx/nyx_gui/frontend/gui_emu_tools.c @@ -52,7 +52,7 @@ lv_res_t create_win_emu_tools(lv_obj_t *btn){ lv_tabview_set_style(tv, LV_TABVIEW_STYLE_BTN_REL, &tv_style); - 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); } diff --git a/nyx/nyx_gui/frontend/gui_info.c b/nyx/nyx_gui/frontend/gui_info.c index 6e0f2276..9f2266a8 100644 --- a/nyx/nyx_gui/frontend/gui_info.c +++ b/nyx/nyx_gui/frontend/gui_info.c @@ -3278,7 +3278,7 @@ void create_tab_info(lv_theme_t *th, lv_obj_t *parent) // Create Bootrom button. lv_obj_t *btn = lv_btn_create(h1, NULL); - if (hekate_bg) + 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); @@ -3375,7 +3375,7 @@ void create_tab_info(lv_theme_t *th, lv_obj_t *parent) // Create eMMC button. lv_obj_t *btn5 = lv_btn_create(h2, NULL); - if (hekate_bg) + if (hekate_bg || hekate_bg_etc) { lv_btn_set_style(btn5, LV_BTN_STYLE_REL, &btn_transp_rel); lv_btn_set_style(btn5, LV_BTN_STYLE_PR, &btn_transp_pr); @@ -3407,7 +3407,7 @@ void create_tab_info(lv_theme_t *th, lv_obj_t *parent) // Create Battery button. lv_obj_t *btn7 = lv_btn_create(h2, NULL); - if (hekate_bg) + if (hekate_bg || hekate_bg_etc) { lv_btn_set_style(btn7, LV_BTN_STYLE_REL, &btn_transp_rel); lv_btn_set_style(btn7, LV_BTN_STYLE_PR, &btn_transp_pr); diff --git a/nyx/nyx_gui/frontend/gui_options.c b/nyx/nyx_gui/frontend/gui_options.c index 05d294ee..fbfbd70e 100644 --- a/nyx/nyx_gui/frontend/gui_options.c +++ b/nyx/nyx_gui/frontend/gui_options.c @@ -1703,7 +1703,7 @@ void create_tab_options(lv_theme_t *th, lv_obj_t *parent) // Create Auto Boot button. lv_obj_t *btn = lv_btn_create(sw_h2, NULL); - if (hekate_bg) + 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); @@ -1754,7 +1754,7 @@ void create_tab_options(lv_theme_t *th, lv_obj_t *parent) lv_ddlist_set_action(ddlist, _autoboot_delay_action); lv_ddlist_set_selected(ddlist, h_cfg.bootwait); - if (hekate_bg) + if (hekate_bg || hekate_bg_etc) { lv_ddlist_set_style(ddlist, LV_DDLIST_STYLE_BG, &ddlist_transp_bg); lv_ddlist_set_style(ddlist, LV_DDLIST_STYLE_BGO, &ddlist_transp_bg); diff --git a/nyx/nyx_gui/frontend/gui_tools.c b/nyx/nyx_gui/frontend/gui_tools.c index 17dd6722..cbd0a2cf 100644 --- a/nyx/nyx_gui/frontend/gui_tools.c +++ b/nyx/nyx_gui/frontend/gui_tools.c @@ -1792,7 +1792,7 @@ static void _create_tab_tools_emmc_sd_usb(lv_theme_t *th, lv_obj_t *parent) // Create Backup eMMC button. lv_obj_t *btn = lv_btn_create(h1, NULL); - if (hekate_bg) + 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); @@ -1856,7 +1856,7 @@ static void _create_tab_tools_emmc_sd_usb(lv_theme_t *th, lv_obj_t *parent) lv_btnm_set_style(btnm, LV_BTNM_STYLE_BTN_TGL_REL, th->btn.tgl_rel); lv_btnm_set_style(btnm, LV_BTNM_STYLE_BTN_TGL_PR, th->btn.tgl_pr); lv_btnm_set_style(btnm, LV_BTNM_STYLE_BTN_INA, th->btn.ina); - if (hekate_bg) + if (hekate_bg || hekate_bg_etc) { lv_btnm_set_style(btnm, LV_BTNM_STYLE_BTN_REL, &btn_transp_rel); lv_btnm_set_style(btnm, LV_BTNM_STYLE_BTN_PR, &btn_transp_pr); @@ -1880,7 +1880,7 @@ static void _create_tab_tools_emmc_sd_usb(lv_theme_t *th, lv_obj_t *parent) // Create USB Tools button. lv_obj_t *btn4 = lv_btn_create(h2, NULL); label_btn = lv_label_create(btn4, NULL); - if (hekate_bg) + if (hekate_bg || hekate_bg_etc) { lv_btn_set_style(btn4, LV_BTN_STYLE_REL, &btn_transp_rel); lv_btn_set_style(btn4, LV_BTN_STYLE_PR, &btn_transp_pr); @@ -1923,7 +1923,7 @@ static void _create_tab_tools_arc_rcm_pkg12(lv_theme_t *th, lv_obj_t *parent) // Create fix archive bit button. lv_obj_t *btn = lv_btn_create(h1, NULL); - if (hekate_bg) + 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); @@ -1976,7 +1976,7 @@ static void _create_tab_tools_arc_rcm_pkg12(lv_theme_t *th, lv_obj_t *parent) // Create AutoRCM On/Off button. lv_obj_t *btn3 = lv_btn_create(h2, NULL); - if (hekate_bg) + 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); @@ -2055,7 +2055,7 @@ void create_tab_tools(lv_theme_t *th, lv_obj_t *parent) tabview_style.body.padding.ver = LV_DPI / 8; lv_tabview_set_style(tv, LV_TABVIEW_STYLE_BTN_REL, &tabview_style); - 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); diff --git a/nyx/nyx_gui/nyx.c b/nyx/nyx_gui/nyx.c index d8b04360..bca67b88 100644 --- a/nyx/nyx_gui/nyx.c +++ b/nyx/nyx_gui/nyx.c @@ -303,6 +303,8 @@ static void nyx_load_bg_icons() // Load background resource if any. hekate_bg = bmp_to_lvimg_obj("bootloader/res/background.bmp"); + // Load alternate background for non-Home tabs (About, Tools, Info, Options). + hekate_bg_etc = bmp_to_lvimg_obj("bootloader/res/background_etc.bmp"); } #define EXCP_EN_ADDR 0x4003FF1C