|
127 | 127 | #endif |
128 | 128 | #endif |
129 | 129 |
|
| 130 | +#ifdef HAVE_MCP |
| 131 | +#include "../network/mcp/mcp_server.h" |
| 132 | +#endif |
| 133 | + |
130 | 134 | #if defined(HAVE_OVERLAY) |
131 | 135 | #include "../input/input_overlay.h" |
132 | 136 | #endif |
@@ -9606,6 +9610,22 @@ static void timezone_change_handler(rarch_setting_t *setting) |
9606 | 9610 | } |
9607 | 9611 | #endif |
9608 | 9612 |
|
| 9613 | +#ifdef HAVE_MCP |
| 9614 | +static void mcp_setting_change_handler(rarch_setting_t *setting) |
| 9615 | +{ |
| 9616 | + (void)setting; |
| 9617 | + mcp_server_deinit(); |
| 9618 | +} |
| 9619 | + |
| 9620 | +static size_t setting_get_string_representation_mcp_password( |
| 9621 | + rarch_setting_t *setting, char *s, size_t len) |
| 9622 | +{ |
| 9623 | + if (setting && !string_is_empty(setting->value.target.string)) |
| 9624 | + return strlcpy(s, "********", len); |
| 9625 | + return 0; |
| 9626 | +} |
| 9627 | +#endif |
| 9628 | + |
9609 | 9629 | static void appicon_change_handler(rarch_setting_t *setting) |
9610 | 9630 | { |
9611 | 9631 | uico_driver_state_t *uico_st = uico_state_get_ptr(); |
@@ -23911,6 +23931,79 @@ static bool setting_append_list( |
23911 | 23931 | general_write_handler, |
23912 | 23932 | general_read_handler, |
23913 | 23933 | SD_FLAG_ADVANCED); |
| 23934 | + |
| 23935 | +#ifdef HAVE_MCP |
| 23936 | + CONFIG_BOOL( |
| 23937 | + list, list_info, |
| 23938 | + &settings->bools.mcp_server_enable, |
| 23939 | + MENU_ENUM_LABEL_MCP_SERVER_ENABLE, |
| 23940 | + MENU_ENUM_LABEL_VALUE_MCP_SERVER_ENABLE, |
| 23941 | + DEFAULT_MCP_SERVER_ENABLE, |
| 23942 | + MENU_ENUM_LABEL_VALUE_OFF, |
| 23943 | + MENU_ENUM_LABEL_VALUE_ON, |
| 23944 | + &group_info, |
| 23945 | + &subgroup_info, |
| 23946 | + parent_group, |
| 23947 | + general_write_handler, |
| 23948 | + general_read_handler, |
| 23949 | + SD_FLAG_NONE); |
| 23950 | + (*list)[list_info->index - 1].action_ok = &setting_bool_action_left_with_refresh; |
| 23951 | + (*list)[list_info->index - 1].action_left = &setting_bool_action_left_with_refresh; |
| 23952 | + (*list)[list_info->index - 1].action_right = &setting_bool_action_right_with_refresh; |
| 23953 | + |
| 23954 | + CONFIG_STRING( |
| 23955 | + list, list_info, |
| 23956 | + settings->arrays.mcp_server_address, |
| 23957 | + sizeof(settings->arrays.mcp_server_address), |
| 23958 | + MENU_ENUM_LABEL_MCP_SERVER_ADDRESS, |
| 23959 | + MENU_ENUM_LABEL_VALUE_MCP_SERVER_ADDRESS, |
| 23960 | + "", |
| 23961 | + &group_info, |
| 23962 | + &subgroup_info, |
| 23963 | + parent_group, |
| 23964 | + NULL, |
| 23965 | + NULL); |
| 23966 | + SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_ALLOW_INPUT); |
| 23967 | + (*list)[list_info->index - 1].ui_type = ST_UI_TYPE_STRING_LINE_EDIT; |
| 23968 | + (*list)[list_info->index - 1].action_start = setting_generic_action_start_default; |
| 23969 | + (*list)[list_info->index - 1].change_handler = mcp_setting_change_handler; |
| 23970 | + |
| 23971 | + CONFIG_UINT( |
| 23972 | + list, list_info, |
| 23973 | + &settings->uints.mcp_server_port, |
| 23974 | + MENU_ENUM_LABEL_MCP_SERVER_PORT, |
| 23975 | + MENU_ENUM_LABEL_VALUE_MCP_SERVER_PORT, |
| 23976 | + DEFAULT_MCP_SERVER_PORT, |
| 23977 | + &group_info, |
| 23978 | + &subgroup_info, |
| 23979 | + parent_group, |
| 23980 | + NULL, |
| 23981 | + NULL); |
| 23982 | + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; |
| 23983 | + (*list)[list_info->index - 1].offset_by = 1; |
| 23984 | + menu_settings_list_current_add_range(list, list_info, 0, 65535, 1, true, true); |
| 23985 | + SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_ALLOW_INPUT); |
| 23986 | + (*list)[list_info->index - 1].change_handler = mcp_setting_change_handler; |
| 23987 | + |
| 23988 | + CONFIG_STRING( |
| 23989 | + list, list_info, |
| 23990 | + settings->arrays.mcp_server_password, |
| 23991 | + sizeof(settings->arrays.mcp_server_password), |
| 23992 | + MENU_ENUM_LABEL_MCP_SERVER_PASSWORD, |
| 23993 | + MENU_ENUM_LABEL_VALUE_MCP_SERVER_PASSWORD, |
| 23994 | + "", |
| 23995 | + &group_info, |
| 23996 | + &subgroup_info, |
| 23997 | + parent_group, |
| 23998 | + NULL, |
| 23999 | + NULL); |
| 24000 | + (*list)[list_info->index - 1].get_string_representation = |
| 24001 | + &setting_get_string_representation_mcp_password; |
| 24002 | + SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_ALLOW_INPUT); |
| 24003 | + (*list)[list_info->index - 1].ui_type = ST_UI_TYPE_PASSWORD_LINE_EDIT; |
| 24004 | + (*list)[list_info->index - 1].action_start = setting_generic_action_start_default; |
| 24005 | + (*list)[list_info->index - 1].change_handler = mcp_setting_change_handler; |
| 24006 | +#endif |
23914 | 24007 | #endif |
23915 | 24008 | CONFIG_BOOL( |
23916 | 24009 | list, list_info, |
|
0 commit comments