File: DynamicInputTextures.md

package info (click to toggle)
dolphin-emu 2512%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 76,328 kB
  • sloc: cpp: 499,023; ansic: 119,674; python: 6,547; sh: 2,338; makefile: 1,093; asm: 726; pascal: 257; javascript: 183; perl: 97; objc: 75; xml: 30
file content (204 lines) | stat: -rw-r--r-- 7,132 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# Dolphin Dynamic Input Textures Specification (v1)

## Format
Dynamic Input Textures are generated textures based on a user's input formed from a group of png files and json files.

```
\__ Dolphin User Directory
    \__ Load (Directory)
        \__ DynamicInputTextures (Directory)
            \__ FOLDER (Directory)
                \__ PNG and JSON GO HERE
```

``FOLDER`` can be one or multiple directories which are named after:
* a complete Game ID (e.g. ``SMNE01`` for "New Super Mario Bros. Wii (NTSC)")
* one without a region (e.g. ``SMN`` for "New Super Mario Bros. Wii (All regions)").
* Any folder name but with an empty ``<GAMEID>.txt`` underneath it

## How to enable

Place the files in the format above and ensure that "Load Custom Textures" is enabled under the advanced tab of the graphics settings.

### PNG files

At a minimum two images are required to support the generation and any number of 'button' images.  These need to be in PNG format.

### JSON files

You need at least a single json file that describes the generation parameters.  You may have multiple JSON files if you prefer that from an organizational standpoint.

#### Possible fields in the JSON for a texture

In each json, one or more generated textures can be specified.  Each of those textures can have the following fields:

|Identifier               |Required | Since |
|-------------------------|---------|-------|
|``image``                | **Yes** | v1    |
|``emulated_controls``    | **Yes** | v1    |
|``host_controls``        | No      | v1    |

*image* - the image that has the input buttons you wish to replace, can be upscaled/redrawn if desired.

*emulated_controls* - a map of emulated devices (ex: ``Wiimote1``, ``GCPad2``) each with their own section of emulated buttons that map to an array of "regions".  Each region is a rectangle defined as a json array of four entries.  The rectangle bounds are offsets into the image where the replacement occurs (left-coordinate, top-coordinate, right-coordinate, bottom-coordinate).

*host_controls* - a map of devices (ex: ``DInput/0/Keyboard Mouse``, ``XInput/1/Gamepad``, or blank for wildcard) each with their own section of host buttons (keyboard or gamepad values) that each map to an image. This image will act as a replacement in the original image if this key is mapped to one of the buttons under the ``emulated_controls`` section.  Required if ``default_host_controls`` is not defined in the global section.

#### Global fields in the JSON applied to all textures

The following fields apply to all textures in the json file:

|Identifier               | Since |
|-------------------------|-------|
|``generated_folder_name``| v1    |
|``preserve_aspect_ratio``| v1    |
|``default_host_controls``| v1    |

*generated_folder_name* - the folder name that the textures will be generated into.  Optional, defaults to '<gameid>_Generated'

*preserve_aspect_ratio* - will preserve the aspect ratio when replacing the colored boxes with the image.  Optional, defaults to on

*default_host_controls* - a default map of devices to a map of host controls (keyboard or gamepad values) that each maps to an image.

#### Examples

Here's an example of generating a single image with the "A" and "B" Wiimote1 buttons replaced to either keyboard buttons or gamepad buttons depending on the user device and the input mapped:

```js
{
    "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"
                }
            }
        }
    }
}
```

As an example, you are writing a pack for a single-player game.  You may want to provide DS4 controller icons but not care what device the user is using.  You can use a wildcard for that:

```js
{
    "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"
                }
            }
        }
    }
}
```

Here's an example of generating multiple images but using defaults from the global section except for one texture:

```js
{
    "default_host_controls": {
        "DInput/0/Keyboard Mouse": {
            "A": "keyboard/a.png",
            "B": "keyboard/b.png"
        }
    },
    "default_device": "DInput/0/Keyboard Mouse",
    "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"
                }
            }
        }
    }
}
```