1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-26 11:42:09 +00:00

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

@ -35,6 +35,7 @@ void set_default_configuration()
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();
@ -47,7 +48,7 @@ void set_default_configuration()
void set_nyx_default_configuration()
{
n_cfg.theme_color = 167;
n_cfg.entries_5_columns = 0;
n_cfg.entries_5_col = 0;
n_cfg.timeoff = 0;
n_cfg.home_screen = 0;
n_cfg.verification = 1;
@ -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);
@ -264,7 +264,7 @@ skip_main_cfg_parse:
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;
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))
@ -278,7 +278,7 @@ skip_main_cfg_parse:
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);
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();
}