diff --git a/nyx/nyx_gui/frontend/fe_emmc_tools.c b/nyx/nyx_gui/frontend/fe_emmc_tools.c index 98ed370a..521e8087 100644 --- a/nyx/nyx_gui/frontend/fe_emmc_tools.c +++ b/nyx/nyx_gui/frontend/fe_emmc_tools.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2018 naehrwert * Copyright (c) 2018 Rajko Stojadinovic - * Copyright (c) 2018-2025 CTCaer + * Copyright (c) 2018-2026 CTCaer * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -122,7 +122,7 @@ static lv_obj_t *create_mbox_text(const char *text, bool button_ok) lv_mbox_set_text(mbox, text); if (button_ok) - lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); + lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_set_top(mbox, true); diff --git a/nyx/nyx_gui/frontend/fe_emummc_tools.c b/nyx/nyx_gui/frontend/fe_emummc_tools.c index d44e724c..9b73c275 100644 --- a/nyx/nyx_gui/frontend/fe_emummc_tools.c +++ b/nyx/nyx_gui/frontend/fe_emummc_tools.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2018 naehrwert * Copyright (c) 2018 Rajko Stojadinovic - * Copyright (c) 2018-2025 CTCaer + * Copyright (c) 2018-2026 CTCaer * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -809,7 +809,7 @@ int emummc_raw_derive_bis_keys() lv_obj_set_width(lb_desc, LV_HOR_RES / 9 * 4); lv_label_set_text(lb_desc, "#FFDD00 BIS keys validation failed!#\n"); - lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); + lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_set_top(mbox, true); diff --git a/nyx/nyx_gui/frontend/gui.c b/nyx/nyx_gui/frontend/gui.c index 3b8c158a..c10a833d 100644 --- a/nyx/nyx_gui/frontend/gui.c +++ b/nyx/nyx_gui/frontend/gui.c @@ -781,7 +781,7 @@ lv_res_t nyx_generic_onoff_toggle(lv_obj_t *btn) return LV_RES_OK; } -lv_res_t mbox_action(lv_obj_t *btns, const char *txt) +lv_res_t nyx_mbox_action(lv_obj_t *btns, const char *txt) { lv_obj_t *mbox = lv_mbox_get_from_btn(btns); lv_obj_t *dark_bg = lv_obj_get_parent(mbox); @@ -816,7 +816,7 @@ bool nyx_emmc_check_battery_enough() "#FFDD00 with selected operation!#\n\n" "Charge to at least #C7EA46 3650 mV#, and try again!"); - lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); + lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); lv_obj_set_width(mbox, LV_HOR_RES / 9 * 5); lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_set_top(mbox, true); @@ -843,7 +843,7 @@ static void _nyx_sd_card_issues_warning(void *param) "#FFDD00 This might mean detached or broken connector!#\n\n" "You might want to check\n#C7EA46 Console Info# -> #C7EA46 microSD#"); - lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); + lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); lv_obj_set_width(mbox, LV_HOR_RES / 9 * 5); lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_set_top(mbox, true); @@ -878,14 +878,14 @@ void nyx_window_toggle_buttons(lv_obj_t *win, bool disable) } } -lv_res_t nyx_win_close_action_custom(lv_obj_t * btn) +lv_res_t nyx_win_close_action(lv_obj_t * btn) { close_btn = NULL; return lv_win_close_action(btn); } -lv_obj_t *nyx_create_standard_window(const char *win_title) +lv_obj_t *nyx_create_standard_window(const char *win_title, lv_action_t close_action) { static lv_style_t win_bg_style; @@ -898,25 +898,10 @@ lv_obj_t *nyx_create_standard_window(const char *win_title) lv_win_set_style(win, LV_WIN_STYLE_BG, &win_bg_style); lv_obj_set_size(win, LV_HOR_RES, LV_VER_RES); - close_btn = lv_win_add_btn(win, NULL, SYMBOL_CLOSE" Close", nyx_win_close_action_custom); - - return win; -} - -lv_obj_t *nyx_create_window_custom_close_btn(const char *win_title, lv_action_t rel_action) -{ - static lv_style_t win_bg_style; - - lv_style_copy(&win_bg_style, &lv_style_plain); - 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; - - lv_obj_t *win = lv_win_create(lv_scr_act(), NULL); - lv_win_set_title(win, win_title); - lv_win_set_style(win, LV_WIN_STYLE_BG, &win_bg_style); - lv_obj_set_size(win, LV_HOR_RES, LV_VER_RES); - - close_btn = lv_win_add_btn(win, NULL, SYMBOL_CLOSE" Close", rel_action); + if (!close_action) + close_btn = lv_win_add_btn(win, NULL, SYMBOL_CLOSE" Close", nyx_win_close_action); + else + close_btn = lv_win_add_btn(win, NULL, SYMBOL_CLOSE" Close", close_action); return win; } @@ -980,7 +965,7 @@ static lv_res_t reload_action(lv_obj_t *btns, const char *txt) if (!lv_btnm_get_pressed(btns)) reload_nyx(NULL, false); - return mbox_action(btns, txt); + return nyx_mbox_action(btns, txt); } static lv_res_t _removed_sd_action(lv_obj_t *btns, const char *txt) @@ -1004,7 +989,7 @@ static lv_res_t _removed_sd_action(lv_obj_t *btns, const char *txt) break; } - return mbox_action(btns, txt); + return nyx_mbox_action(btns, txt); } static void _check_sd_card_removed(void *params) @@ -1062,7 +1047,7 @@ static void _nyx_emmc_issues_warning(void *params) "#FFDD00 This might mean hardware issues!#\n\n" "You might want to check\n#C7EA46 Console Info# -> #C7EA46 eMMC#"); - lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); + lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); lv_obj_set_width(mbox, LV_HOR_RES / 9 * 5); lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_set_top(mbox, true); @@ -1074,7 +1059,7 @@ static lv_res_t _reboot_ofw_action(lv_obj_t *btns, const char *txt) if (!lv_btnm_get_pressed(btns)) power_set_state(REBOOT_BYPASS_FUSES); - return mbox_action(btns, txt); + return nyx_mbox_action(btns, txt); } static lv_res_t _create_mbox_reboot_ofw() @@ -1132,7 +1117,7 @@ static lv_res_t _reboot_action(lv_obj_t *btns, const char *txt) break; } - return mbox_action(btns, txt); + return nyx_mbox_action(btns, txt); } static lv_res_t _poweroff_action(lv_obj_t *btns, const char *txt) @@ -1140,7 +1125,7 @@ static lv_res_t _poweroff_action(lv_obj_t *btns, const char *txt) if (!lv_btnm_get_pressed(btns)) power_set_state(POWER_OFF_RESET); - return mbox_action(btns, txt); + return nyx_mbox_action(btns, txt); } static lv_res_t _create_mbox_reload(lv_obj_t *btn) @@ -1495,7 +1480,7 @@ static lv_res_t _create_mbox_payloads(lv_obj_t *btn) } out_end: - lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); + lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_set_top(mbox, true); @@ -2226,7 +2211,7 @@ static lv_res_t _create_mbox_save_changes_action(lv_obj_t *btns, const char * tx { int btn_idx = lv_btnm_get_pressed(btns); - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); if (!btn_idx) _save_options_action(NULL); diff --git a/nyx/nyx_gui/frontend/gui.h b/nyx/nyx_gui/frontend/gui.h index beb5a222..d656cce0 100644 --- a/nyx/nyx_gui/frontend/gui.h +++ b/nyx/nyx_gui/frontend/gui.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2025 CTCaer + * Copyright (c) 2018-2026 CTCaer * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -74,12 +74,11 @@ extern gui_status_bar_ctx status_bar; void reload_nyx(); lv_img_dsc_t *bmp_to_lvimg_obj(const char *path); -lv_res_t mbox_action(lv_obj_t * btns, const char * txt); bool nyx_emmc_check_battery_enough(); -lv_res_t nyx_win_close_action_custom(lv_obj_t * btn); +lv_res_t nyx_mbox_action(lv_obj_t * btns, const char * txt); +lv_res_t nyx_win_close_action(lv_obj_t * btn); void nyx_window_toggle_buttons(lv_obj_t *win, bool disable); -lv_obj_t *nyx_create_standard_window(const char *win_title); -lv_obj_t *nyx_create_window_custom_close_btn(const char *win_title, lv_action_t rel_action); +lv_obj_t *nyx_create_standard_window(const char *win_title, lv_action_t close_action); void nyx_create_onoff_button(lv_theme_t *th, lv_obj_t *parent, lv_obj_t *btn, const char *btn_name, lv_action_t action, bool transparent); lv_res_t nyx_generic_onoff_toggle(lv_obj_t *btn); void manual_system_maintenance(bool refresh); diff --git a/nyx/nyx_gui/frontend/gui_emmc_tools.c b/nyx/nyx_gui/frontend/gui_emmc_tools.c index 775002fc..65a7f8e9 100644 --- a/nyx/nyx_gui/frontend/gui_emmc_tools.c +++ b/nyx/nyx_gui/frontend/gui_emmc_tools.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2025 CTCaer + * Copyright (c) 2018-2026 CTCaer * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -54,7 +54,7 @@ static void _create_window_backup_restore(emmcPartType_t type, const char* win_l s_printf(win_label_full, "%s%s", emmc_btn_ctxt.restore ? SYMBOL_DOWNLOAD" Restore " : SYMBOL_UPLOAD" Backup ", win_label+3); - lv_obj_t *win = nyx_create_standard_window(win_label_full); + lv_obj_t *win = nyx_create_standard_window(win_label_full, NULL); //Disable buttons. nyx_window_toggle_buttons(win, true); @@ -285,9 +285,9 @@ lv_res_t create_window_backup_restore_tool(lv_obj_t *btn) emmc_btn_ctxt.restore = true; if (!emmc_btn_ctxt.restore) - win = nyx_create_standard_window(SYMBOL_SD" Backup"); + win = nyx_create_standard_window(SYMBOL_SD" Backup", NULL); else - win = nyx_create_standard_window(SYMBOL_SD" Restore"); + win = nyx_create_standard_window(SYMBOL_SD" Restore", NULL); static lv_style_t h_style; lv_style_copy(&h_style, &lv_style_transp); diff --git a/nyx/nyx_gui/frontend/gui_emummc_tools.c b/nyx/nyx_gui/frontend/gui_emummc_tools.c index efa17c53..6e16c485 100644 --- a/nyx/nyx_gui/frontend/gui_emummc_tools.c +++ b/nyx/nyx_gui/frontend/gui_emummc_tools.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2025 CTCaer + * Copyright (c) 2019-2026 CTCaer * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -42,7 +42,7 @@ static lv_res_t (*emummc_tools)(lv_obj_t *btn); static lv_res_t _action_emummc_window_close(lv_obj_t *btn) { - nyx_win_close_action_custom(btn); + nyx_win_close_action(btn); // Delete and relaunch main emuMMC window. lv_obj_del(emummc_manage_window); @@ -57,9 +57,9 @@ static void _create_window_emummc() lv_obj_t *win; if (!mbr_ctx.part_idx) - win = nyx_create_window_custom_close_btn(SYMBOL_DRIVE" Create SD File emuMMC", _action_emummc_window_close); + win = nyx_create_standard_window(SYMBOL_DRIVE" Create SD File emuMMC", _action_emummc_window_close); else - win = nyx_create_window_custom_close_btn(SYMBOL_DRIVE" Create SD Partition emuMMC", _action_emummc_window_close); + win = nyx_create_standard_window(SYMBOL_DRIVE" Create SD Partition emuMMC", _action_emummc_window_close); //Disable buttons. nyx_window_toggle_buttons(win, true); @@ -144,7 +144,7 @@ static lv_res_t _create_emummc_raw_format(lv_obj_t * btns, const char * txt) int btn_idx = lv_btnm_get_pressed(btns); // Delete parent mbox. - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); // Create partition window. if (!btn_idx) @@ -190,7 +190,7 @@ static lv_res_t _create_emummc_raw_action(lv_obj_t * btns, const char * txt) mbr_ctx.part_idx = 0; mbr_ctx.sector_start = 0; - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); return LV_RES_INV; } @@ -328,7 +328,7 @@ static lv_res_t _create_emummc_action(lv_obj_t * btns, const char * txt) break; } - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); return LV_RES_INV; } @@ -374,7 +374,7 @@ static lv_res_t _save_emummc_cfg_mig_mbox_action(lv_obj_t *btns, const char *txt { // Delete main emuMMC and popup windows and relaunch main emuMMC window. lv_obj_del(emummc_manage_window); - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); (*emummc_tools)(NULL); @@ -581,7 +581,7 @@ static lv_res_t _create_emummc_mig1_action(lv_obj_t * btns, const char * txt) mbr_ctx.part_idx = 0; mbr_ctx.sector_start = 0; - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); return LV_RES_INV; } @@ -598,7 +598,7 @@ static lv_res_t _create_emummc_mig0_action(lv_obj_t * btns, const char * txt) mbr_ctx.part_idx = 0; mbr_ctx.sector_start = 0; - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); return LV_RES_INV; } @@ -615,7 +615,7 @@ static lv_res_t _create_emummc_mig2_action(lv_obj_t * btns, const char * txt) mbr_ctx.part_idx = 0; mbr_ctx.sector_start = 0; - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); return LV_RES_INV; } @@ -632,7 +632,7 @@ static lv_res_t _create_emummc_mig3_action(lv_obj_t * btns, const char * txt) mbr_ctx.part_idx = 0; mbr_ctx.sector_start = 0; - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); return LV_RES_INV; } @@ -649,7 +649,7 @@ static lv_res_t _create_emummc_mig4_action(lv_obj_t * btns, const char * txt) mbr_ctx.part_idx = 0; mbr_ctx.sector_start = 0; - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); return LV_RES_INV; } @@ -672,7 +672,7 @@ static lv_res_t _create_emummc_migrate_action(lv_obj_t * btns, const char * txt) case 2: break; case 3: - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); return LV_RES_INV; } @@ -732,7 +732,7 @@ static lv_res_t _create_emummc_migrate_action(lv_obj_t * btns, const char * txt) else { s_printf(txt_buf, "No emuMMC or foreign emunand found!\n"); - lv_mbox_add_btns(mbox, mbox_btn_map3, mbox_action); + lv_mbox_add_btns(mbox, mbox_btn_map3, nyx_mbox_action); } lv_mbox_set_text(mbox, txt_buf); @@ -741,7 +741,7 @@ static lv_res_t _create_emummc_migrate_action(lv_obj_t * btns, const char * txt) lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_set_top(mbox, true); - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); return LV_RES_INV; } @@ -905,7 +905,7 @@ static lv_res_t _save_emummc_cfg_mbox_action(lv_obj_t *btns, const char *txt) free(emummc_img->dirlist); free(emummc_img); - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); (*emummc_tools)(NULL); @@ -978,12 +978,12 @@ static lv_res_t _action_win_change_emummc_close(lv_obj_t *btn) free(emummc_img->dirlist); free(emummc_img); - return nyx_win_close_action_custom(btn); + return nyx_win_close_action(btn); } static lv_res_t _create_change_emummc_window(lv_obj_t *btn_caller) { - lv_obj_t *win = nyx_create_window_custom_close_btn(SYMBOL_SETTINGS" Change emuMMC", _action_win_change_emummc_close); + lv_obj_t *win = nyx_create_standard_window(SYMBOL_SETTINGS" Change emuMMC", _action_win_change_emummc_close); lv_win_add_btn(win, NULL, SYMBOL_POWER" Disable", _save_disable_emummc_cfg_action); sd_mount(); @@ -1204,7 +1204,7 @@ out1: lv_res_t create_win_emummc_tools(lv_obj_t *btn) { - lv_obj_t *win = nyx_create_standard_window(SYMBOL_EDIT" emuMMC Manage"); + lv_obj_t *win = nyx_create_standard_window(SYMBOL_EDIT" emuMMC Manage", NULL); // Set resources to be managed by other windows. emummc_manage_window = win; diff --git a/nyx/nyx_gui/frontend/gui_info.c b/nyx/nyx_gui/frontend/gui_info.c index 7b77e073..14766960 100644 --- a/nyx/nyx_gui/frontend/gui_info.c +++ b/nyx/nyx_gui/frontend/gui_info.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2018 naehrwert - * Copyright (c) 2018-2025 CTCaer + * Copyright (c) 2018-2026 CTCaer * Copyright (c) 2018 balika011 * * This program is free software; you can redistribute it and/or modify it @@ -59,7 +59,7 @@ static lv_res_t _create_window_dump_done(int error, char *dump_filenames) lv_mbox_set_text(mbox, txt_buf); free(txt_buf); - lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); // Important. After set_text. + lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); // Important. After set_text. lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_set_top(mbox, true); @@ -71,7 +71,7 @@ static lv_res_t _cal0_dump_window_action(lv_obj_t *btns, const char * txt) { int btn_idx = lv_btnm_get_pressed(btns); - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); if (btn_idx == 1) { @@ -542,14 +542,14 @@ static lv_res_t _action_win_hw_info_status_close(lv_obj_t *btn) hw_info = NULL; } - return nyx_win_close_action_custom(btn); + return nyx_win_close_action(btn); } static lv_res_t _create_window_hw_info_status(lv_obj_t *btn) { u32 uptime_s = get_tmr_s(); - lv_obj_t *win = nyx_create_window_custom_close_btn(SYMBOL_CHIP" HW & Fuses Info", _action_win_hw_info_status_close); + lv_obj_t *win = nyx_create_standard_window(SYMBOL_CHIP" HW & Fuses Info", _action_win_hw_info_status_close); lv_win_add_btn(win, NULL, SYMBOL_DOWNLOAD" Dump fuses", _fuse_dump_window_action); lv_win_add_btn(win, NULL, SYMBOL_INFO" CAL0 Info", _create_mbox_cal0); @@ -1328,7 +1328,7 @@ static void _ipatch_process(u32 offset, u32 value) static lv_res_t _create_window_bootrom_info_status(lv_obj_t *btn) { - lv_obj_t *win = nyx_create_standard_window(SYMBOL_CHIP" Bootrom Info"); + lv_obj_t *win = nyx_create_standard_window(SYMBOL_CHIP" Bootrom Info", NULL); lv_win_add_btn(win, NULL, SYMBOL_DOWNLOAD" Dump Bootrom", _bootrom_dump_window_action); lv_obj_t *desc = lv_cont_create(win, NULL); @@ -1360,7 +1360,7 @@ static lv_res_t _launch_lockpick_action(lv_obj_t *btns, const char * txt) { int btn_idx = lv_btnm_get_pressed(btns); - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); if (btn_idx == 1) { @@ -1582,7 +1582,7 @@ out: free (txt_buf); free (txt_buf2); - lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); // Important. After set_text. + lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); // Important. After set_text. lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_set_top(mbox, true); @@ -1929,7 +1929,7 @@ out: free(txt_buf); - lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); // Important. After set_text. + lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); // Important. After set_text. lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); return LV_RES_OK; @@ -1951,7 +1951,7 @@ static lv_res_t _create_mbox_sd_bench(lv_obj_t * btn) static lv_res_t _create_window_emmc_info_status(lv_obj_t *btn) { - lv_obj_t *win = nyx_create_standard_window(SYMBOL_CHIP" Internal eMMC Info"); + lv_obj_t *win = nyx_create_standard_window(SYMBOL_CHIP" Internal eMMC Info", NULL); lv_win_add_btn(win, NULL, SYMBOL_CHIP" Benchmark", _create_mbox_emmc_bench); lv_obj_t *desc = lv_cont_create(win, NULL); @@ -2203,7 +2203,7 @@ out_error: emmc_errors[EMMC_ERROR_RW_RETRY]); lv_mbox_set_text(mbox, txt_buf); - lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); + lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); lv_obj_set_width(mbox, LV_HOR_RES / 9 * 5); lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_set_top(mbox, true); @@ -2217,7 +2217,7 @@ out_error: static lv_res_t _create_window_sdcard_info_status(lv_obj_t *btn) { - lv_obj_t *win = nyx_create_standard_window(SYMBOL_SD" microSD Card Info"); + lv_obj_t *win = nyx_create_standard_window(SYMBOL_SD" microSD Card Info", NULL); lv_win_add_btn(win, NULL, SYMBOL_SD" Benchmark", _create_mbox_sd_bench); lv_obj_t *desc = lv_cont_create(win, NULL); @@ -2622,7 +2622,7 @@ failed: static lv_res_t _create_window_battery_status(lv_obj_t *btn) { - lv_obj_t *win = nyx_create_standard_window(SYMBOL_BATTERY_FULL" Battery Info"); + lv_obj_t *win = nyx_create_standard_window(SYMBOL_BATTERY_FULL" Battery Info", NULL); lv_win_add_btn(win, NULL, SYMBOL_DOWNLOAD" Dump Fuel Regs", _battery_dump_window_action); lv_obj_t *desc = lv_cont_create(win, NULL); diff --git a/nyx/nyx_gui/frontend/gui_options.c b/nyx/nyx_gui/frontend/gui_options.c index 5629da94..6e71c3cd 100644 --- a/nyx/nyx_gui/frontend/gui_options.c +++ b/nyx/nyx_gui/frontend/gui_options.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2025 CTCaer + * Copyright (c) 2018-2026 CTCaer * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -548,7 +548,7 @@ static const u16 theme_colors[17] = { static lv_res_t _create_window_nyx_colors(lv_obj_t *btn) { - lv_obj_t *win = nyx_create_standard_window(SYMBOL_COPY" Nyx Color Theme"); + lv_obj_t *win = nyx_create_standard_window(SYMBOL_COPY" Nyx Color Theme", NULL); lv_win_add_btn(win, NULL, SYMBOL_HINT" Toggle Background", _preset_bg_action); lv_win_add_btn(win, NULL, SYMBOL_SAVE" Save & Reload", _save_theme_color_action); color_test.window = win; @@ -722,7 +722,7 @@ static lv_res_t _action_clock_edit(lv_obj_t *btns, const char * txt) nyx_changes_made = true; } - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); return LV_RES_INV; } @@ -1157,7 +1157,7 @@ disabled_or_cal0_issue:; lv_mbox_set_text(mbox, txt_buf); - lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); // Important. After set_text. + lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); // Important. After set_text. lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_set_top(mbox, true); @@ -1184,7 +1184,7 @@ static lv_res_t _action_nyx_options_save(lv_obj_t *btns, const char * txt) { int btn_idx = lv_btnm_get_pressed(btns); - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); if (!btn_idx) _save_nyx_options_action(NULL); @@ -1224,7 +1224,7 @@ static lv_res_t _action_win_nyx_options_close(lv_obj_t *btn) lv_obj_set_opa_scale(status_bar.mid, LV_OPA_0); lv_obj_set_click(status_bar.mid, false); - lv_res_t res = nyx_win_close_action_custom(btn); + lv_res_t res = nyx_win_close_action(btn); _check_nyx_changes(); @@ -1235,7 +1235,7 @@ lv_res_t create_win_nyx_options(lv_obj_t *parrent_btn) { lv_theme_t *th = lv_theme_get_current(); - lv_obj_t *win = nyx_create_window_custom_close_btn(SYMBOL_HOME" Nyx Settings", _action_win_nyx_options_close); + lv_obj_t *win = nyx_create_standard_window(SYMBOL_HOME" Nyx Settings", _action_win_nyx_options_close); static lv_style_t h_style; lv_style_copy(&h_style, &lv_style_transp); diff --git a/nyx/nyx_gui/frontend/gui_tools.c b/nyx/nyx_gui/frontend/gui_tools.c index 4e011605..718512cd 100644 --- a/nyx/nyx_gui/frontend/gui_tools.c +++ b/nyx/nyx_gui/frontend/gui_tools.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2018 naehrwert - * Copyright (c) 2018-2025 CTCaer + * Copyright (c) 2018-2026 CTCaer * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -158,7 +158,7 @@ static lv_res_t _create_mbox_autorcm_status(lv_obj_t *btn) "The boot process is now normal and you need the #FF8000 VOL+# + #FF8000 HOME# (jig) combo to enter RCM.\n"); } - lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); + lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); lv_obj_set_width(mbox, LV_HOR_RES / 9 * 5); lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_set_top(mbox, true); @@ -178,8 +178,8 @@ static lv_res_t _create_mbox_hid(usb_ctxt_t *usbs) lv_obj_set_style(dark_bg, &mbox_darken); lv_obj_set_size(dark_bg, LV_HOR_RES, LV_VER_RES); - static const char *mbox_btn_map[] = { "\251", "\262Close", "\251", "" }; - static const char *mbox_btn_map2[] = { "\251", "\222Close", "\251", "" }; + static const char *mbox_btn_map_dis[] = { "\251", "\262Close", "\251", "" }; + static const char *mbox_btn_map[] = { "\251", "\222Close", "\251", "" }; lv_obj_t *mbox = lv_mbox_create(dark_bg, NULL); lv_mbox_set_recolor_text(mbox, true); @@ -205,14 +205,14 @@ static lv_res_t _create_mbox_hid(usb_ctxt_t *usbs) lv_label_set_static_text(lbl_tip, "Note: To end it, press #C7EA46 L3# + #C7EA46 HOME# or remove the cable."); lv_obj_set_style(lbl_tip, &hint_small_style); - lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); + lv_mbox_add_btns(mbox, mbox_btn_map_dis, nyx_mbox_action); lv_obj_set_width(mbox, LV_HOR_RES / 9 * 5); lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_set_top(mbox, true); usb_device_gadget_hid(usbs); - lv_mbox_add_btns(mbox, mbox_btn_map2, mbox_action); + lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); return LV_RES_OK; } @@ -223,8 +223,8 @@ static lv_res_t _create_mbox_ums(usb_ctxt_t *usbs) lv_obj_set_style(dark_bg, &mbox_darken); lv_obj_set_size(dark_bg, LV_HOR_RES, LV_VER_RES); - static const char *mbox_btn_map[] = { "\251", "\262Close", "\251", "" }; - static const char *mbox_btn_map2[] = { "\251", "\222Close", "\251", "" }; + static const char *mbox_btn_map_dis[] = { "\251", "\262Close", "\251", "" }; + static const char *mbox_btn_map[] = { "\251", "\222Close", "\251", "" }; lv_obj_t *mbox = lv_mbox_create(dark_bg, NULL); lv_mbox_set_recolor_text(mbox, true); @@ -299,7 +299,7 @@ static lv_res_t _create_mbox_ums(usb_ctxt_t *usbs) } lv_obj_set_style(lbl_tip, &hint_small_style); - lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); + lv_mbox_add_btns(mbox, mbox_btn_map_dis, nyx_mbox_action); lv_obj_set_width(mbox, LV_HOR_RES / 9 * 5); lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_set_top(mbox, true); @@ -312,7 +312,7 @@ static lv_res_t _create_mbox_ums(usb_ctxt_t *usbs) // Restore backlight. display_backlight_brightness(h_cfg.backlight - 20, 1000); - lv_mbox_add_btns(mbox, mbox_btn_map2, mbox_action); + lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); ums_mbox = dark_bg; @@ -342,7 +342,7 @@ static lv_res_t _create_mbox_ums_error(int error) break; } - lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); + lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); lv_obj_set_width(mbox, LV_HOR_RES / 9 * 5); lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_set_top(mbox, true); @@ -675,7 +675,7 @@ static lv_res_t _emmc_read_only_toggle(lv_obj_t *btn) static lv_res_t _create_window_usb_tools(lv_obj_t *parent) { - lv_obj_t *win = nyx_create_standard_window(SYMBOL_USB" USB Tools"); + lv_obj_t *win = nyx_create_standard_window(SYMBOL_USB" USB Tools", NULL); static lv_style_t h_style; lv_style_copy(&h_style, &lv_style_transp); @@ -928,7 +928,7 @@ out: static lv_res_t _create_window_unset_abit_tool(lv_obj_t *btn) { - lv_obj_t *win = nyx_create_standard_window(SYMBOL_COPY" Fix Archive Bit (All folders)"); + lv_obj_t *win = nyx_create_standard_window(SYMBOL_COPY" Fix Archive Bit (All folders)", NULL); // Disable buttons. nyx_window_toggle_buttons(win, true); @@ -1111,7 +1111,7 @@ out: lv_mbox_set_text(mbox, "#FFFF00 The touchscreen calibration failed!"); out2: - lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); + lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); free(txt_buf); @@ -1120,7 +1120,7 @@ out2: static lv_res_t _create_window_dump_pk12_tool(lv_obj_t *btn) { - lv_obj_t *win = nyx_create_standard_window(SYMBOL_MODULES" Dump package1/2"); + lv_obj_t *win = nyx_create_standard_window(SYMBOL_MODULES" Dump package1/2", NULL); // Disable buttons. nyx_window_toggle_buttons(win, true); diff --git a/nyx/nyx_gui/frontend/gui_tools_partition_manager.c b/nyx/nyx_gui/frontend/gui_tools_partition_manager.c index 7c475654..1fc9d013 100644 --- a/nyx/nyx_gui/frontend/gui_tools_partition_manager.c +++ b/nyx/nyx_gui/frontend/gui_tools_partition_manager.c @@ -711,7 +711,7 @@ static lv_res_t _action_delete_linux_installer_files(lv_obj_t * btns, const char int btn_idx = lv_btnm_get_pressed(btns); // Delete parent mbox. - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); // Flash Linux. if (!btn_idx) @@ -755,7 +755,7 @@ static lv_res_t _action_flash_linux_data(lv_obj_t * btns, const char * txt) int btn_idx = lv_btnm_get_pressed(btns); // Delete parent mbox. - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); bool succeeded = false; @@ -939,7 +939,7 @@ exit: free(txt_buf); if (!succeeded) - lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); + lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); else lv_mbox_add_btns(mbox, mbox_btn_map2, _action_delete_linux_installer_files); lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); @@ -1141,7 +1141,7 @@ static lv_res_t _action_check_flash_linux(lv_obj_t *btn) goto exit; error: - lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); + lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); exit: lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); @@ -1158,7 +1158,7 @@ static lv_res_t _action_reboot_recovery(lv_obj_t * btns, const char * txt) int btn_idx = lv_btnm_get_pressed(btns); // Delete parent mbox. - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); if (!btn_idx) { @@ -1190,7 +1190,7 @@ static lv_res_t _action_flash_android_data(lv_obj_t * btns, const char * txt) bool boot_recovery = false; // Delete parent mbox. - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); if (btn_idx) return LV_RES_INV; @@ -1436,7 +1436,7 @@ error: lv_mbox_add_btns(mbox, mbox_btn_map2, _action_reboot_recovery); } else - lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); + lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); @@ -1494,7 +1494,7 @@ static lv_res_t _action_part_manager_flash_options0(lv_obj_t *btns, const char * _action_flash_android(NULL); break; case 3: - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); return LV_RES_INV; } @@ -1512,11 +1512,11 @@ static lv_res_t _action_part_manager_flash_options1(lv_obj_t *btns, const char * lv_obj_del(ums_mbox); break; case 1: - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); _action_check_flash_linux(NULL); return LV_RES_INV; case 2: - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); return LV_RES_INV; } @@ -1534,11 +1534,11 @@ static lv_res_t _action_part_manager_flash_options2(lv_obj_t *btns, const char * lv_obj_del(ums_mbox); break; case 1: - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); _action_flash_android(NULL); return LV_RES_INV; case 2: - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); return LV_RES_INV; } @@ -1844,7 +1844,7 @@ out: lv_obj_del(lbl_paths[1]); exit: if (!buttons_set) - lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); + lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_set_top(mbox, true); @@ -2044,7 +2044,7 @@ exit: free(txt_buf); if (!buttons_set) - lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); + lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_set_top(mbox, true); @@ -2065,11 +2065,11 @@ static lv_res_t _create_mbox_partitioning_option0(lv_obj_t *btns, const char *tx action_ums_sd(NULL); return LV_RES_OK; case 1: - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); _sd_create_mbox_start_partitioning(); break; case 2: - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); break; } @@ -2080,11 +2080,10 @@ static lv_res_t _create_mbox_partitioning_option1(lv_obj_t *btns, const char *tx { int btn_idx = lv_btnm_get_pressed(btns); - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); if (!btn_idx) { - mbox_action(btns, txt); if (!part_info.emmc) _sd_create_mbox_start_partitioning(); else @@ -2102,7 +2101,7 @@ static lv_res_t _create_mbox_partitioning_warn() lv_obj_set_size(dark_bg, LV_HOR_RES, LV_VER_RES); static const char *mbox_btn_map[] = { "\222SD UMS", "\222Start", "\222Cancel", "" }; - static const char *mbox_btn_map2[] = { "\222Start", "\222Cancel", "" }; + static const char *mbox_btn_map1[] = { "\222Start", "\222Cancel", "" }; lv_obj_t * mbox = lv_mbox_create(dark_bg, NULL); lv_mbox_set_recolor_text(mbox, true); @@ -2132,7 +2131,7 @@ static lv_res_t _create_mbox_partitioning_warn() lv_label_set_text(lbl_status, txt_buf); if (part_info.backup_possible) - lv_mbox_add_btns(mbox, mbox_btn_map2, _create_mbox_partitioning_option1); + lv_mbox_add_btns(mbox, mbox_btn_map1, _create_mbox_partitioning_option1); else lv_mbox_add_btns(mbox, mbox_btn_map, _create_mbox_partitioning_option0); } @@ -2141,7 +2140,7 @@ static lv_res_t _create_mbox_partitioning_warn() s_printf(txt_buf, "#FFDD00 Warning: This will partition the eMMC!#\n\n" "#FFDD00 The USER partition will also be formatted!#"); lv_label_set_text(lbl_status, txt_buf); - lv_mbox_add_btns(mbox, mbox_btn_map2, _create_mbox_partitioning_option1); + lv_mbox_add_btns(mbox, mbox_btn_map1, _create_mbox_partitioning_option1); } lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); @@ -2156,7 +2155,7 @@ static lv_res_t _create_mbox_partitioning_android(lv_obj_t *btns, const char *tx { int btn_idx = lv_btnm_get_pressed(btns); - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); part_info.and_dynamic = !btn_idx; _create_mbox_partitioning_warn(); @@ -2445,7 +2444,7 @@ static lv_res_t _mbox_check_files_total_size_option(lv_obj_t *btns, const char * if (!lv_btnm_get_pressed(btns)) part_info.backup_possible = false; - mbox_action(btns, txt); + nyx_mbox_action(btns, txt); return LV_RES_INV; } @@ -2624,7 +2623,7 @@ static void _create_mbox_check_files_total_size() lv_obj_align(lbl_table, h1, LV_ALIGN_IN_TOP_MID, 0, LV_DPI); if (!part_info.backup_possible) - lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); + lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); else lv_mbox_add_btns(mbox, mbox_btn_map2, _mbox_check_files_total_size_option); @@ -2957,7 +2956,7 @@ check_changes: out: free(gpt); - lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); + lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_set_top(mbox, true); @@ -2971,11 +2970,11 @@ lv_res_t create_window_partition_manager(bool emmc) if (!emmc) { - win = nyx_create_standard_window(SYMBOL_SD" SD Partition Manager"); + win = nyx_create_standard_window(SYMBOL_SD" SD Partition Manager", NULL); lv_win_add_btn(win, NULL, SYMBOL_MODULES_ALT" Fix Hybrid MBR/GPT", _action_fix_mbr_gpt); } else - win = nyx_create_standard_window(SYMBOL_CHIP" eMMC Partition Manager"); + win = nyx_create_standard_window(SYMBOL_CHIP" eMMC Partition Manager", NULL); static lv_style_t bar_hos_bg, bar_emu_bg, bar_l4t_bg, bar_and_bg; static lv_style_t bar_hos_ind, bar_emu_ind, bar_l4t_ind, bar_and_ind;