Debian Codegraph @

docs/DynamicInputTextures.md

raw symbols SCIP
1 # Dolphin Dynamic Input Textures Specification (v1)
2
3 ## Format
4 Dynamic Input Textures are generated textures based on a user's input formed from a group of png files and json files.
5
6 ```
7 \__ Dolphin User Directory
8 \__ Load (Directory)
9 \__ DynamicInputTextures (Directory)
10 \__ FOLDER (Directory)
11 \__ PNG and JSON GO HERE
12 ```
13
14 ``FOLDER`` can be one or multiple directories which are named after:
15 * a complete Game ID (e.g. ``SMNE01`` for "New Super Mario Bros. Wii (NTSC)")
16 * one without a region (e.g. ``SMN`` for "New Super Mario Bros. Wii (All regions)").
17 * Any folder name but with an empty ``<GAMEID>.txt`` underneath it
18
19 ## How to enable
20
21 Place the files in the format above and ensure that "Load Custom Textures" is enabled under the advanced tab of the graphics settings.
22
23 ### PNG files
24
25 At a minimum two images are required to support the generation and any number of 'button' images. These need to be in PNG format.
26
27 ### JSON files
28
29 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.
30
31 #### Possible fields in the JSON for a texture
32
33 In each json, one or more generated textures can be specified. Each of those textures can have the following fields:
34
35 |Identifier |Required | Since |
36 |-------------------------|---------|-------|
37 |``image`` | **Yes** | v1 |
38 |``emulated_controls`` | **Yes** | v1 |
39 |``host_controls`` | No | v1 |
40
41 *image* - the image that has the input buttons you wish to replace, can be upscaled/redrawn if desired.
42
43 *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).
44
45 *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.
46
47 #### Global fields in the JSON applied to all textures
48
49 The following fields apply to all textures in the json file:
50
51 |Identifier | Since |
52 |-------------------------|-------|
53 |``generated_folder_name``| v1 |
54 |``preserve_aspect_ratio``| v1 |
55 |``default_host_controls``| v1 |
56
57 *generated_folder_name* - the folder name that the textures will be generated into. Optional, defaults to '<gameid>_Generated'
58
59 *preserve_aspect_ratio* - will preserve the aspect ratio when replacing the colored boxes with the image. Optional, defaults to on
60
61 *default_host_controls* - a default map of devices to a map of host controls (keyboard or gamepad values) that each maps to an image.
62
63 #### Examples
64
65 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:
66
67 ```js
68 {
69 "generated_folder_name": "MyDynamicTexturePack",
70 "preserve_aspect_ratio": false,
71 "output_textures":
72 {
73 "tex1_128x128_02870c3b015d8b40_5.png":
74 {
75 "image": "icons.png",
76 "emulated_controls": {
77 "Wiimote1":
78 {
79 "Buttons/A": [
80 [0, 0, 30, 30],
81 [500, 550, 530, 580],
82 ]
83 "Buttons/B": [
84 [100, 342, 132, 374]
85 ]
86 }
87 },
88 "host_controls": {
89 "DInput/0/Keyboard Mouse": {
90 "A": "keyboard/a.png",
91 "B": "keyboard/b.png"
92 },
93 "XInput/0/Gamepad": {
94 "`Button A`": "gamepad/a.png",
95 "`Button B`": "gamepad/b.png"
96 }
97 }
98 }
99 }
100 }
101 ```
102
103 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:
104
105 ```js
106 {
107 "preserve_aspect_ratio": false,
108 "output_textures":
109 {
110 "tex1_128x128_02870c3b015d8b40_5.png":
111 {
112 "image": "icons.png",
113 "emulated_controls": {
114 "Wiimote1":
115 {
116 "Buttons/A": [
117 [0, 0, 30, 30],
118 [500, 550, 530, 580]
119 ]
120 "Buttons/B": [
121 [100, 342, 132, 374]
122 ]
123 }
124 },
125 "host_controls": {
126 "": {
127 "`Button X`": "ds4/x.png",
128 "`Button Y`": "ds4/y.png"
129 }
130 }
131 }
132 }
133 }
134 ```
135
136 Here's an example of generating multiple images but using defaults from the global section except for one texture:
137
138 ```js
139 {
140 "default_host_controls": {
141 "DInput/0/Keyboard Mouse": {
142 "A": "keyboard/a.png",
143 "B": "keyboard/b.png"
144 }
145 },
146 "default_device": "DInput/0/Keyboard Mouse",
147 "output_textures":
148 {
149 "tex1_21x26_5cbc6943a74cb7ca_67a541879d5fe615_9.png":
150 {
151 "image": "icons1.png",
152 "emulated_controls": {
153 "Wiimote1":
154 {
155 "Buttons/A": [
156 [62, 0, 102, 40]
157 ]
158 "Buttons/B": [
159 [100, 342, 132, 374]
160 ]
161 }
162 }
163 },
164 "tex1_21x26_5e71c27dad9cda76_3d76bd5d1e73c3b1_9.png":
165 {
166 "image": "icons2.png",
167 "emulated_controls": {
168 "Wiimote1":
169 {
170 "Buttons/A": [
171 [857, 682, 907, 732]
172 ]
173 "Buttons/B": [
174 [100, 342, 132, 374]
175 ]
176 }
177 }
178 },
179 "tex1_24x24_003f3a17f66f1704_82848f47946caa41_9.png":
180 {
181 "image": "icons3.png",
182 "emulated_controls": {
183 "Wiimote1":
184 {
185 "Buttons/A": [
186 [0, 0, 30, 30],
187 [500, 550, 530, 580]
188 ]
189 "Buttons/B": [
190 [100, 342, 132, 374]
191 ]
192 }
193 },
194 "host_controls":
195 {
196 "DInput/0/Keyboard Mouse": {
197 "A": "keyboard/a_special.png",
198 "B": "keyboard/b.png"
199 }
200 }
201 }
202 }
203 }
204 ```