forked from libretro/RetroArch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu_cbs_start.c
803 lines (673 loc) · 24.3 KB
/
menu_cbs_start.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
/* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2017 - Daniel De Matteis
*
* 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 <compat/strl.h>
#include <file/file_path.h>
#include <lists/string_list.h>
#include <string/stdstring.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
#include "../menu_driver.h"
#include "../menu_cbs.h"
#include "../menu_input.h"
#include "../menu_setting.h"
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
#include "../menu_shader.h"
#endif
#include "../../configuration.h"
#include "../../core.h"
#include "../../core_info.h"
#include "../../core_option_manager.h"
#ifdef HAVE_CHEATS
#include "../../cheat_manager.h"
#endif
#include "../../retroarch.h"
#include "../../verbosity.h"
#include "../../performance_counters.h"
#include "../../playlist.h"
#include "../../manual_content_scan.h"
#include "../../input/input_remapping.h"
#include "../../config.def.h"
#ifdef HAVE_NETWORKING
#include "../../core_updater_list.h"
#endif
#ifndef BIND_ACTION_START
#define BIND_ACTION_START(cbs, name) (cbs)->action_start = (name)
#endif
/* Forward declarations */
int generic_action_ok_command(enum event_command cmd);
int action_ok_push_playlist_manager_settings(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx);
int action_ok_push_core_information_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx);
#ifdef HAVE_AUDIOMIXER
static int action_start_audio_mixer_stream_volume(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
unsigned offset = (type - MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_VOLUME_BEGIN);
if (offset >= AUDIO_MIXER_MAX_STREAMS)
return 0;
audio_driver_mixer_set_stream_volume(offset, 1.0f);
return 0;
}
#endif
static int action_start_remap_file_load(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
input_remapping_deinit();
input_remapping_set_defaults(false);
return 0;
}
static int action_start_shader_preset(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
bool refresh = false;
struct video_shader *shader = menu_shader_get();
shader->passes = 0;
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
command_event(CMD_EVENT_SHADERS_APPLY_CHANGES, NULL);
#endif
return 0;
}
static int action_start_video_filter_file_load(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
settings_t *settings = config_get_ptr();
if (!settings)
return menu_cbs_exit();
if (!string_is_empty(settings->paths.path_softfilter_plugin))
{
bool refresh = false;
/* Unload video filter */
settings->paths.path_softfilter_plugin[0] = '\0';
command_event(CMD_EVENT_REINIT, NULL);
/* Refresh menu */
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
}
return 0;
}
static int action_start_audio_dsp_plugin_file_load(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
settings_t *settings = config_get_ptr();
if (!settings)
return menu_cbs_exit();
if (!string_is_empty(settings->paths.path_audio_dsp_plugin))
{
bool refresh = false;
/* Unload dsp plugin filter */
settings->paths.path_audio_dsp_plugin[0] = '\0';
command_event(CMD_EVENT_DSP_FILTER_INIT, NULL);
/* Refresh menu */
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
}
return 0;
}
static int generic_action_start_performance_counters(struct retro_perf_counter **counters,
unsigned offset, unsigned type, const char *label)
{
if (counters[offset])
{
counters[offset]->total = 0;
counters[offset]->call_cnt = 0;
}
return 0;
}
static int action_start_performance_counters_core(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
struct retro_perf_counter **counters = retro_get_perf_counter_libretro();
unsigned offset = type - MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN;
return generic_action_start_performance_counters(counters, offset, type, label);
}
static int action_start_performance_counters_frontend(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
struct retro_perf_counter **counters = retro_get_perf_counter_rarch();
unsigned offset = type - MENU_SETTINGS_PERF_COUNTERS_BEGIN;
return generic_action_start_performance_counters(counters, offset, type, label);
}
static int action_start_input_desc(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
unsigned user_idx;
unsigned btn_idx;
unsigned mapped_port;
settings_t *settings = config_get_ptr();
rarch_system_info_t *system = &runloop_state_get_ptr()->system;
if (!settings || !system)
return 0;
user_idx = (type - MENU_SETTINGS_INPUT_DESC_BEGIN) / (RARCH_FIRST_CUSTOM_BIND + 8);
btn_idx = (type - MENU_SETTINGS_INPUT_DESC_BEGIN) - (RARCH_FIRST_CUSTOM_BIND + 8) * user_idx;
mapped_port = settings->uints.input_remap_ports[user_idx];
if ((user_idx >= MAX_USERS) ||
(mapped_port >= MAX_USERS) ||
(btn_idx >= RARCH_CUSTOM_BIND_LIST_END))
return 0;
/* Check whether core has defined this input */
if (!string_is_empty(system->input_desc_btn[mapped_port][btn_idx]))
{
const struct retro_keybind *keyptr = &input_config_binds[user_idx][btn_idx];
settings->uints.input_remap_ids[user_idx][btn_idx] = keyptr->id;
}
else
settings->uints.input_remap_ids[user_idx][btn_idx] = RARCH_UNMAPPED;
return 0;
}
static int action_start_input_desc_kbd(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
settings_t *settings = config_get_ptr();
unsigned user_idx;
unsigned btn_idx;
(void)label;
if (!settings)
return 0;
user_idx = (type - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN) / RARCH_ANALOG_BIND_LIST_END;
btn_idx = (type - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN) - RARCH_ANALOG_BIND_LIST_END * user_idx;
if ((user_idx >= MAX_USERS) || (btn_idx >= RARCH_CUSTOM_BIND_LIST_END))
return 0;
/* By default, inputs are unmapped */
settings->uints.input_keymapper_ids[user_idx][btn_idx] = RETROK_FIRST;
return 0;
}
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
static int action_start_shader_action_parameter_generic(
unsigned type, unsigned offset)
{
video_shader_ctx_t shader_info;
struct video_shader_parameter *param = NULL;
unsigned parameter = type - offset;
video_shader_driver_get_current_shader(&shader_info);
if (!shader_info.data)
return 0;
param = &shader_info.data->parameters
[parameter];
param->current = param->initial;
param->current = MIN(MAX(param->minimum, param->current), param->maximum);
return menu_shader_manager_clear_parameter(menu_shader_get(), parameter);
}
static int action_start_shader_action_parameter(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
return action_start_shader_action_parameter_generic(type, MENU_SETTINGS_SHADER_PARAMETER_0);
}
static int action_start_shader_action_preset_parameter(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
return action_start_shader_action_parameter_generic(type, MENU_SETTINGS_SHADER_PRESET_PARAMETER_0);
}
static int action_start_shader_pass(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
menu_handle_t *menu = menu_state_get_ptr()->driver_data;
if (!menu)
return menu_cbs_exit();
menu->scratchpad.unsigned_var = type - MENU_SETTINGS_SHADER_PASS_0;
menu_shader_manager_clear_pass_path(menu_shader_get(),
menu->scratchpad.unsigned_var);
return 0;
}
static int action_start_shader_scale_pass(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
unsigned pass = type - MENU_SETTINGS_SHADER_PASS_SCALE_0;
menu_shader_manager_clear_pass_scale(menu_shader_get(), pass);
return 0;
}
static int action_start_shader_filter_pass(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
unsigned pass = type - MENU_SETTINGS_SHADER_PASS_FILTER_0;
return menu_shader_manager_clear_pass_filter(menu_shader_get(), pass);
}
#endif
static int action_start_netplay_mitm_server(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
settings_t *settings = config_get_ptr();
configuration_set_string(settings,
settings->arrays.netplay_mitm_server,
DEFAULT_NETPLAY_MITM_SERVER);
return 0;
}
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
static int action_start_shader_watch_for_changes(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
settings_t *settings = config_get_ptr();
settings->bools.video_shader_watch_files = DEFAULT_VIDEO_SHADER_WATCH_FILES;
return 0;
}
static int action_start_shader_num_passes(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
return menu_shader_manager_clear_num_passes(menu_shader_get());
}
#endif
#ifdef HAVE_CHEATS
static int action_start_cheat_num_passes(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
if (cheat_manager_get_size())
{
bool refresh = false;
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
cheat_manager_realloc(0, CHEAT_HANDLER_TYPE_EMU);
}
return 0;
}
#endif
static int action_start_core_setting(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
unsigned core_idx = type - MENU_SETTINGS_CORE_OPTION_START;
core_option_manager_t *coreopts = NULL;
if (retroarch_ctl(RARCH_CTL_CORE_OPTIONS_LIST_GET, &coreopts))
core_option_manager_set_default(coreopts, core_idx, true);
return 0;
}
static int action_start_playlist_association(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
playlist_t *playlist = playlist_get_cached();
if (!playlist)
return -1;
/* Set default core path + name to DETECT */
playlist_set_default_core_path(playlist, FILE_PATH_DETECT);
playlist_set_default_core_name(playlist, FILE_PATH_DETECT);
playlist_write_file(playlist);
return 0;
}
static int action_start_playlist_label_display_mode(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
playlist_t *playlist = playlist_get_cached();
if (!playlist)
return -1;
/* Set label display mode to the default */
playlist_set_label_display_mode(playlist, LABEL_DISPLAY_MODE_DEFAULT);
playlist_write_file(playlist);
return 0;
}
static int action_start_playlist_right_thumbnail_mode(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
playlist_t *playlist = playlist_get_cached();
if (!playlist)
return -1;
/* Set thumbnail_mode to default value */
playlist_set_thumbnail_mode(playlist, PLAYLIST_THUMBNAIL_RIGHT, PLAYLIST_THUMBNAIL_MODE_DEFAULT);
playlist_write_file(playlist);
return 0;
}
static int action_start_playlist_left_thumbnail_mode(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
playlist_t *playlist = playlist_get_cached();
if (!playlist)
return -1;
/* Set thumbnail_mode to default value */
playlist_set_thumbnail_mode(playlist, PLAYLIST_THUMBNAIL_LEFT, PLAYLIST_THUMBNAIL_MODE_DEFAULT);
playlist_write_file(playlist);
return 0;
}
static int action_start_playlist_sort_mode(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
playlist_t *playlist = playlist_get_cached();
if (!playlist)
return -1;
/* Set sort mode to the default */
playlist_set_sort_mode(playlist, PLAYLIST_SORT_MODE_DEFAULT);
playlist_write_file(playlist);
return 0;
}
static int action_start_manual_content_scan_dir(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
/* Reset content directory */
manual_content_scan_set_menu_content_dir("");
return 0;
}
static int action_start_manual_content_scan_system_name(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
/* Reset system name */
manual_content_scan_set_menu_system_name(
MANUAL_CONTENT_SCAN_SYSTEM_NAME_CONTENT_DIR, "");
return 0;
}
static int action_start_manual_content_scan_core_name(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
/* Reset core name */
manual_content_scan_set_menu_core_name(
MANUAL_CONTENT_SCAN_CORE_DETECT, "");
return 0;
}
static int action_start_video_resolution(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
#if defined(GEKKO) || !defined(__PSL1GHT__) && !defined(__PS3__)
unsigned width = 0, height = 0;
global_t *global = global_get_ptr();
/* Reset the resolution id to zero */
global->console.screen.resolutions.current.id = 0;
if (video_driver_get_video_output_size(&width, &height))
{
char msg[PATH_MAX_LENGTH];
msg[0] = '\0';
#if defined(_WIN32) || !defined(__PSL1GHT__) && !defined(__PS3__)
generic_action_ok_command(CMD_EVENT_REINIT);
#endif
video_driver_set_video_mode(width, height, true);
#ifdef GEKKO
if (width == 0 || height == 0)
strlcpy(msg, "Resetting to: DEFAULT", sizeof(msg));
else
#endif
snprintf(msg, sizeof(msg),
"Resetting to: %dx%d", width, height);
runloop_msg_queue_push(msg, 1, 100, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
#endif
return 0;
}
static int action_start_load_core(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
int ret = generic_action_ok_command(
CMD_EVENT_UNLOAD_CORE);
bool refresh = false;
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
return ret;
}
#ifdef HAVE_NETWORKING
static int action_start_core_updater_entry(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
core_updater_list_t *core_list = core_updater_list_get_cached();
const core_updater_list_entry_t *entry = NULL;
/* If specified core is installed, go to core
* information menu */
if (core_list &&
core_updater_list_get_filename(core_list, path, &entry) &&
!string_is_empty(entry->local_core_path) &&
path_is_valid(entry->local_core_path))
return action_ok_push_core_information_list(
entry->local_core_path, label, type, idx, entry_idx);
/* Otherwise do nothing */
return 0;
}
#endif
static int action_start_core_lock(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
const char *core_path = path;
bool refresh = false;
int ret = 0;
if (string_is_empty(core_path))
return -1;
/* Core should be unlocked by default
* > If it is currently unlocked, do nothing */
if (!core_info_get_core_lock(core_path, true))
return ret;
/* ...Otherwise, attempt to unlock it */
if (!core_info_set_core_lock(core_path, false))
{
const char *core_name = NULL;
core_info_t *core_info = NULL;
char msg[PATH_MAX_LENGTH];
msg[0] = '\0';
/* Need to fetch core name for error message */
/* If core is found, use display name */
if (core_info_find(core_path, &core_info) &&
core_info->display_name)
core_name = core_info->display_name;
/* If not, use core file name */
else
core_name = path_basename(core_path);
/* Build error message */
strlcpy(msg, msg_hash_to_str(MSG_CORE_UNLOCK_FAILED), sizeof(msg));
if (!string_is_empty(core_name))
strlcat(msg, core_name, sizeof(msg));
/* Generate log + notification */
RARCH_ERR("%s\n", msg);
runloop_msg_queue_push(
msg,
1, 100, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
ret = -1;
}
/* Whenever lock status is changed, menu must be
* refreshed - do this even in the event of an error,
* since we don't want to leave the menu in an
* undefined state */
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
return ret;
}
static int action_start_lookup_setting(
const char *path, const char *label,
unsigned type, size_t idx, size_t entry_idx)
{
return menu_setting_set(type, MENU_ACTION_START, false);
}
static int menu_cbs_init_bind_start_compare_label(menu_file_list_cbs_t *cbs)
{
if (cbs->enum_idx != MSG_UNKNOWN)
{
switch (cbs->enum_idx)
{
case MENU_ENUM_LABEL_CORE_LIST:
BIND_ACTION_START(cbs, action_start_load_core);
break;
case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET:
BIND_ACTION_START(cbs, action_start_shader_preset);
break;
case MENU_ENUM_LABEL_REMAP_FILE_LOAD:
BIND_ACTION_START(cbs, action_start_remap_file_load);
break;
case MENU_ENUM_LABEL_VIDEO_FILTER:
BIND_ACTION_START(cbs, action_start_video_filter_file_load);
break;
case MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN:
BIND_ACTION_START(cbs, action_start_audio_dsp_plugin_file_load);
break;
case MENU_ENUM_LABEL_VIDEO_SHADER_PASS:
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
BIND_ACTION_START(cbs, action_start_shader_pass);
#endif
break;
case MENU_ENUM_LABEL_VIDEO_SHADER_SCALE_PASS:
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
BIND_ACTION_START(cbs, action_start_shader_scale_pass);
#endif
break;
case MENU_ENUM_LABEL_VIDEO_SHADER_FILTER_PASS:
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
BIND_ACTION_START(cbs, action_start_shader_filter_pass);
#endif
break;
case MENU_ENUM_LABEL_SHADER_WATCH_FOR_CHANGES:
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
BIND_ACTION_START(cbs, action_start_shader_watch_for_changes);
#endif
break;
case MENU_ENUM_LABEL_VIDEO_SHADER_NUM_PASSES:
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
BIND_ACTION_START(cbs, action_start_shader_num_passes);
#endif
break;
case MENU_ENUM_LABEL_CHEAT_NUM_PASSES:
#ifdef HAVE_CHEATS
BIND_ACTION_START(cbs, action_start_cheat_num_passes);
#endif
break;
case MENU_ENUM_LABEL_SCREEN_RESOLUTION:
BIND_ACTION_START(cbs, action_start_video_resolution);
break;
case MENU_ENUM_LABEL_NETPLAY_MITM_SERVER:
BIND_ACTION_START(cbs, action_start_netplay_mitm_server);
break;
case MENU_ENUM_LABEL_PLAYLIST_MANAGER_DEFAULT_CORE:
BIND_ACTION_START(cbs, action_start_playlist_association);
break;
case MENU_ENUM_LABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE:
BIND_ACTION_START(cbs, action_start_playlist_label_display_mode);
break;
case MENU_ENUM_LABEL_PLAYLIST_MANAGER_RIGHT_THUMBNAIL_MODE:
BIND_ACTION_START(cbs, action_start_playlist_right_thumbnail_mode);
break;
case MENU_ENUM_LABEL_PLAYLIST_MANAGER_LEFT_THUMBNAIL_MODE:
BIND_ACTION_START(cbs, action_start_playlist_left_thumbnail_mode);
break;
case MENU_ENUM_LABEL_PLAYLIST_MANAGER_SORT_MODE:
BIND_ACTION_START(cbs, action_start_playlist_sort_mode);
break;
case MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_DIR:
BIND_ACTION_START(cbs, action_start_manual_content_scan_dir);
break;
case MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_SYSTEM_NAME:
BIND_ACTION_START(cbs, action_start_manual_content_scan_system_name);
break;
case MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_CORE_NAME:
BIND_ACTION_START(cbs, action_start_manual_content_scan_core_name);
break;
default:
return -1;
}
}
else
return -1;
return 0;
}
static int menu_cbs_init_bind_start_compare_type(menu_file_list_cbs_t *cbs,
unsigned type)
{
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
if (type >= MENU_SETTINGS_SHADER_PARAMETER_0
&& type <= MENU_SETTINGS_SHADER_PARAMETER_LAST)
{
BIND_ACTION_START(cbs, action_start_shader_action_parameter);
}
else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0
&& type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST)
{
BIND_ACTION_START(cbs, action_start_shader_action_preset_parameter);
}
else
#endif
if (type >= MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN &&
type <= MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_END)
{
BIND_ACTION_START(cbs, action_start_performance_counters_core);
}
else if (type >= MENU_SETTINGS_INPUT_DESC_BEGIN
&& type <= MENU_SETTINGS_INPUT_DESC_END)
{
BIND_ACTION_START(cbs, action_start_input_desc);
}
else if (type >= MENU_SETTINGS_INPUT_DESC_KBD_BEGIN
&& type <= MENU_SETTINGS_INPUT_DESC_KBD_END)
{
BIND_ACTION_START(cbs, action_start_input_desc_kbd);
}
else if (type >= MENU_SETTINGS_PERF_COUNTERS_BEGIN &&
type <= MENU_SETTINGS_PERF_COUNTERS_END)
{
BIND_ACTION_START(cbs, action_start_performance_counters_frontend);
}
else if ((type >= MENU_SETTINGS_CORE_OPTION_START) &&
(type < MENU_SETTINGS_CHEEVOS_START))
{
BIND_ACTION_START(cbs, action_start_core_setting);
}
else
{
switch (type)
{
case FILE_TYPE_PLAYLIST_COLLECTION:
BIND_ACTION_START(cbs, action_ok_push_playlist_manager_settings);
break;
#ifdef HAVE_NETWORKING
case FILE_TYPE_DOWNLOAD_CORE:
BIND_ACTION_START(cbs, action_start_core_updater_entry);
break;
#endif
case MENU_SETTING_ACTION_CORE_LOCK:
BIND_ACTION_START(cbs, action_start_core_lock);
break;
default:
return -1;
}
}
return 0;
}
int menu_cbs_init_bind_start(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx)
{
if (!cbs)
return -1;
#ifdef HAVE_AUDIOMIXER
if (type >= MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_VOLUME_BEGIN
&& type <= MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_VOLUME_END)
{
BIND_ACTION_START(cbs, action_start_audio_mixer_stream_volume);
return 0;
}
#endif
BIND_ACTION_START(cbs, action_start_lookup_setting);
if (menu_cbs_init_bind_start_compare_label(cbs) == 0)
return 0;
if (menu_cbs_init_bind_start_compare_type(cbs, type) == 0)
return 0;
return -1;
}