mirror of
https://github.com/edo9300/unlaunch-installer.git
synced 2025-06-18 14:25:39 -04:00
Add battery level check
This commit is contained in:
parent
379db68839
commit
38b1efb15b
@ -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();
|
||||
}
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user