{"action":"created","comment":{"url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/comments/33417946","id":33417946,"diff_hunk":"@@ -287,6 +360,122 @@ @interface ConnectBT: NSObject {}\n \t}\n }\n \n+WiimoteDarwinHid::WiimoteDarwinHid(IOHIDDeviceRef device) : m_device(device)\n+{\n+\tCFRetain(m_device);\n+\tm_connected = false;\n+\tm_report_buffer = Report(MAX_PAYLOAD);\n+}\n+\n+WiimoteDarwinHid::~WiimoteDarwinHid()\n+{\n+\tShutdown();\n+\tCFRelease(m_device);\n+}\n+\n+bool WiimoteDarwinHid::ConnectInternal()\n+{\n+\tIOReturn ret = IOHIDDeviceOpen(m_device, kIOHIDOptionsTypeNone);\n+\tm_connected = ret == kIOReturnSuccess;\n+\tif (m_connected)\n+\t{\n+\t\tIOHIDDeviceScheduleWithRunLoop(m_device, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);\n+\t\tIOHIDDeviceRegisterInputReportCallback(m_device,\n+\t\t                                       m_report_buffer.data() + 1,\n+\t\t                                       MAX_PAYLOAD - 1,\n+\t\t                                       &WiimoteDarwinHid::ReportCallback,\n+\t\t\t\t\t\t\t\t\t\t\t   this);\n+\t\tIOHIDDeviceRegisterRemovalCallback(m_device, &WiimoteDarwinHid::RemoveCallback, this);\n+\t\tNOTICE_LOG(WIIMOTE, \"Connected to Wiimote %i\", m_index + 1);\n+\t}\n+\telse\n+\t{\n+\t\tERROR_LOG(WIIMOTE, \"Could not open IOHID Wiimote: %08x\", ret);\n+\t}\n+\n+\treturn m_connected;\n+}\n+\n+void WiimoteDarwinHid::DisconnectInternal()\n+{\n+\tIOHIDDeviceUnscheduleFromRunLoop(m_device, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);\n+\tIOCancel();\n+\tIOReturn ret = IOHIDDeviceClose(m_device, kIOHIDOptionsTypeNone);\n+\tif (ret != kIOReturnSuccess)\n+\t\tERROR_LOG(WIIMOTE, \"Error closing IOHID Wiimote: %08x\", ret);\n+\n+\tif (!IsConnected())\n+\t\treturn;\n+\n+\tNOTICE_LOG(WIIMOTE, \"Disconnecting Wiimote %i\", m_index + 1);\n+\n+\tm_buffered_reports.Clear();\n+\n+\tm_connected = false;\n+}\n+\n+bool WiimoteDarwinHid::IsConnected() const\n+{\n+\treturn m_connected;\n+}\n+\n+void WiimoteDarwinHid::IOWakeup()\n+{\n+}\n+\n+void WiimoteDarwinHid::IOCancel()\n+{\n+\tm_interrupted.store(true);\n+\tCFRunLoopStop(CFRunLoopGetCurrent());\n+}\n+\n+int WiimoteDarwinHid::IORead(u8* buf)\n+{\n+\tReport rpt;\n+\tm_interrupted.store(false);\n+\twhile (m_buffered_reports.Empty() && !m_interrupted.load())\n+\t{","path":"Source/Core/Core/HW/WiimoteReal/IOdarwin.mm","position":276,"original_position":276,"commit_id":"b163ccab824e582d1367eed056da5005da6ce329","original_commit_id":"b163ccab824e582d1367eed056da5005da6ce329","user":{"login":"Sonicadvance1","id":1018829,"avatar_url":"https://avatars.githubusercontent.com/u/1018829?v=3","gravatar_id":"","url":"https://api.github.com/users/Sonicadvance1","html_url":"https://github.com/Sonicadvance1","followers_url":"https://api.github.com/users/Sonicadvance1/followers","following_url":"https://api.github.com/users/Sonicadvance1/following{/other_user}","gists_url":"https://api.github.com/users/Sonicadvance1/gists{/gist_id}","starred_url":"https://api.github.com/users/Sonicadvance1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sonicadvance1/subscriptions","organizations_url":"https://api.github.com/users/Sonicadvance1/orgs","repos_url":"https://api.github.com/users/Sonicadvance1/repos","events_url":"https://api.github.com/users/Sonicadvance1/events{/privacy}","received_events_url":"https://api.github.com/users/Sonicadvance1/received_events","type":"User","site_admin":false},"body":"This while loop doesn't need braces","created_at":"2015-06-28T01:29:28Z","updated_at":"2015-06-28T01:29:28Z","html_url":"https://github.com/dolphin-emu/dolphin/pull/2670#discussion_r33417946","pull_request_url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/2670","_links":{"self":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/comments/33417946"},"html":{"href":"https://github.com/dolphin-emu/dolphin/pull/2670#discussion_r33417946"},"pull_request":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/2670"}}},"pull_request":{"url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/2670","id":38718301,"html_url":"https://github.com/dolphin-emu/dolphin/pull/2670","diff_url":"https://github.com/dolphin-emu/dolphin/pull/2670.diff","patch_url":"https://github.com/dolphin-emu/dolphin/pull/2670.patch","issue_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues/2670","number":2670,"state":"open","locked":false,"title":"WiimoteReal: Add IOHIDDevice support for OS X","user":{"login":"endrift","id":605502,"avatar_url":"https://avatars.githubusercontent.com/u/605502?v=3","gravatar_id":"","url":"https://api.github.com/users/endrift","html_url":"https://github.com/endrift","followers_url":"https://api.github.com/users/endrift/followers","following_url":"https://api.github.com/users/endrift/following{/other_user}","gists_url":"https://api.github.com/users/endrift/gists{/gist_id}","starred_url":"https://api.github.com/users/endrift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/endrift/subscriptions","organizations_url":"https://api.github.com/users/endrift/orgs","repos_url":"https://api.github.com/users/endrift/repos","events_url":"https://api.github.com/users/endrift/events{/privacy}","received_events_url":"https://api.github.com/users/endrift/received_events","type":"User","site_admin":false},"body":"It's a little flaky at the moment, but this adds support for IOHIDDevices as opposed to just IOBluetoothDevices, enabling devices like the DolphinBar to work on OS X.","created_at":"2015-06-28T01:11:55Z","updated_at":"2015-06-28T01:29:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a19708a99c51658d1cbf37abd3e0f9de9f0004d5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/2670/commits","review_comments_url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/2670/comments","review_comment_url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues/2670/comments","statuses_url":"https://api.github.com/repos/dolphin-emu/dolphin/statuses/b163ccab824e582d1367eed056da5005da6ce329","head":{"label":"endrift:dolphinbar-osx","ref":"dolphinbar-osx","sha":"b163ccab824e582d1367eed056da5005da6ce329","user":{"login":"endrift","id":605502,"avatar_url":"https://avatars.githubusercontent.com/u/605502?v=3","gravatar_id":"","url":"https://api.github.com/users/endrift","html_url":"https://github.com/endrift","followers_url":"https://api.github.com/users/endrift/followers","following_url":"https://api.github.com/users/endrift/following{/other_user}","gists_url":"https://api.github.com/users/endrift/gists{/gist_id}","starred_url":"https://api.github.com/users/endrift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/endrift/subscriptions","organizations_url":"https://api.github.com/users/endrift/orgs","repos_url":"https://api.github.com/users/endrift/repos","events_url":"https://api.github.com/users/endrift/events{/privacy}","received_events_url":"https://api.github.com/users/endrift/received_events","type":"User","site_admin":false},"repo":{"id":34565716,"name":"dolphin","full_name":"endrift/dolphin","owner":{"login":"endrift","id":605502,"avatar_url":"https://avatars.githubusercontent.com/u/605502?v=3","gravatar_id":"","url":"https://api.github.com/users/endrift","html_url":"https://github.com/endrift","followers_url":"https://api.github.com/users/endrift/followers","following_url":"https://api.github.com/users/endrift/following{/other_user}","gists_url":"https://api.github.com/users/endrift/gists{/gist_id}","starred_url":"https://api.github.com/users/endrift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/endrift/subscriptions","organizations_url":"https://api.github.com/users/endrift/orgs","repos_url":"https://api.github.com/users/endrift/repos","events_url":"https://api.github.com/users/endrift/events{/privacy}","received_events_url":"https://api.github.com/users/endrift/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/endrift/dolphin","description":"Dolphin is a GameCube / Wii emulator, allowing you to play games for these two platforms on PC with improvements.","fork":true,"url":"https://api.github.com/repos/endrift/dolphin","forks_url":"https://api.github.com/repos/endrift/dolphin/forks","keys_url":"https://api.github.com/repos/endrift/dolphin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/endrift/dolphin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/endrift/dolphin/teams","hooks_url":"https://api.github.com/repos/endrift/dolphin/hooks","issue_events_url":"https://api.github.com/repos/endrift/dolphin/issues/events{/number}","events_url":"https://api.github.com/repos/endrift/dolphin/events","assignees_url":"https://api.github.com/repos/endrift/dolphin/assignees{/user}","branches_url":"https://api.github.com/repos/endrift/dolphin/branches{/branch}","tags_url":"https://api.github.com/repos/endrift/dolphin/tags","blobs_url":"https://api.github.com/repos/endrift/dolphin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/endrift/dolphin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/endrift/dolphin/git/refs{/sha}","trees_url":"https://api.github.com/repos/endrift/dolphin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/endrift/dolphin/statuses/{sha}","languages_url":"https://api.github.com/repos/endrift/dolphin/languages","stargazers_url":"https://api.github.com/repos/endrift/dolphin/stargazers","contributors_url":"https://api.github.com/repos/endrift/dolphin/contributors","subscribers_url":"https://api.github.com/repos/endrift/dolphin/subscribers","subscription_url":"https://api.github.com/repos/endrift/dolphin/subscription","commits_url":"https://api.github.com/repos/endrift/dolphin/commits{/sha}","git_commits_url":"https://api.github.com/repos/endrift/dolphin/git/commits{/sha}","comments_url":"https://api.github.com/repos/endrift/dolphin/comments{/number}","issue_comment_url":"https://api.github.com/repos/endrift/dolphin/issues/comments{/number}","contents_url":"https://api.github.com/repos/endrift/dolphin/contents/{+path}","compare_url":"https://api.github.com/repos/endrift/dolphin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/endrift/dolphin/merges","archive_url":"https://api.github.com/repos/endrift/dolphin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/endrift/dolphin/downloads","issues_url":"https://api.github.com/repos/endrift/dolphin/issues{/number}","pulls_url":"https://api.github.com/repos/endrift/dolphin/pulls{/number}","milestones_url":"https://api.github.com/repos/endrift/dolphin/milestones{/number}","notifications_url":"https://api.github.com/repos/endrift/dolphin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/endrift/dolphin/labels{/name}","releases_url":"https://api.github.com/repos/endrift/dolphin/releases{/id}","created_at":"2015-04-25T11:21:01Z","updated_at":"2015-06-12T16:25:46Z","pushed_at":"2015-06-28T01:10:48Z","git_url":"git://github.com/endrift/dolphin.git","ssh_url":"git@github.com:endrift/dolphin.git","clone_url":"https://github.com/endrift/dolphin.git","svn_url":"https://github.com/endrift/dolphin","homepage":"https://dolphin-emu.org/","size":222546,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"dolphin-emu:master","ref":"master","sha":"a71e81a1435e91e3d807bc5f13b674bc9e6d7ed9","user":{"login":"dolphin-emu","id":5050316,"avatar_url":"https://avatars.githubusercontent.com/u/5050316?v=3","gravatar_id":"","url":"https://api.github.com/users/dolphin-emu","html_url":"https://github.com/dolphin-emu","followers_url":"https://api.github.com/users/dolphin-emu/followers","following_url":"https://api.github.com/users/dolphin-emu/following{/other_user}","gists_url":"https://api.github.com/users/dolphin-emu/gists{/gist_id}","starred_url":"https://api.github.com/users/dolphin-emu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dolphin-emu/subscriptions","organizations_url":"https://api.github.com/users/dolphin-emu/orgs","repos_url":"https://api.github.com/users/dolphin-emu/repos","events_url":"https://api.github.com/users/dolphin-emu/events{/privacy}","received_events_url":"https://api.github.com/users/dolphin-emu/received_events","type":"Organization","site_admin":false},"repo":{"id":11577304,"name":"dolphin","full_name":"dolphin-emu/dolphin","owner":{"login":"dolphin-emu","id":5050316,"avatar_url":"https://avatars.githubusercontent.com/u/5050316?v=3","gravatar_id":"","url":"https://api.github.com/users/dolphin-emu","html_url":"https://github.com/dolphin-emu","followers_url":"https://api.github.com/users/dolphin-emu/followers","following_url":"https://api.github.com/users/dolphin-emu/following{/other_user}","gists_url":"https://api.github.com/users/dolphin-emu/gists{/gist_id}","starred_url":"https://api.github.com/users/dolphin-emu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dolphin-emu/subscriptions","organizations_url":"https://api.github.com/users/dolphin-emu/orgs","repos_url":"https://api.github.com/users/dolphin-emu/repos","events_url":"https://api.github.com/users/dolphin-emu/events{/privacy}","received_events_url":"https://api.github.com/users/dolphin-emu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dolphin-emu/dolphin","description":"Dolphin is a GameCube / Wii emulator, allowing you to play games for these two platforms on PC with improvements.","fork":false,"url":"https://api.github.com/repos/dolphin-emu/dolphin","forks_url":"https://api.github.com/repos/dolphin-emu/dolphin/forks","keys_url":"https://api.github.com/repos/dolphin-emu/dolphin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dolphin-emu/dolphin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dolphin-emu/dolphin/teams","hooks_url":"https://api.github.com/repos/dolphin-emu/dolphin/hooks","issue_events_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues/events{/number}","events_url":"https://api.github.com/repos/dolphin-emu/dolphin/events","assignees_url":"https://api.github.com/repos/dolphin-emu/dolphin/assignees{/user}","branches_url":"https://api.github.com/repos/dolphin-emu/dolphin/branches{/branch}","tags_url":"https://api.github.com/repos/dolphin-emu/dolphin/tags","blobs_url":"https://api.github.com/repos/dolphin-emu/dolphin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dolphin-emu/dolphin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dolphin-emu/dolphin/git/refs{/sha}","trees_url":"https://api.github.com/repos/dolphin-emu/dolphin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dolphin-emu/dolphin/statuses/{sha}","languages_url":"https://api.github.com/repos/dolphin-emu/dolphin/languages","stargazers_url":"https://api.github.com/repos/dolphin-emu/dolphin/stargazers","contributors_url":"https://api.github.com/repos/dolphin-emu/dolphin/contributors","subscribers_url":"https://api.github.com/repos/dolphin-emu/dolphin/subscribers","subscription_url":"https://api.github.com/repos/dolphin-emu/dolphin/subscription","commits_url":"https://api.github.com/repos/dolphin-emu/dolphin/commits{/sha}","git_commits_url":"https://api.github.com/repos/dolphin-emu/dolphin/git/commits{/sha}","comments_url":"https://api.github.com/repos/dolphin-emu/dolphin/comments{/number}","issue_comment_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues/comments{/number}","contents_url":"https://api.github.com/repos/dolphin-emu/dolphin/contents/{+path}","compare_url":"https://api.github.com/repos/dolphin-emu/dolphin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dolphin-emu/dolphin/merges","archive_url":"https://api.github.com/repos/dolphin-emu/dolphin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dolphin-emu/dolphin/downloads","issues_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues{/number}","pulls_url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls{/number}","milestones_url":"https://api.github.com/repos/dolphin-emu/dolphin/milestones{/number}","notifications_url":"https://api.github.com/repos/dolphin-emu/dolphin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dolphin-emu/dolphin/labels{/name}","releases_url":"https://api.github.com/repos/dolphin-emu/dolphin/releases{/id}","created_at":"2013-07-22T09:07:57Z","updated_at":"2015-06-27T16:21:29Z","pushed_at":"2015-06-28T01:11:55Z","git_url":"git://github.com/dolphin-emu/dolphin.git","ssh_url":"git@github.com:dolphin-emu/dolphin.git","clone_url":"https://github.com/dolphin-emu/dolphin.git","svn_url":"https://github.com/dolphin-emu/dolphin","homepage":"https://dolphin-emu.org/","size":296605,"stargazers_count":1453,"watchers_count":1453,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":449,"mirror_url":null,"open_issues_count":55,"forks":449,"open_issues":55,"watchers":1453,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/2670"},"html":{"href":"https://github.com/dolphin-emu/dolphin/pull/2670"},"issue":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/issues/2670"},"comments":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/issues/2670/comments"},"review_comments":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/2670/comments"},"review_comment":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/2670/commits"},"statuses":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/statuses/b163ccab824e582d1367eed056da5005da6ce329"}}}}