1 #ifndef LIBRETRO_CORE_OPTIONS_H__
2 #define LIBRETRO_CORE_OPTIONS_H__
8 #include <retro_inline.h>
10 #ifndef HAVE_NO_LANGEXTRA
11 #include "libretro_core_options_intl.h"
15 ********************************
17 ********************************
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
38 ********************************
39 * Core Option Definitions
40 ********************************
43 /* RETRO_LANGUAGE_ENGLISH */
46 * - All other languages must include the same keys and values
47 * - Will be used as a fallback in the event that frontend language
49 * - Will be used as a fallback for any missing entries in
50 * frontend language definition
53 struct retro_core_option_v2_category option_cats_us[] = {
57 "Configure base hardware parameters: region, BIOS selection, memory cards, etc."
62 "Configure base display parameters."
68 "Configure low-level settings of the NEON GPU plugin."
74 "GPU Plugin (Advanced)",
75 "Configure low-level settings of the P.E.Op.S. GPU plugin."
81 "GPU Plugin (Advanced)",
82 "Configure low-level settings of the UNAI GPU plugin."
88 "Configure sound emulation: reverb, interpolation, CD audio decoding."
93 "Configure input devices: analog response, haptic feedback, Multitaps, light guns, etc."
97 "Compatibility Fixes",
98 "Configure settings/workarounds required for correct operation of specific games."
100 #if !defined(DRC_DISABLE) && !defined(LIGHTREC)
103 "Speed Hacks (Advanced)",
104 "Configure hacks that may improve performance at the expense of decreased accuracy/stability."
107 { NULL, NULL, NULL },
110 struct retro_core_option_v2_definition option_defs_us[] = {
112 "pcsx_rearmed_region",
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.",
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.",
141 "pcsx_rearmed_show_bios_bootlogo",
142 "Show BIOS Boot Logo",
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.",
148 { "disabled", NULL },
155 "pcsx_rearmed_memcard2",
156 "Enable Second Memory Card (Shared)",
158 "Emulate a second memory card in slot 2. This will be shared by all games.",
162 { "disabled", NULL },
168 #if 0 // ndef _WIN32 // currently disabled, see USE_READ_THREAD in libpcsxcore/cdriso.c
170 "pcsx_rearmed_async_cd",
171 "CD Access Method (Restart)",
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).",
177 { "sync", "Synchronous" },
178 { "async", "Asynchronous" },
179 { "precache", "Pre-Cache (CHD)" },
188 "Dynamic Recompiler",
190 "Dynamically recompile PSX CPU instructions to native instructions. Much faster than using an interpreter, but may be less accurate on some platforms.",
194 { "disabled", NULL },
202 "pcsx_rearmed_psxclock",
203 "PSX CPU Clock Speed",
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)
288 #if defined(HAVE_PRE_ARMV7) && !defined(_3DS)
295 "pcsx_rearmed_dithering",
298 "Enable emulation of the dithering technique used by the PSX to smooth out color banding artifacts. Increases performance requirements.",
302 { "disabled", NULL },
306 #if defined HAVE_LIBNX || defined _3DS
312 #ifdef THREAD_RENDERING
314 "pcsx_rearmed_gpu_thread_rendering",
315 "Threaded Rendering",
317 "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.",
321 { "disabled", NULL },
322 { "sync", "Synchronous" },
323 { "async", "Asynchronous" },
330 "pcsx_rearmed_frameskip_type",
333 "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.",
337 { "disabled", NULL },
339 { "auto_threshold", "Auto (Threshold)" },
340 { "fixed_interval", "Fixed Interval" },
346 "pcsx_rearmed_frameskip_threshold",
347 "Frameskip Threshold (%)",
349 "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.",
374 "pcsx_rearmed_frameskip_interval",
375 "Frameskip Interval",
377 "Specify the maximum number of frames that can be skipped before a new frame is rendered.",
396 "pcsx_rearmed_display_internal_fps",
397 "Display Internal FPS",
399 "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.",
403 { "disabled", NULL },
410 "pcsx_rearmed_gpu_slow_llists",
411 "(GPU) Slow linked list processing",
413 "Slower but more accurate GPU linked list processing. Needed by only a few games like Vampire Hunter D. Should be autodetected in most cases.",
418 { "disabled", NULL },
425 "pcsx_rearmed_screen_centering",
426 "(GPU) Screen centering",
428 "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 uneven 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.",
433 { "game", "Game-controlled" },
434 { "borderless", "Borderless" },
435 { "manual", "Manual" },
440 #define V(x) { #x, NULL }
442 "pcsx_rearmed_screen_centering_x",
443 "(GPU) Manual screen centering X",
445 "X offset of the frame buffer. Only effective when 'Screen centering' is set to 'Manual'.",
449 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),
455 "pcsx_rearmed_screen_centering_y",
456 "(GPU) Manual screen centering Y",
458 "Y offset of the frame buffer. Only effective when 'Screen centering' is set to 'Manual'.",
462 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),
463 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),
471 "pcsx_rearmed_neon_interlace_enable_v2",
472 "(GPU) Show Interlaced Video",
473 "Show Interlaced Video",
474 "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.",
479 { "disabled", NULL },
486 "pcsx_rearmed_neon_enhancement_enable",
487 "(GPU) Enhanced Resolution",
488 "Enhanced Resolution",
489 "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.",
493 { "disabled", NULL },
500 "pcsx_rearmed_neon_enhancement_no_main",
501 "(GPU) Enhanced Resolution Speed Hack",
502 "Enhanced Resolution Speed Hack",
503 "Improves performance when 'Enhanced Resolution' is enabled, but reduces compatibility and may cause rendering errors.",
507 { "disabled", NULL },
513 #endif /* GPU_NEON */
516 "pcsx_rearmed_show_gpu_peops_settings",
517 "Show Advanced P.E.Op.S. GPU Settings",
519 "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.",
523 { "disabled", NULL },
530 "pcsx_rearmed_gpu_peops_odd_even_bit",
531 "(GPU) Odd/Even Bit Hack",
533 "A hack fix used to correct lock-ups that may occur in games such as Chrono Cross. Disable unless required.",
537 { "disabled", NULL },
544 "pcsx_rearmed_gpu_peops_expand_screen_width",
545 "(GPU) Expand Screen Width",
546 "Expand Screen Width",
547 "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.",
551 { "disabled", NULL },
558 "pcsx_rearmed_gpu_peops_ignore_brightness",
559 "(GPU) Ignore Brightness Color",
560 "Ignore Brightness Color",
561 "A hack fix used to repair black screens in Lunar Silver Star Story Complete when entering a house or a menu. Disable unless required.",
565 { "disabled", NULL },
572 "pcsx_rearmed_gpu_peops_disable_coord_check",
573 "(GPU) Disable Coordinate Check",
574 "Disable Coordinate Check",
575 "Legacy compatibility mode. May improve games that fail to run correctly on newer GPU hardware. Disable unless required.",
579 { "disabled", NULL },
586 "pcsx_rearmed_gpu_peops_lazy_screen_update",
587 "(GPU) Lazy Screen Update",
588 "Lazy Screen Update",
589 "A partial fix to prevent text box flickering in Dragon Warrior VII. May also improve Pandemonium 2. Disable unless required.",
593 { "disabled", NULL },
600 "pcsx_rearmed_gpu_peops_repeated_triangles",
601 "(GPU) Repeat Flat Tex Triangles",
602 "Repeat Flat Tex Triangles",
603 "A hack fix used to correct rendering errors in Star Wars: Dark Forces. Disable unless required.",
607 { "disabled", NULL },
614 "pcsx_rearmed_gpu_peops_quads_with_triangles",
615 "(GPU) Draw Tex-Quads as Triangles",
616 "Draw Tex-Quads as Triangles",
617 "Corrects graphical distortions that may occur when games utilize Gouraud Shading, at the expense of reduced texture quality. Disable unless required.",
621 { "disabled", NULL },
628 "pcsx_rearmed_gpu_peops_fake_busy_state",
629 "(GPU) Fake 'GPU Busy' States",
630 "Fake 'GPU Busy' States",
631 "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.",
635 { "disabled", NULL },
641 #endif /* GPU_PEOPS */
644 "pcsx_rearmed_show_gpu_unai_settings",
645 "Show Advanced UNAI GPU Settings",
647 "Show low-level configuration options for the UNAI GPU plugin. Quick Menu may need to be toggled for this setting to take effect.",
651 { "disabled", NULL },
658 "pcsx_rearmed_gpu_unai_blending",
659 "(GPU) Texture Blending",
661 "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.",
665 { "disabled", NULL },
672 "pcsx_rearmed_gpu_unai_lighting",
673 "(GPU) Lighting Effects",
675 "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.).",
679 { "disabled", NULL },
686 "pcsx_rearmed_gpu_unai_fast_lighting",
687 "(GPU) Fast Lighting",
689 "Improves performance when 'Lighting Effects' are enabled, but may cause moderate/severe rendering errors.",
693 { "disabled", NULL },
700 "pcsx_rearmed_gpu_unai_scale_hires",
701 "(GPU) Hi-Res Downscaling",
702 "Hi-Res Downscaling",
703 "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.",
707 { "disabled", NULL },
717 #endif /* GPU_UNAI */
719 "pcsx_rearmed_spu_reverb",
720 "Audio Reverb Effects",
722 "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.",
726 { "disabled", NULL },
730 #ifdef HAVE_PRE_ARMV7
737 "pcsx_rearmed_spu_interpolation",
738 "Sound Interpolation",
740 "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.",
744 { "simple", "Simple" },
745 { "gaussian", "Gaussian" },
746 { "cubic", "Cubic" },
747 { "off", "disabled" },
750 #ifdef HAVE_PRE_ARMV7
757 "pcsx_rearmed_nocdaudio",
760 "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.",
764 { "disabled", NULL },
771 "pcsx_rearmed_noxadecoding",
774 "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.",
778 { "disabled", NULL },
786 "pcsx_rearmed_spu_thread",
789 "Emulates the PSX SPU on another CPU thread. May cause audio glitches in some games.",
793 { "disabled", NULL },
799 #endif // P_HAVE_PTHREAD
801 "pcsx_rearmed_show_input_settings",
802 "Show Input Settings",
804 "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.",
808 { "disabled", NULL },
815 "pcsx_rearmed_analog_axis_modifier",
816 "Analog Axis Bounds",
818 "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.",
822 { "circle", "Circle" },
823 { "square", "Square" },
829 "pcsx_rearmed_vibration",
832 "Enable haptic feedback when using a rumble-equipped gamepad with input device set to 'dualshock'.",
836 { "disabled", NULL },
843 "pcsx_rearmed_analog_combo",
844 "DualShock Analog Mode Toggle Key Combo",
846 "When the input device type is DualShock, this option allows the emulated DualShock to be toggled between DIGITAL and ANALOG mode like original hardware. You can select the button combination for this.",
850 { "disabled", NULL },
851 { "l1+r1+select", "L1 + R1 + Select" },
852 { "l1+r1+start", "L1 + R1 + Start" },
853 { "l1+r1+l3", "L1 + R1 + L3" },
854 { "l1+r1+r3", "L1 + R1 + R3" },
855 { "l3+r3", "L3 + R3" },
861 "pcsx_rearmed_multitap",
864 "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.",
868 { "disabled", NULL },
869 { "port 1", "Port 1" },
870 { "port 2", "Port 2" },
871 { "ports 1 and 2", "Ports 1 and 2" },
877 "pcsx_rearmed_negcon_deadzone",
878 "NegCon Twist Deadzone",
880 "Set the deadzone of the RetroPad left analog stick when simulating the 'twist' action of emulated neGcon Controllers. Used to eliminate drift/unwanted input.",
902 "pcsx_rearmed_negcon_response",
903 "NegCon Twist Response",
905 "Specify the analog response when using a RetroPad left analog stick to simulate the 'twist' action of emulated neGcon Controllers.",
909 { "linear", "Linear" },
910 { "quadratic", "Quadratic" },
911 { "cubic", "Cubic" },
917 "pcsx_rearmed_input_sensitivity",
920 "Adjust responsiveness of emulated 'mouse' input devices.",
968 "pcsx_rearmed_crosshair1",
969 "Player 1 Lightgun Crosshair",
971 "Toggle player 1's crosshair for the Guncon or Konami Gun",
975 { "disabled", NULL },
985 "pcsx_rearmed_crosshair2",
986 "Player 2 Lightgun Crosshair",
988 "Toggle player 2's crosshair for the Guncon or Konami Gun",
992 { "disabled", NULL },
1002 "pcsx_rearmed_konamigunadjustx",
1003 "Konami Gun X Axis Offset",
1005 "Apply an X axis offset to light gun input when emulating a Konami Gun (Hyper Blaster / Justifier) device. Can be used to correct aiming misalignments.",
1095 "pcsx_rearmed_konamigunadjusty",
1096 "Konami Gun Y Axis Offset",
1098 "Apply a Y axis offset to light gun input when emulating a Konami Gun (Hyper Blaster / Justifier) device. Can be used to correct aiming misalignments.",
1188 "pcsx_rearmed_gunconadjustx",
1189 "Guncon X Axis Offset",
1191 "Apply an X axis offset to light gun input when emulating a Guncon device. Can be used to correct aiming misalignments.",
1281 "pcsx_rearmed_gunconadjusty",
1282 "Guncon Y Axis Offset",
1284 "Apply a Y axis offset to light gun input when emulating a Guncon device. Can be used to correct aiming misalignments.",
1374 "pcsx_rearmed_gunconadjustratiox",
1375 "Guncon X Axis Response",
1377 "Adjust relative magnitude of horizontal light gun motion when emulating a Guncon device. Can be used to correct aiming misalignments.",
1437 "pcsx_rearmed_gunconadjustratioy",
1438 "Guncon Y Axis Response",
1440 "Adjust relative magnitude of vertical light gun motion when emulating a Guncon device. Can be used to correct aiming misalignments.",
1500 "pcsx_rearmed_icache_emulation",
1501 "Instruction Cache Emulation",
1503 "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]",
1507 { "enabled", NULL },
1508 { "disabled", NULL },
1514 "pcsx_rearmed_exception_emulation",
1515 "Exception and Breakpoint Emulation",
1517 "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]",
1521 { "disabled", NULL },
1522 { "enabled", NULL },
1527 #if !defined(DRC_DISABLE) && !defined(LIGHTREC)
1529 "pcsx_rearmed_nocompathacks",
1530 "Disable Automatic Compatibility Hacks",
1532 "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.",
1536 { "disabled", NULL },
1537 { "enabled", NULL },
1543 "pcsx_rearmed_nosmccheck",
1544 "(Speed Hack) Disable SMC Checks",
1545 "Disable SMC Checks",
1546 "Will cause crashes when loading, and lead to memory card failure.",
1550 { "disabled", NULL },
1551 { "enabled", NULL },
1557 "pcsx_rearmed_gteregsunneeded",
1558 "(Speed Hack) Assume GTE Registers Unneeded",
1559 "Assume GTE Registers Unneeded",
1560 "May cause rendering errors.",
1564 { "disabled", NULL },
1565 { "enabled", NULL },
1571 "pcsx_rearmed_nogteflags",
1572 "(Speed Hack) Disable GTE Flags",
1573 "Disable GTE Flags",
1574 "Will cause rendering errors.",
1578 { "disabled", NULL },
1579 { "enabled", NULL },
1584 #endif /* !DRC_DISABLE && !LIGHTREC */
1586 "pcsx_rearmed_nostalls",
1587 "Disable CPU/GTE Stalls",
1589 "Will cause some games to run too quickly."
1590 #if defined(LIGHTREC)
1591 " Interpreter only."
1597 { "disabled", NULL },
1598 { "enabled", NULL },
1603 { NULL, NULL, NULL, NULL, NULL, NULL, {{0}}, NULL },
1606 struct retro_core_options_v2 options_us = {
1612 ********************************
1614 ********************************
1617 #ifndef HAVE_NO_LANGEXTRA
1618 struct retro_core_options_v2 *options_intl[RETRO_LANGUAGE_LAST] = {
1619 &options_us, /* RETRO_LANGUAGE_ENGLISH */
1620 NULL, /* RETRO_LANGUAGE_JAPANESE */
1621 NULL, /* RETRO_LANGUAGE_FRENCH */
1622 NULL, /* RETRO_LANGUAGE_SPANISH */
1623 NULL, /* RETRO_LANGUAGE_GERMAN */
1624 NULL, /* RETRO_LANGUAGE_ITALIAN */
1625 NULL, /* RETRO_LANGUAGE_DUTCH */
1626 NULL, /* RETRO_LANGUAGE_PORTUGUESE_BRAZIL */
1627 NULL, /* RETRO_LANGUAGE_PORTUGUESE_PORTUGAL */
1628 NULL, /* RETRO_LANGUAGE_RUSSIAN */
1629 NULL, /* RETRO_LANGUAGE_KOREAN */
1630 NULL, /* RETRO_LANGUAGE_CHINESE_TRADITIONAL */
1631 NULL, /* RETRO_LANGUAGE_CHINESE_SIMPLIFIED */
1632 NULL, /* RETRO_LANGUAGE_ESPERANTO */
1633 NULL, /* RETRO_LANGUAGE_POLISH */
1634 NULL, /* RETRO_LANGUAGE_VIETNAMESE */
1635 NULL, /* RETRO_LANGUAGE_ARABIC */
1636 NULL, /* RETRO_LANGUAGE_GREEK */
1637 &options_tr, /* RETRO_LANGUAGE_TURKISH */
1642 ********************************
1644 ********************************
1647 /* Handles configuration/setting of core options.
1648 * Should be called as early as possible - ideally inside
1649 * retro_set_environment(), and no later than retro_load_game()
1650 * > We place the function body in the header to avoid the
1651 * necessity of adding more .c files (i.e. want this to
1652 * be as painless as possible for core devs)
1655 static INLINE void libretro_set_core_options(retro_environment_t environ_cb,
1656 bool *categories_supported)
1658 unsigned version = 0;
1659 #ifndef HAVE_NO_LANGEXTRA
1660 unsigned language = 0;
1663 if (!environ_cb || !categories_supported)
1666 *categories_supported = false;
1668 if (!environ_cb(RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION, &version))
1673 #ifndef HAVE_NO_LANGEXTRA
1674 struct retro_core_options_v2_intl core_options_intl;
1676 core_options_intl.us = &options_us;
1677 core_options_intl.local = NULL;
1679 if (environ_cb(RETRO_ENVIRONMENT_GET_LANGUAGE, &language) &&
1680 (language < RETRO_LANGUAGE_LAST) && (language != RETRO_LANGUAGE_ENGLISH))
1681 core_options_intl.local = options_intl[language];
1683 *categories_supported = environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL,
1684 &core_options_intl);
1686 *categories_supported = environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2,
1693 size_t option_index = 0;
1694 size_t num_options = 0;
1695 struct retro_core_option_definition
1696 *option_v1_defs_us = NULL;
1697 #ifndef HAVE_NO_LANGEXTRA
1698 size_t num_options_intl = 0;
1699 struct retro_core_option_v2_definition
1700 *option_defs_intl = NULL;
1701 struct retro_core_option_definition
1702 *option_v1_defs_intl = NULL;
1703 struct retro_core_options_intl
1704 core_options_v1_intl;
1706 struct retro_variable *variables = NULL;
1707 char **values_buf = NULL;
1709 /* Determine total number of options */
1712 if (option_defs_us[num_options].key)
1720 /* Allocate US array */
1721 option_v1_defs_us = (struct retro_core_option_definition *)
1722 calloc(num_options + 1, sizeof(struct retro_core_option_definition));
1724 /* Copy parameters from option_defs_us array */
1725 for (i = 0; i < num_options; i++)
1727 struct retro_core_option_v2_definition *option_def_us = &option_defs_us[i];
1728 struct retro_core_option_value *option_values = option_def_us->values;
1729 struct retro_core_option_definition *option_v1_def_us = &option_v1_defs_us[i];
1730 struct retro_core_option_value *option_v1_values = option_v1_def_us->values;
1732 option_v1_def_us->key = option_def_us->key;
1733 option_v1_def_us->desc = option_def_us->desc;
1734 option_v1_def_us->info = option_def_us->info;
1735 option_v1_def_us->default_value = option_def_us->default_value;
1737 /* Values must be copied individually... */
1738 while (option_values->value)
1740 option_v1_values->value = option_values->value;
1741 option_v1_values->label = option_values->label;
1748 #ifndef HAVE_NO_LANGEXTRA
1749 if (environ_cb(RETRO_ENVIRONMENT_GET_LANGUAGE, &language) &&
1750 (language < RETRO_LANGUAGE_LAST) && (language != RETRO_LANGUAGE_ENGLISH) &&
1751 options_intl[language])
1752 option_defs_intl = options_intl[language]->definitions;
1754 if (option_defs_intl)
1756 /* Determine number of intl options */
1759 if (option_defs_intl[num_options_intl].key)
1765 /* Allocate intl array */
1766 option_v1_defs_intl = (struct retro_core_option_definition *)
1767 calloc(num_options_intl + 1, sizeof(struct retro_core_option_definition));
1769 /* Copy parameters from option_defs_intl array */
1770 for (i = 0; i < num_options_intl; i++)
1772 struct retro_core_option_v2_definition *option_def_intl = &option_defs_intl[i];
1773 struct retro_core_option_value *option_values = option_def_intl->values;
1774 struct retro_core_option_definition *option_v1_def_intl = &option_v1_defs_intl[i];
1775 struct retro_core_option_value *option_v1_values = option_v1_def_intl->values;
1777 option_v1_def_intl->key = option_def_intl->key;
1778 option_v1_def_intl->desc = option_def_intl->desc;
1779 option_v1_def_intl->info = option_def_intl->info;
1780 option_v1_def_intl->default_value = option_def_intl->default_value;
1782 /* Values must be copied individually... */
1783 while (option_values->value)
1785 option_v1_values->value = option_values->value;
1786 option_v1_values->label = option_values->label;
1794 core_options_v1_intl.us = option_v1_defs_us;
1795 core_options_v1_intl.local = option_v1_defs_intl;
1797 environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL, &core_options_v1_intl);
1799 environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS, option_v1_defs_us);
1804 /* Allocate arrays */
1805 variables = (struct retro_variable *)calloc(num_options + 1,
1806 sizeof(struct retro_variable));
1807 values_buf = (char **)calloc(num_options, sizeof(char *));
1809 if (!variables || !values_buf)
1812 /* Copy parameters from option_defs_us array */
1813 for (i = 0; i < num_options; i++)
1815 const char *key = option_defs_us[i].key;
1816 const char *desc = option_defs_us[i].desc;
1817 const char *default_value = option_defs_us[i].default_value;
1818 struct retro_core_option_value *values = option_defs_us[i].values;
1820 size_t default_index = 0;
1822 values_buf[i] = NULL;
1824 /* Skip options that are irrelevant when using the
1825 * old style core options interface */
1826 if ((strcmp(key, "pcsx_rearmed_show_input_settings") == 0) ||
1827 (strcmp(key, "pcsx_rearmed_show_gpu_peops_settings") == 0) ||
1828 (strcmp(key, "pcsx_rearmed_show_gpu_unai_settings") == 0))
1833 size_t num_values = 0;
1835 /* Determine number of values */
1838 if (values[num_values].value)
1840 /* Check if this is the default value */
1842 if (strcmp(values[num_values].value, default_value) == 0)
1843 default_index = num_values;
1845 buf_len += strlen(values[num_values].value);
1852 /* Build values string */
1855 buf_len += num_values - 1;
1856 buf_len += strlen(desc);
1858 values_buf[i] = (char *)calloc(buf_len, sizeof(char));
1862 strcpy(values_buf[i], desc);
1863 strcat(values_buf[i], "; ");
1865 /* Default value goes first */
1866 strcat(values_buf[i], values[default_index].value);
1868 /* Add remaining values */
1869 for (j = 0; j < num_values; j++)
1871 if (j != default_index)
1873 strcat(values_buf[i], "|");
1874 strcat(values_buf[i], values[j].value);
1880 variables[option_index].key = key;
1881 variables[option_index].value = values_buf[i];
1886 environ_cb(RETRO_ENVIRONMENT_SET_VARIABLES, variables);
1892 if (option_v1_defs_us)
1894 free(option_v1_defs_us);
1895 option_v1_defs_us = NULL;
1898 #ifndef HAVE_NO_LANGEXTRA
1899 if (option_v1_defs_intl)
1901 free(option_v1_defs_intl);
1902 option_v1_defs_intl = NULL;
1908 for (i = 0; i < num_options; i++)
1912 free(values_buf[i]);
1913 values_buf[i] = NULL;