ScummVM API documentation
libretro-core-options.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef LIBRETRO_CORE_OPTIONS_H__
23#define LIBRETRO_CORE_OPTIONS_H__
24
25#include <stdlib.h>
26#include <string.h>
27
28#include <libretro.h>
29#include <retro_inline.h>
30
31#ifndef HAVE_NO_LANGEXTRA
32#include "libretro-core-options-intl.h"
33#endif
34
35/*
36 ********************************
37 * VERSION: 2.0
38 ********************************
39 *
40 * - 2.0: Add support for core options v2 interface
41 * - 1.3: Move translations to libretro_core_options_intl.h
42 * - libretro_core_options_intl.h includes BOM and utf-8
43 * fix for MSVC 2010-2013
44 * - Added HAVE_NO_LANGEXTRA flag to disable translations
45 * on platforms/compilers without BOM support
46 * - 1.2: Use core options v1 interface when
47 * RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION is >= 1
48 * (previously required RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION == 1)
49 * - 1.1: Support generation of core options v0 retro_core_option_value
50 * arrays containing options with a single value
51 * - 1.0: First commit
52 */
53
54#ifdef __cplusplus
55extern "C" {
56#endif
57
58/*
59 ********************************
60 * Core Option Definitions
61 ********************************
62 */
63
64/* RETRO_LANGUAGE_ENGLISH */
65
66/* Default language:
67 * - All other languages must include the same keys and values
68 * - Will be used as a fallback in the event that frontend language
69 * is not available
70 * - Will be used as a fallback for any missing entries in
71 * frontend language definition */
72
73
74struct retro_core_option_v2_category option_cats_us[] = {
75 {
76 "video",
77 "Video settings",
78 "Configure video settings"
79 },
80 {
81 "cursor",
82 "Cursor Movement",
83 "Configure cursor movement settings"
84 },
85 {
86 "timing",
87 "Timing",
88 "Configure timing settings"
89 },
90 {
91 "retropad",
92 "RetroPad mapping",
93 "Configure RetroPad mapping"
94 },
95 {
96 "system",
97 "System",
98 "Configure system settings"
99 },
100 { NULL, NULL, NULL },
101};
102
103struct retro_core_option_v2_definition option_defs_us[] = {
104 {
105 "scummvm_pointer_device",
106 "Cursor > Pointer Device",
107 "Pointer Device",
108 "Select which device controls the cursor.",
109 NULL,
110 "cursor",
111 {
112 {"retropad", "RetroPad only"},
113 {"mouse", "RetroPad + RetroMouse"},
114 {"pointer", "RetroPad + Pointer"},
115 {NULL, NULL},
116 },
117#if defined(WIIU) || defined(__SWITCH__)
118 "pointer"
119#else
120 "mouse"
121#endif
122 },
123 {
124 "scummvm_gamepad_cursor_speed",
125 "Cursor > Gamepad Cursor Speed",
126 "Gamepad Cursor Speed",
127 "Sets the mouse cursor speed multiplier when moving the cursor with the RetroPad left analog stick or D-Pad. The default value of '1.0' is optimised for games that have a native resolution of '320x200' or '320x240'. When running 'high definition' games with a resolution of '640x400' or '640x480', a Gamepad Cursor Speed of '2.0' is recommended.",
128 NULL,
129 "cursor",
130 {
131 {"0.25", NULL},
132 {"0.5", NULL},
133 {"0.75", NULL},
134 {"1.0", NULL},
135 {"1.5", NULL},
136 {"2.0", NULL},
137 {"2.5", NULL},
138 {"3.0", NULL},
139 {NULL, NULL},
140 },
141 "1.0"
142 },
143 {
144 "scummvm_gamepad_cursor_acceleration_time",
145 "Cursor > Gamepad Cursor Acceleration",
146 "Gamepad Cursor Acceleration",
147 "The amount of time (In seconds) it takes for the cursor to reach full speed",
148 NULL,
149 "cursor",
150 {
151 {"off", NULL},
152 {"0.1", NULL},
153 {"0.2", NULL},
154 {"0.3", NULL},
155 {"0.4", NULL},
156 {"0.5", NULL},
157 {"0.6", NULL},
158 {"0.7", NULL},
159 {"0.8", NULL},
160 {"0.9", NULL},
161 {"1.0", NULL},
162 {NULL, NULL},
163 },
164 "0.2"
165 },
166 {
167 "scummvm_analog_response",
168 "Cursor > Analog Cursor Response",
169 "Analog Cursor Response",
170 "Determines how the speed of the cursor varies when tilting the RetroPad left analog stick. 'Linear': Speed is directly proportional to analog stick displacement. This is standard behaviour with which most users will be familiar. 'Quadratic': Speed increases quadratically with analog stick displacement. This allows for greater precision when making small movements without sacrificing maximum speed at full analog range. This mode may require practice for effective use.",
171 NULL,
172 "cursor",
173 {
174 {"linear", "Linear"},
175 {"quadratic", "Quadratic"},
176 {NULL, NULL},
177 },
178 "linear"
179 },
180 {
181 "scummvm_analog_deadzone",
182 "Cursor > Analog Deadzone",
183 "Analog Deadzone",
184 "Sets the deadzone in percentage of the RetroPad analog sticks. Used to eliminate cursor drift/unwanted input.",
185 NULL,
186 "cursor",
187 {
188 {"0", "0 %"},
189 {"5", "5 %"},
190 {"10", "10 %"},
191 {"15", "15 %"},
192 {"20", "20 %"},
193 {"25", "25 %"},
194 {"30", "30 %"},
195 {NULL, NULL},
196 },
197 "15"
198 },
199 {
200 "scummvm_mouse_speed",
201 "Cursor > Mouse Speed",
202 "Mouse Speed",
203 "Sets the mouse cursor speed multiplier when moving the cursor with the RetroMouse.",
204 NULL,
205 "cursor",
206 {
207 {"0.05", NULL},
208 {"0.1", NULL},
209 {"0.15", NULL},
210 {"0.2", NULL},
211 {"0.25", NULL},
212 {"0.3", NULL},
213 {"0.35", NULL},
214 {"0.4", NULL},
215 {"0.45", NULL},
216 {"0.5", NULL},
217 {"0.6", NULL},
218 {"0.7", NULL},
219 {"0.8", NULL},
220 {"0.9", NULL},
221 {"1.0", NULL},
222 {"1.25", NULL},
223 {"1.5", NULL},
224 {"1.75", NULL},
225 {"2.0", NULL},
226 {"2.5", NULL},
227 {"3.0", NULL},
228 {NULL, NULL},
229 },
230 "1.0"
231 },
232 {
233 "scummvm_mouse_fine_control_speed_reduction",
234 "Cursor > Mouse Fine Control Speed Reduction",
235 "Mouse Fine Control Speed Reduction",
236 "Sets the mouse cursor speed reduction as percentage of normal speed when fine control is activated.",
237 NULL,
238 "cursor",
239 {
240 {"2", "50 %"},
241 {"4", "20 %"},
242 {"10", "10 %"},
243 {NULL, NULL},
244 },
245 "4"
246 },
247 {
248 "scummvm_framerate",
249 "Timing > Frame rate cap",
250 "Frame rate cap",
251 "Set core frame rate upper limit. Reducing the limit will improve the performance on lower end devices. Changing this setting will reset the core.",
252 NULL,
253 "timing",
254 {
255 { "disabled", NULL },
256 { "60 Hz", NULL },
257 { "50 Hz", NULL },
258 { "30 Hz", NULL },
259 { "25 Hz", NULL },
260 { NULL, NULL },
261 },
262 "disabled"
263 },
264 {
265 "scummvm_samplerate",
266 "Timing > Sample rate",
267 "Sample rate",
268 "Set core sample rate. Reducing the rate will slightly improve the performance on lower end devices. Changing this setting will reset the core.",
269 NULL,
270 "timing",
271 {
272 { "48000 Hz", NULL },
273 { "44100 Hz", NULL },
274 { NULL, NULL },
275 },
276 "48000 Hz"
277 },
278 /* Button mappings */
279 {
280 "scummvm_mapper_up",
281 "RetroPad > Up",
282 "Up",
283 NULL,
284 NULL,
285 "retropad",
286 {
287 { NULL, NULL }
288 },
289 "RETROKE_UP"
290 },
291 {
292 "scummvm_mapper_down",
293 "RetroPad > Down",
294 "Down",
295 NULL,
296 NULL,
297 "retropad",
298 {
299 { NULL, NULL }
300 },
301 "RETROKE_DOWN"
302 },
303 {
304 "scummvm_mapper_left",
305 "RetroPad > Left",
306 "Left",
307 NULL,
308 NULL,
309 "retropad",
310 {
311 { NULL, NULL }
312 },
313 "RETROKE_LEFT"
314 },
315 {
316 "scummvm_mapper_right",
317 "RetroPad > Right",
318 "Right",
319 NULL,
320 NULL,
321 "retropad",
322 {
323 { NULL, NULL }
324 },
325 "RETROKE_RIGHT"
326 },
327 {
328 "scummvm_mapper_a",
329 "RetroPad > A",
330 "A",
331 NULL,
332 NULL,
333 "retropad",
334 {
335 { NULL, NULL }
336 },
337 "RETROK_SPACE"
338 },
339 {
340 "scummvm_mapper_b",
341 "RetroPad > B",
342 "B",
343 NULL,
344 NULL,
345 "retropad",
346 {
347 { NULL, NULL }
348 },
349 "RETROK_RETURN"
350 },
351 {
352 "scummvm_mapper_x",
353 "RetroPad > X",
354 "X",
355 NULL,
356 NULL,
357 "retropad",
358 {
359 { NULL, NULL }
360 },
361 "RETROK_F5"
362 },
363 {
364 "scummvm_mapper_y",
365 "RetroPad > Y",
366 "Y",
367 NULL,
368 NULL,
369 "retropad",
370 {
371 { NULL, NULL }
372 },
373 "RETROK_ESCAPE"
374 },
375 {
376 "scummvm_mapper_select",
377 "RetroPad > Select",
378 "Select",
379 NULL,
380 NULL,
381 "retropad",
382 {
383 { NULL, NULL }
384 },
385 "RETROKE_VKBD"
386 },
387 {
388 "scummvm_mapper_start",
389 "RetroPad > Start",
390 "Start",
391 NULL,
392 NULL,
393 "retropad",
394 {
395 { NULL, NULL }
396 },
397 "RETROKE_SCUMMVM_GUI"
398 },
399 {
400 "scummvm_mapper_l",
401 "RetroPad > L",
402 "L",
403 NULL,
404 NULL,
405 "retropad",
406 {
407 { NULL, NULL }
408 },
409 "RETROKE_LEFT_BUTTON"
410 },
411 {
412 "scummvm_mapper_r",
413 "RetroPad > R",
414 "R",
415 NULL,
416 NULL,
417 "retropad",
418 {
419 { NULL, NULL }
420 },
421 "RETROKE_RIGHT_BUTTON"
422 },
423 {
424 "scummvm_mapper_l2",
425 "RetroPad > L2",
426 "L2",
427 NULL,
428 NULL,
429 "retropad",
430 {
431 { NULL, NULL }
432 },
433 "---"
434 },
435 {
436 "scummvm_mapper_r2",
437 "RetroPad > R2",
438 "R2",
439 NULL,
440 NULL,
441 "retropad",
442 {
443 { NULL, NULL }
444 },
445 "RETROKE_FINE_CONTROL"
446 },
447 {
448 "scummvm_mapper_l3",
449 "RetroPad > L3",
450 "L3",
451 NULL,
452 NULL,
453 "retropad",
454 {
455 { NULL, NULL }
456 },
457 "---"
458 },
459 {
460 "scummvm_mapper_r3",
461 "RetroPad > R3",
462 "R3",
463 NULL,
464 NULL,
465 "retropad",
466 {
467 { NULL, NULL }
468 },
469 "---"
470 },
471 /* Left Stick */
472 {
473 "scummvm_mapper_lu",
474 "RetroPad > Left Analog > Up",
475 "Left Analog > Up",
476 NULL,
477 NULL,
478 "retropad",
479 {
480 { NULL, NULL }
481 },
482 "RETROKE_UP"
483 },
484 {
485 "scummvm_mapper_ld",
486 "RetroPad > Left Analog > Down",
487 "Left Analog > Down",
488 NULL,
489 NULL,
490 "retropad",
491 {
492 { NULL, NULL }
493 },
494 "RETROKE_DOWN"
495 },
496 {
497 "scummvm_mapper_ll",
498 "RetroPad > Left Analog > Left",
499 "Left Analog > Left",
500 NULL,
501 NULL,
502 "retropad",
503 {
504 { NULL, NULL }
505 },
506 "RETROKE_LEFT"
507 },
508 {
509 "scummvm_mapper_lr",
510 "RetroPad > Left Analog > Right",
511 "Left Analog > Right",
512 NULL,
513 NULL,
514 "retropad",
515 {
516 { NULL, NULL }
517 },
518 "RETROKE_RIGHT"
519 },
520 /* Right Stick */
521 {
522 "scummvm_mapper_ru",
523 "RetroPad > Right Analog > Up",
524 "Right Analog > Up",
525 NULL,
526 NULL,
527 "retropad",
528 {
529 { NULL, NULL }
530 },
531 "RETROK_UP"
532 },
533 {
534 "scummvm_mapper_rd",
535 "RetroPad > Right Analog > Down",
536 "Right Analog > Down",
537 NULL,
538 NULL,
539 "retropad",
540 {
541 { NULL, NULL }
542 },
543 "RETROK_DOWN"
544 },
545 {
546 "scummvm_mapper_rl",
547 "RetroPad > Right Analog > Left",
548 "Right Analog > Left",
549 NULL,
550 NULL,
551 "retropad",
552 {
553 { NULL, NULL }
554 },
555 "RETROK_LEFT"
556 },
557 {
558 "scummvm_mapper_rr",
559 "RetroPad > Right Analog > Right",
560 "Right Analog > Right",
561 NULL,
562 NULL,
563 "retropad",
564 {
565 { NULL, NULL }
566 },
567 "RETROK_RIGHT"
568 },
569 {
570 "scummvm_video_hw_acceleration",
571 "Video > Hardware acceleration",
572 "Hardware acceleration",
573 "Request video hardware acceleration (OpenGL or OpenGLES2) to the frontend if supported. It is needed to reload the core to apply this setting.",
574 NULL,
575 "video",
576 {
577 {"disabled", NULL},
578#ifdef USE_OPENGL
579 {"enabled", NULL},
580#endif
581 {NULL, NULL},
582 },
583#ifdef USE_OPENGL
584 "enabled"
585#else
586 "disabled"
587#endif
588 },
589#ifdef USE_HIGHRES
590 {
591 "scummvm_gui_aspect_ratio",
592 "Video > GUI aspect ratio",
593 "ScummVM Launcher aspect ratio",
594 "Set ScummVM Launcher aspect ratio.",
595 NULL,
596 "video",
597 {
598 {"0", "4:3"},
599 {"1", "16:9"},
600 {NULL, NULL},
601 },
602 "1"
603 },
604 {
605 "scummvm_gui_h_res",
606 "Video > GUI resolution",
607 "ScummVM Launcher resolution",
608 "Set ScummVM Launcher resolution.",
609 NULL,
610 "video",
611 {
612 {"240", "LD"},
613 {"480", "SD"},
614 {"720", "HD"},
615 {"1080", "FHD"},
616 {NULL, NULL},
617 },
618 "720"
619 },
620#endif
621 {
622 "scummvm_browsing_mode",
623 "System > Browsing mode",
624 "Browsing mode",
625 "Select how the ScummVM file browser lists locations. 'Authorized storage' shows the folders authorized through the frontend (e.g. Android SAF trees). 'Local filesystem' browses the standard local paths.",
626 NULL,
627 "system",
628 {
629 {"local", "Local filesystem"},
630 {"authorized", "Authorized storage"},
631 {NULL, NULL},
632 },
633#ifdef ANDROID
634 "authorized"
635#else
636 "local"
637#endif
638 },
639 { NULL, NULL, NULL, NULL, NULL, NULL, {{0}}, NULL },
640};
641
642struct retro_core_options_v2 options_us = {
643 option_cats_us,
644 option_defs_us
645};
646
647/* List has been reduced to fit RETRO_NUM_CORE_OPTION_VALUES_MAX.
648 * Latest element {NULL, NULL} has been omitted in this case as the array is exactly sized
649 * RETRO_NUM_CORE_OPTION_VALUES_MAX; in case the array size will be reduced, {NULL, NULL}
650 * element to be uncommented.
651 */
652
653struct retro_core_option_value retro_keys_label_us [] = {
654 {"---", "---"},
655 {"RETROKE_VKBD", "Toggle Virtual Keyboard"},
656 {"RETROKE_LEFT", "Mouse Cursor Left"},
657 {"RETROKE_UP", "Mouse Cursor Up"},
658 {"RETROKE_DOWN", "Mouse Cursor Down"},
659 {"RETROKE_RIGHT", "Mouse Cursor Right"},
660 {"RETROKE_LEFT_BUTTON", "Mouse Left Button"},
661 {"RETROKE_RIGHT_BUTTON", "Mouse Right Button"},
662 {"RETROKE_FINE_CONTROL", "Mouse Cursor Fine Control"},
663 {"RETROKE_SCUMMVM_GUI", "ScummVM GUI"},
664 {"RETROKE_SHIFT_MOD", "Keyboard Shift (Modifier)"},
665 {"RETROKE_CTRL_MOD", "Keyboard Control (Modifier)"},
666 {"RETROKE_ALT_MOD", "Keyboard Alt (Modifier)"},
667 {"RETROK_BACKSPACE", "Keyboard Backspace"},
668 {"RETROK_TAB", "Keyboard Tab"},
669 {"RETROK_CLEAR", "Keyboard Clear"},
670 {"RETROK_RETURN", "Keyboard Return"},
671 {"RETROK_PAUSE", "Keyboard Pause"},
672 {"RETROK_ESCAPE", "Keyboard Escape"},
673 {"RETROK_SPACE", "Keyboard Space"},
674 {"RETROK_EXCLAIM", "Keyboard !"},
675 {"RETROK_QUOTEDBL", "Keyboard \""},
676 {"RETROK_HASH", "Keyboard #"},
677 {"RETROK_DOLLAR", "Keyboard $"},
678 {"RETROK_AMPERSAND", "Keyboard &"},
679 {"RETROK_QUOTE", "Keyboard \'"},
680 {"RETROK_LEFTPAREN", "Keyboard ("},
681 {"RETROK_RIGHTPAREN", "Keyboard )"},
682 {"RETROK_ASTERISK", "Keyboard *"},
683 {"RETROK_PLUS", "Keyboard +"},
684 {"RETROK_COMMA", "Keyboard ,"},
685 {"RETROK_MINUS", "Keyboard -"},
686 {"RETROK_PERIOD", "Keyboard ."},
687 {"RETROK_SLASH", "Keyboard /"},
688 {"RETROK_0", "Keyboard 0"},
689 {"RETROK_1", "Keyboard 1"},
690 {"RETROK_2", "Keyboard 2"},
691 {"RETROK_3", "Keyboard 3"},
692 {"RETROK_4", "Keyboard 4"},
693 {"RETROK_5", "Keyboard 5"},
694 {"RETROK_6", "Keyboard 6"},
695 {"RETROK_7", "Keyboard 7"},
696 {"RETROK_8", "Keyboard 8"},
697 {"RETROK_9", "Keyboard 9"},
698 {"RETROK_COLON", "Keyboard :"},
699 {"RETROK_SEMICOLON", "Keyboard ;"},
700 {"RETROK_LESS", "Keyboard <"},
701 {"RETROK_EQUALS", "Keyboard ="},
702 {"RETROK_GREATER", "Keyboard >"},
703 {"RETROK_QUESTION", "Keyboard ?"},
704 {"RETROK_AT", "Keyboard @"},
705 {"RETROK_LEFTBRACKET", "Keyboard ["},
706 {"RETROK_BACKSLASH", "Keyboard \\"},
707 {"RETROK_RIGHTBRACKET", "Keyboard ]"},
708 {"RETROK_CARET", "Keyboard ^"},
709 {"RETROK_UNDERSCORE", "Keyboard _"},
710 {"RETROK_BACKQUOTE", "Keyboard `"},
711 {"RETROK_a", "Keyboard a"},
712 {"RETROK_b", "Keyboard b"},
713 {"RETROK_c", "Keyboard c"},
714 {"RETROK_d", "Keyboard d"},
715 {"RETROK_e", "Keyboard e"},
716 {"RETROK_f", "Keyboard f"},
717 {"RETROK_g", "Keyboard g"},
718 {"RETROK_h", "Keyboard h"},
719 {"RETROK_i", "Keyboard i"},
720 {"RETROK_j", "Keyboard j"},
721 {"RETROK_k", "Keyboard k"},
722 {"RETROK_l", "Keyboard l"},
723 {"RETROK_m", "Keyboard m"},
724 {"RETROK_n", "Keyboard n"},
725 {"RETROK_o", "Keyboard o"},
726 {"RETROK_p", "Keyboard p"},
727 {"RETROK_q", "Keyboard q"},
728 {"RETROK_r", "Keyboard r"},
729 {"RETROK_s", "Keyboard s"},
730 {"RETROK_t", "Keyboard t"},
731 {"RETROK_u", "Keyboard u"},
732 {"RETROK_v", "Keyboard v"},
733 {"RETROK_w", "Keyboard w"},
734 {"RETROK_x", "Keyboard x"},
735 {"RETROK_y", "Keyboard y"},
736 {"RETROK_z", "Keyboard z"},
737 {"RETROK_KP0", "Keyboard Numpad 0"},
738 {"RETROK_KP1", "Keyboard Numpad 1"},
739 {"RETROK_KP2", "Keyboard Numpad 2"},
740 {"RETROK_KP3", "Keyboard Numpad 3"},
741 {"RETROK_KP4", "Keyboard Numpad 4"},
742 {"RETROK_KP5", "Keyboard Numpad 5"},
743 {"RETROK_KP6", "Keyboard Numpad 6"},
744 {"RETROK_KP7", "Keyboard Numpad 7"},
745 {"RETROK_KP8", "Keyboard Numpad 8"},
746 {"RETROK_KP9", "Keyboard Numpad 9"},
747 {"RETROK_KP_PERIOD", "Keyboard Numpad ."},
748 {"RETROK_KP_DIVIDE", "Keyboard Numpad /"},
749 {"RETROK_KP_MULTIPLY", "Keyboard Numpad *"},
750 {"RETROK_KP_MINUS", "Keyboard Numpad -"},
751 {"RETROK_KP_PLUS", "Keyboard Numpad +"},
752 {"RETROK_KP_ENTER", "Keyboard Numpad Enter"},
753 {"RETROK_KP_EQUALS", "Keyboard Numpad ="},
754 {"RETROK_UP", "Keyboard Up"},
755 {"RETROK_DOWN", "Keyboard Down"},
756 {"RETROK_LEFT", "Keyboard Left"},
757 {"RETROK_RIGHT", "Keyboard Right"},
758 {"RETROK_INSERT", "Keyboard Insert"},
759 {"RETROK_DELETE", "Keyboard Delete"},
760 {"RETROK_HOME", "Keyboard Home"},
761 {"RETROK_END", "Keyboard End"},
762 {"RETROK_PAGEUP", "Keyboard PageUp"},
763 {"RETROK_PAGEDOWN", "Keyboard PageDown"},
764 {"RETROK_F1", "Keyboard F1"},
765 {"RETROK_F2", "Keyboard F2"},
766 {"RETROK_F3", "Keyboard F3"},
767 {"RETROK_F4", "Keyboard F4"},
768 {"RETROK_F5", "Keyboard F5"},
769 {"RETROK_F6", "Keyboard F6"},
770 {"RETROK_F7", "Keyboard F7"},
771 {"RETROK_F8", "Keyboard F8"},
772 {"RETROK_F9", "Keyboard F9"},
773 {"RETROK_F10", "Keyboard F10"},
774 {"RETROK_F11", "Keyboard F11"},
775 {"RETROK_F12", "Keyboard F12"},
776//{"RETROK_F13","Keyboard F13"},
777//{"RETROK_F14","Keyboard F14"},
778//{"RETROK_F15","Keyboard F15"},
779//{"RETROK_NUMLOCK","Keyboard NumLock"},
780//{"RETROK_CAPSLOCK","Keyboard Caps Lock"},
781//{"RETROK_SCROLLOCK","Keyboard Scroll Lock"},
782 {"RETROK_LSHIFT", "Keyboard Left Shift"},
783 {"RETROK_RSHIFT", "Keyboard Right Shift"},
784 {"RETROK_LCTRL", "Keyboard Left Control"},
785 {"RETROK_RCTRL", "Keyboard Right Control"},
786 {"RETROK_LALT", "Keyboard Left Alt"},
787 {"RETROK_RALT", "Keyboard Right Alt"},
788//{"RETROK_LMETA","Keyboard Left Meta"},
789//{"RETROK_RMETA","Keyboard Right Meta"},
790//{"RETROK_LSUPER","Keyboard Left Super"},
791//{"RETROK_RSUPER","Keyboard Right Super"},
792//{"RETROK_MODE","Keyboard Mode"},
793//{"RETROK_COMPOSE","Keyboard Compose"},
794//{"RETROK_HELP","Keyboard Help"},
795//{"RETROK_PRINT","Keyboard Print"},
796//{"RETROK_SYSREQ","Keyboard SysReq"},
797//{"RETROK_BREAK","Keyboard Break"},
798//{"RETROK_MENU","Keyboard Menu"},
799//{"RETROK_POWER","Keyboard Power"},
800//{"RETROK_EURO","Keyboard Euro"},
801//{"RETROK_UNDO","Keyboard Undo"},
802//{NULL, NULL}
803};
804
805/*
806 ********************************
807 * Language Mapping
808 ********************************
809 */
810
811#ifndef HAVE_NO_LANGEXTRA
812struct retro_core_options_v2 *options_intl[RETRO_LANGUAGE_LAST] = {
813 &options_us, /* RETRO_LANGUAGE_ENGLISH */
814 NULL, /* RETRO_LANGUAGE_JAPANESE */
815 NULL, /* RETRO_LANGUAGE_FRENCH */
816 NULL, /* RETRO_LANGUAGE_SPANISH */
817 NULL, /* RETRO_LANGUAGE_GERMAN */
818 &options_it, /* RETRO_LANGUAGE_ITALIAN */
819 NULL, /* RETRO_LANGUAGE_DUTCH */
820 NULL, /* RETRO_LANGUAGE_PORTUGUESE_BRAZIL */
821 NULL, /* RETRO_LANGUAGE_PORTUGUESE_PORTUGAL */
822 NULL, /* RETRO_LANGUAGE_RUSSIAN */
823 NULL, /* RETRO_LANGUAGE_KOREAN */
824 NULL, /* RETRO_LANGUAGE_CHINESE_TRADITIONAL */
825 NULL, /* RETRO_LANGUAGE_CHINESE_SIMPLIFIED */
826 NULL, /* RETRO_LANGUAGE_ESPERANTO */
827 NULL, /* RETRO_LANGUAGE_POLISH */
828 NULL, /* RETRO_LANGUAGE_VIETNAMESE */
829 NULL, /* RETRO_LANGUAGE_ARABIC */
830 NULL, /* RETRO_LANGUAGE_GREEK */
831 NULL, /* RETRO_LANGUAGE_TURKISH */
832};
833
834struct retro_core_option_value *retro_keys_labels_intl[RETRO_LANGUAGE_LAST] = {
835 retro_keys_label_us, /* RETRO_LANGUAGE_ENGLISH */
836 NULL, /* RETRO_LANGUAGE_JAPANESE */
837 NULL, /* RETRO_LANGUAGE_FRENCH */
838 NULL, /* RETRO_LANGUAGE_SPANISH */
839 NULL, /* RETRO_LANGUAGE_GERMAN */
840 retro_keys_label_it, /* RETRO_LANGUAGE_ITALIAN */
841 NULL, /* RETRO_LANGUAGE_DUTCH */
842 NULL, /* RETRO_LANGUAGE_PORTUGUESE_BRAZIL */
843 NULL, /* RETRO_LANGUAGE_PORTUGUESE_PORTUGAL */
844 NULL, /* RETRO_LANGUAGE_RUSSIAN */
845 NULL, /* RETRO_LANGUAGE_KOREAN */
846 NULL, /* RETRO_LANGUAGE_CHINESE_TRADITIONAL */
847 NULL, /* RETRO_LANGUAGE_CHINESE_SIMPLIFIED */
848 NULL, /* RETRO_LANGUAGE_ESPERANTO */
849 NULL, /* RETRO_LANGUAGE_POLISH */
850 NULL, /* RETRO_LANGUAGE_VIETNAMESE */
851 NULL, /* RETRO_LANGUAGE_ARABIC */
852 NULL, /* RETRO_LANGUAGE_GREEK */
853 NULL, /* RETRO_LANGUAGE_TURKISH */
854};
855#endif
856
857/*
858 ********************************
859 * Functions
860 ********************************
861 */
862
863static INLINE void libretro_fill_options_mapper_data(retro_environment_t environ_cb) {
864 /* Fill in the values for all the mappers */
865 int m = 0;
866 int n = 0;
867 while (option_defs_us[m].key) {
868 if (strstr(option_defs_us[m].key, "scummvm_mapper_")) {
869 n = 0;
870 while (retro_keys_label_us[n].label && n < RETRO_NUM_CORE_OPTION_VALUES_MAX - 1) {
871 option_defs_us[m].values[n].value = retro_keys_label_us[n].value;
872 option_defs_us[m].values[n].label = retro_keys_label_us[n].label;
873 ++n;
874 }
875 option_defs_us[m].values[n].value = NULL;
876 option_defs_us[m].values[n].label = NULL;
877 }
878 ++m;
879 }
880#ifndef HAVE_NO_LANGEXTRA
881 struct retro_core_option_value *retro_keys_label_intl = NULL;
882 unsigned language = 0;
883
884 if (environ_cb(RETRO_ENVIRONMENT_GET_LANGUAGE, &language) &&
885 (language < RETRO_LANGUAGE_LAST) && (language != RETRO_LANGUAGE_ENGLISH))
886 retro_keys_label_intl = retro_keys_labels_intl[language];
887
888 if (! options_intl[language] || ! retro_keys_label_intl)
889 return;
890
891 m = 0;
892 n = 0;
893 while (options_intl[language]->definitions[m].key) {
894 if (strstr(options_intl[language]->definitions[m].key, "scummvm_mapper_")) {
895 n = 0;
896 while ((retro_keys_label_intl + n)->label && n < RETRO_NUM_CORE_OPTION_VALUES_MAX - 1) {
897 options_intl[language]->definitions[m].values[n].value = (retro_keys_label_intl + n)->value;
898 options_intl[language]->definitions[m].values[n].label = (retro_keys_label_intl + n)->label;
899 ++n;
900 }
901 options_intl[language]->definitions[m].values[n].value = NULL;
902 options_intl[language]->definitions[m].values[n].label = NULL;
903 }
904 ++m;
905 }
906#endif
907}
908
909/* Handles configuration/setting of core options.
910 * Should be called as early as possible - ideally inside
911 * retro_set_environment(), and no later than retro_load_game()
912 * > We place the function body in the header to avoid the
913 * necessity of adding more .c files (i.e. want this to
914 * be as painless as possible for core devs)
915 */
916
917static INLINE void libretro_set_core_options(retro_environment_t environ_cb,
918 bool *categories_supported) {
919 unsigned version = 0;
920#ifndef HAVE_NO_LANGEXTRA
921 unsigned language = 0;
922#endif
923
924 if (!environ_cb || !categories_supported)
925 return;
926
927 *categories_supported = false;
928
929 if (!environ_cb(RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION, &version))
930 version = 0;
931
932 if (version >= 2) {
933#ifndef HAVE_NO_LANGEXTRA
934 struct retro_core_options_v2_intl core_options_intl;
935
936 core_options_intl.us = &options_us;
937 core_options_intl.local = NULL;
938
939 if (environ_cb(RETRO_ENVIRONMENT_GET_LANGUAGE, &language) &&
940 (language < RETRO_LANGUAGE_LAST) && (language != RETRO_LANGUAGE_ENGLISH))
941 core_options_intl.local = options_intl[language];
942
943 *categories_supported = environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL,
944 &core_options_intl);
945#else
946 *categories_supported = environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2,
947 &options_us);
948#endif
949 } else {
950 size_t i, j;
951 size_t option_index = 0;
952 size_t num_options = 0;
953 struct retro_core_option_definition
954 *option_v1_defs_us = NULL;
955#ifndef HAVE_NO_LANGEXTRA
956 size_t num_options_intl = 0;
957 struct retro_core_option_v2_definition
958 *option_defs_intl = NULL;
959 struct retro_core_option_definition
960 *option_v1_defs_intl = NULL;
961 struct retro_core_options_intl
962 core_options_v1_intl;
963#endif
964 struct retro_variable *variables = NULL;
965 char **values_buf = NULL;
966
967 /* Determine total number of options */
968 while (true) {
969 if (option_defs_us[num_options].key)
970 num_options++;
971 else
972 break;
973 }
974
975 if (version >= 1) {
976 /* Allocate US array */
977 option_v1_defs_us = (struct retro_core_option_definition *)
978 calloc(num_options + 1, sizeof(struct retro_core_option_definition));
979
980 /* Copy parameters from option_defs_us array */
981 for (i = 0; i < num_options; i++) {
982 struct retro_core_option_v2_definition *option_def_us = &option_defs_us[i];
983 struct retro_core_option_value *option_values = option_def_us->values;
984 struct retro_core_option_definition *option_v1_def_us = &option_v1_defs_us[i];
985 struct retro_core_option_value *option_v1_values = option_v1_def_us->values;
986
987 option_v1_def_us->key = option_def_us->key;
988 option_v1_def_us->desc = option_def_us->desc;
989 option_v1_def_us->info = option_def_us->info;
990 option_v1_def_us->default_value = option_def_us->default_value;
991
992 /* Values must be copied individually... */
993 while (option_values->value) {
994 option_v1_values->value = option_values->value;
995 option_v1_values->label = option_values->label;
996
997 option_values++;
998 option_v1_values++;
999 }
1000 }
1001
1002#ifndef HAVE_NO_LANGEXTRA
1003 if (environ_cb(RETRO_ENVIRONMENT_GET_LANGUAGE, &language) &&
1004 (language < RETRO_LANGUAGE_LAST) && (language != RETRO_LANGUAGE_ENGLISH) &&
1005 options_intl[language])
1006 option_defs_intl = options_intl[language]->definitions;
1007
1008 if (option_defs_intl) {
1009 /* Determine number of intl options */
1010 while (true) {
1011 if (option_defs_intl[num_options_intl].key)
1012 num_options_intl++;
1013 else
1014 break;
1015 }
1016
1017 /* Allocate intl array */
1018 option_v1_defs_intl = (struct retro_core_option_definition *)
1019 calloc(num_options_intl + 1, sizeof(struct retro_core_option_definition));
1020
1021 /* Copy parameters from option_defs_intl array */
1022 for (i = 0; i < num_options_intl; i++) {
1023 struct retro_core_option_v2_definition *option_def_intl = &option_defs_intl[i];
1024 struct retro_core_option_value *option_values = option_def_intl->values;
1025 struct retro_core_option_definition *option_v1_def_intl = &option_v1_defs_intl[i];
1026 struct retro_core_option_value *option_v1_values = option_v1_def_intl->values;
1027
1028 option_v1_def_intl->key = option_def_intl->key;
1029 option_v1_def_intl->desc = option_def_intl->desc;
1030 option_v1_def_intl->info = option_def_intl->info;
1031 option_v1_def_intl->default_value = option_def_intl->default_value;
1032
1033 /* Values must be copied individually... */
1034 while (option_values->value) {
1035 option_v1_values->value = option_values->value;
1036 option_v1_values->label = option_values->label;
1037
1038 option_values++;
1039 option_v1_values++;
1040 }
1041 }
1042 }
1043
1044 core_options_v1_intl.us = option_v1_defs_us;
1045 core_options_v1_intl.local = option_v1_defs_intl;
1046
1047 environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL, &core_options_v1_intl);
1048#else
1049 environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS, option_v1_defs_us);
1050#endif
1051 } else {
1052 /* Allocate arrays */
1053 variables = (struct retro_variable *)calloc(num_options + 1,
1054 sizeof(struct retro_variable));
1055 values_buf = (char **)calloc(num_options, sizeof(char *));
1056
1057 if (!variables || !values_buf)
1058 goto error;
1059
1060 /* Copy parameters from option_defs_us array */
1061 for (i = 0; i < num_options; i++) {
1062 const char *key = option_defs_us[i].key;
1063 const char *desc = option_defs_us[i].desc;
1064 const char *default_value = option_defs_us[i].default_value;
1065 struct retro_core_option_value *values = option_defs_us[i].values;
1066 size_t buf_len = 3;
1067 size_t default_index = 0;
1068
1069 values_buf[i] = NULL;
1070
1071 if (desc) {
1072 size_t num_values = 0;
1073
1074 /* Determine number of values */
1075 while (true) {
1076 if (values[num_values].value) {
1077 /* Check if this is the default value */
1078 if (default_value)
1079 if (strcmp(values[num_values].value, default_value) == 0)
1080 default_index = num_values;
1081
1082 buf_len += strlen(values[num_values].value);
1083 num_values++;
1084 } else
1085 break;
1086 }
1087
1088 /* Build values string */
1089 if (num_values > 0) {
1090 buf_len += num_values - 1;
1091 buf_len += strlen(desc);
1092
1093 values_buf[i] = (char *)calloc(buf_len, sizeof(char));
1094 if (!values_buf[i])
1095 goto error;
1096
1097 strcpy(values_buf[i], desc);
1098 strcat(values_buf[i], "; ");
1099
1100 /* Default value goes first */
1101 strcat(values_buf[i], values[default_index].value);
1102
1103 /* Add remaining values */
1104 for (j = 0; j < num_values; j++) {
1105 if (j != default_index) {
1106 strcat(values_buf[i], "|");
1107 strcat(values_buf[i], values[j].value);
1108 }
1109 }
1110 }
1111 }
1112
1113 variables[option_index].key = key;
1114 variables[option_index].value = values_buf[i];
1115 option_index++;
1116 }
1117
1118 /* Set variables */
1119 environ_cb(RETRO_ENVIRONMENT_SET_VARIABLES, variables);
1120 }
1121
1122error:
1123 /* Clean up */
1124
1125 if (option_v1_defs_us) {
1126 free(option_v1_defs_us);
1127 option_v1_defs_us = NULL;
1128 }
1129
1130#ifndef HAVE_NO_LANGEXTRA
1131 if (option_v1_defs_intl) {
1132 free(option_v1_defs_intl);
1133 option_v1_defs_intl = NULL;
1134 }
1135#endif
1136
1137 if (values_buf) {
1138 for (i = 0; i < num_options; i++) {
1139 if (values_buf[i]) {
1140 free(values_buf[i]);
1141 values_buf[i] = NULL;
1142 }
1143 }
1144
1145 free(values_buf);
1146 values_buf = NULL;
1147 }
1148
1149 if (variables) {
1150 free(variables);
1151 variables = NULL;
1152 }
1153 }
1154}
1155
1156#ifdef __cplusplus
1157}
1158#endif
1159
1160#endif
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1