mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-07 08:36:02 -10:00
Bluetooth (Windows): show a pairing's progress on screen
Selecting a device showed nothing: whether it paired went only to the log. A pairing now says on screen when it starts and whether it worked, and a Wii controller that could not be paired gets a reminder to press its sync button and select it again while its lights blink.
This commit is contained in:
1 parent
f448ad267d
commit
2ec3607c97
3 files changed
+41
No files matched your search
@@ -50,6 +50,8 @@
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#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);
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user