Compare commits

...

11 Commits

Author SHA1 Message Date
CTCaer
1a50425475 Bump hekate to v5.5.3 and Nyx to v0.9.9 2021-01-14 18:55:11 +02:00
CTCaer
8fc5267110 tmp451: Show correct temperature for T210B01
The thermal measurement substrate transistor was changed in Mariko SoCs.
This ensures that it's properly offset by -12.5 °C.
2021-01-14 17:58:23 +02:00
CTCaer
f6a3b2c9ac sdmmc: Ensure writes gone through after disabling io power 2021-01-14 17:53:22 +02:00
CTCaer
7aa1e77642 nyx: Do not over decrypt pkg1 on t210b01 2021-01-11 23:28:06 +02:00
CTCaer
2370ca0a44 util: Clear alarm wake flags also on power off even if rtc alram is off 2021-01-11 23:24:29 +02:00
CTCaer
abcf7f6f57 nyx: Allow reboot to OFW for patched units
- OFW: This bypasses fuses like always and does not cause a SYS Reset.
- Normal: Resets regulators and causes a SYS Reset.
2021-01-11 22:18:36 +02:00
CTCaer
d1f0ea3de7 Formalize language in various messages 2021-01-11 21:39:44 +02:00
CTCaer
dbc8f4a4c2 nyx: Fix an underflow on Android UDA partition 2021-01-11 21:32:35 +02:00
CTCaer
c6c396ce2a reg5V: Manage battery source based on charger status 2021-01-11 21:30:59 +02:00
CTCaer
74b91b0085 nyx: Cover edge case on backup/restore checks for partition manager
An edge was fixed where the checks for if it's possible to backup files for partition manager would overflow and end up with a value < 1GB and thus proceeding to the backup/restore process.
2021-01-10 02:09:03 +02:00
CTCaer
53c9ca8072 nyx: Fix nyx hanging when updating the partition buttons 2021-01-06 21:29:18 +02:00
25 changed files with 138 additions and 81 deletions

View File

@@ -1,11 +1,11 @@
# IPL Version.
BLVERSION_MAJOR := 5
BLVERSION_MINOR := 5
BLVERSION_HOTFX := 2
BLVERSION_HOTFX := 3
BLVERSION_RSVD := 0
# Nyx Version.
NYXVERSION_MAJOR := 0
NYXVERSION_MINOR := 9
NYXVERSION_HOTFX := 8
NYXVERSION_HOTFX := 9
NYXVERSION_RSVD := 0

View File

