diff --git a/bluetooth/drivers/windows_bt.c b/bluetooth/drivers/windows_bt.c index dc3a56264a..a431d10a98 100644 --- a/bluetooth/drivers/windows_bt.c +++ b/bluetooth/drivers/windows_bt.c @@ -50,6 +50,8 @@ #include #include "../bluetooth_driver.h" +#include "../../msg_hash.h" +#include "../../runloop.h" #include "../../verbosity.h" #define WINBT_MAX_DEVICES 32 @@ -317,6 +319,17 @@ static void winbt_scan_thread(void *data) winbt_unref(bt); } +/* on screen, from the pairing's thread: the queue takes it across */ +static void winbt_notify(enum msg_hash_enums id, const char *name) +{ + char msg[256]; + size_t len = (size_t)snprintf(msg, sizeof(msg), msg_hash_to_str(id), name); + if (len >= sizeof(msg)) + len = sizeof(msg) - 1; + runloop_msg_queue_push(msg, len, 1, 180, true, NULL, + MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); +} + static void winbt_action_thread(void *data) { winbt_t *bt = (winbt_t*)data; @@ -351,6 +364,7 @@ static void winbt_action_thread(void *data) sizeof(name), NULL, NULL); name[sizeof(name) - 1] = '\0'; } + winbt_notify(MSG_BLUETOOTH_PAIRING, name); if (winbt_is_wii(d)) { BLUETOOTH_RADIO_INFO info; @@ -376,10 +390,17 @@ static void winbt_action_thread(void *data) err = bt->service(radio, d, &winbt_hid_service, BLUETOOTH_SERVICE_ENABLE); if (err == ERROR_SUCCESS) + { RARCH_LOG("[Bluetooth] \"%s\" paired.\n", name); + winbt_notify(MSG_BLUETOOTH_PAIRED, name); + } else + { RARCH_WARN("[Bluetooth] \"%s\" could not be paired (error %lu).\n", name, (unsigned long)err); + winbt_notify(winbt_is_wii(d) ? MSG_BLUETOOTH_PAIRING_FAILED_WII + : MSG_BLUETOOTH_PAIRING_FAILED, name); + } } CloseHandle(radio); retro_atomic_store_release_int(&bt->action_busy, 0); diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 72eef2f300..1b3248e01e 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -33348,6 +33348,22 @@ MSG_HASH( MSG_BLUETOOTH_ADAPTER_GENERIC_DRIVER, "This computer's Bluetooth adapter runs on Windows' generic driver, which often finds no devices. Install the Bluetooth driver from the computer's or motherboard's maker." ) +MSG_HASH( + MSG_BLUETOOTH_PAIRING, + "Pairing \"%s\"..." + ) +MSG_HASH( + MSG_BLUETOOTH_PAIRED, + "\"%s\" paired." + ) +MSG_HASH( + MSG_BLUETOOTH_PAIRING_FAILED, + "\"%s\" could not be paired." + ) +MSG_HASH( + MSG_BLUETOOTH_PAIRING_FAILED_WII, + "\"%s\" could not be paired. Press its sync button, then select it again while its lights blink." + ) MSG_HASH( MSG_BLUETOOTH_PAIRING_REMOVED, "Pairing removed. Restart RetroArch to connect/pair again." diff --git a/msg_hash.h b/msg_hash.h index a601fbab3a..c6342205c1 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -585,6 +585,10 @@ enum msg_hash_enums MSG_BLUETOOTH_PAIRING_REMOVED, MSG_BLUETOOTH_SCAN_COMPLETE, MSG_BLUETOOTH_ADAPTER_GENERIC_DRIVER, + MSG_BLUETOOTH_PAIRING, + MSG_BLUETOOTH_PAIRED, + MSG_BLUETOOTH_PAIRING_FAILED, + MSG_BLUETOOTH_PAIRING_FAILED_WII, MSG_WIFI_SCAN_COMPLETE, MSG_WIFI_CONNECTING_TO, MSG_WIFI_EMPTY_SSID,