diff --git a/src/platform/psp2/main.c b/src/platform/psp2/main.c index fcc0552cf..b9d5a6f70 100644 --- a/src/platform/psp2/main.c +++ b/src/platform/psp2/main.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -76,6 +77,16 @@ static enum GUICursorState _pollCursor(int* x, int* y) { return GUI_CURSOR_DOWN; } +static int _batteryState(void) { + int charge = scePowerGetBatteryLifePercent(); + int adapter = scePowerIsPowerOnline(); + int state = 0; + if (adapter) { + state |= BATTERY_CHARGING; + } + charge /= 25; + return state | charge; +} int main() { vita2d_init(); @@ -85,7 +96,7 @@ int main() { PSP2_HORIZONTAL_PIXELS, PSP2_VERTICAL_PIXELS, font, "cache0:", _drawStart, _drawEnd, _pollInput, _pollCursor, - 0, + _batteryState, 0, 0, GUI_PARAMS_TRAIL