@@ -808,10 +808,10 @@ void jc_power_supply(u8 uart, bool enable)
{
if (enable)
{
if (regulator_get_5v_dev_enabled(1 << uart))
if (regulator_5v_get_dev_enabled(1 << uart))
return;
regulator_enable_5v(1 << uart);
regulator_5v_enable(1 << uart);
if (jc_init_done)
{
@@ -841,10 +841,10 @@ void jc_power_supply(u8 uart, bool enable)
}
else
{
if (!regulator_get_5v_dev_enabled(1 << uart))
if (!regulator_5v_get_dev_enabled(1 << uart))
return;
regulator_disable_5v(1 << uart);
regulator_5v_disable(1 << uart);
if (uart == UART_C)
gpio_write(GPIO_PORT_CC, GPIO_PIN_3, GPIO_LOW);

View File

@@ -21,8 +21,9 @@
#include <utils/types.h>
static u8 reg_5v_dev = 0;
static bool batt_src = false;
void regulator_enable_5v(u8 dev)
void regulator_5v_enable(u8 dev)
{
// The power supply selection from battery or USB is automatic.
if (!reg_5v_dev)
@@ -32,6 +33,7 @@ void regulator_enable_5v(u8 dev)
gpio_config(GPIO_PORT_A, GPIO_PIN_5, GPIO_MODE_GPIO);
gpio_output_enable(GPIO_PORT_A, GPIO_PIN_5, GPIO_OUTPUT_ENABLE);
gpio_write(GPIO_PORT_A, GPIO_PIN_5, GPIO_HIGH);
batt_src = true;
// Fan and Rail power from USB 5V VDD.
PINMUX_AUX(PINMUX_AUX_USB_VBUS_EN0) = PINMUX_LPDR | 1;
@@ -47,7 +49,7 @@ void regulator_enable_5v(u8 dev)
reg_5v_dev |= dev;
}
void regulator_disable_5v(u8 dev)
void regulator_5v_disable(u8 dev)
{
reg_5v_dev &= ~dev;
@@ -58,6 +60,7 @@ void regulator_disable_5v(u8 dev)
gpio_output_enable(GPIO_PORT_A, GPIO_PIN_5, GPIO_OUTPUT_DISABLE);
gpio_config(GPIO_PORT_A, GPIO_PIN_5, GPIO_MODE_SPIO);
PINMUX_AUX(PINMUX_AUX_SATA_LED_ACTIVE) = PINMUX_PARKED | PINMUX_INPUT_ENABLE;
batt_src = false;
// Rail power from USB 5V VDD.
gpio_write(GPIO_PORT_CC, GPIO_PIN_4, GPIO_LOW);
@@ -70,7 +73,15 @@ void regulator_disable_5v(u8 dev)
}
}
bool regulator_get_5v_dev_enabled(u8 dev)
bool regulator_5v_get_dev_enabled(u8 dev)
{
return (reg_5v_dev & dev);
}
void regulator_5v_batt_src_enable(bool enable)
{
if (enable && !batt_src)
gpio_write(GPIO_PORT_A, GPIO_PIN_5, GPIO_HIGH);
else if (!enable && batt_src)
gpio_write(GPIO_PORT_A, GPIO_PIN_5, GPIO_LOW);
}

View File

@@ -27,8 +27,9 @@ enum
REGULATOR_5V_ALL = 0xFF
};
void regulator_enable_5v(u8 dev);
void regulator_disable_5v(u8 dev);
bool regulator_get_5v_dev_enabled(u8 dev);
void regulator_5v_enable(u8 dev);
void regulator_5v_disable(u8 dev);
bool regulator_5v_get_dev_enabled(u8 dev);
void regulator_5v_batt_src_enable(bool enable);
#endif

View File

@@ -42,6 +42,7 @@
#include <storage/nx_sd.h>
#include <storage/sdmmc.h>
#include <thermal/fan.h>
#include <thermal/tmp451.h>
#include <utils/util.h>
extern boot_cfg_t b_cfg;
@@ -425,11 +426,12 @@ void hw_reinit_workaround(bool coreboot, u32 magic)
bpmp_clk_rate_set(BPMP_CLK_NORMAL);
#ifdef NYX
// Deinit touchscreen, 5V regulators and Joy-Con.
touch_power_off();
// Disable temperature sensor, touchscreen, 5V regulators and Joy-Con.
tmp451_end();
set_fan_duty(0);
touch_power_off();
jc_deinit();
regulator_disable_5v(REGULATOR_5V_ALL);
regulator_5v_disable(REGULATOR_5V_ALL);
clock_disable_uart(UART_B);
clock_disable_uart(UART_C);
#endif

View File

@@ -1371,12 +1371,12 @@ void sdmmc_end(sdmmc_t *sdmmc)
_sdmmc_sd_clock_disable(sdmmc);
// Disable SDMMC power.
_sdmmc_set_io_power(sdmmc, SDMMC_POWER_OFF);
_sdmmc_commit_changes(sdmmc);
// Disable SD card power.
if (sdmmc->id == SDMMC_1)
sdmmc1_disable_power();
_sdmmc_commit_changes(sdmmc);
clock_sdmmc_disable(sdmmc->id);
sdmmc->clock_stopped = 1;
}

View File

