---
name: "SDL_SetGamepadMapping"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_SetGamepadMapping"
---

# SDL\_SetGamepadMapping(3)

Set the current mapping of a joystick or gamepad.

## NAME

SDL\_SetGamepadMapping - Set the current mapping of a joystick or gamepad.

## HEADER FILE

Defined in SDL3/SDL\_gamepad.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**bool SDL\_SetGamepadMapping(SDL\_JoystickID instance\_id, const char \*mapping);**

## DESCRIPTION

Details about mappings are discussed with

**SDL\_AddGamepadMapping** ().

## FUNCTION PARAMETERS

- *instance\_id*

  the joystick instance ID.

- *mapping*

  the mapping to use for this device, or NULL to clear the mapping.

## RETURN VALUE

Returns true on success or false on failure; call

**SDL\_GetError** () for more information.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_AddGamepadMapping**(3)](/SDL_AddGamepadMapping/3.md), **•**(3), [**SDL\_GetGamepadMapping**(3)](/SDL_GetGamepadMapping/3.md)
