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 },
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 },
201 #if !defined(DRC_DISABLE) && !defined(LIGHTREC)
203 "pcsx_rearmed_psxclock",
204 "PSX CPU Clock Speed",
206 #if defined(HAVE_PRE_ARMV7) && !defined(_3DS)
207 "Overclock or under-clock the PSX CPU. Lower values may reduce performance requirements while higher values may improve frame rates in demanding games at the expense of increased overheads; setting the value too low or high may reduce compatibility. Default is 50.",
209 "Overclock or under-clock the PSX CPU. Lower values may reduce performance requirements while higher values may improve frame rates in demanding games at the expense of increased overheads; setting the value too low or high may reduce compatibility. Default is 57.",
287 #if defined(HAVE_PRE_ARMV7) && !defined(_3DS)
293 #endif /* !DRC_DISABLE && !LIGHTREC */
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
313 "pcsx_rearmed_duping_enable",
314 "Frame Duping (Speedup)",
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.",
320 { "disabled", NULL },
326 #ifdef THREAD_RENDERING
328 "pcsx_rearmed_gpu_thread_rendering",
329 "Threaded Rendering",
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.",
335 { "disabled", NULL },
336 { "sync", "Synchronous" },
337 { "async", "Asynchronous" },
344 "pcsx_rearmed_frameskip_type",
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.",
351 { "disabled", NULL },
353 { "auto_threshold", "Auto (Threshold)" },
354 { "fixed_interval", "Fixed Interval" },
360 "pcsx_rearmed_frameskip_threshold",
361 "Frameskip Threshold (%)",
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.",
388 "pcsx_rearmed_frameskip_interval",
389 "Frameskip Interval",
391 "Specify the maximum number of frames that can be skipped before a new frame is rendered.",
410 "pcsx_rearmed_display_internal_fps",
411 "Display Internal FPS",
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.",
417 { "disabled", NULL },
425 "pcsx_rearmed_neon_interlace_enable",
426 "(GPU) Show Interlaced Video",
427 "Show Interlaced Video",
428 "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.",
432 { "disabled", NULL },
439 "pcsx_rearmed_neon_enhancement_enable",
440 "(GPU) Enhanced Resolution (Slow)",
441 "Enhanced Resolution (Slow)",
442 "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.",
446 { "disabled", NULL },
453 "pcsx_rearmed_neon_enhancement_no_main",
454 "(GPU) Enhanced Resolution Speed Hack",
455 "Enhanced Resolution Speed Hack",
456 "Improves performance when 'Enhanced Resolution (Slow)' is enabled, but reduces compatibility and may cause rendering errors.",
460 { "disabled", NULL },
466 #endif /* GPU_NEON */
469 "pcsx_rearmed_show_gpu_peops_settings",
470 "Show Advanced P.E.Op.S. GPU Settings",
472 "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.",
476 { "disabled", NULL },
483 "pcsx_rearmed_gpu_peops_odd_even_bit",
484 "(GPU) Odd/Even Bit Hack",
486 "A hack fix used to correct lock-ups that may occur in games such as Chrono Cross. Disable unless required.",
490 { "disabled", NULL },
497 "pcsx_rearmed_gpu_peops_expand_screen_width",
498 "(GPU) Expand Screen Width",
499 "Expand Screen Width",
500 "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.",
504 { "disabled", NULL },
511 "pcsx_rearmed_gpu_peops_ignore_brightness",
512 "(GPU) Ignore Brightness Color",
513 "Ignore Brightness Color",
514 "A hack fix used to repair black screens in Lunar Silver Star Story Complete when entering a house or a menu. Disable unless required.",
518 { "disabled", NULL },
525 "pcsx_rearmed_gpu_peops_disable_coord_check",
526 "(GPU) Disable Coordinate Check",
527 "Disable Coordinate Check",
528 "Legacy compatibility mode. May improve games that fail to run correctly on newer GPU hardware. Disable unless required.",
532 { "disabled", NULL },
539 "pcsx_rearmed_gpu_peops_lazy_screen_update",
540 "(GPU) Lazy Screen Update",
541 "Lazy Screen Update",
542 "A partial fix to prevent text box flickering in Dragon Warrior VII. May also improve Pandemonium 2. Disable unless required.",
546 { "disabled", NULL },
553 "pcsx_rearmed_gpu_peops_repeated_triangles",
554 "(GPU) Repeat Flat Tex Triangles",
555 "Repeat Flat Tex Triangles",
556 "A hack fix used to correct rendering errors in Star Wars: Dark Forces. Disable unless required.",
560 { "disabled", NULL },
567 "pcsx_rearmed_gpu_peops_quads_with_triangles",
568 "(GPU) Draw Tex-Quads as Triangles",
569 "Draw Tex-Quads as Triangles",
570 "Corrects graphical distortions that may occur when games utilize Gouraud Shading, at the expense of reduced texture quality. Disable unless required.",
574 { "disabled", NULL },
581 "pcsx_rearmed_gpu_peops_fake_busy_state",
582 "(GPU) Fake 'GPU Busy' States",
583 "Fake 'GPU Busy' States",
584 "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.",
588 { "disabled", NULL },
594 #endif /* GPU_PEOPS */
597 "pcsx_rearmed_show_gpu_unai_settings",
598 "Show Advanced UNAI GPU Settings",
600 "Show low-level configuration options for the UNAI GPU plugin. Quick Menu may need to be toggled for this setting to take effect.",
604 { "disabled", NULL },
611 "pcsx_rearmed_gpu_unai_blending",
612 "(GPU) Texture Blending",
614 "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.",
618 { "disabled", NULL },
625 "pcsx_rearmed_gpu_unai_lighting",
626 "(GPU) Lighting Effects",
628 "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.).",
632 { "disabled", NULL },
639 "pcsx_rearmed_gpu_unai_fast_lighting",
640 "(GPU) Fast Lighting",
642 "Improves performance when 'Lighting Effects' are enabled, but may cause moderate/severe rendering errors.",
646 { "disabled", NULL },
653 "pcsx_rearmed_gpu_unai_scale_hires",
654 "(GPU) Hi-Res Downscaling",
655 "Hi-Res Downscaling",
656 "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.",
660 { "disabled", NULL },
670 #endif /* GPU_UNAI */
672 "pcsx_rearmed_spu_reverb",
673 "Audio Reverb Effects",
675 "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.",
679 { "disabled", NULL },
683 #ifdef HAVE_PRE_ARMV7
690 "pcsx_rearmed_spu_interpolation",
691 "Sound Interpolation",
693 "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.",
697 { "simple", "Simple" },
698 { "gaussian", "Gaussian" },
699 { "cubic", "Cubic" },
700 { "off", "disabled" },
703 #ifdef HAVE_PRE_ARMV7
710 "pcsx_rearmed_nocdaudio",
713 "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.",
717 { "disabled", NULL },
724 "pcsx_rearmed_noxadecoding",
727 "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.",
731 { "disabled", NULL },
738 "pcsx_rearmed_show_input_settings",
739 "Show Input Settings",
741 "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.",
745 { "disabled", NULL },
752 "pcsx_rearmed_analog_axis_modifier",
753 "Analog Axis Bounds",
755 "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.",
759 { "circle", "Circle" },
760 { "square", "Square" },
766 "pcsx_rearmed_vibration",
769 "Enable haptic feedback when using a rumble-equipped gamepad with input device set to 'dualshock'.",
773 { "disabled", NULL },
780 "pcsx_rearmed_multitap",
781 "Multitap Mode (Restart)",
783 "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.",
787 { "disabled", NULL },
788 { "port 1", "Port 1" },
789 { "port 2", "Port 2" },
790 { "ports 1 and 2", "Ports 1 and 2" },
796 "pcsx_rearmed_negcon_deadzone",
797 "NegCon Twist Deadzone",
799 "Set the deadzone of the RetroPad left analog stick when simulating the 'twist' action of emulated neGcon Controllers. Used to eliminate drift/unwanted input.",
821 "pcsx_rearmed_negcon_response",
822 "NegCon Twist Response",
824 "Specify the analog response when using a RetroPad left analog stick to simulate the 'twist' action of emulated neGcon Controllers.",
828 { "linear", "Linear" },
829 { "quadratic", "Quadratic" },
830 { "cubic", "Cubic" },
836 "pcsx_rearmed_input_sensitivity",
839 "Adjust responsiveness of emulated 'mouse' input devices.",
887 "pcsx_rearmed_gunconadjustx",
888 "Guncon X Axis Offset",
890 "Apply an X axis offset to light gun input when emulating a Guncon device. Can be used to correct aiming misalignments.",
950 "pcsx_rearmed_gunconadjusty",
951 "Guncon Y Axis Offset",
953 "Apply a Y axis offset to light gun input when emulating a Guncon device. Can be used to correct aiming misalignments.",
1013 "pcsx_rearmed_gunconadjustratiox",
1014 "Guncon X Axis Response",
1016 "Adjust relative magnitude of horizontal light gun motion when emulating a Guncon device. Can be used to correct aiming misalignments.",
1076 "pcsx_rearmed_gunconadjustratioy",
1077 "Guncon Y Axis Response",
1079 "Adjust relative magnitude of vertical light gun motion when emulating a Guncon device. Can be used to correct aiming misalignments.",
1139 "pcsx_rearmed_pe2_fix",
1140 "Parasite Eve 2/Vandal Hearts 1/2 Fix",
1142 "Hack fix required for correct operation of Parasite Eve 2 and Vandal Hearts 1/2. Should be disabled for all other games.",
1146 { "disabled", NULL },
1147 { "enabled", NULL },
1153 "pcsx_rearmed_inuyasha_fix",
1154 "InuYasha Sengoku Battle Fix",
1156 "Hack fix required for correct operation of Inuyasha Sengoku Otogi Kassen. Should be disabled for all other games.",
1160 { "disabled", NULL },
1161 { "enabled", NULL },
1167 "pcsx_rearmed_spuirq",
1168 "SPU IRQ Always Enabled",
1170 "Hack for certain games where events tied to audio cues do not trigger correctly. Fixes unopenable doors in Alien Resurrection. Fixes desynchronised FMV audio in Legend of Mana. Should be disabled unless required.",
1174 { "disabled", NULL },
1175 { "enabled", NULL },
1181 "pcsx_rearmed_icache_emulation",
1182 "Instruction Cache Emulation",
1184 "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. May cause certain games to fail (e.g. Spyro 2: Gateway to Glimmer, PAL version) so should be disabled unless needed. [Interpreter only and partial on lightrec, unsupported when using ARMv7 backend]",
1188 { "disabled", NULL },
1189 { "enabled", NULL },
1194 #if !defined(DRC_DISABLE) && !defined(LIGHTREC)
1196 "pcsx_rearmed_nocompathacks",
1197 "Disable Automatic Compatibility Hacks",
1199 "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.",
1203 { "disabled", NULL },
1204 { "enabled", NULL },
1210 "pcsx_rearmed_nosmccheck",
1211 "(Speed Hack) Disable SMC Checks",
1212 "Disable SMC Checks",
1213 "Will cause crashes when loading, and lead to memory card failure.",
1217 { "disabled", NULL },
1218 { "enabled", NULL },
1224 "pcsx_rearmed_gteregsunneeded",
1225 "(Speed Hack) Assume GTE Registers Unneeded",
1226 "Assume GTE Registers Unneeded",
1227 "May cause rendering errors.",
1231 { "disabled", NULL },
1232 { "enabled", NULL },
1238 "pcsx_rearmed_nogteflags",
1239 "(Speed Hack) Disable GTE Flags",
1240 "Disable GTE Flags",
1241 "Will cause rendering errors.",
1245 { "disabled", NULL },
1246 { "enabled", NULL },
1252 "pcsx_rearmed_nostalls",
1253 "(Speed Hack) Disable CPU/GTE Stalls",
1254 "Disable CPU/GTE Stalls",
1255 "Will cause some games to run too quickly.",
1259 { "disabled", NULL },
1260 { "enabled", NULL },
1265 #endif /* !DRC_DISABLE && !LIGHTREC */
1266 { NULL, NULL, NULL, NULL, NULL, NULL, {{0}}, NULL },
1269 struct retro_core_options_v2 options_us = {
1275 ********************************
1277 ********************************
1280 #ifndef HAVE_NO_LANGEXTRA
1281 struct retro_core_options_v2 *options_intl[RETRO_LANGUAGE_LAST] = {
1282 &options_us, /* RETRO_LANGUAGE_ENGLISH */
1283 NULL, /* RETRO_LANGUAGE_JAPANESE */
1284 NULL, /* RETRO_LANGUAGE_FRENCH */
1285 NULL, /* RETRO_LANGUAGE_SPANISH */
1286 NULL, /* RETRO_LANGUAGE_GERMAN */
1287 NULL, /* RETRO_LANGUAGE_ITALIAN */
1288 NULL, /* RETRO_LANGUAGE_DUTCH */
1289 NULL, /* RETRO_LANGUAGE_PORTUGUESE_BRAZIL */
1290 NULL, /* RETRO_LANGUAGE_PORTUGUESE_PORTUGAL */
1291 NULL, /* RETRO_LANGUAGE_RUSSIAN */
1292 NULL, /* RETRO_LANGUAGE_KOREAN */
1293 NULL, /* RETRO_LANGUAGE_CHINESE_TRADITIONAL */
1294 NULL, /* RETRO_LANGUAGE_CHINESE_SIMPLIFIED */
1295 NULL, /* RETRO_LANGUAGE_ESPERANTO */
1296 NULL, /* RETRO_LANGUAGE_POLISH */
1297 NULL, /* RETRO_LANGUAGE_VIETNAMESE */
1298 NULL, /* RETRO_LANGUAGE_ARABIC */
1299 NULL, /* RETRO_LANGUAGE_GREEK */
1300 &options_tr, /* RETRO_LANGUAGE_TURKISH */
1305 ********************************
1307 ********************************
1310 /* Handles configuration/setting of core options.
1311 * Should be called as early as possible - ideally inside
1312 * retro_set_environment(), and no later than retro_load_game()
1313 * > We place the function body in the header to avoid the
1314 * necessity of adding more .c files (i.e. want this to
1315 * be as painless as possible for core devs)
1318 static INLINE void libretro_set_core_options(retro_environment_t environ_cb,
1319 bool *categories_supported)
1321 unsigned version = 0;
1322 #ifndef HAVE_NO_LANGEXTRA
1323 unsigned language = 0;
1326 if (!environ_cb || !categories_supported)
1329 *categories_supported = false;
1331 if (!environ_cb(RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION, &version))
1336 #ifndef HAVE_NO_LANGEXTRA
1337 struct retro_core_options_v2_intl core_options_intl;
1339 core_options_intl.us = &options_us;
1340 core_options_intl.local = NULL;
1342 if (environ_cb(RETRO_ENVIRONMENT_GET_LANGUAGE, &language) &&
1343 (language < RETRO_LANGUAGE_LAST) && (language != RETRO_LANGUAGE_ENGLISH))
1344 core_options_intl.local = options_intl[language];
1346 *categories_supported = environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL,
1347 &core_options_intl);
1349 *categories_supported = environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2,
1356 size_t option_index = 0;
1357 size_t num_options = 0;
1358 struct retro_core_option_definition
1359 *option_v1_defs_us = NULL;
1360 #ifndef HAVE_NO_LANGEXTRA
1361 size_t num_options_intl = 0;
1362 struct retro_core_option_v2_definition
1363 *option_defs_intl = NULL;
1364 struct retro_core_option_definition
1365 *option_v1_defs_intl = NULL;
1366 struct retro_core_options_intl
1367 core_options_v1_intl;
1369 struct retro_variable *variables = NULL;
1370 char **values_buf = NULL;
1372 /* Determine total number of options */
1375 if (option_defs_us[num_options].key)
1383 /* Allocate US array */
1384 option_v1_defs_us = (struct retro_core_option_definition *)
1385 calloc(num_options + 1, sizeof(struct retro_core_option_definition));
1387 /* Copy parameters from option_defs_us array */
1388 for (i = 0; i < num_options; i++)
1390 struct retro_core_option_v2_definition *option_def_us = &option_defs_us[i];
1391 struct retro_core_option_value *option_values = option_def_us->values;
1392 struct retro_core_option_definition *option_v1_def_us = &option_v1_defs_us[i];
1393 struct retro_core_option_value *option_v1_values = option_v1_def_us->values;
1395 option_v1_def_us->key = option_def_us->key;
1396 option_v1_def_us->desc = option_def_us->desc;
1397 option_v1_def_us->info = option_def_us->info;
1398 option_v1_def_us->default_value = option_def_us->default_value;
1400 /* Values must be copied individually... */
1401 while (option_values->value)
1403 option_v1_values->value = option_values->value;
1404 option_v1_values->label = option_values->label;
1411 #ifndef HAVE_NO_LANGEXTRA
1412 if (environ_cb(RETRO_ENVIRONMENT_GET_LANGUAGE, &language) &&
1413 (language < RETRO_LANGUAGE_LAST) && (language != RETRO_LANGUAGE_ENGLISH) &&
1414 options_intl[language])
1415 option_defs_intl = options_intl[language]->definitions;
1417 if (option_defs_intl)
1419 /* Determine number of intl options */
1422 if (option_defs_intl[num_options_intl].key)
1428 /* Allocate intl array */
1429 option_v1_defs_intl = (struct retro_core_option_definition *)
1430 calloc(num_options_intl + 1, sizeof(struct retro_core_option_definition));
1432 /* Copy parameters from option_defs_intl array */
1433 for (i = 0; i < num_options_intl; i++)
1435 struct retro_core_option_v2_definition *option_def_intl = &option_defs_intl[i];
1436 struct retro_core_option_value *option_values = option_def_intl->values;
1437 struct retro_core_option_definition *option_v1_def_intl = &option_v1_defs_intl[i];
1438 struct retro_core_option_value *option_v1_values = option_v1_def_intl->values;
1440 option_v1_def_intl->key = option_def_intl->key;
1441 option_v1_def_intl->desc = option_def_intl->desc;
1442 option_v1_def_intl->info = option_def_intl->info;
1443 option_v1_def_intl->default_value = option_def_intl->default_value;
1445 /* Values must be copied individually... */
1446 while (option_values->value)
1448 option_v1_values->value = option_values->value;
1449 option_v1_values->label = option_values->label;
1457 core_options_v1_intl.us = option_v1_defs_us;
1458 core_options_v1_intl.local = option_v1_defs_intl;
1460 environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL, &core_options_v1_intl);
1462 environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS, option_v1_defs_us);
1467 /* Allocate arrays */
1468 variables = (struct retro_variable *)calloc(num_options + 1,
1469 sizeof(struct retro_variable));
1470 values_buf = (char **)calloc(num_options, sizeof(char *));
1472 if (!variables || !values_buf)
1475 /* Copy parameters from option_defs_us array */
1476 for (i = 0; i < num_options; i++)
1478 const char *key = option_defs_us[i].key;
1479 const char *desc = option_defs_us[i].desc;
1480 const char *default_value = option_defs_us[i].default_value;
1481 struct retro_core_option_value *values = option_defs_us[i].values;
1483 size_t default_index = 0;
1485 values_buf[i] = NULL;
1487 /* Skip options that are irrelevant when using the
1488 * old style core options interface */
1489 if ((strcmp(key, "pcsx_rearmed_show_input_settings") == 0) ||
1490 (strcmp(key, "pcsx_rearmed_show_gpu_peops_settings") == 0) ||
1491 (strcmp(key, "pcsx_rearmed_show_gpu_unai_settings") == 0))
1496 size_t num_values = 0;
1498 /* Determine number of values */
1501 if (values[num_values].value)
1503 /* Check if this is the default value */
1505 if (strcmp(values[num_values].value, default_value) == 0)
1506 default_index = num_values;
1508 buf_len += strlen(values[num_values].value);
1515 /* Build values string */
1518 buf_len += num_values - 1;
1519 buf_len += strlen(desc);
1521 values_buf[i] = (char *)calloc(buf_len, sizeof(char));
1525 strcpy(values_buf[i], desc);
1526 strcat(values_buf[i], "; ");
1528 /* Default value goes first */
1529 strcat(values_buf[i], values[default_index].value);
1531 /* Add remaining values */
1532 for (j = 0; j < num_values; j++)
1534 if (j != default_index)
1536 strcat(values_buf[i], "|");
1537 strcat(values_buf[i], values[j].value);
1543 variables[option_index].key = key;
1544 variables[option_index].value = values_buf[i];
1549 environ_cb(RETRO_ENVIRONMENT_SET_VARIABLES, variables);
1555 if (option_v1_defs_us)
1557 free(option_v1_defs_us);
1558 option_v1_defs_us = NULL;
1561 #ifndef HAVE_NO_LANGEXTRA
1562 if (option_v1_defs_intl)
1564 free(option_v1_defs_intl);
1565 option_v1_defs_intl = NULL;
1571 for (i = 0; i < num_options; i++)
1575 free(values_buf[i]);
1576 values_buf[i] = NULL;