mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
(iOS) btdynamic.c cleanups
This commit is contained in:
parent
f58feb6b16
commit
2fc3510af8
@ -70,6 +70,8 @@ static CFRunLoopSourceRef btstack_quit_source;
|
|||||||
|
|
||||||
bool btstack_try_load(void)
|
bool btstack_try_load(void)
|
||||||
{
|
{
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
assert(sizeof(void**) == sizeof(void(*)()));
|
assert(sizeof(void**) == sizeof(void(*)()));
|
||||||
|
|
||||||
if (btstack_tested)
|
if (btstack_tested)
|
||||||
@ -78,7 +80,7 @@ bool btstack_try_load(void)
|
|||||||
btstack_tested = true;
|
btstack_tested = true;
|
||||||
btstack_loaded = false;
|
btstack_loaded = false;
|
||||||
|
|
||||||
void* btstack = dlopen("/usr/lib/libBTstack.dylib", RTLD_LAZY);
|
void *btstack = dlopen("/usr/lib/libBTstack.dylib", RTLD_LAZY);
|
||||||
|
|
||||||
if (!btstack)
|
if (!btstack)
|
||||||
{
|
{
|
||||||
@ -86,7 +88,7 @@ bool btstack_try_load(void)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; grabbers[i].name; i ++)
|
for (i = 0; grabbers[i].name; i ++)
|
||||||
{
|
{
|
||||||
*grabbers[i].target = dlsym(btstack, grabbers[i].name);
|
*grabbers[i].target = dlsym(btstack, grabbers[i].name);
|
||||||
|
|
||||||
@ -116,11 +118,11 @@ void btstack_thread_stop(void *data)
|
|||||||
|
|
||||||
static void btstack_thread_func(void* data)
|
static void btstack_thread_func(void* data)
|
||||||
{
|
{
|
||||||
RARCH_LOG("BTstack: Thread started");
|
RARCH_LOG("[BTstack]: Thread started");
|
||||||
|
|
||||||
if (bt_open_ptr())
|
if (bt_open_ptr())
|
||||||
{
|
{
|
||||||
RARCH_LOG("BTstack: bt_open() failed\n");
|
RARCH_LOG("[BTstack]: bt_open() failed\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,13 +130,13 @@ static void btstack_thread_func(void* data)
|
|||||||
btstack_quit_source = CFRunLoopSourceCreate(0, 0, &ctx);
|
btstack_quit_source = CFRunLoopSourceCreate(0, 0, &ctx);
|
||||||
CFRunLoopAddSource(CFRunLoopGetCurrent(), btstack_quit_source, kCFRunLoopCommonModes);
|
CFRunLoopAddSource(CFRunLoopGetCurrent(), btstack_quit_source, kCFRunLoopCommonModes);
|
||||||
|
|
||||||
RARCH_LOG("BTstack: Turning on\n");
|
RARCH_LOG("[BTstack]: Turning on...\n");
|
||||||
bt_send_cmd_ptr(btstack_set_power_mode_ptr, HCI_POWER_ON);
|
bt_send_cmd_ptr(btstack_set_power_mode_ptr, HCI_POWER_ON);
|
||||||
|
|
||||||
RARCH_LOG("BTstack: Running\n");
|
RARCH_LOG("BTstack: Thread running...\n");
|
||||||
CFRunLoopRun();
|
CFRunLoopRun();
|
||||||
|
|
||||||
RARCH_LOG("BTstack: Done\n");
|
RARCH_LOG("[BTstack]: Thread done.\n");
|
||||||
|
|
||||||
CFRunLoopSourceInvalidate(btstack_quit_source);
|
CFRunLoopSourceInvalidate(btstack_quit_source);
|
||||||
CFRelease(btstack_quit_source);
|
CFRelease(btstack_quit_source);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user