From be0f50b19cf4473afc201d36dc990ec8e05b75d6 Mon Sep 17 00:00:00 2001 From: Aurora Wright Date: Mon, 18 Dec 2017 21:02:41 +0100 Subject: [PATCH] Disable poweroff when shell closed on NTRboothax altogether to prevent issues with unstable magnets --- source/utils.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/source/utils.c b/source/utils.c index 7158d2d..e82a499 100644 --- a/source/utils.c +++ b/source/utils.c @@ -68,11 +68,10 @@ static u64 chrono(void) u32 waitInput(bool isMenu) { static u64 dPadDelay = 0ULL; - static u32 shouldShellShutdown = 2; u64 initialValue = 0ULL; u32 key, oldKey = HID_PAD; - if(shouldShellShutdown == 2) shouldShellShutdown = (bootType == B9SNTR || bootType == NTR) ? 0 : 1; + bool shouldShellShutdown = bootType != B9SNTR && bootType != NTR; if(isMenu) { @@ -87,13 +86,8 @@ u32 waitInput(bool isMenu) if(!key) { - if((i2cReadRegister(I2C_DEV_MCU, 0x10) & 1) == 1) mcuPowerOff(); - if(!(i2cReadRegister(I2C_DEV_MCU, 0xF) & 2)) - { - if(shouldShellShutdown) mcuPowerOff(); - } - else shouldShellShutdown = 1; - + if((!(i2cReadRegister(I2C_DEV_MCU, 0xF) & 2) && shouldShellShutdown) || + (i2cReadRegister(I2C_DEV_MCU, 0x10) & 1) == 1) mcuPowerOff(); oldKey = 0; dPadDelay = 0; continue;