Added OmniNX Version indicator in nyx using manifest

This commit is contained in:
Niklas080208
2026-02-03 19:08:54 +01:00
parent a20a27c71e
commit 350aa37c1b
2 changed files with 64 additions and 3 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -2010,18 +2010,79 @@ failed_sd_mount:
return LV_RES_OK;
}
// Fills buf with theme-colored brand text: "hekate | OmniNX X.X.X Pack" from manifest.ini, or "hekate" 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",
};
// SD is unmounted when the main menu is built; mount so we can read the manifest.
sd_mount();
link_t ini_sections;
list_init(&ini_sections);
int parsed = 0;
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#");
return;
}
const char *version = NULL;
const char *pack = NULL;
LIST_FOREACH_ENTRY(ini_sec_t, ini_sec, &ini_sections, link)
{
if (ini_sec->type != INI_CHOICE)
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, "version"))
version = kv->val;
else if (!strcmp(kv->key, "current_pack"))
pack = kv->val;
else if (!pack && !strcmp(kv->key, "channel_pack"))
pack = kv->val;
}
break;
}
ini_free(&ini_sections);
if (!version || !pack)
{
s_printf(buf, "%s%s", text_color, " hekate#");
return;
}
// Capitalize first letter of pack for display (e.g. light -> Light).
char pack_display[24];
size_t i = 0;
while (pack[i] && i < sizeof(pack_display) - 1)
{
pack_display[i] = (i == 0 && pack[0] >= 'a' && pack[0] <= 'z')
? (char)(pack[0] - 'a' + 'A') : pack[i];
i++;
}
pack_display[i] = '\0';
s_printf(buf, "%s hekate | OmniNX %s %s#", text_color, pack_display, version);
}
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").
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#");
_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);