This commit is contained in:
didix16 2024-11-24 21:05:34 +01:00 committed by GitHub
commit 496077aaf1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 174 additions and 13 deletions

View file

@ -7,14 +7,16 @@ Custom Graphical Nintendo Switch bootloader, firmware patcher, tools, and many m
- [Features](#features)
- [Bootloader folders and files](#bootloader-folders-and-files)
- [Bootloader configuration](#bootloader-configuration)
* [hekate global Configuration keys/values](#hekate-global-configuration-keysvalues-when-entry-is-config)
* [Boot entry key/value combinations](#boot-entry-keyvalue-combinations)
* [Boot entry key/value combinations for Exosphère](#boot-entry-keyvalue-combinations-for-exosphère)
* [Payload storage](#payload-storage)
* [Nyx Configuration keys/values](#nyx-configuration-keysvalues-nyxini)
- [hekate - Nyx](#hekate---nyx)
- [Features](#features)
- [Bootloader folders and files](#bootloader-folders-and-files)
- [Bootloader configuration](#bootloader-configuration)
- [hekate Global Configuration keys/values (when entry is *\[config\]*):](#hekate-global-configuration-keysvalues-when-entry-is-config)
- [Boot entry key/value combinations:](#boot-entry-keyvalue-combinations)
- [Boot entry key/value combinations for Exosphère:](#boot-entry-keyvalue-combinations-for-exosphère)
- [Payload storage:](#payload-storage)
- [Nyx Configuration keys/values (nyx.ini):](#nyx-configuration-keysvalues-nyxini)
- [Extra](#extra)
@ -107,6 +109,7 @@ There are four possible type of entries. "**[ ]**": Boot entry, "**{ }**": Capti
| emummcforce=1 | Forces the use of emuMMC. If emummc.ini is disabled or not found, then it causes an error. |
| emummc_force_disable=1 | Disables emuMMC, if it's enabled. |
| stock=1 | OFW via hekate bootloader. Disables unneeded kernel patching and CFW kips when running stock. `If emuMMC is enabled, emummc_force_disable=1` is required. emuMMC is not supported on stock. If additional KIPs are needed other than OFW's, you can define them with `kip1` key. No kip should be used that relies on Atmosphère patching, because it will hang. If `NOGC` is needed, use `kip1patch=nogc`. |
| ofw=1 | This is different than using `stock`. This executes the same action that Reboot > OFW. Its just a help to create OFW entry on launch menu. |
| fullsvcperm=1 | Disables SVC verification (full services permission). Doesn't work with Mesosphere as kernel. |
| debugmode=1 | Enables Debug mode. Obsolete when used with exosphere as secmon. |
| atmosphere=1 | Enables Atmosphère patching. Not needed when `fss0` is used. |
@ -184,7 +187,10 @@ hekate has a boot storage in the binary that helps it configure it outside of BP
| jcdisable=0 | 1: Disables Joycon driver completely. |
| jcforceright=0 | 1: Forces right joycon to be used as main mouse control. |
| bpmpclock=1 | 0: Auto, 1: Fastest, 2: Faster, 3: Fast. Use 2 or 3 if Nyx hangs or some functions like UMS/Backup Verification fail. |
| safeui=0 | 1: With homescreen=2 (Launch menu), removes the close and Logs buttons from launch menu to avoid return to home menu and do something else. This option is usefull to people that just need to power on the console and select one boot option without worring about do something harmful. Special for kids or non-tech person. |
#### Extra
Konami code is supported in Nyx. It will show message box and on close it, restores the safeui=0 and homescreen=0 options. Useful for reenable full control over UI. The code is: `↑ ↑ ↓ ↓ ← → ← → B A`. (buttons only)
```
hekate (c) 2018, naehrwert, st4rk.

View file

@ -6,6 +6,6 @@ BLVERSION_REL := 0
# Nyx Version.
NYXVERSION_MAJOR := 1
NYXVERSION_MINOR := 6
NYXVERSION_HOTFX := 4
NYXVERSION_MINOR := 7
NYXVERSION_HOTFX := 0
NYXVERSION_REL := 0

View file

@ -28,6 +28,32 @@
#define JC_BTNS_ALL (JC_BTNS_PREV_NEXT | JC_BTNS_ENTER | JC_BTNS_DIRECTION_PAD | JC_BTNS_ESC)
// Joy-Con buttons mask
#define JC_BTNS_Y 0x000001
#define JC_BTNS_X 0x000002
#define JC_BTNS_B 0x000004
#define JC_BTNS_A 0x000008
#define JC_BTNS_SR_R 0x000010
#define JC_BTNS_SL_R 0x000020
#define JC_BTNS_R 0x000040
#define JC_BTNS_ZR 0x000080
#define JC_BTNS_MINUS 0x000100
#define JC_BTNS_PLUS 0x000200
#define JC_BTNS_R3 0x000400
#define JC_BTNS_L3 0x000800
#define JC_BTNS_HOME 0x001000
#define JC_BTNS_CAPTURE 0x002000
#define JC_BTNS_PAD 0x004000
#define JC_BTNS_WIRED 0x008000
#define JC_BTNS_DOWN 0x010000
#define JC_BTNS_UP 0x020000
#define JC_BTNS_RIGHT 0x040000
#define JC_BTNS_LEFT 0x080000
#define JC_BTNS_SR_L 0x100000
#define JC_BTNS_SL_L 0x200000
#define JC_BTNS_L 0x400000
#define JC_BTNS_ZL 0x800000
typedef struct _jc_bt_conn_t
{
u8 type;

View file

@ -27,6 +27,7 @@ OBJS = $(addprefix $(BUILDDIR)/$(TARGET)/, \
start.o exception_handlers.o \
nyx.o heap.o \
gfx.o \
konami.o \
gui.o gui_info.o gui_tools.o gui_options.o gui_emmc_tools.o gui_emummc_tools.o gui_tools_partition_manager.o \
fe_emummc_tools.o fe_emmc_tools.o \
)

View file

@ -60,6 +60,7 @@ void set_nyx_default_configuration()
n_cfg.jc_disable = 0;
n_cfg.jc_force_right = 0;
n_cfg.bpmp_clock = 0;
n_cfg.safeui = 0;
}
int create_config_entry()
@ -242,6 +243,10 @@ int create_nyx_config_entry(bool force_unmount)
itoa(n_cfg.bpmp_clock, lbuf, 10);
f_puts(lbuf, &fp);
f_puts("\nsafeui=", &fp);
itoa(n_cfg.safeui, lbuf, 10);
f_puts(lbuf, &fp);
f_puts("\n", &fp);
f_close(&fp);

View file

@ -54,6 +54,7 @@ typedef struct _nyx_config
u32 jc_disable;
u32 jc_force_right;
u32 bpmp_clock;
u32 safeui;
} nyx_config;
void set_default_configuration();

View file

@ -29,6 +29,7 @@
#include "../config.h"
#include <libs/fatfs/ff.h>
#include "konami.h"
extern hekate_config h_cfg;
extern nyx_config n_cfg;
@ -615,6 +616,8 @@ static bool _jc_virt_mouse_read(lv_indev_data_t *data)
close_btn = NULL;
}
check_konami_code(jc_pad);
return false; // No buffering so no more data read.
}
@ -779,6 +782,35 @@ lv_res_t mbox_action(lv_obj_t *btns, const char *txt)
return LV_RES_INV;
}
lv_res_t mbox_konami_action(lv_obj_t *btns, const char *txt)
{
lv_obj_t *mbox = lv_mbox_get_from_btn(btns);
// Do here some konami code related stuff
// put safeui to false and homescreen to 0
n_cfg.safeui = 0;
n_cfg.home_screen = 0;
//store nyx config
int res = !create_nyx_config_entry(true);
if(res){
lv_obj_t *dark_bg = lv_obj_get_parent(mbox);
lv_obj_del(dark_bg); // Deletes children also (mbox).
reload_nyx();
return LV_RES_INV;
}else {
static const char * mbox_btn_map[] = {"\251", "\222OK!", "\251", ""};
mbox = lv_mbox_create(lv_scr_act(), NULL);
lv_mbox_set_recolor_text(mbox, true);
lv_mbox_set_text(mbox, "#FF8000 Nyx Configuration#\n\n#FFDD00 Failed to save the configuration#\n#FFDD00 to sd card!#");
lv_mbox_add_btns(mbox, mbox_btn_map, NULL);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
return LV_RES_OK;
}
}
bool nyx_emmc_check_battery_enough()
{
if (fuse_read_hw_state() == FUSE_NX_HW_STATE_DEV)
@ -1508,7 +1540,10 @@ static lv_obj_t *create_window_launch(const char *win_title)
lv_win_set_style(win, LV_WIN_STYLE_BG, &win_bg_style);
close_btn = lv_win_add_btn(win, NULL, SYMBOL_CLOSE" Close", _win_launch_close_action);
if(!n_cfg.safeui)
close_btn = lv_win_add_btn(win, NULL, SYMBOL_CLOSE" Close", _win_launch_close_action);
else
close_btn = NULL;
return win;
}
@ -1522,6 +1557,12 @@ static lv_res_t _launch_action(lv_obj_t *btn)
return LV_RES_OK;
}
static lv_res_t _launch_ofw_action(lv_obj_t *btn)
{
power_set_state(REBOOT_BYPASS_FUSES);
return LV_RES_OK;
}
static lv_res_t logs_onoff_toggle(lv_obj_t *btn)
{
launch_logs_enable = !launch_logs_enable;
@ -1639,7 +1680,8 @@ static lv_res_t _create_window_home_launch(lv_obj_t *btn)
else
win = create_window_launch(SYMBOL_GPS" More Configurations");
lv_win_add_btn(win, NULL, SYMBOL_LIST" Logs #D0D0D0 OFF#", logs_onoff_toggle);
if(!n_cfg.safeui)
lv_win_add_btn(win, NULL, SYMBOL_LIST" Logs #D0D0D0 OFF#", logs_onoff_toggle);
launch_logs_enable = false;
lv_cont_set_fit(lv_page_get_scrl(lv_win_get_content(win)), false, false);
@ -1733,6 +1775,7 @@ ini_parsing:
icon_path = NULL;
bool payload = false;
bool ofw = false;
bool img_colorize = false;
bool img_noborder = false;
lv_img_dsc_t *bmp = NULL;
@ -1745,6 +1788,9 @@ ini_parsing:
icon_path = kv->val;
else if (!strcmp("payload", kv->key))
payload = true;
else if (!strcmp("ofw", kv->key))
if (kv->val[0] == '1')
ofw = true;
}
// If icon not found, check res folder for section_name.bmp.
@ -1863,7 +1909,9 @@ ini_parsing:
ext->idx = entry_idx;
// Set action.
if (!more_cfg)
if(ofw)
lv_btn_set_action(btns, LV_BTN_ACTION_CLICK, _launch_ofw_action);
else if (!more_cfg)
lv_btn_set_action(btns, LV_BTN_ACTION_CLICK, _launch_action);
else
lv_btn_set_action(btns, LV_BTN_ACTION_CLICK, _launch_more_cfg_action);
@ -2276,6 +2324,24 @@ void first_time_bpmp_clock(void *param)
create_nyx_config_entry(false);
}
static void _show_mbox_konami(){
lv_obj_t *dark_bg = lv_obj_create(lv_scr_act(), NULL);
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", "\222OK", "\251", "" };
lv_obj_t * mbox = lv_mbox_create(dark_bg, NULL);
lv_mbox_set_recolor_text(mbox, true);
lv_obj_set_width(mbox, LV_HOR_RES * 5 / 9);
lv_mbox_set_text(mbox, "#FF8000 Konami Code#\n\n#96FF00 You found a secret!#");
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_konami_action);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
}
static void _nyx_main_menu(lv_theme_t * th)
{
static lv_style_t no_padding;
@ -2446,6 +2512,9 @@ void nyx_load_and_run()
// Create main menu
_nyx_main_menu(th);
// Register konami code handler
register_konami_code_handler(_show_mbox_konami);
jc_drv_ctx.cursor = lv_img_create(lv_scr_act(), NULL);
lv_img_set_src(jc_drv_ctx.cursor, &touch_cursor);
lv_obj_set_opa_scale(jc_drv_ctx.cursor, LV_OPA_TRANSP);

View file

@ -0,0 +1,41 @@
#include "konami.h"
// pointer to function
static void (*konami_code_handler)(void) = NULL;
void check_konami_code(jc_gamepad_rpt_t *jc_pad){
static u32 konami_code[] = {
JC_BTNS_UP,
JC_BTNS_UP,
JC_BTNS_DOWN,
JC_BTNS_DOWN,
JC_BTNS_LEFT,
JC_BTNS_RIGHT,
JC_BTNS_LEFT,
JC_BTNS_RIGHT,
JC_BTNS_B,
JC_BTNS_A
};
static u8 konami_code_idx = 0;
u32 key_pressed = (jc_pad->buttons & konami_code[konami_code_idx]);
if (key_pressed && (key_pressed == konami_code[konami_code_idx] || key_pressed == konami_code[(konami_code_idx = 0)]))
{
konami_code_idx++;
if (konami_code_idx == 10)
{
konami_code_idx = 0;
if (konami_code_handler)
{
(*konami_code_handler)();
}
}
}
}
void register_konami_code_handler(// pointer to function
void (*handler)(void)) {
konami_code_handler = handler;
}

View file

@ -0,0 +1,10 @@
#ifndef _KONAMI_H_
#define _KONAMI_H_
#include <bdk.h>
void check_konami_code(jc_gamepad_rpt_t *jc_pad);
void register_konami_code_handler(// pointer to function
void (*handler)(void));
#endif /* _KONAMI_H_ */

View file

@ -286,6 +286,8 @@ skip_main_cfg_parse:
n_cfg.jc_force_right = atoi(kv->val) == 1;
else if (!strcmp("bpmpclock", kv->key))
n_cfg.bpmp_clock = atoi(kv->val);
else if (!strcmp("safeui", kv->key))
n_cfg.safeui = atoi(kv->val) == 1;
}
break;