nyx: config: rename entries column var

This commit is contained in:
CTCaer 2022-10-11 06:24:52 +03:00
parent 7cac7fe095
commit f5fb0a1ee9
5 changed files with 58 additions and 54 deletions

View file

@ -27,14 +27,15 @@ extern nyx_config n_cfg;
void set_default_configuration()
{
h_cfg.autoboot = 0;
h_cfg.autoboot = 0;
h_cfg.autoboot_list = 0;
h_cfg.bootwait = 3;
h_cfg.backlight = 100;
h_cfg.autohosoff = 0;
h_cfg.autonogc = 1;
h_cfg.updater2p = 0;
h_cfg.bootprotect = 0;
h_cfg.bootwait = 3;
h_cfg.backlight = 100;
h_cfg.autohosoff = 0;
h_cfg.autonogc = 1;
h_cfg.updater2p = 0;
h_cfg.bootprotect = 0;
h_cfg.errors = 0;
h_cfg.eks = NULL;
h_cfg.rcm_patched = fuse_check_patched_rcm();
@ -46,15 +47,15 @@ void set_default_configuration()
void set_nyx_default_configuration()
{
n_cfg.theme_color = 167;
n_cfg.entries_5_columns = 0;
n_cfg.timeoff = 0;
n_cfg.home_screen = 0;
n_cfg.verification = 1;
n_cfg.ums_emmc_rw = 0;
n_cfg.jc_disable = 0;
n_cfg.theme_color = 167;
n_cfg.entries_5_col = 0;
n_cfg.timeoff = 0;
n_cfg.home_screen = 0;
n_cfg.verification = 1;
n_cfg.ums_emmc_rw = 0;
n_cfg.jc_disable = 0;
n_cfg.jc_force_right = 0;
n_cfg.bpmp_clock = 0;
n_cfg.bpmp_clock = 0;
}
int create_config_entry()
@ -200,7 +201,7 @@ int create_nyx_config_entry(bool force_unmount)
itoa(n_cfg.theme_color, lbuf, 10);
f_puts(lbuf, &fp);
f_puts("\nentries5col=", &fp);
itoa(n_cfg.entries_5_columns, lbuf, 10);
itoa(n_cfg.entries_5_col, lbuf, 10);
f_puts(lbuf, &fp);
f_puts("\ntimeoff=", &fp);
itoa(n_cfg.timeoff, lbuf, 16);

View file

@ -43,7 +43,7 @@ typedef struct _hekate_config
typedef struct _nyx_config
{
u32 theme_color;
u32 entries_5_columns;
u32 entries_5_col;
u32 timeoff;
u32 home_screen;
u32 verification;

View file

@ -1568,8 +1568,8 @@ static const launch_button_pos_t launch_button_pos10[10] = {
static lv_res_t _create_window_home_launch(lv_obj_t *btn)
{
const u32 max_entries = n_cfg.entries_5_columns ? 10 : 8;
const launch_button_pos_t *launch_button_pos = n_cfg.entries_5_columns ? launch_button_pos10 : launch_button_pos8;
const u32 max_entries = n_cfg.entries_5_col ? 10 : 8;
const launch_button_pos_t *launch_button_pos = n_cfg.entries_5_col ? launch_button_pos10 : launch_button_pos8;
char *icon_path;
@ -1660,7 +1660,7 @@ static lv_res_t _create_window_home_launch(lv_obj_t *btn)
lv_obj_set_style(boot_entry_lbl_cont, &btn_label_home_transp);
// Create the rest of the buttons.
for (u32 btn_idx = 1; btn_idx < (n_cfg.entries_5_columns ? 10 : 8); btn_idx++)
for (u32 btn_idx = 1; btn_idx < (n_cfg.entries_5_col ? 10 : 8); btn_idx++)
{
btn_boot_entry = lv_btn_create(win, btn_boot_entry);
launch_ctxt.btn[btn_idx] = btn_boot_entry;
@ -1672,7 +1672,7 @@ static lv_res_t _create_window_home_launch(lv_obj_t *btn)
launch_ctxt.label[btn_idx] = boot_entry_label;
}
// Create colorized icon style based on its parrent style.
// Create colorized icon style based on its parent style.
static lv_style_t img_style;
lv_style_copy(&img_style, &lv_style_plain);
img_style.image.color = lv_color_hsv_to_rgb(n_cfg.theme_color, 100, 100);
@ -1850,7 +1850,7 @@ ini_parsing:
ini_parse_failed:
// Reiterate the loop with more cfgs if combined.
if (combined_cfg && (curr_btn_idx < (n_cfg.entries_5_columns ? 10 : 8)) && !more_cfg)
if (combined_cfg && (curr_btn_idx < (n_cfg.entries_5_col ? 10 : 8)) && !more_cfg)
goto ini_parsing;
failed_sd_mount:

View file

@ -23,7 +23,7 @@
#include <libs/lvgl/lvgl.h>
#define CLOCK_MIN_YEAR 2022
#define CLOCK_MAX_YEAR 2032
#define CLOCK_MAX_YEAR (CLOCK_MIN_YEAR + 10)
extern hekate_config h_cfg;
extern nyx_config n_cfg;
@ -339,10 +339,10 @@ static lv_res_t _data_verification_action(lv_obj_t *ddlist)
static lv_res_t _entries_columns_action(lv_obj_t *btn)
{
n_cfg.entries_5_columns = !n_cfg.entries_5_columns;
n_cfg.entries_5_col = !n_cfg.entries_5_col;
nyx_changes_made = true;
if (!n_cfg.entries_5_columns)
if (!n_cfg.entries_5_col)
lv_btn_set_state(btn, LV_BTN_STATE_REL);
else
lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL);
@ -1083,7 +1083,7 @@ lv_res_t create_win_nyx_options(lv_obj_t *parrent_btn)
lv_obj_t *btn2 = lv_btn_create(sw_h2, NULL);
nyx_create_onoff_button(th, sw_h2, btn2, SYMBOL_GPS" Extended Boot Entries", _entries_columns_action, true);
lv_obj_align(btn2, line_sep, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 10);
if (n_cfg.entries_5_columns)
if (n_cfg.entries_5_col)
lv_btn_set_state(btn2, LV_BTN_STATE_TGL_REL);
nyx_generic_onoff_toggle(btn2);

View file

@ -205,7 +205,7 @@ out:
return LV_RES_OK;
}
void load_saved_configuration()
static void _load_saved_configuration()
{
LIST_INIT(ini_sections);
LIST_INIT(ini_nyx_sections);
@ -221,24 +221,24 @@ void load_saved_configuration()
{
LIST_FOREACH_ENTRY(ini_kv_t, kv, &ini_sec->kvs, link)
{
if (!strcmp("autoboot", kv->key))
h_cfg.autoboot = atoi(kv->val);
if (!strcmp("autoboot", kv->key))
h_cfg.autoboot = atoi(kv->val);
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);
else if (!strcmp("backlight", kv->key))
else if (!strcmp("bootwait", kv->key))
h_cfg.bootwait = atoi(kv->val);
else if (!strcmp("backlight", kv->key))
{
h_cfg.backlight = atoi(kv->val);
if (h_cfg.backlight <= 20)
h_cfg.backlight = 30;
}
else if (!strcmp("autohosoff", kv->key))
h_cfg.autohosoff = atoi(kv->val);
else if (!strcmp("autonogc", kv->key))
h_cfg.autonogc = atoi(kv->val);
else if (!strcmp("updater2p", kv->key))
h_cfg.updater2p = atoi(kv->val);
else if (!strcmp("autohosoff", kv->key))
h_cfg.autohosoff = atoi(kv->val);
else if (!strcmp("autonogc", kv->key))
h_cfg.autonogc = atoi(kv->val);
else if (!strcmp("updater2p", kv->key))
h_cfg.updater2p = atoi(kv->val);
else if (!strcmp("bootprotect", kv->key))
h_cfg.bootprotect = atoi(kv->val);
}
@ -261,24 +261,24 @@ skip_main_cfg_parse:
{
LIST_FOREACH_ENTRY(ini_kv_t, kv, &ini_sec->kvs, link)
{
if (!strcmp("themecolor", kv->key))
n_cfg.theme_color = atoi(kv->val);
else if (!strcmp("entries5col", kv->key))
n_cfg.entries_5_columns = atoi(kv->val) == 1;
else if (!strcmp("timeoff", kv->key))
n_cfg.timeoff = strtol(kv->val, NULL, 16);
else if (!strcmp("homescreen", kv->key))
n_cfg.home_screen = atoi(kv->val);
if (!strcmp("themecolor", kv->key))
n_cfg.theme_color = atoi(kv->val);
else if (!strcmp("entries5col", kv->key))
n_cfg.entries_5_col = atoi(kv->val) == 1;
else if (!strcmp("timeoff", kv->key))
n_cfg.timeoff = strtol(kv->val, NULL, 16);
else if (!strcmp("homescreen", kv->key))
n_cfg.home_screen = atoi(kv->val);
else if (!strcmp("verification", kv->key))
n_cfg.verification = atoi(kv->val);
else if (!strcmp("umsemmcrw", kv->key))
n_cfg.ums_emmc_rw = atoi(kv->val) == 1;
else if (!strcmp("jcdisable", kv->key))
n_cfg.jc_disable = atoi(kv->val) == 1;
n_cfg.verification = atoi(kv->val);
else if (!strcmp("umsemmcrw", kv->key))
n_cfg.ums_emmc_rw = atoi(kv->val) == 1;
else if (!strcmp("jcdisable", kv->key))
n_cfg.jc_disable = atoi(kv->val) == 1;
else if (!strcmp("jcforceright", kv->key))
n_cfg.jc_force_right = atoi(kv->val) == 1;
else if (!strcmp("bpmpclock", kv->key))
n_cfg.bpmp_clock = strtol(kv->val, NULL, 10);
else if (!strcmp("bpmpclock", kv->key))
n_cfg.bpmp_clock = atoi(kv->val);
}
break;
@ -381,7 +381,8 @@ void nyx_init_load_res()
// Train DRAM and switch to max frequency.
minerva_init();
load_saved_configuration();
// Load hekate/Nyx configuration.
_load_saved_configuration();
// Initialize nyx cfg to lower clock for T210.
// In case of lower binned SoC, this can help with hangs.
@ -396,6 +397,7 @@ void nyx_init_load_res()
if (n_cfg.bpmp_clock < 2)
bpmp_clk_rate_set(BPMP_CLK_DEFAULT_BOOST);
// Load Nyx resources.
FIL fp;
if (!f_open(&fp, "bootloader/sys/res.pak", FA_READ))
{
@ -418,6 +420,7 @@ void nyx_init_load_res()
// Load background resource if any.
hekate_bg = bmp_to_lvimg_obj("bootloader/res/background.bmp");
// Unmount FAT partition.
sd_unmount();
}