I’m trying to retrieve SDL_Joystick powerlevel of PS3/PS4 and XBOX One gamecontrollers using the call:
SDL_GameController *gamecontroller = SDL_GameControllerOpen (event.cdevice.which);
SDL_Joystick *joystick = SDL_GameControllerGetJoystick (gamecontroller);
SDL_JoystickPowerLevel plevel = SDL_JoystickCurrentPowerLevel (joystick);
But the unique enum I get is: SDL_JOYSTICK_POWERLEVEL_UNKNOWN
.
SDL_GetError()
sometimes report ERROR: GameControllerInfo: SDL_JoystickCurrentPowerLevel(): Invalid RWops
or Haptic: Unable to get device's features: Invalid argument
.
The full source code is here gp.c (7.5 KB)