From 11df6030f90bdcc67b246d0dd96e8101eb0a6289 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Sat, 18 Jul 2020 00:54:35 +0300 Subject: [PATCH] Various fixes --- bdk/thermal/fan.c | 4 ++-- bootloader/hos/fss.c | 3 ++- nyx/nyx_gui/hos/hos.c | 2 +- nyx/nyx_gui/nyx.c | 8 +++++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/bdk/thermal/fan.c b/bdk/thermal/fan.c index 686f9e8..f39b082 100644 --- a/bdk/thermal/fan.c +++ b/bdk/thermal/fan.c @@ -38,7 +38,7 @@ void set_fan_duty(u32 duty) gpio_config(GPIO_PORT_S, GPIO_PIN_7, GPIO_MODE_GPIO); gpio_output_enable(GPIO_PORT_S, GPIO_PIN_7, GPIO_OUTPUT_DISABLE); - PWM(PWM_CONTROLLER_PWM_CSR_1) = PWM_CSR_EN | (1 << 24); // Max PWM to disable fan. + PWM(PWM_CONTROLLER_PWM_CSR_1) = PWM_CSR_EN | (0x100 << 16); // Max PWM to disable fan. PINMUX_AUX(PINMUX_AUX_LCD_GPIO2) = 1; // Set source to PWM1. gpio_config(GPIO_PORT_V, GPIO_PIN_4, GPIO_MODE_SPIO); // Fan power mode. @@ -55,7 +55,7 @@ void set_fan_duty(u32 duty) // If disabled send a 0 duty. if (inv_duty == 236) { - PWM(PWM_CONTROLLER_PWM_CSR_1) = PWM_CSR_EN | (1 << 24); // Bit 24 is absolute 0%. + PWM(PWM_CONTROLLER_PWM_CSR_1) = PWM_CSR_EN | (0x100 << 16); // Bit 24 is absolute 0%. regulator_disable_5v(REGULATOR_5V_FAN); // Disable fan. diff --git a/bootloader/hos/fss.c b/bootloader/hos/fss.c index 8813591..2825c42 100644 --- a/bootloader/hos/fss.c +++ b/bootloader/hos/fss.c @@ -121,7 +121,8 @@ int parse_fss(launch_ctxt_t *ctxt, const char *path, fss0_sept_t *sept_ctxt) stock = true; } - if (stock && ctxt->pkg1_id->kb <= KB_FIRMWARE_VERSION_620 && (!emu_cfg.enabled || h_cfg.emummc_force_disable)) + bool emummc_disabled = !emu_cfg.enabled || h_cfg.emummc_force_disable; + if (stock && ctxt->pkg1_id->kb <= KB_FIRMWARE_VERSION_620 && emummc_disabled) return 1; } diff --git a/nyx/nyx_gui/hos/hos.c b/nyx/nyx_gui/hos/hos.c index 073c8f7..ca8c9de 100644 --- a/nyx/nyx_gui/hos/hos.c +++ b/nyx/nyx_gui/hos/hos.c @@ -365,7 +365,7 @@ void hos_eks_bis_clear() se_aes_crypt_ecb(14, 1, eks, sizeof(hos_eks_mbr_t), eks, sizeof(hos_eks_mbr_t)); // Write EKS blob to SD. - memcpy(mbr + 0x60, eks, sizeof(hos_eks_mbr_t)); + memcpy(mbr + 0x80, eks, sizeof(hos_eks_mbr_t)); hos_eks_rw_try(mbr, true); free(eks); diff --git a/nyx/nyx_gui/nyx.c b/nyx/nyx_gui/nyx.c index 7db06cf..77942ec 100644 --- a/nyx/nyx_gui/nyx.c +++ b/nyx/nyx_gui/nyx.c @@ -359,9 +359,11 @@ void nyx_init_load_res() load_saved_configuration(); FIL fp; - f_open(&fp, "bootloader/sys/res.pak", FA_READ); - f_read(&fp, (void *)NYX_RES_ADDR, f_size(&fp), NULL); - f_close(&fp); + if (!f_open(&fp, "bootloader/sys/res.pak", FA_READ)) + { + f_read(&fp, (void *)NYX_RES_ADDR, f_size(&fp), NULL); + f_close(&fp); + } // If no custom switch icon exists, load normal. if (f_stat("bootloader/res/icon_switch_custom.bmp", NULL))