SDL: Use SDL_GetPowerInfo

This commit is contained in:
Henrik Rydgård 2025-02-11 10:46:28 -06:00
parent 61aa231fe2
commit 1ea14efcf9

View file

@ -549,9 +549,17 @@ int64_t System_GetPropertyInt(SystemProperty prop) {
return g_DesktopWidth;
case SYSPROP_DISPLAY_YRES:
return g_DesktopHeight;
#if PPSSPP_PLATFORM(MAC)
case SYSPROP_BATTERY_PERCENTAGE:
#if PPSSPP_PLATFORM(MAC)
// Let's keep using the old code on Mac for safety. Evaluate later if to be deleted.
return Apple_GetCurrentBatteryCapacity();
#else
{
int seconds = 0;
int percentage = 0;
SDL_GetPowerInfo(&seconds, &percentage);
return percentage;
}
#endif
default:
return -1;
@ -614,8 +622,6 @@ bool System_GetPropertyBool(SystemProperty prop) {
#if PPSSPP_PLATFORM(MAC)
case SYSPROP_HAS_FOLDER_BROWSER:
case SYSPROP_HAS_FILE_BROWSER:
case SYSPROP_CAN_READ_BATTERY_PERCENTAGE:
return true;
#endif
case SYSPROP_HAS_ACCELEROMETER:
#if defined(MOBILE_DEVICE)
@ -623,7 +629,9 @@ bool System_GetPropertyBool(SystemProperty prop) {
#else
return false;
#endif
default:
case SYSPROP_CAN_READ_BATTERY_PERCENTAGE:
return true;
default:
return false;
}
}