Updated source to match SDL function prototype style
This commit is contained in:
@@ -84,8 +84,7 @@ static SDL_GetPowerInfo_Impl implementations[] = {
|
||||
};
|
||||
#endif
|
||||
|
||||
SDL_PowerState
|
||||
SDL_GetPowerInfo(int *seconds, int *percent)
|
||||
SDL_PowerState SDL_GetPowerInfo(int *seconds, int *percent)
|
||||
{
|
||||
#ifndef SDL_POWER_DISABLED
|
||||
const int total = sizeof(implementations) / sizeof(implementations[0]);
|
||||
|
||||
@@ -27,8 +27,7 @@
|
||||
|
||||
#include "../../core/android/SDL_android.h"
|
||||
|
||||
SDL_bool
|
||||
SDL_GetPowerInfo_Android(SDL_PowerState *state, int *seconds, int *percent)
|
||||
SDL_bool SDL_GetPowerInfo_Android(SDL_PowerState *state, int *seconds, int *percent)
|
||||
{
|
||||
int battery;
|
||||
int plugged;
|
||||
|
||||
@@ -25,8 +25,7 @@
|
||||
|
||||
#include <emscripten/html5.h>
|
||||
|
||||
SDL_bool
|
||||
SDL_GetPowerInfo_Emscripten(SDL_PowerState *state, int *seconds, int *percent)
|
||||
SDL_bool SDL_GetPowerInfo_Emscripten(SDL_PowerState *state, int *seconds, int *percent)
|
||||
{
|
||||
EmscriptenBatteryEvent batteryState;
|
||||
int haveBattery = 0;
|
||||
|
||||
@@ -40,8 +40,7 @@
|
||||
#define APM_DEVICE_ALL 1
|
||||
#define APM_BIOS_CALL (B_DEVICE_OP_CODES_END + 3)
|
||||
|
||||
SDL_bool
|
||||
SDL_GetPowerInfo_Haiku(SDL_PowerState *state, int *seconds, int *percent)
|
||||
SDL_bool SDL_GetPowerInfo_Haiku(SDL_PowerState *state, int *seconds, int *percent)
|
||||
{
|
||||
const int fd = open("/dev/misc/apm", O_RDONLY | O_CLOEXEC);
|
||||
SDL_bool need_details = SDL_FALSE;
|
||||
|
||||
@@ -228,9 +228,7 @@ static void check_proc_acpi_ac_adapter(const char *node, SDL_bool *have_ac)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_GetPowerInfo_Linux_proc_acpi(SDL_PowerState *state,
|
||||
int *seconds, int *percent)
|
||||
SDL_bool SDL_GetPowerInfo_Linux_proc_acpi(SDL_PowerState *state, int *seconds, int *percent)
|
||||
{
|
||||
struct dirent *dent = NULL;
|
||||
DIR *dirp = NULL;
|
||||
@@ -313,9 +311,7 @@ static SDL_bool int_string(char *str, int *val)
|
||||
}
|
||||
|
||||
/* http://lxr.linux.no/linux+v2.6.29/drivers/char/apm-emulation.c */
|
||||
SDL_bool
|
||||
SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState *state,
|
||||
int *seconds, int *percent)
|
||||
SDL_bool SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState *state, int *seconds, int *percent)
|
||||
{
|
||||
SDL_bool need_details = SDL_FALSE;
|
||||
int ac_status = 0;
|
||||
@@ -421,8 +417,7 @@ SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState *state,
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *state, int *seconds, int *percent)
|
||||
SDL_bool SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *state, int *seconds, int *percent)
|
||||
{
|
||||
const char *base = sys_class_power_supply_path;
|
||||
struct dirent *dent;
|
||||
@@ -611,8 +606,7 @@ static void check_upower_device(DBusConnection *conn, const char *path, SDL_Powe
|
||||
}
|
||||
#endif
|
||||
|
||||
SDL_bool
|
||||
SDL_GetPowerInfo_Linux_org_freedesktop_upower(SDL_PowerState *state, int *seconds, int *percent)
|
||||
SDL_bool SDL_GetPowerInfo_Linux_org_freedesktop_upower(SDL_PowerState *state, int *seconds, int *percent)
|
||||
{
|
||||
SDL_bool retval = SDL_FALSE;
|
||||
|
||||
|
||||
@@ -136,8 +136,7 @@ static void checkps(CFDictionaryRef dict, SDL_bool *have_ac, SDL_bool *have_batt
|
||||
#undef GETVAL
|
||||
#undef STRMATCH
|
||||
|
||||
SDL_bool
|
||||
SDL_GetPowerInfo_MacOSX(SDL_PowerState *state, int *seconds, int *percent)
|
||||
SDL_bool SDL_GetPowerInfo_MacOSX(SDL_PowerState *state, int *seconds, int *percent)
|
||||
{
|
||||
CFTypeRef blob = IOPSCopyPowerSourcesInfo();
|
||||
|
||||
|
||||
@@ -25,15 +25,14 @@
|
||||
|
||||
#include <3ds.h>
|
||||
|
||||
SDL_FORCE_INLINE SDL_PowerState GetPowerState(void);
|
||||
SDL_FORCE_INLINE int ReadStateFromPTMU(bool *is_plugged, u8 *is_charging);
|
||||
SDL_FORCE_INLINE int GetBatteryPercentage(void);
|
||||
static SDL_PowerState GetPowerState(void);
|
||||
static int ReadStateFromPTMU(bool *is_plugged, u8 *is_charging);
|
||||
static int GetBatteryPercentage(void);
|
||||
|
||||
#define BATTERY_PERCENT_REG 0xB
|
||||
#define BATTERY_PERCENT_REG_SIZE 2
|
||||
|
||||
SDL_bool
|
||||
SDL_GetPowerInfo_N3DS(SDL_PowerState *state, int *seconds, int *percent)
|
||||
SDL_bool SDL_GetPowerInfo_N3DS(SDL_PowerState *state, int *seconds, int *percent)
|
||||
{
|
||||
*state = GetPowerState();
|
||||
*percent = GetBatteryPercentage();
|
||||
@@ -42,8 +41,7 @@ SDL_GetPowerInfo_N3DS(SDL_PowerState *state, int *seconds, int *percent)
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
SDL_FORCE_INLINE SDL_PowerState
|
||||
GetPowerState(void)
|
||||
static SDL_PowerState GetPowerState(void)
|
||||
{
|
||||
bool is_plugged;
|
||||
u8 is_charging;
|
||||
@@ -63,8 +61,7 @@ GetPowerState(void)
|
||||
return SDL_POWERSTATE_ON_BATTERY;
|
||||
}
|
||||
|
||||
SDL_FORCE_INLINE int
|
||||
ReadStateFromPTMU(bool *is_plugged, u8 *is_charging)
|
||||
static int ReadStateFromPTMU(bool *is_plugged, u8 *is_charging)
|
||||
{
|
||||
if (R_FAILED(ptmuInit())) {
|
||||
return SDL_SetError("Failed to initialise PTMU service");
|
||||
@@ -84,8 +81,7 @@ ReadStateFromPTMU(bool *is_plugged, u8 *is_charging)
|
||||
return 0;
|
||||
}
|
||||
|
||||
SDL_FORCE_INLINE int
|
||||
GetBatteryPercentage(void)
|
||||
static int GetBatteryPercentage(void)
|
||||
{
|
||||
u8 data[BATTERY_PERCENT_REG_SIZE];
|
||||
|
||||
|
||||
@@ -26,9 +26,7 @@
|
||||
|
||||
#include <psppower.h>
|
||||
|
||||
SDL_bool
|
||||
SDL_GetPowerInfo_PSP(SDL_PowerState *state, int *seconds,
|
||||
int *percent)
|
||||
SDL_bool SDL_GetPowerInfo_PSP(SDL_PowerState *state, int *seconds, int *percent)
|
||||
{
|
||||
int battery = scePowerIsBatteryExist();
|
||||
int plugged = scePowerIsPowerOnline();
|
||||
|
||||
@@ -50,8 +50,7 @@ void SDL_UIKit_UpdateBatteryMonitoring(void)
|
||||
}
|
||||
#endif /* !TARGET_OS_TV */
|
||||
|
||||
SDL_bool
|
||||
SDL_GetPowerInfo_UIKit(SDL_PowerState *state, int *seconds, int *percent)
|
||||
SDL_bool SDL_GetPowerInfo_UIKit(SDL_PowerState *state, int *seconds, int *percent)
|
||||
{
|
||||
#if TARGET_OS_TV
|
||||
*state = SDL_POWERSTATE_NO_BATTERY;
|
||||
|
||||
@@ -26,9 +26,7 @@
|
||||
|
||||
#include <psp2/power.h>
|
||||
|
||||
SDL_bool
|
||||
SDL_GetPowerInfo_VITA(SDL_PowerState *state, int *seconds,
|
||||
int *percent)
|
||||
SDL_bool SDL_GetPowerInfo_VITA(SDL_PowerState *state, int *seconds, int *percent)
|
||||
{
|
||||
int battery = 1;
|
||||
int plugged = scePowerIsPowerOnline();
|
||||
|
||||
@@ -25,8 +25,7 @@
|
||||
|
||||
#include "../../core/windows/SDL_windows.h"
|
||||
|
||||
SDL_bool
|
||||
SDL_GetPowerInfo_Windows(SDL_PowerState *state, int *seconds, int *percent)
|
||||
SDL_bool SDL_GetPowerInfo_Windows(SDL_PowerState *state, int *seconds, int *percent)
|
||||
{
|
||||
SYSTEM_POWER_STATUS status;
|
||||
SDL_bool need_details = SDL_FALSE;
|
||||
|
||||
Reference in New Issue
Block a user