> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GetExtraButtonIndexes

> GetExtraButtonIndexes

# GetExtraButtonIndexes

Gets the controller button indexes of the extra buttons on the device for a given input kind.

## Syntax

```cpp theme={null}
HRESULT GetExtraButtonIndexes(
    GameInputKind inputKind,
    uint32_t extraButtonCount,
    uint8_t* extraButtonIndexes
);
```

### Parameters

*inputKind*   \_In\_\
Type: GameInputKind

The input kind whose extra button indexes are being requested.

*extraButtonCount*   \_In\_\
Type: uint32\_t

Expected count of button indexes for extra buttons.
This number can be retrieved by calling  [GetExtraButtonCount](/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getextrabuttoncount).

*extraButtonIndexes*   \_Out\_writes\_(extraButtonCount)\_\
Type: uint8\_t\*

Pointer to the array of button indexes.

### Return value

Type: HRESULT

Function result.

## Remarks

Extra buttons are controller buttons that exist on the physical device but are not part of the standard mapping for the specified input kind.

Before calling this method, you should first call [GetExtraButtonCount](/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getextrabuttoncount) to determine how many extra buttons are available and pass that count as the extraButtonCount parameter.

The next code snippet demonstrates how to make use of a gamepad's extra buttons:

```cpp theme={null}
bool GetGamepadExtraButtonValues(
    std::vector<bool>* extraButtons,
    IGameInputReading* reading) noexcept
{
    Mwrl::ComPtr<IGameInputDevice> device;
    reading->GetDevice(&device);

    uint32_t extraButtonCount = 0;
    if (FAILED(device->GetExtraButtonCount(GameInputKindGamepad, &extraButtonCount)))
    {
        return false;
    }

    std::vector<uint8_t> buttonIndexes(extraButtonCount);
    extraButtons->resize(extraButtonCount);
    if (FAILED(device->GetExtraButtonIndexes(
        GameInputKindGamepad,
        extraButtonCount,
        buttonIndexes.data())))
    {
        return false;
    }

    std::vector<bool> buttonStates(reading->GetControllerButtonCount());
    reading->GetControllerButtonState(static_cast<uint32_t>(buttonStates.size()), buttonStates.data());

    for (size_t i = 0; i < buttonIndexes.size(); ++i)
    {
        if (buttonIndexes[i] < buttonStates.size())
        {
            (*extraButtons)[i] = buttonStates[buttonIndexes[i]];
        }
    }

    return true;
}
```

## Requirements

**Header:** GameInput.h

**Library:** gameinput.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## See also

[GameInputKind](/reference/input/gameinput/enums/gameinputkind)<br />
[GetExtraButtonCount](/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getextrabuttoncount)<br />
[GetExtraAxisIndexes](/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getextraaxisindexes)<br />
[IGameInputDevice](/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice)

## Version History

| Version | Changes     |
| ------- | ----------- |
| **v3**  | Introduced. |


## Related topics

- [GetExtraButtonCount](/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getextrabuttoncount.md)
- [GetExtraAxisIndexes](/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getextraaxisindexes.md)
- [IGameInputDevice](/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)
- [GetExtraAxisCount](/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getextraaxiscount.md)
- [GameInputRacingWheelInfo](/reference/input/gameinput/structs/gameinputracingwheelinfo.md)
