Skip to content

Commit 6b5cf43

Browse files
libretroadminLibretroAdmin
authored andcommitted
menu_setting: move the MIDI device selectors into descriptor rows
The MIDI input and output pickers were built by hand with their four device-cycling handlers - start, left, right, ok - poked on after construction. They are S_STRING rows now, those handlers riding in the slots the grammar already provides; the builder body drops the two CONFIG_STRING blocks for one ADD_DESC under the same non-console guard. Settings dump byte-identical, so both defaults, the empty flag word and all four handlers reproduced exactly; referee reads two more settings index-faithful, two fewer hand built. Net 23 lines from the builder plus a 21-line def file. Second of the fully-movable hand-CONFIG builders to cross. Noted in passing: core_updater looked movable by raw handler shape but is not - its buildbot URLs sit inside an Android play-feature runtime guard and its backup uint is interleaved with a computed offset_by range, so it needs interleaving and runtime-condition grammar the rows do not have yet, and stays coded.
1 parent 8f61b61 commit 6b5cf43

2 files changed

Lines changed: 31 additions & 34 deletions

File tree

menu/menu_setting.c

Lines changed: 11 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12560,6 +12560,13 @@ static const setting_desc_t privacy_desc_2[] = {
1256012560
};
1256112561

1256212562
#if !defined(RARCH_CONSOLE)
12563+
#if !defined(RARCH_CONSOLE)
12564+
static const setting_desc_t midi_devices_desc_0[] = {
12565+
/* GENERATED: rows come from settings_def_midi_devices.h in order. */
12566+
#include "../settings/settings_def_midi_devices.h"
12567+
};
12568+
#endif
12569+
1256312570
static const setting_desc_t midi_desc_0[] = {
1256412571
/* GENERATED: rows come from settings_def_midi_volume.h in order. */
1256512572
#include "../settings/settings_def_midi_volume.h"
@@ -17026,40 +17033,7 @@ static void settings_build_midi(
1702617033
&group_info, &subgroup_info, parent_group);
1702717034

1702817035
#if !defined(RARCH_CONSOLE)
17029-
/* Descriptor holdout: poke tail outside the descriptor grammar. */
17030-
CONFIG_STRING(
17031-
list, list_info,
17032-
settings->arrays.midi_input,
17033-
sizeof(settings->arrays.midi_input),
17034-
MENU_ENUM_LABEL_MIDI_INPUT,
17035-
MENU_ENUM_LABEL_VALUE_MIDI_INPUT,
17036-
DEFAULT_MIDI_INPUT,
17037-
&group_info,
17038-
&subgroup_info,
17039-
parent_group,
17040-
general_write_handler,
17041-
general_read_handler);
17042-
SETTINGS_ACTION_SET(start, &(*list)[list_info->index - 1], setting_string_action_start_midi_device)
17043-
SETTINGS_ACTION_SET(left, &(*list)[list_info->index - 1], setting_string_action_left_midi_input)
17044-
SETTINGS_ACTION_SET(right, &(*list)[list_info->index - 1], setting_string_action_right_midi_input)
17045-
SETTINGS_ACTION_SET(ok, &(*list)[list_info->index - 1], setting_string_action_ok_midi_device)
17046-
17047-
CONFIG_STRING(
17048-
list, list_info,
17049-
settings->arrays.midi_output,
17050-
sizeof(settings->arrays.midi_output),
17051-
MENU_ENUM_LABEL_MIDI_OUTPUT,
17052-
MENU_ENUM_LABEL_VALUE_MIDI_OUTPUT,
17053-
DEFAULT_MIDI_OUTPUT,
17054-
&group_info,
17055-
&subgroup_info,
17056-
parent_group,
17057-
general_write_handler,
17058-
general_read_handler);
17059-
SETTINGS_ACTION_SET(start, &(*list)[list_info->index - 1], setting_string_action_start_midi_device)
17060-
SETTINGS_ACTION_SET(left, &(*list)[list_info->index - 1], setting_string_action_left_midi_output)
17061-
SETTINGS_ACTION_SET(right, &(*list)[list_info->index - 1], setting_string_action_right_midi_output)
17062-
SETTINGS_ACTION_SET(ok, &(*list)[list_info->index - 1], setting_string_action_ok_midi_device)
17036+
ADD_DESC(midi_devices_desc_0);
1706317037

1706417038
ADD_DESC(midi_desc_0);
1706517039
#endif
@@ -18160,6 +18134,9 @@ static const settings_desc_table_t settings_desc_registry[] = {
1816018134
#endif
1816118135
{ privacy_desc_2, (uint16_t)ARRAY_SIZE(privacy_desc_2) },
1816218136
#if !defined(RARCH_CONSOLE)
18137+
#if !defined(RARCH_CONSOLE)
18138+
{ midi_devices_desc_0, (uint16_t)ARRAY_SIZE(midi_devices_desc_0) },
18139+
#endif
1816318140
{ midi_desc_0, (uint16_t)ARRAY_SIZE(midi_desc_0) },
1816418141
#endif
1816518142
#ifdef HAVE_MIST
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* Single-source definitions: MIDI input/output device selectors.
2+
* Grammar identical to settings_def_video_sync.h plus S_FLOAT and
3+
* the _NS no-sublabel variants; the descriptor argument span
4+
* matches SDESC_<kind>_ROW; row order is menu display order;
5+
* h2json.py parses these rows for the Crowdin source upload. */
6+
7+
#if !defined(RARCH_CONSOLE)
8+
/* Device pickers: start/left/right/ok cycle the enumerated MIDI
9+
* devices, so those four handlers ride in the row. */
10+
S_STRING(midi_input, MIDI_INPUT,
11+
"midi_input",
12+
DEFAULT_MIDI_INPUT, SD_FLAG_NONE, 0, setting_string_action_ok_midi_device, NULL, setting_string_action_start_midi_device, NULL, setting_string_action_left_midi_input, setting_string_action_right_midi_input, 0,
13+
"Input",
14+
"Select input device.")
15+
S_STRING(midi_output, MIDI_OUTPUT,
16+
"midi_output",
17+
DEFAULT_MIDI_OUTPUT, SD_FLAG_NONE, 0, setting_string_action_ok_midi_device, NULL, setting_string_action_start_midi_device, NULL, setting_string_action_left_midi_output, setting_string_action_right_midi_output, 0,
18+
"Output",
19+
"Select output device.")
20+
#endif

0 commit comments

Comments
 (0)