(Menu) Lakka Services : Bluetooth

This commit is contained in:
Jean-André Santoni 2016-03-23 20:06:53 +07:00
parent b82976b206
commit 288c2c3996
6 changed files with 44 additions and 0 deletions

View File

@ -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);

View File

@ -403,6 +403,7 @@ typedef struct settings
#ifdef HAVE_LAKKA
bool ssh_enable;
bool samba_enable;
bool bluetooth_enable;
#endif
} settings_t;

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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