From 1ea14efcf9938ea9063cc59ea14406140baa8bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 11 Feb 2025 10:46:28 -0600 Subject: [PATCH] SDL: Use SDL_GetPowerInfo --- SDL/SDLMain.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index d341e64523..f544457da8 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -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; } }