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