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

# Dynamic Input Textures

> Generate game textures dynamically based on user input devices

## Overview

Dynamic Input Textures allow texture packs to automatically display correct button prompts based on the user's actual input device - showing keyboard keys, Xbox buttons, PlayStation buttons, or other controller types as appropriate.

## How It Works

The system replaces rectangular regions in game textures with input-specific button images. When you press 'A' on a Wiimote mapped to 'X' on an Xbox controller, the game will display an Xbox 'X' button instead of a generic 'A' prompt.

## Setup

### Directory Structure

```
Dolphin User Directory/
  └── Load/
      └── DynamicInputTextures/
          └── GAMEID/
              ├── config.json
              ├── base_texture.png
              ├── keyboard/
              │   ├── a.png
              │   └── b.png
              └── gamepad/
                  ├── a.png
                  └── b.png
```

### Game ID Naming

Folder names can be:

* **Complete Game ID**: `SMNE01` (New Super Mario Bros. Wii NTSC)
* **Region-agnostic ID**: `SMN` (New Super Mario Bros. Wii, all regions)
* **Any name with empty `GAMEID.txt`** file underneath

### Enable Custom Textures

<Note>
  Enable "Load Custom Textures" in Graphics Settings > Advanced tab for dynamic input textures to work.
</Note>

## JSON Configuration

### Required Fields

<ResponseField name="image" type="string" required>
  Base texture PNG file containing regions to replace
</ResponseField>

<ResponseField name="emulated_controls" type="object" required>
  Map of emulated devices to button regions
</ResponseField>

<ResponseField name="host_controls" type="object">
  Map of host devices to button images (required if `default_host_controls` not set)
</ResponseField>

### Global Fields

<ResponseField name="generated_folder_name" type="string">
  Output folder name (default: `<gameid>_Generated`)
</ResponseField>

<ResponseField name="preserve_aspect_ratio" type="boolean">
  Maintain button image aspect ratios (default: `true`)
</ResponseField>

<ResponseField name="default_host_controls" type="object">
  Default device-to-image mappings applied to all textures
</ResponseField>

## Complete Examples

### Basic Configuration

<CodeGroup>
  ```json Keyboard and Gamepad Support theme={null}
  {
    "generated_folder_name": "MyDynamicTexturePack",
    "preserve_aspect_ratio": false,
    "output_textures": {
      "tex1_128x128_02870c3b015d8b40_5.png": {
        "image": "icons.png",
        "emulated_controls": {
          "Wiimote1": {
            "Buttons/A": [
              [0, 0, 30, 30],
              [500, 550, 530, 580]
            ],
            "Buttons/B": [
              [100, 342, 132, 374]
            ]
          }
        },
        "host_controls": {
          "DInput/0/Keyboard Mouse": {
            "A": "keyboard/a.png",
            "B": "keyboard/b.png"
          },
          "XInput/0/Gamepad": {
            "`Button A`": "gamepad/a.png",
            "`Button B`": "gamepad/b.png"
          }
        }
      }
    }
  }
  ```

  ```json Wildcard Device (DS4 Icons) theme={null}
  {
    "preserve_aspect_ratio": false,
    "output_textures": {
      "tex1_128x128_02870c3b015d8b40_5.png": {
        "image": "icons.png",
        "emulated_controls": {
          "Wiimote1": {
            "Buttons/A": [
              [0, 0, 30, 30],
              [500, 550, 530, 580]
            ],
            "Buttons/B": [
              [100, 342, 132, 374]
            ]
          }
        },
        "host_controls": {
          "": {
            "`Button X`": "ds4/x.png",
            "`Button Y`": "ds4/y.png"
          }
        }
      }
    }
  }
  ```

  ```json Multiple Textures with Defaults theme={null}
  {
    "default_host_controls": {
      "DInput/0/Keyboard Mouse": {
        "A": "keyboard/a.png",
        "B": "keyboard/b.png"
      }
    },
    "output_textures": {
      "tex1_21x26_5cbc6943a74cb7ca_67a541879d5fe615_9.png": {
        "image": "icons1.png",
        "emulated_controls": {
          "Wiimote1": {
            "Buttons/A": [[62, 0, 102, 40]],
            "Buttons/B": [[100, 342, 132, 374]]
          }
        }
      },
      "tex1_21x26_5e71c27dad9cda76_3d76bd5d1e73c3b1_9.png": {
        "image": "icons2.png",
        "emulated_controls": {
          "Wiimote1": {
            "Buttons/A": [[857, 682, 907, 732]],
            "Buttons/B": [[100, 342, 132, 374]]
          }
        }
      },
      "tex1_24x24_003f3a17f66f1704_82848f47946caa41_9.png": {
        "image": "icons3.png",
        "emulated_controls": {
          "Wiimote1": {
            "Buttons/A": [
              [0, 0, 30, 30],
              [500, 550, 530, 580]
            ],
            "Buttons/B": [[100, 342, 132, 374]]
          }
        },
        "host_controls": {
          "DInput/0/Keyboard Mouse": {
            "A": "keyboard/a_special.png",
            "B": "keyboard/b.png"
          }
        }
      }
    }
  }
  ```
