sdlGetGamepadPath function gamepad

String? sdlGetGamepadPath(
  1. Pointer<SdlGamepad> gamepad
)

Get the implementation-dependent path for an opened gamepad.

\param gamepad a gamepad identifier previously returned by SDL_OpenGamepad(). \returns the implementation dependent path for the gamepad, or NULL if there is no path or the identifier passed is invalid.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.2.0.

\sa SDL_GetGamepadPathForID

extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadPath(SDL_Gamepad *gamepad)

Implementation

String? sdlGetGamepadPath(Pointer<SdlGamepad> gamepad) {
  final sdlGetGamepadPathLookupFunction = _libSdl
      .lookupFunction<
        Pointer<Utf8> Function(Pointer<SdlGamepad> gamepad),
        Pointer<Utf8> Function(Pointer<SdlGamepad> gamepad)
      >('SDL_GetGamepadPath');
  final result = sdlGetGamepadPathLookupFunction(gamepad);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}