forked from libretro/RetroArch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configuration.c
3387 lines (2910 loc) · 116 KB
/
configuration.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2016 - Daniel De Matteis
* Copyright (C) 2014-2016 - Jean-André Santoni
* Copyright (C) 2016 - Brad Parker
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <ctype.h>
#include <file/config_file.h>
#include <file/file_path.h>
#include <compat/strl.h>
#include <compat/posix_string.h>
#include <retro_stat.h>
#include <retro_assert.h>
#include <string/stdstring.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "file_path_special.h"
#include "audio/audio_driver.h"
#include "configuration.h"
#include "content.h"
#include "config.def.h"
#include "input/input_config.h"
#include "input/input_keymaps.h"
#include "input/input_remapping.h"
#include "defaults.h"
#include "core.h"
#include "dirs.h"
#include "paths.h"
#include "retroarch.h"
#include "runloop.h"
#include "verbosity.h"
#include "lakka.h"
#include "tasks/tasks_internal.h"
/* All config related settings go here. */
struct config_bool_setting
{
const char *ident;
bool *ptr;
bool def_enable;
bool def;
bool handle;
};
struct config_int_setting
{
const char *ident;
unsigned *ptr;
bool def_enable;
unsigned def;
bool handle;
};
struct config_float_setting
{
const char *ident;
float *ptr;
bool def_enable;
float def;
bool handle;
};
struct config_array_setting
{
const char *ident;
char *ptr;
bool def_enable;
const char *def;
bool handle;
};
struct config_path_setting
{
const char *ident;
char *ptr;
bool def_enable;
char *def;
bool handle;
};
#define GENERAL_SETTING(key, configval, default_enable, default_setting, type, handle_setting) \
{ \
if (count == 0) \
tmp = (type*)malloc(sizeof(type) * (count + 1)); \
else \
tmp = (type*)realloc(tmp, sizeof(type) * (count + 1)); \
tmp[count].ident = key; \
tmp[count].ptr = configval; \
tmp[count].def_enable = default_enable; \
if (default_enable) \
tmp[count].def = default_setting; \
tmp[count].handle = handle_setting; \
count++; \
}
#define SETTING_BOOL(key, configval, default_enable, default_setting, handle_setting) \
GENERAL_SETTING(key, configval, default_enable, default_setting, struct config_bool_setting, handle_setting)
#define SETTING_FLOAT(key, configval, default_enable, default_setting, handle_setting) \
GENERAL_SETTING(key, configval, default_enable, default_setting, struct config_float_setting, handle_setting)
#define SETTING_INT(key, configval, default_enable, default_setting, handle_setting) \
GENERAL_SETTING(key, configval, default_enable, default_setting, struct config_int_setting, handle_setting)
#define SETTING_PATH(key, configval, default_enable, default_setting, handle_setting) \
GENERAL_SETTING(key, configval, default_enable, default_setting, struct config_path_setting, handle_setting)
#define SETTING_ARRAY(key, configval, default_enable, default_setting, handle_setting) \
GENERAL_SETTING(key, configval, default_enable, default_setting, struct config_array_setting, handle_setting)
struct defaults g_defaults;
static settings_t *configuration_settings = NULL;
settings_t *config_get_ptr(void)
{
return configuration_settings;
}
void config_free(void)
{
free(configuration_settings);
configuration_settings = NULL;
}
bool config_init(void)
{
configuration_settings = (settings_t*)calloc(1, sizeof(settings_t));
if (!configuration_settings)
return false;
return true;
}
/**
* config_get_default_audio:
*
* Gets default audio driver.
*
* Returns: Default audio driver.
**/
const char *config_get_default_audio(void)
{
enum audio_driver_enum default_driver = AUDIO_DEFAULT_DRIVER;
switch (default_driver)
{
case AUDIO_RSOUND:
return "rsound";
case AUDIO_OSS:
return "oss";
case AUDIO_ALSA:
return "alsa";
case AUDIO_ALSATHREAD:
return "alsathread";
case AUDIO_ROAR:
return "roar";
case AUDIO_COREAUDIO:
return "coreaudio";
case AUDIO_AL:
return "openal";
case AUDIO_SL:
return "opensl";
case AUDIO_SDL:
return "sdl";
case AUDIO_SDL2:
return "sdl2";
case AUDIO_DSOUND:
return "dsound";
case AUDIO_XAUDIO:
return "xaudio";
case AUDIO_PULSE:
return "pulse";
case AUDIO_EXT:
return "ext";
case AUDIO_XENON360:
return "xenon360";
case AUDIO_PS3:
return "ps3";
case AUDIO_WII:
return "gx";
case AUDIO_WIIU:
return "AX";
case AUDIO_PSP:
#ifdef VITA
return "vita";
#else
return "psp";
#endif
case AUDIO_CTR:
return "csnd";
case AUDIO_RWEBAUDIO:
return "rwebaudio";
case AUDIO_JACK:
return "jack";
case AUDIO_NULL:
break;
}
return "null";
}
const char *config_get_default_record(void)
{
enum record_driver_enum default_driver = RECORD_DEFAULT_DRIVER;
switch (default_driver)
{
case RECORD_FFMPEG:
return "ffmpeg";
case RECORD_NULL:
break;
}
return "null";
}
/**
* config_get_default_audio_resampler:
*
* Gets default audio resampler driver.
*
* Returns: Default audio resampler driver.
**/
const char *config_get_default_audio_resampler(void)
{
enum audio_resampler_driver_enum default_driver = AUDIO_DEFAULT_RESAMPLER_DRIVER;
switch (default_driver)
{
case AUDIO_RESAMPLER_CC:
return "cc";
case AUDIO_RESAMPLER_SINC:
return "sinc";
case AUDIO_RESAMPLER_NEAREST:
return "nearest";
case AUDIO_RESAMPLER_NULL:
break;
}
return "null";
}
/**
* config_get_default_video:
*
* Gets default video driver.
*
* Returns: Default video driver.
**/
const char *config_get_default_video(void)
{
enum video_driver_enum default_driver = VIDEO_DEFAULT_DRIVER;
switch (default_driver)
{
case VIDEO_GL:
return "gl";
case VIDEO_VULKAN:
return "vulkan";
case VIDEO_DRM:
return "drm";
case VIDEO_WII:
return "gx";
case VIDEO_WIIU:
return "gx2";
case VIDEO_XENON360:
return "xenon360";
case VIDEO_XDK_D3D:
case VIDEO_D3D9:
return "d3d";
case VIDEO_PSP1:
return "psp1";
case VIDEO_VITA2D:
return "vita2d";
case VIDEO_CTR:
return "ctr";
case VIDEO_XVIDEO:
return "xvideo";
case VIDEO_SDL:
return "sdl";
case VIDEO_SDL2:
return "sdl2";
case VIDEO_EXT:
return "ext";
case VIDEO_VG:
return "vg";
case VIDEO_OMAP:
return "omap";
case VIDEO_EXYNOS:
return "exynos";
case VIDEO_DISPMANX:
return "dispmanx";
case VIDEO_SUNXI:
return "sunxi";
case VIDEO_CACA:
return "caca";
case VIDEO_GDI:
return "gdi";
case VIDEO_VGA:
return "vga";
case VIDEO_NULL:
break;
}
return "null";
}
/**
* config_get_default_input:
*
* Gets default input driver.
*
* Returns: Default input driver.
**/
const char *config_get_default_input(void)
{
enum input_driver_enum default_driver = INPUT_DEFAULT_DRIVER;
switch (default_driver)
{
case INPUT_ANDROID:
return "android";
case INPUT_PS3:
return "ps3";
case INPUT_PSP:
#ifdef VITA
return "vita";
#else
return "psp";
#endif
case INPUT_CTR:
return "ctr";
case INPUT_SDL:
return "sdl";
case INPUT_SDL2:
return "sdl2";
case INPUT_DINPUT:
return "dinput";
case INPUT_X:
return "x";
case INPUT_WAYLAND:
return "wayland";
case INPUT_XENON360:
return "xenon360";
case INPUT_XINPUT:
return "xinput";
case INPUT_WII:
return "gx";
case INPUT_WIIU:
return "wiiu";
case INPUT_LINUXRAW:
return "linuxraw";
case INPUT_UDEV:
return "udev";
case INPUT_COCOA:
return "cocoa";
case INPUT_QNX:
return "qnx_input";
case INPUT_RWEBINPUT:
return "rwebinput";
case INPUT_DOS:
return "dos";
case INPUT_NULL:
break;
}
return "null";
}
/**
* config_get_default_joypad:
*
* Gets default input joypad driver.
*
* Returns: Default input joypad driver.
**/
const char *config_get_default_joypad(void)
{
enum joypad_driver_enum default_driver = JOYPAD_DEFAULT_DRIVER;
switch (default_driver)
{
case JOYPAD_PS3:
return "ps3";
case JOYPAD_XINPUT:
return "xinput";
case JOYPAD_GX:
return "gx";
case JOYPAD_WIIU:
return "wiiu";
case JOYPAD_XDK:
return "xdk";
case JOYPAD_PSP:
#ifdef VITA
return "vita";
#else
return "psp";
#endif
case JOYPAD_CTR:
return "ctr";
case JOYPAD_DINPUT:
return "dinput";
case JOYPAD_UDEV:
return "udev";
case JOYPAD_LINUXRAW:
return "linuxraw";
case JOYPAD_ANDROID:
return "android";
case JOYPAD_SDL:
#ifdef HAVE_SDL2
return "sdl2";
#else
return "sdl";
#endif
case JOYPAD_HID:
return "hid";
case JOYPAD_QNX:
return "qnx";
case JOYPAD_DOS:
return "dos";
case JOYPAD_NULL:
break;
}
return "null";
}
/**
* config_get_default_camera:
*
* Gets default camera driver.
*
* Returns: Default camera driver.
**/
const char *config_get_default_camera(void)
{
enum camera_driver_enum default_driver = CAMERA_DEFAULT_DRIVER;
switch (default_driver)
{
case CAMERA_V4L2:
return "video4linux2";
case CAMERA_RWEBCAM:
return "rwebcam";
case CAMERA_ANDROID:
return "android";
case CAMERA_AVFOUNDATION:
return "avfoundation";
case CAMERA_NULL:
break;
}
return "null";
}
/**
* config_get_default_wifi:
*
* Gets default wifi driver.
*
* Returns: Default wifi driver.
**/
const char *config_get_default_wifi(void)
{
enum wifi_driver_enum default_driver = WIFI_DEFAULT_DRIVER;
switch (default_driver)
{
case WIFI_CONNMANCTL:
return "connmanctl";
case WIFI_NULL:
break;
}
return "null";
}
/**
* config_get_default_location:
*
* Gets default location driver.
*
* Returns: Default location driver.
**/
const char *config_get_default_location(void)
{
enum location_driver_enum default_driver = LOCATION_DEFAULT_DRIVER;
switch (default_driver)
{
case LOCATION_ANDROID:
return "android";
case LOCATION_CORELOCATION:
return "corelocation";
case LOCATION_NULL:
break;
}
return "null";
}
#ifdef HAVE_MENU
/**
* config_get_default_menu:
*
* Gets default menu driver.
*
* Returns: Default menu driver.
**/
const char *config_get_default_menu(void)
{
enum menu_driver_enum default_driver = MENU_DEFAULT_DRIVER;
if (!string_is_empty(g_defaults.settings.menu))
return g_defaults.settings.menu;
switch (default_driver)
{
case MENU_RGUI:
return "rgui";
case MENU_XUI:
return "xui";
case MENU_MATERIALUI:
return "glui";
case MENU_XMB:
return "xmb";
case MENU_NUKLEAR:
return "nuklear";
case MENU_NULL:
break;
}
return "null";
}
#endif
bool config_overlay_enable_default(void)
{
if (g_defaults.overlay.set)
return g_defaults.overlay.enable;
return true;
}
static struct config_array_setting *populate_settings_array(settings_t *settings, int *size)
{
unsigned count = 0;
struct config_array_setting *tmp = NULL;
/* Arrays */
SETTING_ARRAY("playlist_names", settings->playlist_names, false, NULL, true);
SETTING_ARRAY("playlist_cores", settings->playlist_cores, false, NULL, true);
SETTING_ARRAY("video_driver", settings->video.driver, false, NULL, true);
SETTING_ARRAY("record_driver", settings->record.driver, false, NULL, true);
SETTING_ARRAY("camera_driver", settings->camera.driver, false, NULL, true);
SETTING_ARRAY("wifi_driver", settings->wifi.driver, false, NULL, true);
SETTING_ARRAY("location_driver", settings->location.driver,false, NULL, true);
#ifdef HAVE_MENU
SETTING_ARRAY("menu_driver", settings->menu.driver, false, NULL, true);
#endif
SETTING_ARRAY("audio_device", settings->audio.device, false, NULL, true);
SETTING_ARRAY("camera_device", settings->camera.device, false, NULL, true);
#ifdef HAVE_CHEEVOS
SETTING_ARRAY("cheevos_username", settings->cheevos.username, false, NULL, true);
SETTING_ARRAY("cheevos_password", settings->cheevos.password, false, NULL, true);
#endif
SETTING_ARRAY("video_context_driver", settings->video.context_driver, false, NULL, true);
SETTING_ARRAY("audio_driver", settings->audio.driver, false, NULL, true);
SETTING_ARRAY("audio_resampler", settings->audio.resampler, false, NULL, true);
SETTING_ARRAY("input_driver", settings->input.driver, false, NULL, true);
SETTING_ARRAY("input_joypad_driver", settings->input.joypad_driver, false, NULL, true);
SETTING_ARRAY("input_keyboard_layout", settings->input.keyboard_layout, false, NULL, true);
SETTING_ARRAY("bundle_assets_src_path", settings->path.bundle_assets_src, false, NULL, true);
SETTING_ARRAY("bundle_assets_dst_path", settings->path.bundle_assets_dst, false, NULL, true);
SETTING_ARRAY("bundle_assets_dst_path_subdir", settings->path.bundle_assets_dst_subdir, false, NULL, true);
*size = count;
return tmp;
}
static struct config_path_setting *populate_settings_path(settings_t *settings, int *size)
{
unsigned count = 0;
struct config_path_setting *tmp = NULL;
global_t *global = global_get_ptr();
/* Paths */
#ifdef HAVE_XMB
SETTING_PATH("xmb_font", settings->menu.xmb.font, false, NULL, true);
#endif
SETTING_PATH("netplay_nickname", settings->username, false, NULL, true);
SETTING_PATH("video_filter", settings->path.softfilter_plugin, false, NULL, true);
SETTING_PATH("audio_dsp_plugin", settings->path.audio_dsp_plugin, false, NULL, true);
SETTING_PATH("core_updater_buildbot_url", settings->network.buildbot_url, false, NULL, true);
SETTING_PATH("core_updater_buildbot_assets_url", settings->network.buildbot_assets_url, false, NULL, true);
#ifdef HAVE_NETWORKING
SETTING_PATH("netplay_ip_address", settings->netplay.server, false, NULL, true);
SETTING_PATH("netplay_password", settings->netplay.password, false, NULL, true);
SETTING_PATH("netplay_spectate_password", settings->netplay.spectate_password, false, NULL, true);
#endif
SETTING_PATH("libretro_directory",
settings->directory.libretro, false, NULL, false);
SETTING_PATH("core_options_path",
settings->path.core_options, false, NULL, true);
SETTING_PATH("libretro_info_path",
settings->path.libretro_info, false, NULL, true);
SETTING_PATH("video_shader",
settings->path.shader, false, NULL, true);
SETTING_PATH("content_database_path",
settings->path.content_database, false, NULL, true);
SETTING_PATH("cheat_database_path",
settings->path.cheat_database, false, NULL, true);
#ifdef HAVE_MENU
SETTING_PATH("menu_wallpaper",
settings->path.menu_wallpaper, false, NULL, true);
#endif
SETTING_PATH("content_history_path",
settings->path.content_history, false, NULL, true);
SETTING_PATH("content_music_history_path",
settings->path.content_music_history, false, NULL, true);
SETTING_PATH("content_video_history_path",
settings->path.content_video_history, false, NULL, true);
SETTING_PATH("content_image_history_path",
settings->path.content_image_history, false, NULL, true);
#ifdef HAVE_OVERLAY
SETTING_PATH("input_overlay",
settings->path.overlay, false, NULL, true);
#endif
SETTING_PATH("video_font_path",
settings->path.font, false, NULL, true);
SETTING_PATH("cursor_directory",
settings->directory.cursor, false, NULL, true);
SETTING_PATH("content_history_dir",
settings->directory.content_history, false, NULL, true);
SETTING_PATH("screenshot_directory",
settings->directory.screenshot, true, NULL, true);
SETTING_PATH("system_directory",
settings->directory.system, true, NULL, true);
SETTING_PATH("cache_directory",
settings->directory.cache, false, NULL, true);
SETTING_PATH("input_remapping_directory",
settings->directory.input_remapping, false, NULL, true);
SETTING_PATH("resampler_directory",
settings->directory.resampler, false, NULL, true);
SETTING_PATH("video_shader_dir",
settings->directory.video_shader, true, NULL, true);
SETTING_PATH("video_filter_dir",
settings->directory.video_filter, true, NULL, true);
SETTING_PATH("core_assets_directory",
settings->directory.core_assets, true, NULL, true);
SETTING_PATH("assets_directory",
settings->directory.assets, true, NULL, true);
SETTING_PATH("dynamic_wallpapers_directory",
settings->directory.dynamic_wallpapers, true, NULL, true);
SETTING_PATH("thumbnails_directory",
settings->directory.thumbnails, true, NULL, true);
SETTING_PATH("playlist_directory",
settings->directory.playlist, true, NULL, true);
SETTING_PATH("joypad_autoconfig_dir",
settings->directory.autoconfig, false, NULL, true);
SETTING_PATH("audio_filter_dir",
settings->directory.audio_filter, true, NULL, true);
SETTING_PATH("savefile_directory",
dir_get_ptr(RARCH_DIR_SAVEFILE), true, NULL, false);
SETTING_PATH("savestate_directory",
dir_get_ptr(RARCH_DIR_SAVESTATE), true, NULL, false);
#ifdef HAVE_MENU
SETTING_PATH("rgui_browser_directory",
settings->directory.menu_content, true, NULL, true);
SETTING_PATH("rgui_config_directory",
settings->directory.menu_config, true, NULL, true);
#endif
#ifdef HAVE_OVERLAY
SETTING_PATH("overlay_directory",
settings->directory.overlay, true, NULL, true);
#endif
#ifndef HAVE_DYNAMIC
SETTING_PATH("libretro_path",
path_get_ptr(RARCH_PATH_CORE), false, NULL, false);
#endif
SETTING_PATH(
"screenshot_directory",
settings->directory.screenshot, true, NULL, false);
if (global)
{
SETTING_PATH("recording_output_directory",
global->record.output_dir, false, NULL, true);
SETTING_PATH("recording_config_directory",
global->record.config_dir, false, NULL, true);
}
*size = count;
return tmp;
}
static struct config_bool_setting *populate_settings_bool(settings_t *settings, int *size)
{
unsigned count = 0;
global_t *global = global_get_ptr();
struct config_bool_setting *tmp = NULL;
SETTING_BOOL("ui_companion_start_on_boot", &settings->ui.companion_start_on_boot, true, ui_companion_start_on_boot, false);
SETTING_BOOL("ui_companion_enable", &settings->ui.companion_enable, true, ui_companion_enable, false);
SETTING_BOOL("video_gpu_record", &settings->video.gpu_record, true, gpu_record, false);
SETTING_BOOL("input_remap_binds_enable", &settings->input.remap_binds_enable, true, true, false);
SETTING_BOOL("all_users_control_menu", &settings->input.all_users_control_menu, true, all_users_control_menu, false);
SETTING_BOOL("menu_swap_ok_cancel_buttons", &settings->input.menu_swap_ok_cancel_buttons, true, menu_swap_ok_cancel_buttons, false);
#ifdef HAVE_NETWORKING
SETTING_BOOL("netplay_stateless_mode", &settings->netplay.stateless_mode, false, netplay_stateless_mode, false);
SETTING_BOOL("netplay_client_swap_input", &settings->netplay.swap_input, true, netplay_client_swap_input, false);
#endif
SETTING_BOOL("input_descriptor_label_show", &settings->input.input_descriptor_label_show, true, input_descriptor_label_show, false);
SETTING_BOOL("input_descriptor_hide_unbound", &settings->input.input_descriptor_hide_unbound, true, input_descriptor_hide_unbound, false);
SETTING_BOOL("load_dummy_on_core_shutdown", &settings->load_dummy_on_core_shutdown, true, load_dummy_on_core_shutdown, false);
SETTING_BOOL("check_firmware_before_loading", &settings->check_firmware_before_loading, true, check_firmware_before_loading, false);
SETTING_BOOL("builtin_mediaplayer_enable", &settings->multimedia.builtin_mediaplayer_enable, false, false /* TODO */, false);
SETTING_BOOL("builtin_imageviewer_enable", &settings->multimedia.builtin_imageviewer_enable, true, true, false);
SETTING_BOOL("fps_show", &settings->fps_show, true, false, false);
SETTING_BOOL("ui_menubar_enable", &settings->ui.menubar_enable, true, true, false);
SETTING_BOOL("suspend_screensaver_enable", &settings->ui.suspend_screensaver_enable, true, true, false);
SETTING_BOOL("rewind_enable", &settings->rewind_enable, true, rewind_enable, false);
SETTING_BOOL("audio_sync", &settings->audio.sync, true, audio_sync, false);
SETTING_BOOL("video_shader_enable", &settings->video.shader_enable, true, shader_enable, false);
/* Let implementation decide if automatic, or 1:1 PAR. */
SETTING_BOOL("video_aspect_ratio_auto", &settings->video.aspect_ratio_auto, true, aspect_ratio_auto, false);
SETTING_BOOL("video_allow_rotate", &settings->video.allow_rotate, true, allow_rotate, false);
SETTING_BOOL("video_windowed_fullscreen", &settings->video.windowed_fullscreen, true, windowed_fullscreen, false);
SETTING_BOOL("video_crop_overscan", &settings->video.crop_overscan, true, crop_overscan, false);
SETTING_BOOL("video_scale_integer", &settings->video.scale_integer, true, scale_integer, false);
SETTING_BOOL("video_smooth", &settings->video.smooth, true, video_smooth, false);
SETTING_BOOL("video_force_aspect", &settings->video.force_aspect, true, force_aspect, false);
SETTING_BOOL("video_threaded", &settings->video.threaded, true, video_threaded, false);
SETTING_BOOL("video_shared_context", &settings->video.shared_context, true, video_shared_context, false);
SETTING_BOOL("auto_screenshot_filename", &settings->auto_screenshot_filename, true, auto_screenshot_filename, false);
SETTING_BOOL("video_force_srgb_disable", &settings->video.force_srgb_disable, true, false, false);
SETTING_BOOL("video_fullscreen", &settings->video.fullscreen, true, fullscreen, false);
SETTING_BOOL("bundle_assets_extract_enable", &settings->bundle_assets_extract_enable, true, bundle_assets_extract_enable, false);
SETTING_BOOL("video_vsync", &settings->video.vsync, true, vsync, false);
SETTING_BOOL("video_hard_sync", &settings->video.hard_sync, true, hard_sync, false);
SETTING_BOOL("video_black_frame_insertion", &settings->video.black_frame_insertion, true, black_frame_insertion, false);
SETTING_BOOL("video_disable_composition", &settings->video.disable_composition, true, disable_composition, false);
SETTING_BOOL("pause_nonactive", &settings->pause_nonactive, true, pause_nonactive, false);
SETTING_BOOL("video_gpu_screenshot", &settings->video.gpu_screenshot, true, gpu_screenshot, false);
SETTING_BOOL("video_post_filter_record", &settings->video.post_filter_record, true, post_filter_record, false);
SETTING_BOOL("keyboard_gamepad_enable", &settings->input.keyboard_gamepad_enable, true, true, false);
SETTING_BOOL("core_set_supports_no_game_enable", &settings->set_supports_no_game_enable, true, true, false);
SETTING_BOOL("audio_enable", &settings->audio.enable, true, audio_enable, false);
SETTING_BOOL("audio_mute_enable", &settings->audio.mute_enable, true, false, false);
SETTING_BOOL("location_allow", &settings->location.allow, true, false, false);
SETTING_BOOL("video_font_enable", &settings->video.font_enable, true, font_enable, false);
SETTING_BOOL("core_updater_auto_extract_archive", &settings->network.buildbot_auto_extract_archive, true, true, false);
SETTING_BOOL("camera_allow", &settings->camera.allow, true, false, false);
#if defined(VITA)
SETTING_BOOL("input_backtouch_enable", &settings->input.backtouch_enable, false, false, false);
SETTING_BOOL("input_backtouch_toggle", &settings->input.backtouch_toggle, false, false, false);
#endif
#if TARGET_OS_IPHONE
SETTING_BOOL("small_keyboard_enable", &settings->input.small_keyboard_enable, true, false, false);
#endif
#ifdef GEKKO
SETTING_BOOL("video_vfilter", &settings->video.vfilter, true, video_vfilter, false);
#endif
#ifdef HAVE_MENU
SETTING_BOOL("menu_unified_controls", &settings->menu.unified_controls, true, false, false);
#ifdef HAVE_THREADS
SETTING_BOOL("threaded_data_runloop_enable", &settings->threaded_data_runloop_enable, true, threaded_data_runloop_enable, false);
#endif
SETTING_BOOL("menu_throttle_framerate", &settings->menu.throttle_framerate, true, true, false);
SETTING_BOOL("menu_linear_filter", &settings->menu.linear_filter, true, true, false);
SETTING_BOOL("dpi_override_enable", &settings->menu.dpi.override_enable, true, menu_dpi_override_enable, false);
SETTING_BOOL("menu_pause_libretro", &settings->menu.pause_libretro, true, true, false);
SETTING_BOOL("menu_mouse_enable", &settings->menu.mouse.enable, true, def_mouse_enable, false);
SETTING_BOOL("menu_pointer_enable", &settings->menu.pointer.enable, true, pointer_enable, false);
SETTING_BOOL("menu_timedate_enable", &settings->menu.timedate_enable, true, true, false);
SETTING_BOOL("menu_battery_level_enable", &settings->menu.battery_level_enable, true, true, false);
SETTING_BOOL("menu_core_enable", &settings->menu.core_enable, true, true, false);
SETTING_BOOL("menu_dynamic_wallpaper_enable", &settings->menu.dynamic_wallpaper_enable, true, false, false);
#ifdef HAVE_XMB
SETTING_BOOL("xmb_shadows_enable", &settings->menu.xmb.shadows_enable, true, xmb_shadows_enable, false);
SETTING_BOOL("xmb_show_settings", &settings->menu.xmb.show_settings, true, xmb_show_settings, false);
#ifdef HAVE_IMAGEVIEWER
SETTING_BOOL("xmb_show_images", &settings->menu.xmb.show_images, true, xmb_show_images, false);
#endif
#ifdef HAVE_FFMPEG
SETTING_BOOL("xmb_show_music", &settings->menu.xmb.show_music, true, xmb_show_music, false);
SETTING_BOOL("xmb_show_video", &settings->menu.xmb.show_video, true, xmb_show_video, false);
#endif
SETTING_BOOL("xmb_show_history", &settings->menu.xmb.show_history, true, xmb_show_history, false);
#ifdef HAVE_LIBRETRODB
SETTING_BOOL("xmb_show_add", &settings->menu.xmb.show_add, true, xmb_show_add, false);
#endif
#endif
SETTING_BOOL("rgui_show_start_screen", &settings->menu_show_start_screen, false, false /* TODO */, false);
SETTING_BOOL("menu_navigation_wraparound_enable", &settings->menu.navigation.wraparound.enable, true, true, false);
SETTING_BOOL("menu_navigation_browser_filter_supported_extensions_enable",
&settings->menu.navigation.browser.filter.supported_extensions_enable, true, true, false);
SETTING_BOOL("menu_show_advanced_settings", &settings->menu.show_advanced_settings, true, show_advanced_settings, false);
#endif
#ifdef HAVE_CHEEVOS
SETTING_BOOL("cheevos_enable", &settings->cheevos.enable, true, cheevos_enable, false);
SETTING_BOOL("cheevos_test_unofficial", &settings->cheevos.test_unofficial, true, false, false);
SETTING_BOOL("cheevos_hardcore_mode_enable", &settings->cheevos.hardcore_mode_enable, true, false, false);
#endif
#ifdef HAVE_OVERLAY
SETTING_BOOL("input_overlay_enable", &settings->input.overlay_enable, true, config_overlay_enable_default(), false);
SETTING_BOOL("input_overlay_enable_autopreferred", &settings->input.overlay_enable_autopreferred, true, true, false);
SETTING_BOOL("input_overlay_hide_in_menu", &settings->input.overlay_hide_in_menu, true, overlay_hide_in_menu, false);
#endif
#ifdef HAVE_COMMAND
SETTING_BOOL("network_cmd_enable", &settings->network_cmd_enable, true, network_cmd_enable, false);
SETTING_BOOL("stdin_cmd_enable", &settings->stdin_cmd_enable, true, stdin_cmd_enable, false);
#endif
#ifdef HAVE_NETWORKGAMEPAD
SETTING_BOOL("network_remote_enable", &settings->network_remote_enable, false, false /* TODO */, false);
#endif
#ifdef HAVE_NETWORKING
SETTING_BOOL("netplay_nat_traversal", &settings->netplay.nat_traversal, true, true, false);
#endif
SETTING_BOOL("block_sram_overwrite", &settings->block_sram_overwrite, true, block_sram_overwrite, false);
SETTING_BOOL("savestate_auto_index", &settings->savestate_auto_index, true, savestate_auto_index, false);
SETTING_BOOL("savestate_auto_save", &settings->savestate_auto_save, true, savestate_auto_save, false);
SETTING_BOOL("savestate_auto_load", &settings->savestate_auto_load, true, savestate_auto_load, false);
SETTING_BOOL("savestate_thumbnail_enable", &settings->savestate_thumbnail_enable, true, savestate_thumbnail_enable, false);
SETTING_BOOL("history_list_enable", &settings->history_list_enable, true, def_history_list_enable, false);
SETTING_BOOL("playlist_entry_remove", &settings->playlist_entry_remove, true, def_playlist_entry_remove, false);
SETTING_BOOL("game_specific_options", &settings->game_specific_options, true, default_game_specific_options, false);
SETTING_BOOL("auto_overrides_enable", &settings->auto_overrides_enable, true, default_auto_overrides_enable, false);
SETTING_BOOL("auto_remaps_enable", &settings->auto_remaps_enable, true, default_auto_remaps_enable, false);
SETTING_BOOL("auto_shaders_enable", &settings->auto_shaders_enable, true, default_auto_shaders_enable, false);
SETTING_BOOL("sort_savefiles_enable", &settings->sort_savefiles_enable, true, default_sort_savefiles_enable, false);
SETTING_BOOL("sort_savestates_enable", &settings->sort_savestates_enable, true, default_sort_savestates_enable, false);
SETTING_BOOL("config_save_on_exit", &settings->config_save_on_exit, true, config_save_on_exit, false);
SETTING_BOOL("show_hidden_files", &settings->show_hidden_files, true, show_hidden_files, false);
SETTING_BOOL("input_autodetect_enable", &settings->input.autodetect_enable, true, input_autodetect_enable, false);
SETTING_BOOL("audio_rate_control", &settings->audio.rate_control, true, rate_control, false);
if (global)
{
SETTING_BOOL("custom_bgm_enable", &global->console.sound.system_bgm_enable, true, false, false);
}
*size = count;
return tmp;
}
static struct config_float_setting *populate_settings_float(settings_t *settings, int *size)
{
unsigned count = 0;
struct config_float_setting *tmp = NULL;
SETTING_FLOAT("video_aspect_ratio", &settings->video.aspect_ratio, true, aspect_ratio, false);
SETTING_FLOAT("video_scale", &settings->video.scale, false, 0.0f, false);
SETTING_FLOAT("video_refresh_rate", &settings->video.refresh_rate, true, refresh_rate, false);
SETTING_FLOAT("audio_rate_control_delta", &settings->audio.rate_control_delta, true, rate_control_delta, false);
SETTING_FLOAT("audio_max_timing_skew", &settings->audio.max_timing_skew, true, max_timing_skew, false);
SETTING_FLOAT("audio_volume", &settings->audio.volume, true, audio_volume, false);
#ifdef HAVE_OVERLAY
SETTING_FLOAT("input_overlay_opacity", &settings->input.overlay_opacity, true, 0.7f, false);
SETTING_FLOAT("input_overlay_scale", &settings->input.overlay_scale, true, 1.0f, false);
#endif
#ifdef HAVE_MENU
SETTING_FLOAT("menu_wallpaper_opacity", &settings->menu.wallpaper.opacity, true, menu_wallpaper_opacity, false);
SETTING_FLOAT("menu_footer_opacity", &settings->menu.footer.opacity, true, menu_footer_opacity, false);
SETTING_FLOAT("menu_header_opacity", &settings->menu.header.opacity, true, menu_header_opacity, false);
#endif
SETTING_FLOAT("video_message_pos_x", &settings->video.msg_pos_x, true, message_pos_offset_x, false);
SETTING_FLOAT("video_message_pos_y", &settings->video.msg_pos_y, true, message_pos_offset_y, false);
SETTING_FLOAT("video_font_size", &settings->video.font_size, true, font_size, false);
SETTING_FLOAT("fastforward_ratio", &settings->fastforward_ratio, true, fastforward_ratio, false);
SETTING_FLOAT("slowmotion_ratio", &settings->slowmotion_ratio, true, slowmotion_ratio, false);
SETTING_FLOAT("input_axis_threshold", &settings->input.axis_threshold, true, axis_threshold, false);
*size = count;
return tmp;
}
static struct config_int_setting *populate_settings_int(settings_t *settings, int *size)
{
unsigned count = 0;
struct config_int_setting *tmp = NULL;
SETTING_INT("input_bind_timeout", &settings->input.bind_timeout, true, input_bind_timeout, false);
SETTING_INT("input_turbo_period", &settings->input.turbo_period, true, turbo_period, false);
SETTING_INT("input_duty_cycle", &settings->input.turbo_duty_cycle, true, turbo_duty_cycle, false);
SETTING_INT("input_max_users", &settings->input.max_users, true, input_max_users, false);
SETTING_INT("input_menu_toggle_gamepad_combo", &settings->input.menu_toggle_gamepad_combo, true, menu_toggle_gamepad_combo, false);
SETTING_INT("audio_latency", &settings->audio.latency, false, 0 /* TODO */, false);
SETTING_INT("audio_block_frames", &settings->audio.block_frames, true, 0, false);
SETTING_INT("rewind_granularity", &settings->rewind_granularity, true, rewind_granularity, false);
SETTING_INT("autosave_interval", &settings->autosave_interval, true, autosave_interval, false);
SETTING_INT("libretro_log_level", &settings->libretro_log_level, true, libretro_log_level, false);
SETTING_INT("keyboard_gamepad_mapping_type",&settings->input.keyboard_gamepad_mapping_type, true, 1, false);
SETTING_INT("input_poll_type_behavior", &settings->input.poll_type_behavior, true, 2, false);
#ifdef HAVE_MENU
#endif
SETTING_INT("video_monitor_index", &settings->video.monitor_index, true, monitor_index, false);
SETTING_INT("video_fullscreen_x", &settings->video.fullscreen_x, true, fullscreen_x, false);
SETTING_INT("video_fullscreen_y", &settings->video.fullscreen_y, true, fullscreen_y, false);
SETTING_INT("video_window_x", &settings->video.window_x, true, fullscreen_x, false);
SETTING_INT("video_window_y", &settings->video.window_y, true, fullscreen_y, false);
#ifdef HAVE_COMMAND
SETTING_INT("network_cmd_port", &settings->network_cmd_port, true, network_cmd_port, false);
#endif
#ifdef HAVE_NETWORKGAMEPAD
SETTING_INT("network_remote_base_port", &settings->network_remote_base_port, true, network_remote_base_port, false);
#endif
#ifdef GEKKO
SETTING_INT("video_viwidth", &settings->video.viwidth, true, video_viwidth, false);
#endif
#ifdef HAVE_MENU
SETTING_INT("dpi_override_value", &settings->menu.dpi.override_value, true, menu_dpi_override_value, false);
SETTING_INT("menu_thumbnails", &settings->menu.thumbnails, true, menu_thumbnails_default, false);
#ifdef HAVE_XMB
SETTING_INT("xmb_alpha_factor", &settings->menu.xmb.alpha_factor, true, xmb_alpha_factor, false);
SETTING_INT("xmb_scale_factor", &settings->menu.xmb.scale_factor, true, xmb_scale_factor, false);
SETTING_INT("xmb_theme", &settings->menu.xmb.theme, true, xmb_icon_theme, false);
SETTING_INT("xmb_menu_color_theme", &settings->menu.xmb.menu_color_theme, true, xmb_theme, false);
#endif
SETTING_INT("materialui_menu_color_theme", &settings->menu.materialui.menu_color_theme, true, MATERIALUI_THEME_BLUE, false);
#ifdef HAVE_SHADERPIPELINE
SETTING_INT("menu_shader_pipeline", &settings->menu.xmb.shader_pipeline, true, menu_shader_pipeline, false);
#endif
#endif
SETTING_INT("audio_out_rate", &settings->audio.out_rate, true, out_rate, false);
SETTING_INT("custom_viewport_width", &settings->video_viewport_custom.width, false, 0 /* TODO */, false);
SETTING_INT("custom_viewport_height", &settings->video_viewport_custom.height, false, 0 /* TODO */, false);
SETTING_INT("custom_viewport_x", (unsigned*)&settings->video_viewport_custom.x, false, 0 /* TODO */, false);
SETTING_INT("custom_viewport_y", (unsigned*)&settings->video_viewport_custom.y, false, 0 /* TODO */, false);
SETTING_INT("content_history_size", &settings->content_history_size, true, default_content_history_size, false);
SETTING_INT("video_hard_sync_frames", &settings->video.hard_sync_frames, true, hard_sync_frames, false);
SETTING_INT("video_frame_delay", &settings->video.frame_delay, true, frame_delay, false);
SETTING_INT("video_max_swapchain_images", &settings->video.max_swapchain_images, true, max_swapchain_images, false);
SETTING_INT("video_swap_interval", &settings->video.swap_interval, true, swap_interval, false);
SETTING_INT("video_rotation", &settings->video.rotation, true, ORIENTATION_NORMAL, false);
SETTING_INT("aspect_ratio_index", &settings->video.aspect_ratio_idx, true, aspect_ratio_idx, false);
SETTING_INT("state_slot", (unsigned*)&settings->state_slot, false, 0 /* TODO */, false);
#ifdef HAVE_NETWORKING
SETTING_INT("netplay_ip_port", &settings->netplay.port, true, RARCH_DEFAULT_PORT, false);
SETTING_INT("netplay_check_frames", (unsigned*)&settings->netplay.check_frames, true, netplay_check_frames, false);
#endif
#ifdef HAVE_LANGEXTRA
SETTING_INT("user_language", &settings->user_language, true, RETRO_LANGUAGE_ENGLISH, false);
#endif
SETTING_INT("bundle_assets_extract_version_current", &settings->bundle_assets_extract_version_current, true, 0, false);
SETTING_INT("bundle_assets_extract_last_version", &settings->bundle_assets_extract_last_version, true, 0, false);
*size = count;
return tmp;
}
/**
* config_set_defaults:
*
* Set 'default' configuration values.
**/
static void config_set_defaults(void)
{
unsigned i, j;
int float_settings_size = 0;
int bool_settings_size = 0;
int int_settings_size = 0;
settings_t *settings = config_get_ptr();
const char *def_video = config_get_default_video();
const char *def_audio = config_get_default_audio();
const char *def_audio_resampler = config_get_default_audio_resampler();
const char *def_input = config_get_default_input();
const char *def_joypad = config_get_default_joypad();
#ifdef HAVE_MENU
const char *def_menu = config_get_default_menu();
#endif
const char *def_camera = config_get_default_camera();
const char *def_wifi = config_get_default_wifi();