</CodeGroup>

## Understanding Regions

Regions define rectangular areas in the base image to replace with button icons. Each region is an array of four coordinates:

```json theme={null}
[left, top, right, bottom]
```

### Multiple Regions

One button can replace multiple regions in the same texture:

```json theme={null}
"Buttons/A": [
  [0, 0, 30, 30],      // Top-left corner
  [500, 550, 530, 580], // Bottom-right area
  [250, 100, 280, 130]  // Center area
]
```

<Warning>
  Coordinates are pixel offsets into the base image. Ensure they don't exceed image dimensions.
</Warning>

## Emulated Device Names

### GameCube Controllers

* `GCPad1`, `GCPad2`, `GCPad3`, `GCPad4`

### Wiimotes

* `Wiimote1`, `Wiimote2`, `Wiimote3`, `Wiimote4`

### Button Path Examples

<AccordionGroup>
  <Accordion title="Wiimote Buttons">
    ```
    Buttons/A
    Buttons/B
    Buttons/1
    Buttons/2
    Buttons/+
    Buttons/-
    Buttons/Home
    ```
  </Accordion>

  <Accordion title="GameCube Buttons">
    ```
    Buttons/A
    Buttons/B
    Buttons/X
    Buttons/Y
    Buttons/Z
    Buttons/Start
    ```
  </Accordion>

  <Accordion title="D-Pad">
    ```
    D-Pad/Up
    D-Pad/Down
    D-Pad/Left
    D-Pad/Right
    ```
  </Accordion>

  <Accordion title="Analog Sticks">
    ```
    Main Stick/Up
    Main Stick/Down
    C-Stick/Up
    C-Stick/Down
    ```
  </Accordion>
</AccordionGroup>

## Host Device Strings

### Keyboard

```json theme={null}
"DInput/0/Keyboard Mouse": {
  "A": "keyboard/a.png",
  "SPACE": "keyboard/space.png",
  "RETURN": "keyboard/enter.png"
}
```

### Xbox Controllers

```json theme={null}
"XInput/0/Gamepad": {
  "`Button A`": "xbox/a.png",
  "`Button B`": "xbox/b.png",
  "`Button X`": "xbox/x.png",
  "`Button Y`": "xbox/y.png"
}
```

### Wildcard (Any Device)

```json theme={null}
"": {
  "`Button A`": "generic/a.png"
}
```

<Note>
  Gamepad button names use backticks: `` `Button A` ``, `` `Button X` ``, etc.
</Note>

## Image Requirements

### Base Texture

* PNG format required
* Should be the game texture you're modifying
* Can be upscaled or redrawn versions

### Button Images

* PNG format required
* Transparent backgrounds recommended
* Will be scaled to fit regions (unless `preserve_aspect_ratio: true`)

## Creating a Pack

<Steps>
  <Step title="Dump Game Textures">
    Enable "Dump Textures" in Graphics Settings and play the game to capture textures with button prompts
  </Step>

  <Step title="Create Button Assets">
    Design PNG images for each button on each input device type you want to support
  </Step>

  <Step title="Identify Regions">
    Open base textures in an image editor and note the pixel coordinates of button prompt locations
  </Step>

  <Step title="Write Configuration">
    Create JSON file mapping emulated controls to regions and host controls to images
  </Step>

  <Step title="Test">
    Load the game with different controller types and verify correct button images appear
  </Step>
</Steps>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Textures Not Appearing">
    * Verify "Load Custom Textures" is enabled
    * Check folder is named correctly (matching Game ID)
    * Ensure JSON has no syntax errors
    * Verify `output_textures` keys match actual game texture filenames
  </Accordion>

  <Accordion title="Wrong Buttons Showing">
    * Check host device string matches your controller type
    * Verify button name mapping is correct
    * Use wildcard `""` device if specific device detection fails
  </Accordion>

  <Accordion title="Images Stretched or Distorted">
    * Set `"preserve_aspect_ratio": true`
    * Adjust region dimensions to match button image aspect ratios
    * Ensure button PNGs are the correct resolution
  </Accordion>
</AccordionGroup>

## Related Topics

<CardGroup cols={2}>
  <Card title="Resource Packs" icon="box" href="/advanced/resource-packs">
    Package custom textures for distribution
  </Card>

  <Card title="Graphics Mods" icon="palette" href="/advanced/graphics-mods">
    Modify rendering behavior and effects
  </Card>
</CardGroup>
