1 // license:BSD-3-Clause
2 // copyright-holders:Maurizio Petrarota
3 /*********************************************************************
4 
5     ui/cmddata.h
6 
7 *********************************************************************/
8 #ifndef MAME_EMU_UI_CMDDATA_H
9 #define MAME_EMU_UI_CMDDATA_H
10 
11 #pragma once
12 
13 #define BUTTON_COLOR_RED        rgb_t(255,64,64)
14 #define BUTTON_COLOR_YELLOW     rgb_t(255,238,0)
15 #define BUTTON_COLOR_GREEN      rgb_t(0,255,64)
16 #define BUTTON_COLOR_BLUE       rgb_t(0,170,255)
17 #define BUTTON_COLOR_PURPLE     rgb_t(170,0,255)
18 #define BUTTON_COLOR_PINK       rgb_t(255,0,170)
19 #define BUTTON_COLOR_AQUA       rgb_t(0,255,204)
20 #define BUTTON_COLOR_SILVER     rgb_t(255,0,255)
21 #define BUTTON_COLOR_NAVY       rgb_t(255,160,0)
22 #define BUTTON_COLOR_LIME       rgb_t(190,190,190)
23 
24 enum
25 {
26 	B_COLOR_RED,
27 	B_COLOR_YELLOW,
28 	B_COLOR_GREEN,
29 	B_COLOR_BLUE,
30 	B_COLOR_PURPLE,
31 	B_COLOR_PINK,
32 	B_COLOR_AQUA,
33 	B_COLOR_SILVER,
34 	B_COLOR_NAVY,
35 	B_COLOR_LIME,
36 	MAX_COLORTABLE
37 };
38 
39 // command.dat symbols assigned to Unicode PUA U+E000
40 #define COMMAND_UNICODE (0xe000)
41 #define MAX_GLYPH_FONT  (150)
42 
43 // Define Game Command Font Converting Conditions
44 #define COMMAND_DEFAULT_TEXT    '_'
45 
46 // Define Expanded Game Command ShortCut
47 #define COMMAND_EXPAND_TEXT  '^'
48 
49 // Define Simple Game Command ShortCut
50 #define COMMAND_CONVERT_TEXT    '@'
51 
52 // Defined Game Command Font Color Array
53 static rgb_t const color_table[] =
54 {
55 	0,                   // dummy
56 	BUTTON_COLOR_RED,    // BTN_A
57 	BUTTON_COLOR_YELLOW, // BTN_B
58 	BUTTON_COLOR_GREEN,  // BTN_C
59 	BUTTON_COLOR_BLUE,   // BTN_D
60 	BUTTON_COLOR_PINK,   // BTN_E
61 	BUTTON_COLOR_PURPLE, // BTN_F
62 	BUTTON_COLOR_AQUA,   // BTN_G
63 	BUTTON_COLOR_SILVER, // BTN_H
64 	BUTTON_COLOR_NAVY,   // BTN_I
65 	BUTTON_COLOR_LIME,   // BTN_J
66 	BUTTON_COLOR_RED,    // BTN_K
67 	BUTTON_COLOR_YELLOW, // BTN_L
68 	BUTTON_COLOR_GREEN,  // BTN_M
69 	BUTTON_COLOR_BLUE,   // BTN_N
70 	BUTTON_COLOR_PINK,   // BTN_O
71 	BUTTON_COLOR_PURPLE, // BTN_P
72 	BUTTON_COLOR_AQUA,   // BTN_Q
73 	BUTTON_COLOR_SILVER, // BTN_R
74 	BUTTON_COLOR_NAVY,   // BTN_S
75 	BUTTON_COLOR_LIME,   // BTN_T
76 	BUTTON_COLOR_RED,    // BTN_U
77 	BUTTON_COLOR_YELLOW, // BTN_V
78 	BUTTON_COLOR_GREEN,  // BTN_W
79 	BUTTON_COLOR_BLUE,   // BTN_X
80 	BUTTON_COLOR_PINK,   // BTN_Y
81 	BUTTON_COLOR_PURPLE, // BTN_Z
82 	BUTTON_COLOR_RED,    // BTN_1
83 	BUTTON_COLOR_YELLOW, // BTN_2
84 	BUTTON_COLOR_GREEN,  // BTN_3
85 	BUTTON_COLOR_BLUE,   // BTN_4
86 	BUTTON_COLOR_PINK,   // BTN_5
87 	BUTTON_COLOR_PURPLE, // BTN_6
88 	BUTTON_COLOR_AQUA,   // BTN_7
89 	BUTTON_COLOR_SILVER, // BTN_8
90 	BUTTON_COLOR_NAVY,   // BTN_9
91 	BUTTON_COLOR_LIME,   // BTN_10
92 	BUTTON_COLOR_BLUE,   // BTN_DEC
93 	BUTTON_COLOR_RED,    // BTN_INC
94 	0,                   // BTN_+
95 	0,                   // DIR_...
96 	0,                   // DIR_1
97 	0,                   // DIR_2
98 	0,                   // DIR_3
99 	0,                   // DIR_4
100 	BUTTON_COLOR_RED,    // Joystick Ball
101 	0,                   // DIR_6
102 	0,                   // DIR_7
103 	0,                   // DIR_8
104 	0,                   // DIR_9
105 	0,                   // DIR_N
106 	BUTTON_COLOR_RED,    // BTN_START
107 	BUTTON_COLOR_YELLOW, // BTN_SELECT
108 	BUTTON_COLOR_PINK,   // BTN_PUNCH
109 	BUTTON_COLOR_PURPLE, // BTN_KICK
110 	BUTTON_COLOR_BLUE,   // BTN_GUARD
111 	0,
112 	BUTTON_COLOR_YELLOW, // Light Punch
113 	BUTTON_COLOR_NAVY,   // Middle Punch
114 	BUTTON_COLOR_RED,    // Strong Punch
115 	BUTTON_COLOR_LIME,   // Light Kick
116 	BUTTON_COLOR_AQUA,   // Middle Kick
117 	BUTTON_COLOR_BLUE,   // Strong Kick
118 	BUTTON_COLOR_PURPLE, // 3 Kick
119 	BUTTON_COLOR_PINK,   // 3 Punch
120 	BUTTON_COLOR_PURPLE, // 2 Kick
121 	BUTTON_COLOR_PINK,   // 2 Punch
122 	BUTTON_COLOR_RED,    // CUSTOM_1
123 	BUTTON_COLOR_YELLOW, // CUSTOM_2
124 	BUTTON_COLOR_GREEN,  // CUSTOM_3
125 	BUTTON_COLOR_BLUE,   // CUSTOM_4
126 	BUTTON_COLOR_PINK,   // CUSTOM_5
127 	BUTTON_COLOR_PURPLE, // CUSTOM_6
128 	BUTTON_COLOR_AQUA,   // CUSTOM_7
129 	BUTTON_COLOR_SILVER, // CUSTOM_8
130 	BUTTON_COLOR_RED,    // (Cursor Up)
131 	BUTTON_COLOR_YELLOW, // (Cursor Down)
132 	BUTTON_COLOR_GREEN,  // (Cursor Left)
133 	BUTTON_COLOR_BLUE,   // (Cursor Right)
134 	0,                   // Non Player Lever
135 	BUTTON_COLOR_LIME,   // Gray Color Lever
136 	BUTTON_COLOR_RED,    // 1 Player Lever
137 	BUTTON_COLOR_YELLOW, // 2 Player Lever
138 	BUTTON_COLOR_GREEN,  // 3 Player Lever
139 	BUTTON_COLOR_BLUE,   // 4 Player Lever
140 	BUTTON_COLOR_PINK,   // 5 Player Lever
141 	BUTTON_COLOR_PURPLE, // 6 Player Lever
142 	BUTTON_COLOR_AQUA,   // 7 Player Lever
143 	BUTTON_COLOR_SILVER  // 8 Player Lever
144 };
145 
146 #define COLOR_BUTTONS   ARRAY_LENGTH(color_table)
147 
148 struct fix_command_t
149 {
150 	char        glyph_char;
151 	unsigned    glyph_code;
152 };
153 
154 
155 struct fix_strings_t
156 {
157 	char const  *glyph_str;
158 	int const   glyph_code;
159 	unsigned    glyph_str_len;
160 };
161 
162 static fix_command_t const default_text[] =
163 {
164 	// Alphabetic Buttons (NeoGeo): A~D,H,Z
165 	{ 'A', 1 },     // BTN_A
166 	{ 'B', 2 },     // BTN_B
167 	{ 'C', 3 },     // BTN_C
168 	{ 'D', 4 },     // BTN_D
169 	{ 'H', 8 },     // BTN_H
170 	{ 'Z', 26 },    // BTN_Z
171 	// Numerical Buttons (Capcom): 1~10
172 	{ 'a', 27 },    // BTN_1
173 	{ 'b', 28 },    // BTN_2
174 	{ 'c', 29 },    // BTN_3
175 	{ 'd', 30 },    // BTN_4
176 	{ 'e', 31 },    // BTN_5
177 	{ 'f', 32 },    // BTN_6
178 	{ 'g', 33 },    // BTN_7
179 	{ 'h', 34 },    // BTN_8
180 	{ 'i', 35 },    // BTN_9
181 	{ 'j', 36 },    // BTN_10
182 	// Directions of Arrow, Joystick Ball
183 	{ '+', 39 },    // BTN_+
184 	{ '.', 40 },    // DIR_...
185 	{ '1', 41 },    // DIR_1
186 	{ '2', 42 },    // DIR_2
187 	{ '3', 43 },    // DIR_3
188 	{ '4', 44 },    // DIR_4
189 	{ '5', 45 },    // Joystick Ball
190 	{ '6', 46 },    // DIR_6
191 	{ '7', 47 },    // DIR_7
192 	{ '8', 48 },    // DIR_8
193 	{ '9', 49 },    // DIR_9
194 	{ 'N', 50 },    // DIR_N
195 	// Special Buttons
196 	{ 'S', 51 },    // BTN_START
197 	{ 'P', 53 },    // BTN_PUNCH
198 	{ 'K', 54 },    // BTN_KICK
199 	{ 'G', 55 },    // BTN_GUARD
200 	// Composition of Arrow Directions
201 	{ '!',  90 },   // Arrow
202 	{ 'k', 100 },   // Half Circle Back
203 	{ 'l', 101 },   // Half Circle Front Up
204 	{ 'm', 102 },   // Half Circle Front
205 	{ 'n', 103 },   // Half Circle Back Up
206 	{ 'o', 104 },   // 1/4 Cir For 2 Down
207 	{ 'p', 105 },   // 1/4 Cir Down 2 Back
208 	{ 'q', 106 },   // 1/4 Cir Back 2 Up
209 	{ 'r', 107 },   // 1/4 Cir Up 2 For
210 	{ 's', 108 },   // 1/4 Cir Back 2 Down
211 	{ 't', 109 },   // 1/4 Cir Down 2 For
212 	{ 'u', 110 },   // 1/4 Cir For 2 Up
213 	{ 'v', 111 },   // 1/4 Cir Up 2 Back
214 	{ 'w', 112 },   // Full Clock Forward
215 	{ 'x', 113 },   // Full Clock Back
216 	{ 'y', 114 },   // Full Count Forward
217 	{ 'z', 115 },   // Full Count Back
218 	{ 'L', 116 },   // 2x Forward
219 	{ 'M', 117 },   // 2x Back
220 	{ 'Q', 118 },   // Dragon Screw Forward
221 	{ 'R', 119 },   // Dragon Screw Back
222 	// Big letter Text
223 	{ '^', 121 },   // AIR
224 	{ '?', 122 },   // DIR
225 	{ 'X', 124 },   // TAP
226 	// Condition of Positions
227 	{ '|', 125 },   // Jump
228 	{ 'O', 126 },   // Hold
229 	{ '-', 127 },   // Air
230 	{ '=', 128 },   // Squatting
231 	{ '~', 131 },   // Charge
232 	// Special Character Text
233 	{ '`', 135 },   // Small Dot
234 	{ '@', 136 },   // Double Ball
235 	{ ')', 137 },   // Single Ball
236 	{ '(', 138 },   // Solid Ball
237 	{ '*', 139 },   // Star
238 	{ '&', 140 },   // Solid star
239 	{ '%', 141 },   // Triangle
240 	{ '$', 142 },   // Solid Triangle
241 	{ '#', 143 },   // Double Square
242 	{ ']', 144 },   // Single Square
243 	{ '[', 145 },   // Solid Square
244 	{ '{', 146 },   // Down Triangle
245 	{ '}', 147 },   // Solid Down Triangle
246 	{ '<', 148 },   // Diamond
247 	{ '>', 149 },   // Solid Diamond
248 	{ 0, 0 }    // end of array
249 };
250 
251 static fix_command_t const expand_text[] =
252 {
253 	// Alphabetic Buttons (NeoGeo): S (Slash Button)
254 	{ 's', 19 },    // BTN_S
255 	// Special Buttons
256 	{ 'S', 52 },    // BTN_SELECT
257 	// Multiple Punches & Kicks
258 	{ 'E', 57 },    // Light  Punch
259 	{ 'F', 58 },    // Middle Punch
260 	{ 'G', 59 },    // Strong Punch
261 	{ 'H', 60 },    // Light  Kick
262 	{ 'I', 61 },    // Middle Kick
263 	{ 'J', 62 },    // Strong Kick
264 	{ 'T', 63 },    // 3 Kick
265 	{ 'U', 64 },    // 3 Punch
266 	{ 'V', 65 },    // 2 Kick
267 	{ 'W', 66 },    // 2 Pick
268 	// Composition of Arrow Directions
269 	{ '!', 91 },    // Continue Arrow
270 	// Charge of Arrow Directions
271 	{ '1', 92 },    // Charge DIR_1
272 	{ '2', 93 },    // Charge DIR_2
273 	{ '3', 94 },    // Charge DIR_3
274 	{ '4', 95 },    // Charge DIR_4
275 	{ '6', 96 },    // Charge DIR_6
276 	{ '7', 97 },    // Charge DIR_7
277 	{ '8', 98 },    // Charge DIR_8
278 	{ '9', 99 },    // Charge DIR_9
279 	// Big letter Text
280 	{ 'M', 123 },   // MAX
281 	// Condition of Positions
282 	{ '-', 129 },   // Close
283 	{ '=', 130 },   // Away
284 	{ '*', 132 },   // Serious Tap
285 	{ '?', 133 },   // Any Button
286 	{ 0, 0 }    // end of array
287 };
288 
289 static fix_strings_t convert_text[] =
290 {
291 	// Alphabetic Buttons: A~Z
292 	{ "A-button",  1, 0 }, // BTN_A
293 	{ "B-button",  2, 0 }, // BTN_B
294 	{ "C-button",  3, 0 }, // BTN_C
295 	{ "D-button",  4, 0 }, // BTN_D
296 	{ "E-button",  5, 0 }, // BTN_E
297 	{ "F-button",  6, 0 }, // BTN_F
298 	{ "G-button",  7, 0 }, // BTN_G
299 	{ "H-button",  8, 0 }, // BTN_H
300 	{ "I-button",  9, 0 }, // BTN_I
301 	{ "J-button", 10, 0 }, // BTN_J
302 	{ "K-button", 11, 0 }, // BTN_K
303 	{ "L-button", 12, 0 }, // BTN_L
304 	{ "M-button", 13, 0 }, // BTN_M
305 	{ "N-button", 14, 0 }, // BTN_N
306 	{ "O-button", 15, 0 }, // BTN_O
307 	{ "P-button", 16, 0 }, // BTN_P
308 	{ "Q-button", 17, 0 }, // BTN_Q
309 	{ "R-button", 18, 0 }, // BTN_R
310 	{ "S-button", 19, 0 }, // BTN_S
311 	{ "T-button", 20, 0 }, // BTN_T
312 	{ "U-button", 21, 0 }, // BTN_U
313 	{ "V-button", 22, 0 }, // BTN_V
314 	{ "W-button", 23, 0 }, // BTN_W
315 	{ "X-button", 24, 0 }, // BTN_X
316 	{ "Y-button", 25, 0 }, // BTN_Y
317 	{ "Z-button", 26, 0 }, // BTN_Z
318 	// Special Moves and Buttons
319 	{ "decrease", 37, 0 }, // BTN_DEC
320 	{ "increase", 38, 0 }, // BTN_INC
321 	{ "BALL",     45, 0 }, // Joystick Ball
322 	{ "start",    51, 0 }, // BTN_START
323 	{ "select",   52, 0 }, // BTN_SELECT
324 	{ "punch",    53, 0 }, // BTN_PUNCH
325 	{ "kick",     54, 0 }, // BTN_KICK
326 	{ "guard",    55, 0 }, // BTN_GUARD
327 	{ "L-punch",  57, 0 }, // Light Punch
328 	{ "M-punch",  58, 0 }, // Middle Punch
329 	{ "S-punch",  59, 0 }, // Strong Punch
330 	{ "L-kick",   60, 0 }, // Light Kick
331 	{ "M-kick",   61, 0 }, // Middle Kick
332 	{ "S-kick",   62, 0 }, // Strong Kick
333 	{ "3-kick",   63, 0 }, // 3 Kick
334 	{ "3-punch",  64, 0 }, // 3 Punch
335 	{ "2-kick",   65, 0 }, // 2 Kick
336 	{ "2-punch",  66, 0 }, // 2 Pick
337 	// Custom Buttons and Cursor Buttons
338 	{ "custom1",  67, 0 }, // CUSTOM_1
339 	{ "custom2",  68, 0 }, // CUSTOM_2
340 	{ "custom3",  69, 0 }, // CUSTOM_3
341 	{ "custom4",  70, 0 }, // CUSTOM_4
342 	{ "custom5",  71, 0 }, // CUSTOM_5
343 	{ "custom6",  72, 0 }, // CUSTOM_6
344 	{ "custom7",  73, 0 }, // CUSTOM_7
345 	{ "custom8",  74, 0 }, // CUSTOM_8
346 	{ "up",       75, 0 }, // (Cursor Up)
347 	{ "down",     76, 0 }, // (Cursor Down)
348 	{ "left",     77, 0 }, // (Cursor Left)
349 	{ "right",    78, 0 }, // (Cursor Right)
350 	// Player Lever
351 	{ "lever",    79, 0 }, // Non Player Lever
352 	{ "nplayer",  80, 0 }, // Gray Color Lever
353 	{ "1player",  81, 0 }, // 1 Player Lever
354 	{ "2player",  82, 0 }, // 2 Player Lever
355 	{ "3player",  83, 0 }, // 3 Player Lever
356 	{ "4player",  84, 0 }, // 4 Player Lever
357 	{ "5player",  85, 0 }, // 5 Player Lever
358 	{ "6player",  86, 0 }, // 6 Player Lever
359 	{ "7player",  87, 0 }, // 7 Player Lever
360 	{ "8player",  88, 0 }, // 8 Player Lever
361 	// Composition of Arrow Directions
362 	{ "-->",      90, 0 }, // Arrow
363 	{ "==>",      91, 0 }, // Continue Arrow
364 	{ "hcb",     100, 0 }, // Half Circle Back
365 	{ "huf",     101, 0 }, // Half Circle Front Up
366 	{ "hcf",     102, 0 }, // Half Circle Front
367 	{ "hub",     103, 0 }, // Half Circle Back Up
368 	{ "qfd",     104, 0 }, // 1/4 Cir For 2 Down
369 	{ "qdb",     105, 0 }, // 1/4 Cir Down 2 Back
370 	{ "qbu",     106, 0 }, // 1/4 Cir Back 2 Up
371 	{ "quf",     107, 0 }, // 1/4 Cir Up 2 For
372 	{ "qbd",     108, 0 }, // 1/4 Cir Back 2 Down
373 	{ "qdf",     109, 0 }, // 1/4 Cir Down 2 For
374 	{ "qfu",     110, 0 }, // 1/4 Cir For 2 Up
375 	{ "qub",     111, 0 }, // 1/4 Cir Up 2 Back
376 	{ "fdf",     112, 0 }, // Full Clock Forward
377 	{ "fub",     113, 0 }, // Full Clock Back
378 	{ "fuf",     114, 0 }, // Full Count Forward
379 	{ "fdb",     115, 0 }, // Full Count Back
380 	{ "xff",     116, 0 }, // 2x Forward
381 	{ "xbb",     117, 0 }, // 2x Back
382 	{ "dsf",     118, 0 }, // Dragon Screw Forward
383 	{ "dsb",     119, 0 }, // Dragon Screw Back
384 	// Big letter Text
385 	{ "AIR",     121, 0 }, // AIR
386 	{ "DIR",     122, 0 }, // DIR
387 	{ "MAX",     123, 0 }, // MAX
388 	{ "TAP",     124, 0 }, // TAP
389 	// Condition of Positions
390 	{ "jump",    125, 0 }, // Jump
391 	{ "hold",    126, 0 }, // Hold
392 	{ "air",     127, 0 }, // Air
393 	{ "sit",     128, 0 }, // Squatting
394 	{ "close",   129, 0 }, // Close
395 	{ "away",    130, 0 }, // Away
396 	{ "charge",  131, 0 }, // Charge
397 	{ "tap",     132, 0 }, // Serious Tap
398 	{ "button",  133, 0 }, // Any Button
399 	{ nullptr,     0, 0 }  // end of array
400 };
401 
402 #endif // MAME_EMU_UI_CMDDATA_H
403