mGUI: Add BATTERY_NOT_PRESENT state
Vicki Pfau vi@endrift.com
Thu, 20 Sep 2018 11:22:58 -0700
3 files changed,
7 insertions(+),
1 deletions(-)
M
include/mgba-util/gui.h
→
include/mgba-util/gui.h
@@ -47,7 +47,8 @@ BATTERY_HALF = 2,
BATTERY_HIGH = 3, BATTERY_FULL = 4, - BATTERY_CHARGING = 8 + BATTERY_CHARGING = 8, + BATTERY_NOT_PRESENT = 16 }; struct GUIBackground {
M
src/platform/switch/main.c
→
src/platform/switch/main.c
@@ -360,6 +360,8 @@ u32 charge;
int state = 0; if (R_SUCCEEDED(psmGetBatteryChargePercentage(&charge))) { state = (charge + 12) / 25; + } else { + return BATTERY_NOT_PRESENT; } ChargerType type; if (R_SUCCEEDED(psmGetChargerType(&type)) && type) {