diff --git a/arm7/src/main.c b/arm7/src/main.c index c822a41..3dd7f61 100644 --- a/arm7/src/main.c +++ b/arm7/src/main.c @@ -182,6 +182,7 @@ int main() irqEnable( IRQ_VBLANK | IRQ_VCOUNT | IRQ_NETWORK); // Keep the ARM7 mostly idle + int oldBatteryStatus = 0; while (!exitflag) { if ( 0 == (REG_KEYINPUT & (KEY_SELECT | KEY_START | KEY_L | KEY_R))) @@ -189,12 +190,11 @@ int main() exitflag = true; } - int batteryStatus; - if (isDSiMode() || REG_SCFG_EXT != 0) - batteryStatus = i2cReadRegister(I2C_PM, I2CREGPM_BATTERY); - else - batteryStatus = (readPowerManagement(PM_BATTERY_REG) & 1) ? 0x3 : 0xF; - fifoSendValue32(FIFO_USER_03, batteryStatus); + int batteryStatus = i2cReadRegister(I2C_PM, I2CREGPM_BATTERY); + if(oldBatteryStatus != batteryStatus) + { + fifoSendValue32(FIFO_USER_03, oldBatteryStatus = batteryStatus); + } swiWaitForVBlank(); } diff --git a/arm9/src/main.c b/arm9/src/main.c index 4b66db7..893165b 100644 --- a/arm9/src/main.c +++ b/arm9/src/main.c @@ -20,8 +20,8 @@ static bool disableAllPatches = false; static bool enableSoundAndSplash = false; static const char* splashSoundBinaryPatchPath = NULL; static const char* customBgPath = NULL; -bool charging = false; -u8 batteryLevel = 0; +volatile bool charging = false; +volatile u8 batteryLevel = 0; PrintConsole topScreen; PrintConsole bottomScreen; @@ -139,7 +139,7 @@ int main(int argc, char **argv) //DSi check if (!isDSiMode()) { - messageBox("\x1B[31mError:\x1B[33m This app is only for DSi."); + messageBox("\x1B[31mError:\x1B[33m This app is exclusively for DSi."); return 0; } @@ -156,6 +156,12 @@ int main(int argc, char **argv) return 0; } + while (batteryLevel < 7 && !charging) + { + if (choiceBox("\x1B[47mBattery is too low!\nPlease plug in the console.\n\nContinue?") == NO) + return 0; + } + DeviceList* deviceList = getDeviceList(); const char* installerPath = (argc > 0) ? argv[0] : (deviceList ? deviceList->appname : "sd:/ntrboot.nds");