libretro: disable spu thread by default, with option to reenable
[pcsx_rearmed.git] / frontend / libretro_core_options.h
CommitLineData
7a8d521f 1#ifndef LIBRETRO_CORE_OPTIONS_H__
2#define LIBRETRO_CORE_OPTIONS_H__
3
4#include <stdlib.h>
5#include <string.h>
6
7#include <libretro.h>
8#include <retro_inline.h>
9
10#ifndef HAVE_NO_LANGEXTRA
11#include "libretro_core_options_intl.h"
12#endif
13
14/*
15 ********************************
16 * VERSION: 2.0
17 ********************************
18 *
19 * - 2.0: Add support for core options v2 interface
20 * - 1.3: Move translations to libretro_core_options_intl.h
21 * - libretro_core_options_intl.h includes BOM and utf-8
22 * fix for MSVC 2010-2013
23 * - Added HAVE_NO_LANGEXTRA flag to disable translations
24 * on platforms/compilers without BOM support
25 * - 1.2: Use core options v1 interface when
26 * RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION is >= 1
27 * (previously required RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION == 1)
28 * - 1.1: Support generation of core options v0 retro_core_option_value
29 * arrays containing options with a single value
30 * - 1.0: First commit
31*/
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37/*
38 ********************************
39 * Core Option Definitions
40 ********************************
41*/
42
43/* RETRO_LANGUAGE_ENGLISH */
44
45/* Default language:
46 * - All other languages must include the same keys and values
47 * - Will be used as a fallback in the event that frontend language
48 * is not available
49 * - Will be used as a fallback for any missing entries in
50 * frontend language definition
51 */
52
53struct retro_core_option_v2_category option_cats_us[] = {
54 {
55 "system",
56 "System",
57 "Configure base hardware parameters: region, BIOS selection, memory cards, etc."
58 },
59 {
60 "video",
61 "Video",
62 "Configure base display parameters."
63 },
64#ifdef GPU_NEON
65 {
66 "gpu_neon",
67 "GPU Plugin",
68 "Configure low-level settings of the NEON GPU plugin."
69 },
70#endif
71#ifdef GPU_PEOPS
72 {
73 "gpu_peops",
74 "GPU Plugin (Advanced)",
75 "Configure low-level settings of the P.E.Op.S. GPU plugin."
76 },
77#endif
78#ifdef GPU_UNAI
79 {
80 "gpu_unai",
81 "GPU Plugin (Advanced)",
82 "Configure low-level settings of the UNAI GPU plugin."
83 },
84#endif
85 {
86 "audio",
87 "Audio",
88 "Configure sound emulation: reverb, interpolation, CD audio decoding."
89 },
90 {
91 "input",
92 "Input",
93 "Configure input devices: analog response, haptic feedback, Multitaps, light guns, etc."
94 },
95 {
96 "compat_hack",
97 "Compatibility Fixes",
98 "Configure settings/workarounds required for correct operation of specific games."
99 },
100#if !defined(DRC_DISABLE) && !defined(LIGHTREC)
101 {
102 "speed_hack",
103 "Speed Hacks (Advanced)",
104 "Configure hacks that may improve performance at the expense of decreased accuracy/stability."
105 },
106#endif
107 { NULL, NULL, NULL },
108};
109
110struct retro_core_option_v2_definition option_defs_us[] = {
111 {
112 "pcsx_rearmed_region",
113 "Region",
114 NULL,
115 "Specify which region the system is from. 'NTSC' is 60 Hz while 'PAL' is 50 Hz. 'Auto' will detect the region of the currently loaded content. Games may run faster or slower than normal if the incorrect region is selected.",
116 NULL,
117 "system",
118 {
119 { "auto", "Auto" },
120 { "NTSC", NULL },
121 { "PAL", NULL },
122 { NULL, NULL },
123 },
124 "auto",
125 },
126 {
127 "pcsx_rearmed_bios",
128 "BIOS Selection",
129 NULL,
130 "Specify which BIOS to use. 'Auto' will attempt to load a real bios file from the frontend 'system' directory, falling back to high level emulation if unavailable. 'HLE' forces high level BIOS emulation. It is recommended to use an official bios file for better compatibility.",
131 NULL,
132 "system",
133 {
134 { "auto", "Auto" },
135 { "HLE", NULL },
136 { NULL, NULL },
137 },
138 "auto",
139 },
140 {
141 "pcsx_rearmed_show_bios_bootlogo",
142 "Show BIOS Boot Logo",
143 NULL,
144 "When using an official BIOS file, specify whether to show the PlayStation logo upon starting or resetting content. Warning: Enabling the boot logo may reduce game compatibility.",
145 NULL,
146 "system",
147 {
148 { "disabled", NULL },
149 { "enabled", NULL },
150 { NULL, NULL },
151 },
152 "disabled",
153 },
154 {
155 "pcsx_rearmed_memcard2",
156 "Enable Second Memory Card (Shared)",
157 NULL,
158 "Emulate a second memory card in slot 2. This will be shared by all games.",
159 NULL,
160 "system",
161 {
162 { "disabled", NULL },
163 { "enabled", NULL },
164 { NULL, NULL },
165 },
166 "disabled",
167 },
168#ifndef _WIN32
169 {
170 "pcsx_rearmed_async_cd",
171 "CD Access Method (Restart)",
172 NULL,
173 "Select method used to read data from content disk images. 'Synchronous' mimics original hardware. 'Asynchronous' can reduce stuttering on devices with slow storage. 'Pre-Cache (CHD)' loads disk image into memory for faster access (CHD files only).",
174 NULL,
175 "system",
176 {
177 { "sync", "Synchronous" },
178 { "async", "Asynchronous" },
179 { "precache", "Pre-Cache (CHD)" },
180 { NULL, NULL},
181 },
182 "sync",
183 },
184#endif
185#ifndef DRC_DISABLE
186 {
187 "pcsx_rearmed_drc",
188 "Dynamic Recompiler",
189 NULL,
190 "Dynamically recompile PSX CPU instructions to native instructions. Much faster than using an interpreter, but may be less accurate on some platforms.",
191 NULL,
192 "system",
193 {
194 { "disabled", NULL },
195 { "enabled", NULL },
196 { NULL, NULL },
197 },
198 "enabled",
199 },
200#endif
201 {
202 "pcsx_rearmed_psxclock",
203 "PSX CPU Clock Speed",
204 NULL,
205 "Overclock or under-clock the PSX CPU. Try adjusting this if the game is too slow, too fast or hangs."
206#if defined(LIGHTREC)
207 " Currently doesn't work with Lightrec dynarec."
208#endif
209#if defined(HAVE_PRE_ARMV7) && !defined(_3DS)
210 " Default is 50."
211#else
212 " Default is 57."
213#endif
214 ,
215 NULL,
216 "system",
217 {
218 { "30", NULL },
219 { "31", NULL },
220 { "32", NULL },
221 { "33", NULL },
222 { "34", NULL },
223 { "35", NULL },
224 { "36", NULL },
225 { "37", NULL },
226 { "38", NULL },
227 { "39", NULL },
228 { "40", NULL },
229 { "41", NULL },
230 { "42", NULL },
231 { "43", NULL },
232 { "44", NULL },
233 { "45", NULL },
234 { "46", NULL },
235 { "47", NULL },
236 { "48", NULL },
237 { "49", NULL },
238 { "50", NULL },
239 { "51", NULL },
240 { "52", NULL },
241 { "53", NULL },
242 { "54", NULL },
243 { "55", NULL },
244 { "56", NULL },
245 { "57", NULL },
246 { "58", NULL },
247 { "59", NULL },
248 { "60", NULL },
249 { "61", NULL },
250 { "62", NULL },
251 { "63", NULL },
252 { "64", NULL },
253 { "65", NULL },
254 { "66", NULL },
255 { "67", NULL },
256 { "68", NULL },
257 { "69", NULL },
258 { "70", NULL },
259 { "71", NULL },
260 { "72", NULL },
261 { "73", NULL },
262 { "74", NULL },
263 { "75", NULL },
264 { "76", NULL },
265 { "77", NULL },
266 { "78", NULL },
267 { "79", NULL },
268 { "80", NULL },
269 { "81", NULL },
270 { "82", NULL },
271 { "83", NULL },
272 { "84", NULL },
273 { "85", NULL },
274 { "86", NULL },
275 { "87", NULL },
276 { "88", NULL },
277 { "89", NULL },
278 { "90", NULL },
279 { "91", NULL },
280 { "92", NULL },
281 { "93", NULL },
282 { "94", NULL },
283 { "95", NULL },
284 { "96", NULL },
285 { "97", NULL },
286 { "98", NULL },
287 { "99", NULL },
288 { "100", NULL },
289 { NULL, NULL },
290 },
291#if defined(HAVE_PRE_ARMV7) && !defined(_3DS)
292 "50",
293#else
294 "57",
295#endif
296 },
297 {
298 "pcsx_rearmed_dithering",
299 "Dithering Pattern",
300 NULL,
301 "Enable emulation of the dithering technique used by the PSX to smooth out color banding artifacts. Increases performance requirements.",
302 NULL,
303 "video",
304 {
305 { "disabled", NULL },
306 { "enabled", NULL },
307 { NULL, NULL },
308 },
309#if defined HAVE_LIBNX || defined _3DS
310 "disabled",
311#else
312 "enabled",
313#endif
314 },
315 {
316 "pcsx_rearmed_duping_enable",
317 "Frame Duping (Speedup)",
318 NULL,
319 "When enabled and supported by the libretro frontend, provides a small performance increase by directing the frontend to repeat the previous frame if the core has nothing new to display.",
320 NULL,
321 "video",
322 {
323 { "disabled", NULL },
324 { "enabled", NULL },
325 { NULL, NULL },
326 },
327 "enabled",
328 },
329#ifdef THREAD_RENDERING
330 {
331 "pcsx_rearmed_gpu_thread_rendering",
332 "Threaded Rendering",
333 NULL,
334 "When enabled, runs GPU commands in a secondary thread. 'Synchronous' improves performance while maintaining proper frame pacing. 'Asynchronous' improves performance even further, but may cause dropped frames and increased latency. Produces best results with games that run natively at less than 60 frames per second.",
335 NULL,
336 "video",
337 {
338 { "disabled", NULL },
339 { "sync", "Synchronous" },
340 { "async", "Asynchronous" },
341 { NULL, NULL},
342 },
343 "disabled",
344 },
345#endif
346 {
347 "pcsx_rearmed_frameskip_type",
348 "Frameskip",
349 NULL,
350 "Skip frames to avoid audio buffer under-run (crackling). Improves performance at the expense of visual smoothness. 'Auto' skips frames when advised by the frontend. 'Auto (Threshold)' utilises the 'Frameskip Threshold (%)' setting. 'Fixed Interval' utilises the 'Frameskip Interval' setting.",
351 NULL,
352 "video",
353 {
354 { "disabled", NULL },
355 { "auto", "Auto" },
356 { "auto_threshold", "Auto (Threshold)" },
357 { "fixed_interval", "Fixed Interval" },
358 { NULL, NULL },
359 },
360 "disabled"
361 },
362 {
363 "pcsx_rearmed_frameskip_threshold",
364 "Frameskip Threshold (%)",
365 NULL,
366 "When 'Frameskip' is set to 'Auto (Threshold)', specifies the audio buffer occupancy threshold (percentage) below which frames will be skipped. Higher values reduce the risk of crackling by causing frames to be dropped more frequently.",
367 NULL,
368 "video",
369 {
370 { "15", NULL },
371 { "18", NULL },
372 { "21", NULL },
373 { "24", NULL },
374 { "27", NULL },
375 { "30", NULL },
376 { "33", NULL },
377 { "36", NULL },
378 { "39", NULL },
379 { "42", NULL },
380 { "45", NULL },
381 { "48", NULL },
382 { "51", NULL },
383 { "54", NULL },
384 { "57", NULL },
385 { "60", NULL },
386 { NULL, NULL },
387 },
388 "33"
389 },
390 {
391 "pcsx_rearmed_frameskip_interval",
392 "Frameskip Interval",
393 NULL,
394 "Specify the maximum number of frames that can be skipped before a new frame is rendered.",
395 NULL,
396 "video",
397 {
398 { "1", NULL },
399 { "2", NULL },
400 { "3", NULL },
401 { "4", NULL },
402 { "5", NULL },
403 { "6", NULL },
404 { "7", NULL },
405 { "8", NULL },
406 { "9", NULL },
407 { "10", NULL },
408 { NULL, NULL },
409 },
410 "3"
411 },
412 {
413 "pcsx_rearmed_display_internal_fps",
414 "Display Internal FPS",
415 NULL,
416 "Show the internal frame rate at which the emulated PlayStation system is rendering content. Note: Requires on-screen notifications to be enabled in the libretro frontend.",
417 NULL,
418 "video",
419 {
420 { "disabled", NULL },
421 { "enabled", NULL },
422 { NULL, NULL },
423 },
424 "disabled",
425 },
8c84ba5f 426 {
427 "pcsx_rearmed_gpu_slow_llists",
428 "(GPU) Slow linked list processing",
429 NULL,
430 "Slower but more accurate GPU linked list processing. Needed by only a few games like Vampire Hunter D. Should be autodetected in most cases.",
431 NULL,
432 "video",
433 {
434 { "auto", NULL },
435 { "disabled", NULL },
436 { "enabled", NULL },
437 { NULL, NULL },
438 },
439 "auto",
440 },
7a8d521f 441#ifdef GPU_NEON
442 {
443 "pcsx_rearmed_neon_interlace_enable",
444 "(GPU) Show Interlaced Video",
445 "Show Interlaced Video",
446 "When enabled, games that run in high resolution video modes (480i, 512i) will produced interlaced video output. While this displays correctly on CRT televisions, it will produce artifacts on modern displays. When disabled, all video is output in progressive format.",
447 NULL,
448 "gpu_neon",
449 {
450 { "disabled", NULL },
451 { "enabled", NULL },
452 { NULL, NULL },
453 },
454 "disabled",
455 },
456 {
457 "pcsx_rearmed_neon_enhancement_enable",
458 "(GPU) Enhanced Resolution (Slow)",
459 "Enhanced Resolution (Slow)",
460 "Render games that do not already run in high resolution video modes (480i, 512i) at twice the native internal resolution. Improves the fidelity of 3D models at the expense of increased performance requirements. 2D elements are generally unaffected by this setting.",
461 NULL,
462 "gpu_neon",
463 {
464 { "disabled", NULL },
465 { "enabled", NULL },
466 { NULL, NULL },
467 },
468 "disabled",
469 },
470 {
471 "pcsx_rearmed_neon_enhancement_no_main",
472 "(GPU) Enhanced Resolution Speed Hack",
473 "Enhanced Resolution Speed Hack",
474 "Improves performance when 'Enhanced Resolution (Slow)' is enabled, but reduces compatibility and may cause rendering errors.",
475 NULL,
476 "gpu_neon",
477 {
478 { "disabled", NULL },
479 { "enabled", NULL },
480 { NULL, NULL },
481 },
482 "disabled",
483 },
484#endif /* GPU_NEON */
485#ifdef GPU_PEOPS
486 {
487 "pcsx_rearmed_show_gpu_peops_settings",
488 "Show Advanced P.E.Op.S. GPU Settings",
489 NULL,
490 "Show low-level configuration options for the P.E.Op.S. GPU plugin. Quick Menu may need to be toggled for this setting to take effect.",
491 NULL,
492 NULL,
493 {
494 { "disabled", NULL },
495 { "enabled", NULL },
496 { NULL, NULL },
497 },
498 "disabled",
499 },
500 {
501 "pcsx_rearmed_gpu_peops_odd_even_bit",
502 "(GPU) Odd/Even Bit Hack",
503 "Odd/Even Bit Hack",
504 "A hack fix used to correct lock-ups that may occur in games such as Chrono Cross. Disable unless required.",
505 NULL,
506 "gpu_peops",
507 {
508 { "disabled", NULL },
509 { "enabled", NULL },
510 { NULL, NULL },
511 },
512 "disabled",
513 },
514 {
515 "pcsx_rearmed_gpu_peops_expand_screen_width",
516 "(GPU) Expand Screen Width",
517 "Expand Screen Width",
518 "Intended for use only with Capcom 2D fighting games. Enlarges the display area at the right side of the screen to show all background elements without cut-off. May cause rendering errors.",
519 NULL,
520 "gpu_peops",
521 {
522 { "disabled", NULL },
523 { "enabled", NULL },
524 { NULL, NULL },
525 },
526 "disabled",
527 },
528 {
529 "pcsx_rearmed_gpu_peops_ignore_brightness",
530 "(GPU) Ignore Brightness Color",
531 "Ignore Brightness Color",
532 "A hack fix used to repair black screens in Lunar Silver Star Story Complete when entering a house or a menu. Disable unless required.",
533 NULL,
534 "gpu_peops",
535 {
536 { "disabled", NULL },
537 { "enabled", NULL },
538 { NULL, NULL },
539 },
540 "disabled",
541 },
542 {
543 "pcsx_rearmed_gpu_peops_disable_coord_check",
544 "(GPU) Disable Coordinate Check",
545 "Disable Coordinate Check",
546 "Legacy compatibility mode. May improve games that fail to run correctly on newer GPU hardware. Disable unless required.",
547 NULL,
548 "gpu_peops",
549 {
550 { "disabled", NULL },
551 { "enabled", NULL },
552 { NULL, NULL },
553 },
554 "disabled",
555 },
556 {
557 "pcsx_rearmed_gpu_peops_lazy_screen_update",
558 "(GPU) Lazy Screen Update",
559 "Lazy Screen Update",
560 "A partial fix to prevent text box flickering in Dragon Warrior VII. May also improve Pandemonium 2. Disable unless required.",
561 NULL,
562 "gpu_peops",
563 {
564 { "disabled", NULL },
565 { "enabled", NULL },
566 { NULL, NULL },
567 },
568 "disabled",
569 },
570 {
571 "pcsx_rearmed_gpu_peops_repeated_triangles",
572 "(GPU) Repeat Flat Tex Triangles",
573 "Repeat Flat Tex Triangles",
574 "A hack fix used to correct rendering errors in Star Wars: Dark Forces. Disable unless required.",
575 NULL,
576 "gpu_peops",
577 {
578 { "disabled", NULL },
579 { "enabled", NULL },
580 { NULL, NULL },
581 },
582 "disabled",
583 },
584 {
585 "pcsx_rearmed_gpu_peops_quads_with_triangles",
586 "(GPU) Draw Tex-Quads as Triangles",
587 "Draw Tex-Quads as Triangles",
588 "Corrects graphical distortions that may occur when games utilize Gouraud Shading, at the expense of reduced texture quality. Disable unless required.",
589 NULL,
590 "gpu_peops",
591 {
592 { "disabled", NULL },
593 { "enabled", NULL },
594 { NULL, NULL },
595 },
596 "disabled",
597 },
598 {
599 "pcsx_rearmed_gpu_peops_fake_busy_state",
600 "(GPU) Fake 'GPU Busy' States",
601 "Fake 'GPU Busy' States",
602 "Emulate the 'GPU is busy' (drawing primitives) status flag of the original hardware instead of assuming the GPU is always ready for commands. May improve compatibility at the expense of reduced performance. Disable unless required.",
603 NULL,
604 "gpu_peops",
605 {
606 { "disabled", NULL },
607 { "enabled", NULL },
608 { NULL, NULL },
609 },
610 "disabled",
611 },
612#endif /* GPU_PEOPS */
613#ifdef GPU_UNAI
614 {
615 "pcsx_rearmed_show_gpu_unai_settings",
616 "Show Advanced UNAI GPU Settings",
617 NULL,
618 "Show low-level configuration options for the UNAI GPU plugin. Quick Menu may need to be toggled for this setting to take effect.",
619 NULL,
620 NULL,
621 {
622 { "disabled", NULL },
623 { "enabled", NULL },
624 { NULL, NULL},
625 },
626 "disabled",
627 },
628 {
629 "pcsx_rearmed_gpu_unai_blending",
630 "(GPU) Texture Blending",
631 "Texture Blending",
632 "Enable alpha-based (and additive) texture blending. Required for various rendering effects, including transparency (e.g. water, shadows). Can be disabled to improve performance at the expense of severe display errors/inaccuracies.",
633 NULL,
634 "gpu_unai",
635 {
636 { "disabled", NULL },
637 { "enabled", NULL },
638 { NULL, NULL},
639 },
640 "enabled",
641 },
642 {
643 "pcsx_rearmed_gpu_unai_lighting",
644 "(GPU) Lighting Effects",
645 "Lighting Effects",
646 "Enable simulated lighting effects (via vertex coloring combined with texture mapping). Required by almost all 3D games. Can be disabled to improve performance at the expense of severe display errors/inaccuracies (missing shadows, flat textures, etc.).",
647 NULL,
648 "gpu_unai",
649 {
650 { "disabled", NULL },
651 { "enabled", NULL },
652 { NULL, NULL},
653 },
654 "enabled",
655 },
656 {
657 "pcsx_rearmed_gpu_unai_fast_lighting",
658 "(GPU) Fast Lighting",
659 "Fast Lighting",
660 "Improves performance when 'Lighting Effects' are enabled, but may cause moderate/severe rendering errors.",
661 NULL,
662 "gpu_unai",
663 {
664 { "disabled", NULL },
665 { "enabled", NULL },
666 { NULL, NULL},
667 },
668 "disabled",
669 },
670 {
671 "pcsx_rearmed_gpu_unai_scale_hires",
672 "(GPU) Hi-Res Downscaling",
673 "Hi-Res Downscaling",
674 "When enabled, games that run in high resolution video modes (480i, 512i) will be downscaled to 320x240. Can improve performance, and is recommended on devices with native 240p display resolutions.",
675 NULL,
676 "gpu_unai",
677 {
678 { "disabled", NULL },
679 { "enabled", NULL },
680 { NULL, NULL},
681 },
682#ifdef _MIYOO
683 "enabled",
684#else
685 "disabled",
686#endif
687 },
688#endif /* GPU_UNAI */
689 {
690 "pcsx_rearmed_spu_reverb",
691 "Audio Reverb Effects",
692 "Reverb Effects",
693 "Enable emulation of the reverb feature provided by the PSX SPU. Can be disabled to improve performance at the expense of reduced audio quality/authenticity.",
694 NULL,
695 "audio",
696 {
697 { "disabled", NULL },
698 { "enabled", NULL },
699 { NULL, NULL },
700 },
701#ifdef HAVE_PRE_ARMV7
702 "disabled",
703#else
704 "enabled",
705#endif
706 },
707 {
708 "pcsx_rearmed_spu_interpolation",
709 "Sound Interpolation",
710 NULL,
711 "Enable emulation of the in-built audio interpolation provided by the PSX SPU. 'Gaussian' sounds closest to original hardware. 'Simple' improves performance but reduces quality. 'Cubic' has the highest performance requirements but produces increased clarity. Can be disabled entirely for maximum performance, at the expense of greatly reduced audio quality.",
712 NULL,
713 "audio",
714 {
715 { "simple", "Simple" },
716 { "gaussian", "Gaussian" },
717 { "cubic", "Cubic" },
718 { "off", "disabled" },
719 { NULL, NULL },
720 },
721#ifdef HAVE_PRE_ARMV7
722 "off",
723#else
724 "simple",
725#endif
726 },
727 {
728 "pcsx_rearmed_nocdaudio",
729 "CD Audio",
730 NULL,
731 "Enable playback of CD (CD-DA) audio tracks. Can be disabled to improve performance in games that include CD audio, at the expense of missing music.",
732 NULL,
733 "audio",
734 {
735 { "disabled", NULL },
736 { "enabled", NULL },
737 { NULL, NULL },
738 },
739 "enabled",
740 },
741 {
742 "pcsx_rearmed_noxadecoding",
743 "XA Decoding",
744 NULL,
745 "Enable playback of XA (eXtended Architecture ADPCM) audio tracks. Can be disabled to improve performance in games that include XA audio, at the expense of missing music.",
746 NULL,
747 "audio",
748 {
749 { "disabled", NULL },
750 { "enabled", NULL },
751 { NULL, NULL },
752 },
753 "enabled",
754 },
16809ab9 755#if !defined(THREAD_ENABLED) && !defined(_WIN32) && !defined(NO_OS)
756 {
757 "pcsx_rearmed_spu_thread",
758 "Threaded SPU",
759 NULL,
760 "Emulates the PSX SPU on another CPU thread. May cause audio glitches in some games.",
761 NULL,
762 "audio",
763 {
764 { "disabled", NULL },
765 { "enabled", NULL },
766 { NULL, NULL },
767 },
768 "disabled",
769 },
770#endif // THREAD_ENABLED
7a8d521f 771 {
772 "pcsx_rearmed_show_input_settings",
773 "Show Input Settings",
774 NULL,
775 "Show configuration options for all input devices: analog response, Multitaps, light guns, etc. Quick Menu may need to be toggled for this setting to take effect.",
776 NULL,
777 NULL,
778 {
779 { "disabled", NULL },
780 { "enabled", NULL },
781 { NULL, NULL },
782 },
783 "disabled",
784 },
785 {
786 "pcsx_rearmed_analog_axis_modifier",
787 "Analog Axis Bounds",
788 NULL,
789 "Specify range limits for the left and right analog sticks when input device is set to 'analog' or 'dualshock'. 'Square' bounds improve input response when using controllers with highly circular ranges that are unable to fully saturate the X and Y axes at 45 degree deflections.",
790 NULL,
791 "input",
792 {
793 { "circle", "Circle" },
794 { "square", "Square" },
795 { NULL, NULL },
796 },
797 "circle",
798 },
799 {
800 "pcsx_rearmed_vibration",
801 "Rumble Effects",
802 NULL,
803 "Enable haptic feedback when using a rumble-equipped gamepad with input device set to 'dualshock'.",
804 NULL,
805 "input",
806 {
807 { "disabled", NULL },
808 { "enabled", NULL },
809 { NULL, NULL },
810 },
811 "enabled",
812 },
813 {
814 "pcsx_rearmed_multitap",
815 "Multitap Mode (Restart)",
816 NULL,
817 "Connect a virtual PSX Multitap peripheral to either controller 'Port 1' or controller 'Port 2' for 5 player simultaneous input, or to both 'Ports 1 and 2' for 8 player input. Mutlitap usage requires compatible games. To avoid input defects, option should be disabled when running games that have no support for Multitap features.",
818 NULL,
819 "input",
820 {
821 { "disabled", NULL },
822 { "port 1", "Port 1" },
823 { "port 2", "Port 2" },
824 { "ports 1 and 2", "Ports 1 and 2" },
825 { NULL, NULL },
826 },
827 "disabled",
828 },
829 {
830 "pcsx_rearmed_negcon_deadzone",
831 "NegCon Twist Deadzone",
832 NULL,
833 "Set the deadzone of the RetroPad left analog stick when simulating the 'twist' action of emulated neGcon Controllers. Used to eliminate drift/unwanted input.",
834 NULL,
835 "input",
836 {
837 { "0", "0%" },
838 { "3", "3%" },
839 { "5", "5%" },
840 { "7", "7%" },
841 { "10", "10%" },
842 { "13", "13%" },
843 { "15", "15%" },
844 { "17", "17%" },
845 { "20", "20%" },
846 { "23", "23%" },
847 { "25", "25%" },
848 { "27", "27%" },
849 { "30", "30%" },
850 { NULL, NULL },
851 },
852 "0",
853 },
854 {
855 "pcsx_rearmed_negcon_response",
856 "NegCon Twist Response",
857 NULL,
858 "Specify the analog response when using a RetroPad left analog stick to simulate the 'twist' action of emulated neGcon Controllers.",
859 NULL,
860 "input",
861 {
862 { "linear", "Linear" },
863 { "quadratic", "Quadratic" },
864 { "cubic", "Cubic" },
865 { NULL, NULL },
866 },
867 "linear",
868 },
869 {
870 "pcsx_rearmed_input_sensitivity",
871 "Mouse Sensitivity",
872 NULL,
873 "Adjust responsiveness of emulated 'mouse' input devices.",
874 NULL,
875 "input",
876 {
877 { "0.05", NULL },
878 { "0.10", NULL },
879 { "0.15", NULL },
880 { "0.20", NULL },
881 { "0.25", NULL },
882 { "0.30", NULL },
883 { "0.35", NULL },
884 { "0.40", NULL },
885 { "0.45", NULL },
886 { "0.50", NULL },
887 { "0.55", NULL },
888 { "0.60", NULL },
889 { "0.65", NULL },
890 { "0.70", NULL },
891 { "0.75", NULL },
892 { "0.80", NULL },
893 { "0.85", NULL },
894 { "0.90", NULL },
895 { "0.95", NULL },
896 { "1.00", NULL },
897 { "1.05", NULL },
898 { "1.10", NULL },
899 { "1.15", NULL },
900 { "1.20", NULL },
901 { "1.25", NULL },
902 { "1.30", NULL },
903 { "1.35", NULL },
904 { "1.40", NULL },
905 { "1.45", NULL },
906 { "1.50", NULL },
907 { "1.55", NULL },
908 { "1.60", NULL },
909 { "1.65", NULL },
910 { "1.70", NULL },
911 { "1.75", NULL },
912 { "1.80", NULL },
913 { "1.85", NULL },
914 { "1.90", NULL },
915 { "1.95", NULL },
916 { "2.00", NULL },
917 },
918 "1.00",
919 },
920 {
921 "pcsx_rearmed_gunconadjustx",
922 "Guncon X Axis Offset",
923 NULL,
924 "Apply an X axis offset to light gun input when emulating a Guncon device. Can be used to correct aiming misalignments.",
925 NULL,
926 "input",
927 {
928 { "-25", NULL },
929 { "-24", NULL },
930 { "-23", NULL },
931 { "-22", NULL },
932 { "-21", NULL },
933 { "-20", NULL },
934 { "-19", NULL },
935 { "-18", NULL },
936 { "-17", NULL },
937 { "-16", NULL },
938 { "-15", NULL },
939 { "-14", NULL },
940 { "-13", NULL },
941 { "-12", NULL },
942 { "-11", NULL },
943 { "-10", NULL },
944 { "-9", NULL },
945 { "-8", NULL },
946 { "-7", NULL },
947 { "-6", NULL },
948 { "-5", NULL },
949 { "-4", NULL },
950 { "-3", NULL },
951 { "-2", NULL },
952 { "-1", NULL },
953 { "0", NULL },
954 { "1", NULL },
955 { "2", NULL },
956 { "3", NULL },
957 { "4", NULL },
958 { "5", NULL },
959 { "6", NULL },
960 { "7", NULL },
961 { "8", NULL },
962 { "9", NULL },
963 { "10", NULL },
964 { "11", NULL },
965 { "12", NULL },
966 { "13", NULL },
967 { "14", NULL },
968 { "15", NULL },
969 { "16", NULL },
970 { "17", NULL },
971 { "18", NULL },
972 { "19", NULL },
973 { "20", NULL },
974 { "21", NULL },
975 { "22", NULL },
976 { "23", NULL },
977 { "24", NULL },
978 { "25", NULL },
979 { NULL, NULL },
980 },
981 "0",
982 },
983 {
984 "pcsx_rearmed_gunconadjusty",
985 "Guncon Y Axis Offset",
986 NULL,
987 "Apply a Y axis offset to light gun input when emulating a Guncon device. Can be used to correct aiming misalignments.",
988 NULL,
989 "input",
990 {
991 { "-25", NULL },
992 { "-24", NULL },
993 { "-23", NULL },
994 { "-22", NULL },
995 { "-21", NULL },
996 { "-20", NULL },
997 { "-19", NULL },
998 { "-18", NULL },
999 { "-17", NULL },
1000 { "-16", NULL },
1001 { "-15", NULL },
1002 { "-14", NULL },
1003 { "-13", NULL },
1004 { "-12", NULL },
1005 { "-11", NULL },
1006 { "-10", NULL },
1007 { "-9", NULL },
1008 { "-8", NULL },
1009 { "-7", NULL },
1010 { "-6", NULL },
1011 { "-5", NULL },
1012 { "-4", NULL },
1013 { "-3", NULL },
1014 { "-2", NULL },
1015 { "-1", NULL },
1016 { "0", NULL },
1017 { "1", NULL },
1018 { "2", NULL },
1019 { "3", NULL },
1020 { "4", NULL },
1021 { "5", NULL },
1022 { "6", NULL },
1023 { "7", NULL },
1024 { "8", NULL },
1025 { "9", NULL },
1026 { "10", NULL },
1027 { "11", NULL },
1028 { "12", NULL },
1029 { "13", NULL },
1030 { "14", NULL },
1031 { "15", NULL },
1032 { "16", NULL },
1033 { "17", NULL },
1034 { "18", NULL },
1035 { "19", NULL },
1036 { "20", NULL },
1037 { "21", NULL },
1038 { "22", NULL },
1039 { "23", NULL },
1040 { "24", NULL },
1041 { "25", NULL },
1042 { NULL, NULL },
1043 },
1044 "0",
1045 },
1046 {
1047 "pcsx_rearmed_gunconadjustratiox",
1048 "Guncon X Axis Response",
1049 NULL,
1050 "Adjust relative magnitude of horizontal light gun motion when emulating a Guncon device. Can be used to correct aiming misalignments.",
1051 NULL,
1052 "input",
1053 {
1054 { "0.75", NULL },
1055 { "0.76", NULL },
1056 { "0.77", NULL },
1057 { "0.78", NULL },
1058 { "0.79", NULL },
1059 { "0.80", NULL },
1060 { "0.81", NULL },
1061 { "0.82", NULL },
1062 { "0.83", NULL },
1063 { "0.84", NULL },
1064 { "0.85", NULL },
1065 { "0.86", NULL },
1066 { "0.87", NULL },
1067 { "0.88", NULL },
1068 { "0.89", NULL },
1069 { "0.90", NULL },
1070 { "0.91", NULL },
1071 { "0.92", NULL },
1072 { "0.93", NULL },
1073 { "0.94", NULL },
1074 { "0.95", NULL },
1075 { "0.96", NULL },
1076 { "0.97", NULL },
1077 { "0.98", NULL },
1078 { "0.99", NULL },
1079 { "1.00", NULL },
1080 { "1.01", NULL },
1081 { "1.02", NULL },
1082 { "1.03", NULL },
1083 { "1.04", NULL },
1084 { "1.05", NULL },
1085 { "1.06", NULL },
1086 { "1.07", NULL },
1087 { "1.08", NULL },
1088 { "1.09", NULL },
1089 { "1.10", NULL },
1090 { "1.11", NULL },
1091 { "1.12", NULL },
1092 { "1.13", NULL },
1093 { "1.14", NULL },
1094 { "1.15", NULL },
1095 { "1.16", NULL },
1096 { "1.17", NULL },
1097 { "1.18", NULL },
1098 { "1.19", NULL },
1099 { "1.20", NULL },
1100 { "1.21", NULL },
1101 { "1.22", NULL },
1102 { "1.23", NULL },
1103 { "1.24", NULL },
1104 { "1.25", NULL },
1105 { NULL, NULL },
1106 },
1107 "1.00",
1108 },
1109 {
1110 "pcsx_rearmed_gunconadjustratioy",
1111 "Guncon Y Axis Response",
1112 NULL,
1113 "Adjust relative magnitude of vertical light gun motion when emulating a Guncon device. Can be used to correct aiming misalignments.",
1114 NULL,
1115 "input",
1116 {
1117 { "0.75", NULL },
1118 { "0.76", NULL },
1119 { "0.77", NULL },
1120 { "0.78", NULL },
1121 { "0.79", NULL },
1122 { "0.80", NULL },
1123 { "0.81", NULL },
1124 { "0.82", NULL },
1125 { "0.83", NULL },
1126 { "0.84", NULL },
1127 { "0.85", NULL },
1128 { "0.86", NULL },
1129 { "0.87", NULL },
1130 { "0.88", NULL },
1131 { "0.89", NULL },
1132 { "0.90", NULL },
1133 { "0.91", NULL },
1134 { "0.92", NULL },
1135 { "0.93", NULL },
1136 { "0.94", NULL },
1137 { "0.95", NULL },
1138 { "0.96", NULL },
1139 { "0.97", NULL },
1140 { "0.98", NULL },
1141 { "0.99", NULL },
1142 { "1.00", NULL },
1143 { "1.01", NULL },
1144 { "1.02", NULL },
1145 { "1.03", NULL },
1146 { "1.04", NULL },
1147 { "1.05", NULL },
1148 { "1.06", NULL },
1149 { "1.07", NULL },
1150 { "1.08", NULL },
1151 { "1.09", NULL },
1152 { "1.10", NULL },
1153 { "1.11", NULL },
1154 { "1.12", NULL },
1155 { "1.13", NULL },
1156 { "1.14", NULL },
1157 { "1.15", NULL },
1158 { "1.16", NULL },
1159 { "1.17", NULL },
1160 { "1.18", NULL },
1161 { "1.19", NULL },
1162 { "1.20", NULL },
1163 { "1.21", NULL },
1164 { "1.22", NULL },
1165 { "1.23", NULL },
1166 { "1.24", NULL },
1167 { "1.25", NULL },
1168 { NULL, NULL },
1169 },
1170 "1.00",
1171 },
1172 {
1173 "pcsx_rearmed_icache_emulation",
1174 "Instruction Cache Emulation",
1175 NULL,
1176 "Enable emulation of the PSX CPU instruction cache. Improves accuracy at the expense of increased performance overheads. Required for Formula One 2001, Formula One Arcade and Formula One 99. [Interpreter only and partial on lightrec, unsupported when using ARMv7 backend]",
1177 NULL,
1178 "compat_hack",
1179 {
1180 { "disabled", NULL },
1181 { "enabled", NULL },
1182 { NULL, NULL },
1183 },
1184 "disabled",
1185 },
1186#if !defined(DRC_DISABLE) && !defined(LIGHTREC)
1187 {
1188 "pcsx_rearmed_nocompathacks",
1189 "Disable Automatic Compatibility Hacks",
1190 NULL,
1191 "By default, PCSX-ReARMed will apply auxiliary compatibility hacks automatically, based on the currently loaded content. This behaviour is required for correct operation, but may be disabled if desired.",
1192 NULL,
1193 "compat_hack",
1194 {
1195 { "disabled", NULL },
1196 { "enabled", NULL },
1197 { NULL, NULL },
1198 },
1199 "disabled",
1200 },
1201 {
1202 "pcsx_rearmed_nosmccheck",
1203 "(Speed Hack) Disable SMC Checks",
1204 "Disable SMC Checks",
1205 "Will cause crashes when loading, and lead to memory card failure.",
1206 NULL,
1207 "speed_hack",
1208 {
1209 { "disabled", NULL },
1210 { "enabled", NULL },
1211 { NULL, NULL },
1212 },
1213 "disabled",
1214 },
1215 {
1216 "pcsx_rearmed_gteregsunneeded",
1217 "(Speed Hack) Assume GTE Registers Unneeded",
1218 "Assume GTE Registers Unneeded",
1219 "May cause rendering errors.",
1220 NULL,
1221 "speed_hack",
1222 {
1223 { "disabled", NULL },
1224 { "enabled", NULL },
1225 { NULL, NULL },
1226 },
1227 "disabled",
1228 },
1229 {
1230 "pcsx_rearmed_nogteflags",
1231 "(Speed Hack) Disable GTE Flags",
1232 "Disable GTE Flags",
1233 "Will cause rendering errors.",
1234 NULL,
1235 "speed_hack",
1236 {
1237 { "disabled", NULL },
1238 { "enabled", NULL },
1239 { NULL, NULL },
1240 },
1241 "disabled",
1242 },
1243 {
1244 "pcsx_rearmed_nostalls",
1245 "(Speed Hack) Disable CPU/GTE Stalls",
1246 "Disable CPU/GTE Stalls",
1247 "Will cause some games to run too quickly.",
1248 NULL,
1249 "speed_hack",
1250 {
1251 { "disabled", NULL },
1252 { "enabled", NULL },
1253 { NULL, NULL },
1254 },
1255 "disabled",
1256 },
1257#endif /* !DRC_DISABLE && !LIGHTREC */
1258 { NULL, NULL, NULL, NULL, NULL, NULL, {{0}}, NULL },
1259};
1260
1261struct retro_core_options_v2 options_us = {
1262 option_cats_us,
1263 option_defs_us
1264};
1265
1266/*
1267 ********************************
1268 * Language Mapping
1269 ********************************
1270*/
1271
1272#ifndef HAVE_NO_LANGEXTRA
1273struct retro_core_options_v2 *options_intl[RETRO_LANGUAGE_LAST] = {
1274 &options_us, /* RETRO_LANGUAGE_ENGLISH */
1275 NULL, /* RETRO_LANGUAGE_JAPANESE */
1276 NULL, /* RETRO_LANGUAGE_FRENCH */
1277 NULL, /* RETRO_LANGUAGE_SPANISH */
1278 NULL, /* RETRO_LANGUAGE_GERMAN */
1279 NULL, /* RETRO_LANGUAGE_ITALIAN */
1280 NULL, /* RETRO_LANGUAGE_DUTCH */
1281 NULL, /* RETRO_LANGUAGE_PORTUGUESE_BRAZIL */
1282 NULL, /* RETRO_LANGUAGE_PORTUGUESE_PORTUGAL */
1283 NULL, /* RETRO_LANGUAGE_RUSSIAN */
1284 NULL, /* RETRO_LANGUAGE_KOREAN */
1285 NULL, /* RETRO_LANGUAGE_CHINESE_TRADITIONAL */
1286 NULL, /* RETRO_LANGUAGE_CHINESE_SIMPLIFIED */
1287 NULL, /* RETRO_LANGUAGE_ESPERANTO */
1288 NULL, /* RETRO_LANGUAGE_POLISH */
1289 NULL, /* RETRO_LANGUAGE_VIETNAMESE */
1290 NULL, /* RETRO_LANGUAGE_ARABIC */
1291 NULL, /* RETRO_LANGUAGE_GREEK */
1292 &options_tr, /* RETRO_LANGUAGE_TURKISH */
1293};
1294#endif
1295
1296/*
1297 ********************************
1298 * Functions
1299 ********************************
1300*/
1301
1302/* Handles configuration/setting of core options.
1303 * Should be called as early as possible - ideally inside
1304 * retro_set_environment(), and no later than retro_load_game()
1305 * > We place the function body in the header to avoid the
1306 * necessity of adding more .c files (i.e. want this to
1307 * be as painless as possible for core devs)
1308 */
1309
1310static INLINE void libretro_set_core_options(retro_environment_t environ_cb,
1311 bool *categories_supported)
1312{
1313 unsigned version = 0;
1314#ifndef HAVE_NO_LANGEXTRA
1315 unsigned language = 0;
1316#endif
1317
1318 if (!environ_cb || !categories_supported)
1319 return;
1320
1321 *categories_supported = false;
1322
1323 if (!environ_cb(RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION, &version))
1324 version = 0;
1325
1326 if (version >= 2)
1327 {
1328#ifndef HAVE_NO_LANGEXTRA
1329 struct retro_core_options_v2_intl core_options_intl;
1330
1331 core_options_intl.us = &options_us;
1332 core_options_intl.local = NULL;
1333
1334 if (environ_cb(RETRO_ENVIRONMENT_GET_LANGUAGE, &language) &&
1335 (language < RETRO_LANGUAGE_LAST) && (language != RETRO_LANGUAGE_ENGLISH))
1336 core_options_intl.local = options_intl[language];
1337
1338 *categories_supported = environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL,
1339 &core_options_intl);
1340#else
1341 *categories_supported = environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2,
1342 &options_us);
1343#endif
1344 }
1345 else
1346 {
1347 size_t i, j;
1348 size_t option_index = 0;
1349 size_t num_options = 0;
1350 struct retro_core_option_definition
1351 *option_v1_defs_us = NULL;
1352#ifndef HAVE_NO_LANGEXTRA
1353 size_t num_options_intl = 0;
1354 struct retro_core_option_v2_definition
1355 *option_defs_intl = NULL;
1356 struct retro_core_option_definition
1357 *option_v1_defs_intl = NULL;
1358 struct retro_core_options_intl
1359 core_options_v1_intl;
1360#endif
1361 struct retro_variable *variables = NULL;
1362 char **values_buf = NULL;
1363
1364 /* Determine total number of options */
1365 while (true)
1366 {
1367 if (option_defs_us[num_options].key)
1368 num_options++;
1369 else
1370 break;
1371 }
1372
1373 if (version >= 1)
1374 {
1375 /* Allocate US array */
1376 option_v1_defs_us = (struct retro_core_option_definition *)
1377 calloc(num_options + 1, sizeof(struct retro_core_option_definition));
1378
1379 /* Copy parameters from option_defs_us array */
1380 for (i = 0; i < num_options; i++)
1381 {
1382 struct retro_core_option_v2_definition *option_def_us = &option_defs_us[i];
1383 struct retro_core_option_value *option_values = option_def_us->values;
1384 struct retro_core_option_definition *option_v1_def_us = &option_v1_defs_us[i];
1385 struct retro_core_option_value *option_v1_values = option_v1_def_us->values;
1386
1387 option_v1_def_us->key = option_def_us->key;
1388 option_v1_def_us->desc = option_def_us->desc;
1389 option_v1_def_us->info = option_def_us->info;
1390 option_v1_def_us->default_value = option_def_us->default_value;
1391
1392 /* Values must be copied individually... */
1393 while (option_values->value)
1394 {
1395 option_v1_values->value = option_values->value;
1396 option_v1_values->label = option_values->label;
1397
1398 option_values++;
1399 option_v1_values++;
1400 }
1401 }
1402
1403#ifndef HAVE_NO_LANGEXTRA
1404 if (environ_cb(RETRO_ENVIRONMENT_GET_LANGUAGE, &language) &&
1405 (language < RETRO_LANGUAGE_LAST) && (language != RETRO_LANGUAGE_ENGLISH) &&
1406 options_intl[language])
1407 option_defs_intl = options_intl[language]->definitions;
1408
1409 if (option_defs_intl)
1410 {
1411 /* Determine number of intl options */
1412 while (true)
1413 {
1414 if (option_defs_intl[num_options_intl].key)
1415 num_options_intl++;
1416 else
1417 break;
1418 }
1419
1420 /* Allocate intl array */
1421 option_v1_defs_intl = (struct retro_core_option_definition *)
1422 calloc(num_options_intl + 1, sizeof(struct retro_core_option_definition));
1423
1424 /* Copy parameters from option_defs_intl array */
1425 for (i = 0; i < num_options_intl; i++)
1426 {
1427 struct retro_core_option_v2_definition *option_def_intl = &option_defs_intl[i];
1428 struct retro_core_option_value *option_values = option_def_intl->values;
1429 struct retro_core_option_definition *option_v1_def_intl = &option_v1_defs_intl[i];
1430 struct retro_core_option_value *option_v1_values = option_v1_def_intl->values;
1431
1432 option_v1_def_intl->key = option_def_intl->key;
1433 option_v1_def_intl->desc = option_def_intl->desc;
1434 option_v1_def_intl->info = option_def_intl->info;
1435 option_v1_def_intl->default_value = option_def_intl->default_value;
1436
1437 /* Values must be copied individually... */
1438 while (option_values->value)
1439 {
1440 option_v1_values->value = option_values->value;
1441 option_v1_values->label = option_values->label;
1442
1443 option_values++;
1444 option_v1_values++;
1445 }
1446 }
1447 }
1448
1449 core_options_v1_intl.us = option_v1_defs_us;
1450 core_options_v1_intl.local = option_v1_defs_intl;
1451
1452 environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL, &core_options_v1_intl);
1453#else
1454 environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS, option_v1_defs_us);
1455#endif
1456 }
1457 else
1458 {
1459 /* Allocate arrays */
1460 variables = (struct retro_variable *)calloc(num_options + 1,
1461 sizeof(struct retro_variable));
1462 values_buf = (char **)calloc(num_options, sizeof(char *));
1463
1464 if (!variables || !values_buf)
1465 goto error;
1466
1467 /* Copy parameters from option_defs_us array */
1468 for (i = 0; i < num_options; i++)
1469 {
1470 const char *key = option_defs_us[i].key;
1471 const char *desc = option_defs_us[i].desc;
1472 const char *default_value = option_defs_us[i].default_value;
1473 struct retro_core_option_value *values = option_defs_us[i].values;
1474 size_t buf_len = 3;
1475 size_t default_index = 0;
1476
1477 values_buf[i] = NULL;
1478
1479 /* Skip options that are irrelevant when using the
1480 * old style core options interface */
1481 if ((strcmp(key, "pcsx_rearmed_show_input_settings") == 0) ||
1482 (strcmp(key, "pcsx_rearmed_show_gpu_peops_settings") == 0) ||
1483 (strcmp(key, "pcsx_rearmed_show_gpu_unai_settings") == 0))
1484 continue;
1485
1486 if (desc)
1487 {
1488 size_t num_values = 0;
1489
1490 /* Determine number of values */
1491 while (true)
1492 {
1493 if (values[num_values].value)
1494 {
1495 /* Check if this is the default value */
1496 if (default_value)
1497 if (strcmp(values[num_values].value, default_value) == 0)
1498 default_index = num_values;
1499
1500 buf_len += strlen(values[num_values].value);
1501 num_values++;
1502 }
1503 else
1504 break;
1505 }
1506
1507 /* Build values string */
1508 if (num_values > 0)
1509 {
1510 buf_len += num_values - 1;
1511 buf_len += strlen(desc);
1512
1513 values_buf[i] = (char *)calloc(buf_len, sizeof(char));
1514 if (!values_buf[i])
1515 goto error;
1516
1517 strcpy(values_buf[i], desc);
1518 strcat(values_buf[i], "; ");
1519
1520 /* Default value goes first */
1521 strcat(values_buf[i], values[default_index].value);
1522
1523 /* Add remaining values */
1524 for (j = 0; j < num_values; j++)
1525 {
1526 if (j != default_index)
1527 {
1528 strcat(values_buf[i], "|");
1529 strcat(values_buf[i], values[j].value);
1530 }
1531 }
1532 }
1533 }
1534
1535 variables[option_index].key = key;
1536 variables[option_index].value = values_buf[i];
1537 option_index++;
1538 }
1539
1540 /* Set variables */
1541 environ_cb(RETRO_ENVIRONMENT_SET_VARIABLES, variables);
1542 }
1543
1544error:
1545 /* Clean up */
1546
1547 if (option_v1_defs_us)
1548 {
1549 free(option_v1_defs_us);
1550 option_v1_defs_us = NULL;
1551 }
1552
1553#ifndef HAVE_NO_LANGEXTRA
1554 if (option_v1_defs_intl)
1555 {
1556 free(option_v1_defs_intl);
1557 option_v1_defs_intl = NULL;
1558 }
1559#endif
1560
1561 if (values_buf)
1562 {
1563 for (i = 0; i < num_options; i++)
1564 {
1565 if (values_buf[i])
1566 {
1567 free(values_buf[i]);
1568 values_buf[i] = NULL;
1569 }
1570 }
1571
1572 free(values_buf);
1573 values_buf = NULL;
1574 }
1575
1576 if (variables)
1577 {
1578 free(variables);
1579 variables = NULL;
1580 }
1581 }
1582}
1583
1584#ifdef __cplusplus
1585}
1586#endif
1587
1588#endif