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