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