From 3794c61ab29c15ea811f1852b574eb116918a985 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Fri, 1 May 2020 17:28:24 +0300 Subject: [PATCH] Mitigate a L4T Joy-Cond driver issue --- bootloader/soc/uart.c | 1 + bootloader/soc/uart.h | 1 + nyx/nyx_gui/frontend/gui.c | 20 +++++++++++++++----- nyx/nyx_gui/soc/uart.c | 1 + nyx/nyx_gui/soc/uart.h | 1 + 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/bootloader/soc/uart.c b/bootloader/soc/uart.c index a788ac7..2568d10 100644 --- a/bootloader/soc/uart.c +++ b/bootloader/soc/uart.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2018 naehrwert +* Copyright (c) 2019-2020 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, diff --git a/bootloader/soc/uart.h b/bootloader/soc/uart.h index 23dde13..ef22108 100644 --- a/bootloader/soc/uart.h +++ b/bootloader/soc/uart.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2018 naehrwert +* Copyright (c) 2019-2020 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, diff --git a/nyx/nyx_gui/frontend/gui.c b/nyx/nyx_gui/frontend/gui.c index db9d74f..1f5bdff 100644 --- a/nyx/nyx_gui/frontend/gui.c +++ b/nyx/nyx_gui/frontend/gui.c @@ -787,7 +787,7 @@ static void _launch_hos(u8 autoboot, u8 autoboot_list) b_cfg->boot_cfg = BOOT_CFG_AUTOBOOT_EN; if (launch_logs_enable) b_cfg->boot_cfg |= BOOT_CFG_FROM_LAUNCH; - b_cfg->autoboot = autoboot; + b_cfg->autoboot = autoboot & ~0x80; b_cfg->autoboot_list = autoboot_list; void (*main_ptr)() = (void *)nyx_str->hekate; @@ -796,6 +796,10 @@ static void _launch_hos(u8 autoboot, u8 autoboot_list) reconfig_hw_workaround(false, 0); + // Mitigate L4T Joy-Con driver issue. + if ((autoboot & 0x80) && h_cfg.bootwait < 2) + msleep((2 - h_cfg.bootwait) * 1000); + (*main_ptr)(); } @@ -1534,7 +1538,7 @@ ini_parsing: continue; icon_path = NULL; - bool payload = false; + u32 payload = 0; lv_img_dsc_t *bmp = NULL; lv_obj_t *img = NULL; @@ -1544,7 +1548,13 @@ ini_parsing: if (!strcmp("icon", kv->key)) icon_path = kv->val; else if (!strcmp("payload", kv->key)) - payload = true; + { + payload = 1; + + // Mitigate L4T Joy-Con driver issue. + if (!memcmp(kv->val + strlen(kv->val) - 3, "rom", 3)) + payload = 2; + } } // If icon not found, check res folder for section_name.bmp. @@ -1588,9 +1598,9 @@ ini_parsing: // Set autoboot index. ext = lv_obj_get_ext_attr(btn); - ext->idx = i; + ext->idx = payload != 2 ? i : (i | 0x80); ext = lv_obj_get_ext_attr(launch_ctxt[curr_btn_idx]); // Redundancy. - ext->idx = i; + ext->idx = payload != 2 ? i : (i | 0x80); // Set action. if (!more_cfg) diff --git a/nyx/nyx_gui/soc/uart.c b/nyx/nyx_gui/soc/uart.c index a788ac7..2568d10 100644 --- a/nyx/nyx_gui/soc/uart.c +++ b/nyx/nyx_gui/soc/uart.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2018 naehrwert +* Copyright (c) 2019-2020 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, diff --git a/nyx/nyx_gui/soc/uart.h b/nyx/nyx_gui/soc/uart.h index 23dde13..ef22108 100644 --- a/nyx/nyx_gui/soc/uart.h +++ b/nyx/nyx_gui/soc/uart.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2018 naehrwert +* Copyright (c) 2019-2020 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,