SameBoy | Accurate GB/GBC emulator |
| download: https://git.y1.nz/archives/sameboy.tar.gz | |
| README | Files | Log | Refs | LICENSE |
libretro/libretro_core_options.inc
1 #ifndef LIBRETRO_CORE_OPTIONS_H__
2 #define LIBRETRO_CORE_OPTIONS_H__
3
4 #include <stdlib.h>
5 #include <string.h>
6
7 #include "libretro.h"
8 #include "retro_inline.h"
9
10 /*
11 ********************************
12 * VERSION: 2.0
13 ********************************
14 *
15 * - 2.0: Add support for core options v2 interface
16 * - 1.3: Move translations to libretro_core_options_intl.h
17 * - libretro_core_options_intl.h includes BOM and utf-8
18 * fix for MSVC 2010-2013
19 * - Added HAVE_NO_LANGEXTRA flag to disable translations
20 * on platforms/compilers without BOM support
21 * - 1.2: Use core options v1 interface when
22 * RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION is >= 1
23 * (previously required RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION == 1)
24 * - 1.1: Support generation of core options v0 retro_core_option_value
25 * arrays containing options with a single value
26 * - 1.0: First commit
27 */
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 /*
34 ********************************
35 * Core Option Definitions
36 ********************************
37 */
38
39 /* RETRO_LANGUAGE_ENGLISH */
40
41 /* Default language:
42 * - All other languages must include the same keys and values
43 * - Will be used as a fallback in the event that frontend language
44 * is not available
45 * - Will be used as a fallback for any missing entries in
46 * frontend language definition */
47
48 struct retro_core_option_v2_category option_cats_us[] = {
49 {
50 "system",
51 "System",
52 "Configure base hardware selection."
53 },
54 {
55 "video",
56 "Video",
57 "Configure display parameters: palette selection, colour correction, screen border."
58 },
59 {
60 "audio",
61 "Audio",
62 "Configure audio emulation: highpass filter, electrical interference."
63 },
64 {
65 "input",
66 "Input",
67 "Configure input parameters: rumble support."
68 },
69 { NULL, NULL },
70 };
71
72 struct retro_core_option_v2_definition option_defs_us[] = {
73
74 /* Core options used in single cart mode */
75
76 {
77 "sameboy_model",
78 "System - Emulated Model (Requires Restart)",
79 "Emulated Model (Requires Restart)",
80 "Chooses which system model the content should be started on. Certain games may activate special in-game features when ran on specific models. This option requires a content restart in order to take effect.",
81 NULL,
82 "system",
83 {
84 { "Auto", "Auto Detect DMG/CGB" },
85 { "Auto (SGB)", "Auto Detect DMG/SGB/CGB" },
86 { "Game Boy", "Game Boy (DMG-CPU B)" },
87 { "Game Boy Pocket", "Game Boy Pocket/Light" },
88 { "Game Boy Color 0", "Game Boy Color (CPU CGB 0)" },
89 { "Game Boy Color A", "Game Boy Color (CPU CGB A)" },
90 { "Game Boy Color B", "Game Boy Color (CPU CGB B)" },
91 { "Game Boy Color C", "Game Boy Color (CPU CGB C)" },
92 { "Game Boy Color D", "Game Boy Color (CPU CGB D)" },
93 { "Game Boy Color", "Game Boy Color (CPU CGB E)" },
94 { "Game Boy Advance", "Game Boy Advance (CPU AGB A)" },
95 { "Game Boy Player", "Game Boy Player (CPU AGB A)" },
96 { "Super Game Boy", "Super Game Boy NTSC" },
97 { "Super Game Boy PAL", NULL },
98 { "Super Game Boy 2", NULL },
99 { NULL, NULL },
100 },
101 "Auto"
102 },
103 {
104 "sameboy_auto_sgb_model",
105 "System - Auto Detected SGB Model (Requires Restart)",
106 "Auto Detected SGB Model (Requires Restart)",
107 "Specifies which model of Super Game Boy hardware to emulate when SGB content is automatically detected. This option requires a content restart in order to take effect.",
108 NULL,
109 "system",
110 {
111 { "Super Game Boy", "Super Game Boy NTSC" },
112 { "Super Game Boy PAL", NULL },
113 { "Super Game Boy 2", NULL },
114 { NULL, NULL },
115 },
116 "Super Game Boy"
117 },
118 {
119 "sameboy_mono_palette",
120 "Video - GB Mono Palette",
121 "GB Mono Palette",
122 "Selects the color palette that should be used when playing Game Boy games.",
123 NULL,
124 "video",
125 {
126 { "greyscale", "Greyscale" },
127 { "lime", "Lime (Game Boy)" },
128 { "olive", "Olive (Game Boy Pocket)" },
129 { "teal", "Teal (Game Boy Light)" },
130 { NULL, NULL },
131 },
132 "greyscale"
133 },
134 {
135 "sameboy_color_correction_mode",
136 "Video - GBC Color Correction",
137 "GBC Color Correction",
138 "Defines which type of color correction should be applied when playing Game Boy Color games.",
139 NULL,
140 "video",
141 {
142 { "emulate hardware", "Modern - Balanced" },
143 { "accurate", "Modern - Accurate" },
144 { "preserve brightness", "Modern - Boost Contrast" },
145 { "reduce contrast", "Reduce Contrast" },
146 { "correct curves", "Correct Color Curves" },
147 { "harsh reality", "Harsh Reality (Low Contrast)" },
148 { "off", "Disabled" },
149 { NULL, NULL },
150 },
151 "emulate hardware"
152 },
153 {
154 "sameboy_light_temperature",
155 "Video - Ambient Light Temperature",
156 "Ambient Light Temperature",
157 "Simulates an ambient light's effect on non-backlit Game Boy screens, by setting a user-controlled color temperature. This option has no effect if the content is run on an original Game Boy (DMG) emulated model.",
158 NULL,
159 "video",
160 {
161 { "1.0", "1000K (Warmest)" },
162 { "0.9", "1550K" },
163 { "0.8", "2100K" },
164 { "0.7", "2650K" },
165 { "0.6", "3200K" },
166 { "0.5", "3750K" },
167 { "0.4", "4300K" },
168 { "0.3", "4850K" },
169 { "0.2", "5400K" },
170 { "0.1", "5950K" },
171 { "0", "6500K (Neutral White)" },
172 { "-0.1", "7050K" },
173 { "-0.2", "7600K" },
174 { "-0.3", "8150K" },
175 { "-0.4", "8700K" },
176 { "-0.5", "9250K" },
177 { "-0.6", "9800K" },
178 { "-0.7", "10350K" },
179 { "-0.8", "10900K" },
180 { "-0.9", "11450K" },
181 { "-1.0", "12000K (Coolest)" },
182 { NULL, NULL },
183 },
184 "0"
185 },
186 {
187 "sameboy_border",
188 "Video - Display Border",
189 "Display Border",
190 "Defines when to display an on-screen border around the content.",
191 NULL,
192 "video",
193 {
194 { "always", "Always" },
195 { "Super Game Boy only", "Only for Super Game Boy" },
196 { "never", "Disabled" },
197 { NULL, NULL },
198 },
199 "Super Game Boy only"
200 },
201 {
202 "sameboy_high_pass_filter_mode",
203 "Audio - Highpass Filter",
204 "Highpass Filter",
205 "Applies a filter to the audio output, removing certain pop sounds caused by the DC Offset. If disabled, the sound will be rendered as output by the Game Boy APU, but popping effects will be heard when the emulator is paused or resumed. 'Accurate' will apply a global filter, masking popping sounds while also reducing lower frequencies. 'Preserve Waveform' applies the filter only to the DC Offset.",
206 NULL,
207 "audio",
208 {
209 { "accurate", "Accurate" },
210 { "remove dc offset", "Preserve Waveform" },
211 { "off", "Disabled" },
212 { NULL, NULL },
213 },
214 "accurate"
215 },
216 {
217 "sameboy_audio_interference",
218 "Audio - Interference Volume",
219 "Interference Volume",
220 "Controls the volume of the buzzing effect caused by the electrical interference between the Game Boy SoC and the system speakers.",
221 NULL,
222 "audio",
223 {
224 { "0", "0%" },
225 { "5", "5%" },
226 { "10", "10%" },
227 { "15", "15%" },
228 { "20", "20%" },
229 { "25", "25%" },
230 { "30", "30%" },
231 { "35", "35%" },
232 { "40", "40%" },
233 { "45", "45%" },
234 { "50", "50%" },
235 { "55", "55%" },
236 { "60", "60%" },
237 { "65", "65%" },
238 { "70", "70%" },
239 { "75", "75%" },
240 { "80", "80%" },
241 { "85", "85%" },
242 { "90", "90%" },
243 { "95", "95%" },
244 { "100", "100%" },
245 { NULL, NULL },
246 },
247 "0"
248 },
249 {
250 "sameboy_rumble",
251 "Input - Rumble Mode",
252 "Rumble Mode",
253 "Defines which type of content should trigger rumble effects.",
254 NULL,
255 "input",
256 {
257 { "all games", "Always" },
258 { "rumble-enabled games", "Only for rumble-enabled games" },
259 { "never", "Never" },
260 { NULL, NULL },
261 },
262 "rumble-enabled games"
263 },
264
265 /* Core options used in dual cart mode */
266
267 {
268 "sameboy_link",
269 "System - Link Cable Emulation",
270 "Link Cable Emulation",
271 "Enables the emulation of the link cable, allowing communication and exchange of data between two Game Boy systems.",
272 NULL,
273 "system",
274 {
275 { "enabled", "Enabled" },
276 { "disabled", "Disabled" },
277 { NULL, NULL },
278 },
279 "enabled"
280 },
281 {
282 "sameboy_model_1",
283 "System - Emulated Model for Game Boy #1 (Requires Restart)",
284 "Emulated Model for Game Boy #1 (Requires Restart)",
285 "Chooses which system model the content should be started on for Game Boy #1. Certain games may activate special in-game features when ran on specific models. This option requires a content restart in order to take effect.",
286 NULL,
287 "system",
288 {
289 { "Auto", "Auto Detect DMG/CGB" },
290 { "Auto (SGB)", "Auto Detect DMG/SGB/CGB" },
291 { "Game Boy", "Game Boy (DMG-CPU B)" },
292 { "Game Boy Pocket", "Game Boy Pocket/Light" },
293 { "Game Boy Color 0", "Game Boy Color (CPU CGB 0)" },
294 { "Game Boy Color A", "Game Boy Color (CPU CGB A)" },
295 { "Game Boy Color B", "Game Boy Color (CPU CGB B)" },
296 { "Game Boy Color C", "Game Boy Color (CPU CGB C)" },
297 { "Game Boy Color D", "Game Boy Color (CPU CGB D)" },
298 { "Game Boy Color", "Game Boy Color (CPU CGB E)" },
299 { "Game Boy Advance", "Game Boy Advance (CPU AGB A)" },
300 { "Game Boy Player", "Game Boy Player (CPU AGB A)" },
301 { "Super Game Boy", "Super Game Boy NTSC" },
302 { "Super Game Boy PAL", NULL },
303 { "Super Game Boy 2", NULL },
304 { NULL, NULL },
305 },
306 "Auto"
307 },
308 {
309 "sameboy_auto_sgb_model_1",
310 "System - Auto Detected SGB Model for Game Boy #1 (Requires Restart)",
311 "Auto Detected SGB Model for Game Boy #1 (Requires Restart)",
312 "Specifies which model of Super Game Boy hardware to emulate when SGB content is automatically detected for Game Boy #1. This option requires a content restart in order to take effect.",
313 NULL,
314 "system",
315 {
316 { "Super Game Boy", "Super Game Boy NTSC" },
317 { "Super Game Boy PAL", NULL },
318 { "Super Game Boy 2", NULL },
319 { NULL, NULL },
320 },
321 "Super Game Boy"
322 },
323 {
324 "sameboy_model_2",
325 "System - Emulated Model for Game Boy #2 (Requires Restart)",
326 "Emulated Model for Game Boy #2 (Requires Restart)",
327 "Chooses which system model the content should be started on for Game Boy #2. Certain games may activate special in-game features when ran on specific models. This option requires a content restart in order to take effect.",
328 NULL,
329 "system",
330 {
331 { "Auto", "Auto Detect DMG/CGB" },
332 { "Auto (SGB)", "Auto Detect DMG/SGB/CGB" },
333 { "Game Boy", "Game Boy (DMG-CPU B)" },
334 { "Game Boy Pocket", "Game Boy Pocket/Light" },
335 { "Game Boy Color 0", "Game Boy Color (CPU CGB 0)" },
336 { "Game Boy Color A", "Game Boy Color (CPU CGB A)" },
337 { "Game Boy Color B", "Game Boy Color (CPU CGB B)" },
338 { "Game Boy Color C", "Game Boy Color (CPU CGB C)" },
339 { "Game Boy Color D", "Game Boy Color (CPU CGB D)" },
340 { "Game Boy Color", "Game Boy Color (CPU CGB E)" },
341 { "Game Boy Advance", "Game Boy Advance (CPU AGB A)" },
342 { "Game Boy Player", "Game Boy Player (CPU AGB A)" },
343 { "Super Game Boy", "Super Game Boy NTSC" },
344 { "Super Game Boy PAL", NULL },
345 { "Super Game Boy 2", NULL },
346 { NULL, NULL },
347 },
348 "Auto"
349 },
350 {
351 "sameboy_auto_sgb_model_2",
352 "System - Auto Detected SGB Model for Game Boy #2 (Requires Restart)",
353 "Auto Detected SGB Model for Game Boy #2 (Requires Restart)",
354 "Specifies which model of Super Game Boy hardware to emulate when SGB content is automatically detected for Game Boy #2. This option requires a content restart in order to take effect.",
355 NULL,
356 "system",
357 {
358 { "Super Game Boy", "Super Game Boy NTSC" },
359 { "Super Game Boy PAL", NULL },
360 { "Super Game Boy 2", NULL },
361 { NULL, NULL },
362 },
363 "Super Game Boy"
364 },
365 {
366 "sameboy_screen_layout",
367 "Video - Screen Layout",
368 "Screen Layout",
369 "When emulating two systems at once, this option defines the respective position of the two screens.",
370 NULL,
371 "video",
372 {
373 { "top-down", "Top-Down" },
374 { "left-right", "Left-Right" },
375 { NULL, NULL },
376 },
377 "top-down"
378 },
379 {
380 "sameboy_mono_palette_1",
381 "Video - GB Mono Palette for Game Boy #1",
382 "GB Mono Palette for Game Boy #1",
383 "Selects the color palette that should be used when playing Game Boy games on Game Boy #1.",
384 NULL,
385 "video",
386 {
387 { "greyscale", "Greyscale" },
388 { "lime", "Lime (Game Boy)" },
389 { "olive", "Olive (Game Boy Pocket)" },
390 { "teal", "Teal (Game Boy Light)" },
391 { NULL, NULL },
392 },
393 "greyscale"
394 },
395 {
396 "sameboy_mono_palette_2",
397 "Video - GB Mono Palette for Game Boy #2",
398 "GB Mono Palette for Game Boy #2",
399 "Selects the color palette that should be used when playing Game Boy games on Game Boy #2.",
400 NULL,
401 "video",
402 {
403 { "greyscale", "Greyscale" },
404 { "lime", "Lime (Game Boy)" },
405 { "olive", "Olive (Game Boy Pocket)" },
406 { "teal", "Teal (Game Boy Light)" },
407 { NULL, NULL },
408 },
409 "greyscale"
410 },
411 {
412 "sameboy_color_correction_mode_1",
413 "Video - GBC Color Correction for Game Boy #1",
414 "GBC Color Correction for Game Boy #1",
415 "Defines which type of color correction should be applied when playing Game Boy Color games on Game Boy #1.",
416 NULL,
417 "video",
418 {
419 { "emulate hardware", "Modern - Balanced" },
420 { "accurate", "Modern - Accurate" },
421 { "preserve brightness", "Modern - Boost Contrast" },
422 { "reduce contrast", "Reduce Contrast" },
423 { "correct curves", "Correct Color Curves" },
424 { "harsh reality", "Harsh Reality (Low Contrast)" },
425 { "off", "Disabled" },
426 { NULL, NULL },
427 },
428 "emulate hardware"
429 },
430 {
431 "sameboy_color_correction_mode_2",
432 "Video - GBC Color Correction for Game Boy #2",
433 "GBC Color Correction for Game Boy #2",
434 "Defines which type of color correction should be applied when playing Game Boy Color games on Game Boy #2.",
435 NULL,
436 "video",
437 {
438 { "emulate hardware", "Modern - Balanced" },
439 { "accurate", "Modern - Accurate" },
440 { "preserve brightness", "Modern - Boost Contrast" },
441 { "reduce contrast", "Reduce Contrast" },
442 { "correct curves", "Correct Color Curves" },
443 { "harsh reality", "Harsh Reality (Low Contrast)" },
444 { "off", "Disabled" },
445 { NULL, NULL },
446 },
447 "emulate hardware"
448 },
449 {
450 "sameboy_light_temperature_1",
451 "Video - Ambient Light Temperature for Game Boy #1",
452 "Ambient Light Temperature for Game Boy #1",
453 "Simulates an ambient light's effect on non-backlit Game Boy screens, by setting a user-controlled color temperature applied to the screen of Game Boy #1. This option has no effect if the content is run on an original Game Boy (DMG) emulated model.",
454 NULL,
455 "video",
456 {
457 { "1.0", "1000K (Warmest)" },
458 { "0.9", "1550K" },
459 { "0.8", "2100K" },
460 { "0.7", "2650K" },
461 { "0.6", "3200K" },
462 { "0.5", "3750K" },
463 { "0.4", "4300K" },
464 { "0.3", "4850K" },
465 { "0.2", "5400K" },
466 { "0.1", "5950K" },
467 { "0", "6500K (Neutral White)" },
468 { "-0.1", "7050K" },
469 { "-0.2", "7600K" },
470 { "-0.3", "8150K" },
471 { "-0.4", "8700K" },
472 { "-0.5", "9250K" },
473 { "-0.6", "9800K" },
474 { "-0.7", "10350K" },
475 { "-0.8", "10900K" },
476 { "-0.9", "11450K" },
477 { "-1.0", "12000K (Coolest)" },
478 { NULL, NULL },
479 },
480 "0"
481 },
482 {
483 "sameboy_light_temperature_2",
484 "Video - Ambient Light Temperature for Game Boy #2",
485 "Ambient Light Temperature for Game Boy #2",
486 "Simulates an ambient light's effect on non-backlit Game Boy screens, by setting a user-controlled color temperature applied to the screen of Game Boy #2. This option has no effect if the content is run on an original Game Boy (DMG) emulated model.",
487 NULL,
488 "video",
489 {
490 { "1.0", "1000K (Warmest)" },
491 { "0.9", "1550K" },
492 { "0.8", "2100K" },
493 { "0.7", "2650K" },
494 { "0.6", "3200K" },
495 { "0.5", "3750K" },
496 { "0.4", "4300K" },
497 { "0.3", "4850K" },
498 { "0.2", "5400K" },
499 { "0.1", "5950K" },
500 { "0", "6500K (Neutral White)" },
501 { "-0.1", "7050K" },
502 { "-0.2", "7600K" },
503 { "-0.3", "8150K" },
504 { "-0.4", "8700K" },
505 { "-0.5", "9250K" },
506 { "-0.6", "9800K" },
507 { "-0.7", "10350K" },
508 { "-0.8", "10900K" },
509 { "-0.9", "11450K" },
510 { "-1.0", "12000K (Coolest)" },
511 { NULL, NULL },
512 },
513 "0"
514 },
515 {
516 "sameboy_audio_output",
517 "Audio - Audio Output",
518 "Audio Output",
519 "Selects which of the two emulated Game Boy systems should output audio. If Mix Both is chosen, both Game Boys must have the same clock speed.",
520 NULL,
521 "audio",
522 {
523 { "Game Boy #1", NULL },
524 { "Game Boy #2", NULL },
525 { "Mix Both", NULL },
526 { NULL, NULL },
527 },
528 "Game Boy #1"
529 },
530 {
531 "sameboy_high_pass_filter_mode_1",
532 "Audio - Highpass Filter for Game Boy #1",
533 "Highpass Filter for Game Boy #1",
534 "Applies a filter to the audio output for Game Boy #1, removing certain pop sounds caused by the DC Offset. If disabled, the sound will be rendered as output by the Game Boy APU, but popping effects will be heard when the emulator is paused or resumed. 'Accurate' will apply a global filter, masking popping sounds while also reducing lower frequencies. 'Preserve Waveform' applies the filter only to the DC Offset.",
535 NULL,
536 "audio",
537 {
538 { "accurate", "Accurate" },
539 { "remove dc offset", "Preserve Waveform" },
540 { "off", "disabled" },
541 { NULL, NULL },
542 },
543 "accurate"
544 },
545 {
546 "sameboy_high_pass_filter_mode_2",
547 "Audio - Highpass Filter for Game Boy #2",
548 "Highpass Filter for Game Boy #2",
549 "Applies a filter to the audio output for Game Boy #2, removing certain pop sounds caused by the DC Offset. If disabled, the sound will be rendered as output by the Game Boy APU, but popping effects will be heard when the emulator is paused or resumed. 'Accurate' will apply a global filter, masking popping sounds while also reducing lower frequencies. 'Preserve Waveform' applies the filter only to the DC Offset.",
550 NULL,
551 "audio",
552 {
553 { "accurate", "Accurate" },
554 { "remove dc offset", "Preserve Waveform" },
555 { "off", "disabled" },
556 { NULL, NULL },
557 },
558 "accurate"
559 },
560 {
561 "sameboy_audio_interference_1",
562 "Audio - Interference Volume for Game Boy #1",
563 "Interference Volume for Game Boy #1",
564 "Controls the volume of the buzzing effect caused by the electrical interference between the Game Boy SoC and the system speakers on Game Boy #1.",
565 NULL,
566 "audio",
567 {
568 { "0", "0%" },
569 { "5", "5%" },
570 { "10", "10%" },
571 { "15", "15%" },
572 { "20", "20%" },
573 { "25", "25%" },
574 { "30", "30%" },
575 { "35", "35%" },
576 { "40", "40%" },
577 { "45", "45%" },
578 { "50", "50%" },
579 { "55", "55%" },
580 { "60", "60%" },
581 { "65", "65%" },
582 { "70", "70%" },
583 { "75", "75%" },
584 { "80", "80%" },
585 { "85", "85%" },
586 { "90", "90%" },
587 { "95", "95%" },
588 { "100", "100%" },
589 { NULL, NULL },
590 },
591 "0"
592 },
593 {
594 "sameboy_audio_interference_2",
595 "Audio - Interference Volume for Game Boy #2",
596 "Interference Volume for Game Boy #2",
597 "Controls the volume of the buzzing effect caused by the electrical interference between the Game Boy SoC and the system speakers on Game Boy #2.",
598 NULL,
599 "audio",
600 {
601 { "0", "0%" },
602 { "5", "5%" },
603 { "10", "10%" },
604 { "15", "15%" },
605 { "20", "20%" },
606 { "25", "25%" },
607 { "30", "30%" },
608 { "35", "35%" },
609 { "40", "40%" },
610 { "45", "45%" },
611 { "50", "50%" },
612 { "55", "55%" },
613 { "60", "60%" },
614 { "65", "65%" },
615 { "70", "70%" },
616 { "75", "75%" },
617 { "80", "80%" },
618 { "85", "85%" },
619 { "90", "90%" },
620 { "95", "95%" },
621 { "100", "100%" },
622 { NULL, NULL },
623 },
624 "0"
625 },
626 {
627 "sameboy_rumble_1",
628 "Input - Rumble Mode for Game Boy #1",
629 "Rumble Mode for Game Boy #1",
630 "Defines which type of content should trigger rumble effects when played on Game Boy #1.",
631 NULL,
632 "input",
633 {
634 { "all games", "Always" },
635 { "rumble-enabled games", "Only for rumble-enabled games" },
636 { "never", "Never" },
637 { NULL, NULL },
638 },
639 "rumble-enabled games"
640 },
641 {
642 "sameboy_rumble_2",
643 "Input - Rumble Mode for Game Boy #2",
644 "Rumble Mode for Game Boy #2",
645 "Defines which type of content should trigger rumble effects when played on Game Boy #2.",
646 NULL,
647 "input",
648 {
649 { "all games", "Always" },
650 { "rumble-enabled games", "Only for rumble-enabled games" },
651 { "never", "Never" },
652 { NULL, NULL },
653 },
654 "rumble-enabled games"
655 },
656
657 /* Options available in both mode */
658 {
659 "sameboy_rtc",
660 "System - Real Time Clock Emulation",
661 "Real Time Clock Emulation",
662 "Specifies how the emulation of the real-time clock feature used in certain Game Boy and Game Boy Color games should function.",
663 NULL,
664 "system",
665 {
666 { "sync to system clock", "Sync to System Clock" },
667 { "accurate", "Accurate" },
668 { NULL, NULL },
669 },
670 "sync to system clock"
671 },
672
673 { NULL, NULL, NULL, NULL, NULL, NULL, {{0}}, NULL },
674 };
675
676 struct retro_core_options_v2 options_us = {
677 option_cats_us,
678 option_defs_us
679 };
680
681 /*
682 ********************************
683 * Language Mapping
684 ********************************
685 */
686
687 #ifndef HAVE_NO_LANGEXTRA
688 struct retro_core_options_v2 *options_intl[RETRO_LANGUAGE_LAST] = {
689 &options_us, /* RETRO_LANGUAGE_ENGLISH */
690 NULL, /* RETRO_LANGUAGE_JAPANESE */
691 NULL, /* RETRO_LANGUAGE_FRENCH */
692 NULL, /* RETRO_LANGUAGE_SPANISH */
693 NULL, /* RETRO_LANGUAGE_GERMAN */
694 NULL, /* RETRO_LANGUAGE_ITALIAN */
695 NULL, /* RETRO_LANGUAGE_DUTCH */
696 NULL, /* RETRO_LANGUAGE_PORTUGUESE_BRAZIL */
697 NULL, /* RETRO_LANGUAGE_PORTUGUESE_PORTUGAL */
698 NULL, /* RETRO_LANGUAGE_RUSSIAN */
699 NULL, /* RETRO_LANGUAGE_KOREAN */
700 NULL, /* RETRO_LANGUAGE_CHINESE_TRADITIONAL */
701 NULL, /* RETRO_LANGUAGE_CHINESE_SIMPLIFIED */
702 NULL, /* RETRO_LANGUAGE_ESPERANTO */
703 NULL, /* RETRO_LANGUAGE_POLISH */
704 NULL, /* RETRO_LANGUAGE_VIETNAMESE */
705 NULL, /* RETRO_LANGUAGE_ARABIC */
706 NULL, /* RETRO_LANGUAGE_GREEK */
707 NULL, /* RETRO_LANGUAGE_TURKISH */
708 NULL, /* RETRO_LANGUAGE_SLOVAK */
709 NULL, /* RETRO_LANGUAGE_PERSIAN */
710 NULL, /* RETRO_LANGUAGE_HEBREW */
711 NULL, /* RETRO_LANGUAGE_ASTURIAN */
712 NULL, /* RETRO_LANGUAGE_FINNISH */
713 };
714 #endif
715
716 /*
717 ********************************
718 * Functions
719 ********************************
720 */
721
722 /* Handles configuration/setting of core options.
723 * Should be called as early as possible - ideally inside
724 * retro_set_environment(), and no later than retro_load_game()
725 * > We place the function body in the header to avoid the
726 * necessity of adding more .c files (i.e. want this to
727 * be as painless as possible for core devs)
728 */
729
730 static INLINE void libretro_set_core_options(retro_environment_t environ_cb,
731 bool *categories_supported)
732 {
733 unsigned version = 0;
734 #ifndef HAVE_NO_LANGEXTRA
735 unsigned language = 0;
736 #endif
737
738 if (!environ_cb || !categories_supported) return;
739
740 *categories_supported = false;
741
742 if (!environ_cb(RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION, &version)) version = 0;
743
744 if (version >= 2) {
745 #ifndef HAVE_NO_LANGEXTRA
746 struct retro_core_options_v2_intl core_options_intl;
747
748 core_options_intl.us = &options_us;
749 core_options_intl.local = NULL;
750
751 if (environ_cb(RETRO_ENVIRONMENT_GET_LANGUAGE, &language) &&
752 (language < RETRO_LANGUAGE_LAST) && (language != RETRO_LANGUAGE_ENGLISH))
753 core_options_intl.local = options_intl[language];
754
755 *categories_supported = environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL,
756 &core_options_intl);
757 #else
758 *categories_supported = environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2,
759 &options_us);
760 #endif
761 }
762 else {
763 size_t i, j;
764 size_t option_index = 0;
765 size_t num_options = 0;
766 struct retro_core_option_definition
767 *option_v1_defs_us = NULL;
768 #ifndef HAVE_NO_LANGEXTRA
769 size_t num_options_intl = 0;
770 struct retro_core_option_v2_definition
771 *option_defs_intl = NULL;
772 struct retro_core_option_definition
773 *option_v1_defs_intl = NULL;
774 struct retro_core_options_intl
775 core_options_v1_intl;
776 #endif
777 struct retro_variable *variables = NULL;
778 char **values_buf = NULL;
779
780 /* Determine total number of options */
781 while (true) {
782 if (option_defs_us[num_options].key) num_options++;
783 else break;
784 }
785
786 if (version >= 1) {
787 /* Allocate US array */
788 option_v1_defs_us = (struct retro_core_option_definition *) calloc(num_options + 1, sizeof(struct retro_core_option_definition));
789
790 /* Copy parameters from option_defs_us array */
791 for (i = 0; i < num_options; i++) {
792 struct retro_core_option_v2_definition *option_def_us = &option_defs_us[i];
793 struct retro_core_option_value *option_values = option_def_us->values;
794 struct retro_core_option_definition *option_v1_def_us = &option_v1_defs_us[i];
795 struct retro_core_option_value *option_v1_values = option_v1_def_us->values;
796
797 option_v1_def_us->key = option_def_us->key;
798 option_v1_def_us->desc = option_def_us->desc;
799 option_v1_def_us->info = option_def_us->info;
800 option_v1_def_us->default_value = option_def_us->default_value;
801
802 /* Values must be copied individually... */
803 while (option_values->value) {
804 option_v1_values->value = option_values->value;
805 option_v1_values->label = option_values->label;
806
807 option_values++;
808 option_v1_values++;
809 }
810 }
811
812 #ifndef HAVE_NO_LANGEXTRA
813 if (environ_cb(RETRO_ENVIRONMENT_GET_LANGUAGE, &language) &&
814 (language < RETRO_LANGUAGE_LAST) && (language != RETRO_LANGUAGE_ENGLISH) &&
815 options_intl[language])
816 option_defs_intl = options_intl[language]->definitions;
817
818 if (option_defs_intl) {
819 /* Determine number of intl options */
820 while (true) {
821 if (option_defs_intl[num_options_intl].key) num_options_intl++;
822 else break;
823 }
824
825 /* Allocate intl array */
826 option_v1_defs_intl = (struct retro_core_option_definition *)
827 calloc(num_options_intl + 1, sizeof(struct retro_core_option_definition));
828
829 /* Copy parameters from option_defs_intl array */
830 for (i = 0; i < num_options_intl; i++) {
831 struct retro_core_option_v2_definition *option_def_intl = &option_defs_intl[i];
832 struct retro_core_option_value *option_values = option_def_intl->values;
833 struct retro_core_option_definition *option_v1_def_intl = &option_v1_defs_intl[i];
834 struct retro_core_option_value *option_v1_values = option_v1_def_intl->values;
835
836 option_v1_def_intl->key = option_def_intl->key;
837 option_v1_def_intl->desc = option_def_intl->desc;
838 option_v1_def_intl->info = option_def_intl->info;
839 option_v1_def_intl->default_value = option_def_intl->default_value;
840
841 /* Values must be copied individually... */
842 while (option_values->value) {
843 option_v1_values->value = option_values->value;
844 option_v1_values->label = option_values->label;
845
846 option_values++;
847 option_v1_values++;
848 }
849 }
850 }
851
852 core_options_v1_intl.us = option_v1_defs_us;
853 core_options_v1_intl.local = option_v1_defs_intl;
854
855 environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL, &core_options_v1_intl);
856 #else
857 environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS, option_v1_defs_us);
858 #endif
859 }
860 else {
861 /* Allocate arrays */
862 variables = (struct retro_variable *)calloc(num_options + 1,
863 sizeof(struct retro_variable));
864 values_buf = (char **)calloc(num_options, sizeof(char *));
865
866 if (!variables || !values_buf) goto error;
867
868 /* Copy parameters from option_defs_us array */
869 for (i = 0; i < num_options; i++) {
870 const char *key = option_defs_us[i].key;
871 const char *desc = option_defs_us[i].desc;
872 const char *default_value = option_defs_us[i].default_value;
873 struct retro_core_option_value *values = option_defs_us[i].values;
874 size_t buf_len = 3;
875 size_t default_index = 0;
876
877 values_buf[i] = NULL;
878
879 if (desc) {
880 size_t num_values = 0;
881
882 /* Determine number of values */
883 while (true) {
884 if (values[num_values].value) {
885 /* Check if this is the default value */
886 if (default_value) {
887 if (strcmp(values[num_values].value, default_value) == 0) default_index = num_values;
888
889 buf_len += strlen(values[num_values].value);
890 num_values++;
891 }
892 }
893 else break;
894 }
895
896 /* Build values string */
897 if (num_values > 0) {
898 buf_len += num_values - 1;
899 buf_len += strlen(desc);
900
901 values_buf[i] = (char *)calloc(buf_len, sizeof(char));
902 if (!values_buf[i]) goto error;
903
904 strcpy(values_buf[i], desc);
905 strcat(values_buf[i], "; ");
906
907 /* Default value goes first */
908 strcat(values_buf[i], values[default_index].value);
909
910 /* Add remaining values */
911 for (j = 0; j < num_values; j++) {
912 if (j != default_index) {
913 strcat(values_buf[i], "|");
914 strcat(values_buf[i], values[j].value);
915 }
916 }
917 }
918 }
919
920 variables[option_index].key = key;
921 variables[option_index].value = values_buf[i];
922 option_index++;
923 }
924
925 /* Set variables */
926 environ_cb(RETRO_ENVIRONMENT_SET_VARIABLES, variables);
927 }
928
929 error:
930 /* Clean up */
931
932 if (option_v1_defs_us) {
933 free(option_v1_defs_us);
934 option_v1_defs_us = NULL;
935 }
936
937 #ifndef HAVE_NO_LANGEXTRA
938 if (option_v1_defs_intl) {
939 free(option_v1_defs_intl);
940 option_v1_defs_intl = NULL;
941 }
942 #endif
943
944 if (values_buf) {
945 for (i = 0; i < num_options; i++) {
946 if (values_buf[i]) {
947 free(values_buf[i]);
948 values_buf[i] = NULL;
949 }
950 }
951
952 free(values_buf);
953 values_buf = NULL;
954 }
955
956 if (variables) {
957 free(variables);
958 variables = NULL;
959 }
960 }
961 }
962
963 #ifdef __cplusplus
964 }
965 #endif
966
967 #endif
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.