@@ -56,7 +56,7 @@ void set_fan_duty(u32 duty)
if (inv_duty == 236)
{
PWM(PWM_CONTROLLER_PWM_CSR_1) = PWM_CSR_EN | (0x100 << 16); // Bit 24 is absolute 0%.
regulator_disable_5v(REGULATOR_5V_FAN);
regulator_5v_disable(REGULATOR_5V_FAN);
// Disable fan.
PINMUX_AUX(PINMUX_AUX_LCD_GPIO2) =
@@ -65,7 +65,7 @@ void set_fan_duty(u32 duty)
else // Set PWM duty.
{
// Fan power supply.
regulator_enable_5v(REGULATOR_5V_FAN);
regulator_5v_enable(REGULATOR_5V_FAN);
PWM(PWM_CONTROLLER_PWM_CSR_1) = PWM_CSR_EN | (inv_duty << 16);
// Enable fan.

View File

@@ -1,7 +1,7 @@
/*
* SOC/PCB Temperature driver for Nintendo Switch's TI TMP451
*
* Copyright (c) 2018 CTCaer
* Copyright (c) 2018-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,
@@ -16,7 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <soc/hw_init.h>
#include <soc/i2c.h>
#include <soc/t210.h>
#include <thermal/tmp451.h>
u16 tmp451_get_soc_temp(bool intenger)
@@ -56,6 +58,20 @@ void tmp451_init()
// Disable ALARM and Range to 0 - 127 oC.
i2c_send_byte(I2C_1, TMP451_I2C_ADDR, TMP451_CONFIG_REG, 0x80);
// Set remote sensor offsets based on SoC.
if (hw_get_chip_id() == GP_HIDREV_MAJOR_T210)
{
// Set offset to 0 oC for Erista.
i2c_send_byte(I2C_1, TMP451_I2C_ADDR, TMP451_SOC_TMP_OFH_REG, 0);
i2c_send_byte(I2C_1, TMP451_I2C_ADDR, TMP451_SOC_TMP_OFL_REG, 0);
}
else
{
// Set offset to -12.5 oC for Mariko.
i2c_send_byte(I2C_1, TMP451_I2C_ADDR, TMP451_SOC_TMP_OFH_REG, 0xF3); // - 13 oC.
i2c_send_byte(I2C_1, TMP451_I2C_ADDR, TMP451_SOC_TMP_OFL_REG, 0x80); // + 0.5 oC.
}
// Set conversion rate to 32/s and make a read to update the reg.
i2c_send_byte(I2C_1, TMP451_I2C_ADDR, TMP451_CNV_RATE_REG, 9);
tmp451_get_soc_temp(false);
@@ -63,3 +79,9 @@ void tmp451_init()
// Set rate to every 4 seconds.
i2c_send_byte(I2C_1, TMP451_I2C_ADDR, TMP451_CNV_RATE_REG, 2);
}
void tmp451_end()
{
// Place into shutdown mode to conserve power.
i2c_send_byte(I2C_1, TMP451_I2C_ADDR, TMP451_CONFIG_REG, 0xC0);
}

View File

@@ -32,11 +32,15 @@
#define TMP451_SOC_TMP_DEC_REG 0x10
#define TMP451_PCB_TMP_DEC_REG 0x15
#define TMP451_SOC_TMP_OFH_REG 0x11
#define TMP451_SOC_TMP_OFL_REG 0x12
// If input is false, the return value is packed. MSByte is the integer in oC
// and the LSByte is the decimal point truncated to 2 decimal places.
// Otherwise it's an integer oC.
u16 tmp451_get_soc_temp(bool integer);
u16 tmp451_get_pcb_temp(bool integer);
void tmp451_init();
void tmp451_end();
#endif /* __TMP451_H_ */

View File

@@ -29,7 +29,7 @@ u8 btn_read()
res |= BTN_VOL_DOWN;
if (!gpio_read(GPIO_PORT_X, GPIO_PIN_6))
res |= BTN_VOL_UP;
if (i2c_recv_byte(4, MAX77620_I2C_ADDR, MAX77620_REG_ONOFFSTAT) & MAX77620_ONOFFSTAT_EN0)
if (i2c_recv_byte(I2C_5, MAX77620_I2C_ADDR, MAX77620_REG_ONOFFSTAT) & MAX77620_ONOFFSTAT_EN0)
res |= BTN_POWER;
return res;
}

View File

@@ -167,10 +167,10 @@ void power_set_state(power_state_t state)
default:
// Enable/Disable soft reset wake event.
reg = i2c_recv_byte(I2C_5, MAX77620_I2C_ADDR, MAX77620_REG_ONOFFCNFG2);
if (state == POWER_OFF_RESET)
reg &= ~MAX77620_ONOFFCNFG2_SFT_RST_WK; // Do not wake up after power off.
else // POWER_OFF_REBOOT.
reg |= MAX77620_ONOFFCNFG2_SFT_RST_WK; // Wake up after power off.
if (state == POWER_OFF_RESET) // Do not wake up after power off.
reg &= ~(MAX77620_ONOFFCNFG2_SFT_RST_WK | MAX77620_ONOFFCNFG2_WK_ALARM1 | MAX77620_ONOFFCNFG2_WK_ALARM2);
else // POWER_OFF_REBOOT. Wake up after power off.
reg |= MAX77620_ONOFFCNFG2_SFT_RST_WK;
i2c_send_byte(I2C_5, MAX77620_I2C_ADDR, MAX77620_REG_ONOFFCNFG2, reg);
// Initiate power down sequence and generate a reset (regulators' state resets).

View File

@@ -735,7 +735,7 @@ static int _restore_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part
{
gfx_con.fntsz = 16;
EPRINTFARGS("\nFatal error (%d) when reading from SD Card", res);
EPRINTF("\nYour device may be in an inoperative state!\n\nPress any key and try again now...\n");
EPRINTF("\nThis device may be in an inoperative state!\n\nPress any key and try again now...\n");
f_close(&fp);
return 0;
@@ -751,7 +751,7 @@ static int _restore_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part
gfx_con.fntsz = 16;
EPRINTFARGS("\nFailed to write %d blocks @ LBA %08X\nfrom eMMC. Aborting..\n",
num, lba_curr);
EPRINTF("\nYour device may be in an inoperative state!\n\nPress any key and try again...\n");
EPRINTF("\nThis device may be in an inoperative state!\n\nPress any key and try again...\n");
f_close(&fp);
return 0;
@@ -797,7 +797,7 @@ static void _restore_emmc_selected(emmcPartType_t restoreType)
tui_sbar(true);
gfx_con_setpos(0, 0);
gfx_printf("%kThis may render your device inoperative!\n\n", 0xFFFFDD00);
gfx_printf("%kThis may render the device inoperative!\n\n", 0xFFFFDD00);
gfx_printf("Are you really sure?\n\n%k", 0xFFCCCCCC);
if ((restoreType & PART_BOOT) || (restoreType & PART_GP_ALL))
{

View File

@@ -329,7 +329,7 @@ void menu_autorcm()
if (h_cfg.rcm_patched)
{
gfx_printf("%kThis device is RCM patched and\nAutoRCM function is disabled.\n\n"
"In case %kAutoRCM%k is enabled\nthis will %kBRICK%k your device PERMANENTLY!!%k",
"In case %kAutoRCM%k is enabled\nthis will %kBRICK%k the device PERMANENTLY!!%k",
0xFFFFDD00, 0xFFFF0000, 0xFFFFDD00, 0xFFFF0000, 0xFFFFDD00, 0xFFCCCCCC);
btn_wait();
@@ -393,7 +393,7 @@ void menu_autorcm()
ments[4].data = NULL;
memset(&ments[5], 0, sizeof(ment_t));
menu_t menu = {ments, "This corrupts your BOOT0!", 0, 0};
menu_t menu = {ments, "This corrupts BOOT0!", 0, 0};
tui_do_menu(&menu);
}

View File

@@ -970,7 +970,8 @@ int hos_launch(ini_sec_t *cfg)
}
// Patch kip1s in memory if needed.
gfx_printf("%kPatching kips%k\n", 0xFFFFBA00, 0xFFCCCCCC);
if (ctxt.kip1_patches)
gfx_printf("%kPatching kips%k\n", 0xFFFFBA00, 0xFFCCCCCC);
const char* unappliedPatch = pkg2_patch_kips(&kip1_info, ctxt.kip1_patches);
if (unappliedPatch != NULL)
{

View File

@@ -211,6 +211,7 @@ int pkg1_decrypt(const pkg1_id_t *id, u8 *pkg1)
hdr = (pk11_hdr_t *)(pkg1 + id->pkg11_off + 0x20);
// Use BEK for T210B01.
// Additionally, skip 0x20 bytes from decryption to maintain the header.
se_aes_iv_clear(13);
se_aes_crypt_cbc(13, 0, pkg1 + 0x20, oem_hdr->size - 0x20, pkg1 + 0x20, oem_hdr->size - 0x20);
}

View File

@@ -706,7 +706,7 @@ void nyx_load_run()
gfx_con_setpos(0, 0);
WPRINTF("Old Nyx GUI found! There will be dragons!\n");
WPRINTF("\nUpdate your bootloader folder!\n\n");
WPRINTF("\nUpdate the bootloader folder!\n\n");
WPRINTF("Press any key...");
msleep(1000);
@@ -1521,7 +1521,7 @@ ment_t ment_top[] = {
MDEF_END()
};
menu_t menu_top = { ment_top, "hekate - CTCaer mod v5.5.2", 0, 0 };
menu_t menu_top = { ment_top, "hekate - CTCaer mod v5.5.3", 0, 0 };
extern void pivot_stack(u32 stack_top);

View File

@@ -1023,7 +1023,7 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa
{
lv_obj_t *warn_mbox_bg = create_mbox_text(
"#FF8000 Size of SD Card split backup does not match,#\n#FF8000 eMMC's selected part size!#\n\n"
"#FFDD00 Your backup might be corrupted!#\n#FFDD00 Aborting is suggested!#\n\n"
"#FFDD00 The backup might be corrupted!#\n#FFDD00 Aborting is suggested!#\n\n"
"Press #FF8000 POWER# to Continue.\nPress #FF8000 VOL# to abort.", false);
manual_system_maintenance(true);
@@ -1085,7 +1085,7 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa
{
lv_obj_t *warn_mbox_bg = create_mbox_text(
"#FF8000 Size of the SD Card backup does not match,#\n#FF8000 eMMC's selected part size!#\n\n"
"#FFDD00 Your backup might be corrupted!#\n#FFDD00 Aborting is suggested!#\n\n"
"#FFDD00 The backup might be corrupted!#\n#FFDD00 Aborting is suggested!#\n\n"
"Press #FF8000 POWER# to Continue.\nPress #FF8000 VOL# to abort.", false);
manual_system_maintenance(true);
@@ -1206,7 +1206,7 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa
{
s_printf(gui->txt_buf,
"\n#FF0000 Fatal error (%d) when reading from SD!#\n"
"#FF0000 Your device may be in an inoperative state!#\n"
"#FF0000 This device may be in an inoperative state!#\n"
"#FFDD00 Please try again now!#\n", res);
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
@@ -1235,7 +1235,7 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa
if (retryCount >= 3)
{
s_printf(gui->txt_buf, "#FF0000 Aborting...#\n"
"#FF0000 Your device may be in an inoperative state!#\n"
"#FF0000 This device may be in an inoperative state!#\n"
"#FFDD00 Please try again now!#\n");
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
@@ -1328,7 +1328,7 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
manual_system_maintenance(true);
s_printf(txt_buf,
"#FFDD00 This may render your device inoperative!#\n\n"
"#FFDD00 This may render the device inoperative!#\n\n"
"#FFDD00 Are you really sure?#");
if ((restoreType & PART_BOOT) || (restoreType & PART_GP_ALL))
{

View File

@@ -36,6 +36,7 @@
#include <mem/minerva.h>
#include <power/bq24193.h>
#include <power/max17050.h>
#include <power/regulator_5v.h>
#include <rtc/max77620-rtc.h>
#include <soc/bpmp.h>
#include <soc/fuse.h>
@@ -765,7 +766,7 @@ static void nyx_sd_card_issues(void *param)
lv_mbox_set_text(mbox,
"#FF8000 SD Card Issues Check#\n\n"
"#FFDD00 Your SD Card is initialized in 1-bit mode!#\n"
"#FFDD00 The SD Card is initialized in 1-bit mode!#\n"
"#FFDD00 This might mean detached or broken connector!#\n\n"
"You might want to check\n#C7EA46 Console Info# -> #C7EA46 SD Card#");
@@ -954,15 +955,13 @@ static lv_res_t _reboot_action(lv_obj_t *btns, const char *txt)
switch (btnidx)
{
case 0:
if (h_cfg.rcm_patched)
power_set_state(POWER_OFF_REBOOT);
else
power_set_state(REBOOT_BYPASS_FUSES);
power_set_state(REBOOT_BYPASS_FUSES);
break;
case 1:
if (h_cfg.rcm_patched)
break;
power_set_state(REBOOT_RCM);
power_set_state(POWER_OFF_REBOOT);
else
power_set_state(REBOOT_RCM);
break;
}
@@ -1005,7 +1004,7 @@ static lv_res_t _create_mbox_reboot(lv_obj_t *btn)
lv_obj_set_size(dark_bg, LV_HOR_RES, LV_VER_RES);
static const char * mbox_btn_map[] = { "\221OFW", "\221RCM", "\221Cancel", "" };
static const char * mbox_btn_map_patched[] = { "\221Reboot", "\221Cancel", "" };
static const char * mbox_btn_map_patched[] = { "\221OFW", "\221Normal", "\221Cancel", "" };
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 / 2);
@@ -1263,8 +1262,14 @@ static void _update_status_bar(void *params)
else
strcat(label, "#FF3C28 "SYMBOL_BATTERY_EMPTY"#");
// Set charging symbol and regulator 5V source based on USB state.
if (charge_status)
{
strcat(label, " #FFDD00 "SYMBOL_CHARGE"#");
regulator_5v_batt_src_enable(false);
}
else
regulator_5v_batt_src_enable(true);
lv_label_set_text(status_bar.battery, label);
lv_obj_realign(status_bar.battery);
@@ -2000,7 +2005,7 @@ void nyx_check_ini_changes()
lv_mbox_set_text(mbox,
"#FF8000 Main configuration#\n\n"
"You changed your configuration!\n\n"
"You changed the configuration!\n\n"
"Do you want to save it?");
lv_mbox_add_btns(mbox, mbox_btn_map, _create_mbox_save_changes_action);

View File

@@ -333,15 +333,15 @@ lv_res_t create_window_backup_restore_tool(lv_obj_t *btn)
if (!emmc_btn_ctxt.restore)
{
lv_label_set_static_text(label_txt2,
"Allows you to backup your BOOT physical partitions.\n"
"They contain your BCT, keys and various package1.\n"
"Allows you to backup the BOOT physical partitions.\n"
"They contain the BCT, keys and various package1.\n"
"#FF8000 These are paired with the RAW GPP backup.#");
}
else
{
lv_label_set_static_text(label_txt2,
"Allows you to restore your BOOT physical partitions.\n"
"They contain your BCT, keys and various package1.\n"
"Allows you to restore the BOOT physical partitions.\n"
"They contain the BCT, keys and various package1.\n"
"#FF8000 These are paired with the RAW GPP restore.#");
}
lv_obj_set_style(label_txt2, &hint_small_style);
@@ -363,14 +363,14 @@ lv_res_t create_window_backup_restore_tool(lv_obj_t *btn)
if (!emmc_btn_ctxt.restore)
{
lv_label_set_static_text(label_txt2,
"Allows you to backup your GPP physical partition.\n"
"Allows you to backup the GPP physical partition.\n"
"It contains, CAL0, various package2, SYSTEM, USER, etc.\n"
"#FF8000 This is paired with the BOOT0/1 backups.#");
}
else
{
lv_label_set_static_text(label_txt2,
"Allows you to restore your GPP physical partition.\n"
"Allows you to restore the GPP physical partition.\n"
"It contains, CAL0, various package2, SYSTEM, USER, etc.\n"
"#FF8000 This is paired with the BOOT0/1 restore.#");
}

View File

@@ -272,7 +272,7 @@ static void _create_mbox_emummc_raw()
if (!mbr_ctx.available)
strcat(txt_buf,
"\n#FF8000 Do you want to partition your SD card?#\n"
"\n#FF8000 Do you want to partition the SD card?#\n"
"#FF8000 (You will be asked on how to proceed)#");
lv_mbox_set_text(mbox, txt_buf);
@@ -345,7 +345,7 @@ static lv_res_t _create_mbox_emummc_create(lv_obj_t *btn)
lv_mbox_set_text(mbox,
"Welcome to #C7EA46 emuMMC# creation tool!\n\n"
"Please choose what type of emuMMC you want to create.\n"
"#FF8000 SD File# is saved as files in your FAT partition.\n"
"#FF8000 SD File# is saved as files in the FAT partition.\n"
"#FF8000 SD Partition# is saved as raw image in an available partition.");
lv_mbox_add_btns(mbox, mbox_btn_map, _create_emummc_action);

View File

@@ -975,9 +975,9 @@ static lv_res_t _create_window_fuses_info_status(lv_obj_t *btn)
// Check if patched unit.
if (!fuse_check_patched_rcm())
strcat(txt_buf, "\n\n#96FF00 Your unit is exploitable#\n#96FF00 to the RCM bug!#");
strcat(txt_buf, "\n\n#96FF00 This unit is exploitable#\n#96FF00 to the RCM bug!#");
else
strcat(txt_buf, "\n\n#FF8000 Your unit is patched#\n#FF8000 to the RCM bug!#");
strcat(txt_buf, "\n\n#FF8000 This unit is patched#\n#FF8000 to the RCM bug!#");
lv_label_set_text(lb_desc2, txt_buf);
@@ -2122,8 +2122,8 @@ void create_tab_info(lv_theme_t *th, lv_obj_t *parent)
lv_obj_t *label_txt4 = lv_label_create(h1, NULL);
lv_label_set_recolor(label_txt4, true);
lv_label_set_static_text(label_txt4,
"View and dump your cached #C7EA46 Fuses# and #C7EA46 KFuses#.\n"
"Fuses contain info about your SoC and device and KFuses contain HDCP.\n"
"View and dump the cached #C7EA46 Fuses# and #C7EA46 KFuses#.\n"
"Fuses contain info about the SoC/SKU and KFuses HDCP keys.\n"
"You can also see info about #C7EA46 DRAM#, #C7EA46 Screen# and #C7EA46 Touch panel#.");
lv_obj_set_style(label_txt4, &hint_small_style);
lv_obj_align(label_txt4, btn3, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3);
@@ -2172,7 +2172,7 @@ void create_tab_info(lv_theme_t *th, lv_obj_t *parent)
lv_obj_t *label_txt5 = lv_label_create(h2, NULL);
lv_label_set_recolor(label_txt5, true);
lv_label_set_static_text(label_txt5,
"View info about your eMMC or microSD and their partition list.\n"
"View info about the eMMC or microSD and their partition list.\n"
"Additionally you can benchmark read speeds.");
lv_obj_set_style(label_txt5, &hint_small_style);
lv_obj_align(label_txt5, btn5, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3);

View File

@@ -927,7 +927,7 @@ static void _check_nyx_changes()
lv_mbox_set_text(mbox,
"#FF8000 Nyx configuration#\n\n"
"You changed your configuration!\n\n"
"You changed the configuration!\n\n"
"Do you want to save it?");
lv_mbox_add_btns(mbox, mbox_btn_map, _action_nyx_options_save);

View File

@@ -691,7 +691,7 @@ static lv_res_t _create_window_usb_tools(lv_obj_t *parent)
lv_obj_t *label_txt2 = lv_label_create(h1, NULL);
lv_label_set_recolor(label_txt2, true);
lv_label_set_static_text(label_txt2,
"Allows you to mount your SD Card to a PC/Phone.\n"
"Allows you to mount the SD Card to a PC/Phone.\n"
"#C7EA46 All operating systems are supported. Access is# #FF8000 Read/Write.#");
lv_obj_set_style(label_txt2, &hint_small_style);
@@ -737,7 +737,7 @@ static lv_res_t _create_window_usb_tools(lv_obj_t *parent)
label_txt2 = lv_label_create(h1, NULL);
lv_label_set_recolor(label_txt2, true);
lv_label_set_static_text(label_txt2,
"Allows you to mount your eMMC/emuMMC.\n"
"Allows you to mount the eMMC/emuMMC.\n"
"#C7EA46 Default access is# #FF8000 read-only.#");
lv_obj_set_style(label_txt2, &hint_small_style);
lv_obj_align(label_txt2, btn_emu_gpp, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3);
@@ -788,8 +788,8 @@ static lv_res_t _create_window_usb_tools(lv_obj_t *parent)
lv_obj_t *label_txt4 = lv_label_create(h2, NULL);
lv_label_set_recolor(label_txt4, true);
lv_label_set_static_text(label_txt4,
"Plug-in your Joy-Con and convert your device\n"
"into a gamepad for your PC/Phone.\n"
"Plug-in the Joy-Con and convert the device\n"
"into a gamepad for PC or Phone.\n"
"#C7EA46 Needs both Joy-Con in order to function.#");
lv_obj_set_style(label_txt4, &hint_small_style);
@@ -806,7 +806,7 @@ static lv_res_t _create_window_usb_tools(lv_obj_t *parent)
label_txt4 = lv_label_create(h2, NULL);
lv_label_set_recolor(label_txt4, true);
lv_label_set_static_text(label_txt4,
"Control your PC via your device touchscreen.\n"
"Control the PC via the device\'s touchscreen.\n"
"#C7EA46 Two fingers tap acts like a# #FF8000 Right click##C7EA46 .#\n");
lv_obj_set_style(label_txt4, &hint_small_style);
lv_obj_align(label_txt4, btn4, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3);
@@ -1463,8 +1463,8 @@ static void _create_tab_tools_emmc_pkg12(lv_theme_t *th, lv_obj_t *parent)
lv_obj_t *label_txt2 = lv_label_create(h1, NULL);
lv_label_set_recolor(label_txt2, true);
lv_label_set_static_text(label_txt2,
"Allows you to backup your eMMC partitions individually or as\n"
"a whole raw image to your SD card.\n"
"Allows you to backup the eMMC partitions individually or as\n"
"a whole raw image to the SD card.\n"
"#C7EA46 Supports SD cards from# #FF8000 4GB# #C7EA46 and up. #"
"#FF8000 FAT32# #C7EA46 and ##FF8000 exFAT##C7EA46 .#");
lv_obj_set_style(label_txt2, &hint_small_style);
@@ -1480,8 +1480,8 @@ static void _create_tab_tools_emmc_pkg12(lv_theme_t *th, lv_obj_t *parent)
label_txt2 = lv_label_create(h1, NULL);
lv_label_set_recolor(label_txt2, true);
lv_label_set_static_text(label_txt2,
"Allows you to restore your eMMC/emuMMC partitions individually\n"
"or as a whole raw image from your SD card.\n"
"Allows you to restore the eMMC/emuMMC partitions individually\n"
"or as a whole raw image from the SD card.\n"
"#C7EA46 Supports SD cards from# #FF8000 4GB# #C7EA46 and up. #"
"#FF8000 FAT32# #C7EA46 and ##FF8000 exFAT##C7EA46 .#");
lv_obj_set_style(label_txt2, &hint_small_style);
@@ -1539,7 +1539,7 @@ static void _create_tab_tools_emmc_pkg12(lv_theme_t *th, lv_obj_t *parent)
lv_label_set_static_text(label_txt4,
"#C7EA46 USB mass storage#, #C7EA46 gamepad# and other USB tools.\n"
"Mass storage can mount SD, eMMC and emuMMC. The\n"
"gamepad transforms your Switch into an input device.#");
"gamepad transforms the Switch into an input device.#");
lv_obj_set_style(label_txt4, &hint_small_style);
lv_obj_align(label_txt4, btn4, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3);
}
@@ -1598,7 +1598,7 @@ static void _create_tab_tools_arc_autorcm(lv_theme_t *th, lv_obj_t *parent)
label_txt2 = lv_label_create(h1, NULL);
lv_label_set_recolor(label_txt2, true);
lv_label_set_static_text(label_txt2,
"Allows you to calibrate your touchscreen module.\n"
"Allows you to calibrate the touchscreen module.\n"
"#FF8000 This fixes any issues with touchscreen in Nyx and HOS.#");
lv_obj_set_style(label_txt2, &hint_small_style);
lv_obj_align(label_txt2, btn2, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3);
@@ -1653,7 +1653,7 @@ static void _create_tab_tools_arc_autorcm(lv_theme_t *th, lv_obj_t *parent)
s_printf(txt_buf,
"Allows you to enter RCM without using #C7EA46 VOL+# & #C7EA46 HOME# (jig).\n"
"#FF8000 It can restore all versions of AutoRCM whenever requested.#\n"
"#FF3C28 This corrupts your BCT and you can't boot without a custom#\n"
"#FF3C28 This corrupts the BCT and you can't boot without a custom#\n"
"#FF3C28 bootloader.#");
if (h_cfg.rcm_patched)
@@ -1681,7 +1681,7 @@ static void _create_tab_tools_arc_autorcm(lv_theme_t *th, lv_obj_t *parent)
label_txt2 = lv_label_create(h2, NULL);
lv_label_set_recolor(label_txt2, true);
lv_label_set_static_text(label_txt2,
"Allows you to partition your SD Card for using it with #C7EA46 emuMMC#,\n"
"Allows you to partition the SD Card for using it with #C7EA46 emuMMC#,\n"
"#C7EA46 Android# and #C7EA46 Linux#. You can also flash Linux and Android.");
lv_obj_set_style(label_txt2, &hint_small_style);
lv_obj_align(label_txt2, btn4, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 3);

View File

@@ -134,7 +134,12 @@ static int _backup_and_restore_files(char *path, u32 *total_files, u32 *total_si
// Check for overflow.
if ((file_size + *total_size) < *total_size)
{
// Set size to > 1GB, skip next folders and return.
*total_size = 0x80000000;
res = -1;
break;
}
*total_size += file_size;
*total_files += 1;
@@ -177,7 +182,11 @@ static int _backup_and_restore_files(char *path, u32 *total_files, u32 *total_si
// If total is > 1GB exit.
if (*total_size > (RAM_DISK_SZ - 0x1000000)) // 0x2400000.
{
// Skip next folders and return.
res = -1;
break;
}
}
else // It's a directory.
{
@@ -411,7 +420,7 @@ static void _prepare_and_flash_mbr_gpt()
gpt_idx++;
// Android Userdata partition.
u32 user_size = (part_info.and_size << 11) - 0x798000 - curr_part_lba; // Subtract the other partitions (3888MB).
u32 user_size = (part_info.and_size << 11) - 0x798000; // Subtract the other partitions (3888MB).
if (!part_info.emu_size)
user_size -= 0x800; // Reserve 1MB.
memcpy(gpt.entries[gpt_idx].type_guid, android_part_guid, 16);
@@ -1616,7 +1625,7 @@ static lv_res_t _create_mbox_partitioning_next(lv_obj_t *btn)
lv_obj_t *lbl_status = lv_label_create(mbox, NULL);
lv_label_set_recolor(lbl_status, true);
s_printf(txt_buf, "#FFDD00 Warning: This will partition your SD Card!#\n\n");
s_printf(txt_buf, "#FFDD00 Warning: This will partition the SD Card!#\n\n");
if (part_info.backup_possible)
strcat(txt_buf, "#C7EA46 Your files will be backed up and restored!#\n#FFDD00Any other partition will be wiped!#");
@@ -1858,15 +1867,15 @@ static void create_mbox_check_files_total_size()
path[0] = 0;
// Check total size of files.
_backup_and_restore_files(path, &total_files, &total_size, NULL, NULL, NULL);
int res = _backup_and_restore_files(path, &total_files, &total_size, NULL, NULL, NULL);
// Not more than 1.0GB.
part_info.backup_possible = !(total_size > (RAM_DISK_SZ - 0x1000000)); // 0x2400000
part_info.backup_possible = !res && !(total_size > (RAM_DISK_SZ - 0x1000000)); // 0x2400000
if (part_info.backup_possible)
{
s_printf(txt_buf,
"#96FF00 Your SD Card files will be backed up automatically!#\n"
"#96FF00 The SD Card files will be backed up automatically!#\n"
"#FFDD00 Any other partition will be wiped!#\n"
"#00DDFF Total files:# %d, #00DDFF Total size:# %d MiB", total_files, total_size >> 20);
lv_mbox_set_text(mbox, txt_buf);
@@ -1874,7 +1883,7 @@ static void create_mbox_check_files_total_size()
else
{
lv_mbox_set_text(mbox,
"#FFDD00 Your SD Card cannot be backed up!#\n\n"
"#FFDD00 The SD Card cannot be backed up!#\n\n"
"You will be asked to back up your files later via UMS.");
}
@@ -2378,7 +2387,7 @@ lv_res_t create_window_partition_manager(lv_obj_t *btn)
lv_obj_align(btn1, h1, LV_ALIGN_IN_TOP_LEFT, 0, LV_DPI * 5);
lv_btn_set_action(btn1, LV_BTN_ACTION_CLICK, _action_part_manager_ums_sd);
lv_obj_t *btn_flash_l4t = lv_btn_create(h1, NULL);
btn_flash_l4t = lv_btn_create(h1, NULL);
lv_obj_t *label_btn2 = lv_label_create(btn_flash_l4t, NULL);
lv_btn_set_fit(btn_flash_l4t, true, true);
lv_label_set_static_text(label_btn2, SYMBOL_DOWNLOAD" Flash Linux");

View File

@@ -94,8 +94,9 @@ int pkg1_decrypt(const pkg1_id_t *id, u8 *pkg1)
hdr = (pk11_hdr_t *)(pkg1 + id->pkg11_off + 0x20);
// Use BEK for T210B01.
// Additionally, skip 0x20 bytes from decryption to maintain the header.
se_aes_iv_clear(13);
se_aes_crypt_cbc(13, 0, pkg1 + 0x20, oem_hdr->size, pkg1 + 0x20, oem_hdr->size);
se_aes_crypt_cbc(13, 0, pkg1 + 0x20, oem_hdr->size - 0x20, pkg1 + 0x20, oem_hdr->size - 0x20);
}
// Return if header is valid.