diff --git a/configuration.c b/configuration.c index 49fb9e79e3..7277d65e23 100644 --- a/configuration.c +++ b/configuration.c @@ -603,6 +603,7 @@ static void config_set_defaults(void) #ifdef HAVE_LAKKA settings->ssh_enable = path_file_exists(LAKKA_SSH_PATH); settings->samba_enable = path_file_exists(LAKKA_SAMBA_PATH); + settings->bluetooth_enable = path_file_exists(LAKKA_BLUETOOTH_PATH); #endif #ifdef HAVE_MENU @@ -1733,6 +1734,7 @@ static bool config_load_file(const char *path, bool set_defaults) #ifdef HAVE_LAKKA settings->ssh_enable = path_file_exists(LAKKA_SSH_PATH); settings->ssh_enable = path_file_exists(LAKKA_SAMBA_PATH); + settings->bluetooth_enable = path_file_exists(LAKKA_BLUETOOTH_PATH); #endif #ifdef HAVE_NETWORK_GAMEPAD @@ -2864,6 +2866,10 @@ bool config_save_file(const char *path) fclose(fopen(LAKKA_SAMBA_PATH, "w")); else remove(LAKKA_SAMBA_PATH); + if (settings->bluetooth_enable) + fclose(fopen(LAKKA_BLUETOOTH_PATH, "w")); + else + remove(LAKKA_BLUETOOTH_PATH); #endif config_set_float(conf, "fastforward_ratio", settings->fastforward_ratio); diff --git a/configuration.h b/configuration.h index 0cb0c44d3c..12d04a490b 100644 --- a/configuration.h +++ b/configuration.h @@ -403,6 +403,7 @@ typedef struct settings #ifdef HAVE_LAKKA bool ssh_enable; bool samba_enable; + bool bluetooth_enable; #endif } settings_t; diff --git a/lakka.h b/lakka.h index ab3fb2b320..e8e6ab50fc 100644 --- a/lakka.h +++ b/lakka.h @@ -19,5 +19,6 @@ #define LAKKA_SSH_PATH "/storage/.cache/services/sshd.conf" #define LAKKA_SAMBA_PATH "/storage/.cache/services/samba.conf" +#define LAKKA_BLUETOOTH_PATH "/storage/.cache/services/bluez.conf" #endif diff --git a/menu/intl/menu_hash_us.c b/menu/intl/menu_hash_us.c index d839a28ac0..22427caf4a 100644 --- a/menu/intl/menu_hash_us.c +++ b/menu/intl/menu_hash_us.c @@ -266,6 +266,8 @@ static const char *menu_hash_to_str_us_label(uint32_t hash) return "ssh_enable"; case MENU_LABEL_SAMBA_ENABLE: return "samba_enable"; + case MENU_LABEL_BLUETOOTH_ENABLE: + return "bluetooth_enable"; case MENU_LABEL_NETPLAY_DELAY_FRAMES: return "netplay_delay_frames"; case MENU_LABEL_NETPLAY_MODE: @@ -1016,6 +1018,8 @@ const char *menu_hash_to_str_us(uint32_t hash) return "SSH Enable"; case MENU_LABEL_VALUE_SAMBA_ENABLE: return "SAMBA Enable"; + case MENU_LABEL_VALUE_BLUETOOTH_ENABLE: + return "Bluetooth Enable"; case MENU_LABEL_VALUE_NETPLAY_DELAY_FRAMES: return "Netplay Delay Frames"; case MENU_LABEL_VALUE_NETPLAY_MODE: diff --git a/menu/menu_hash.h b/menu/menu_hash.h index bfc4dddaa4..bf9ecf3aba 100644 --- a/menu/menu_hash.h +++ b/menu/menu_hash.h @@ -403,6 +403,8 @@ extern "C" { #define MENU_LABEL_VALUE_SSH_ENABLE 0x0430627aU #define MENU_LABEL_SAMBA_ENABLE 0x379e15efU #define MENU_LABEL_VALUE_SAMBA_ENABLE 0x9846d9b0U +#define MENU_LABEL_BLUETOOTH_ENABLE 0xbac1e1e1U +#define MENU_LABEL_VALUE_BLUETOOTH_ENABLE 0xf7e31e22U #define MENU_LABEL_NETPLAY_CLIENT_SWAP_INPUT 0xd87bbba9U #define MENU_LABEL_VALUE_NETPLAY_CLIENT_SWAP_INPUT 0x57e5be2dU #define MENU_LABEL_NETPLAY_DELAY_FRAMES 0x86b2c48dU diff --git a/menu/menu_setting.c b/menu/menu_setting.c index ae994551c8..65754b8832 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -3121,6 +3121,21 @@ static void samba_enable_toggle_change_handler(void *data) return; } +static void bluetooth_enable_toggle_change_handler(void *data) +{ + settings_t *settings = config_get_ptr(); + rarch_setting_t *setting = (rarch_setting_t *)data; + + if (!setting) + return; + + if (settings && settings->bluetooth_enable) + fclose(fopen(LAKKA_BLUETOOTH_PATH, "w")); + else + remove(LAKKA_BLUETOOTH_PATH); + + return; +} #endif enum settings_list_type @@ -6571,6 +6586,21 @@ static bool setting_append_list( general_read_handler); (*list)[list_info->index - 1].change_handler = samba_enable_toggle_change_handler; + CONFIG_BOOL( + list, list_info, + &settings->bluetooth_enable, + menu_hash_to_str(MENU_LABEL_BLUETOOTH_ENABLE), + menu_hash_to_str(MENU_LABEL_VALUE_BLUETOOTH_ENABLE), + true, + menu_hash_to_str(MENU_VALUE_OFF), + menu_hash_to_str(MENU_VALUE_ON), + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].change_handler = bluetooth_enable_toggle_change_handler; + END_SUB_GROUP(list, list_info, parent_group); END_GROUP(list, list_info, parent_group); #endif