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