{"action":"created","comment":{"url":"https://api.github.com/repos/citra-emu/citra/pulls/comments/54827043","id":54827043,"diff_hunk":"@@ -245,20 +241,79 @@ static void ReadPipeIfPossible(Service::Interface* self) {\n     u32 size = cmd_buff[3] & 0xFFFF;// Lower 16 bits are size\n     VAddr addr = cmd_buff[0x41];\n \n-    if (!Memory::GetPointer(addr)) {\n-        LOG_ERROR(Service_DSP, \"Invalid addr: pipe=0x%08X, unk2=0x%08X, size=0x%X, buffer=0x%08X\", pipe, unk2, size, addr);\n-        cmd_buff[1] = -1; // TODO\n-        return;\n+    ASSERT_MSG(Memory::GetPointer(addr), \"Invalid addr: pipe=0x%08X, unk2=0x%08X, size=0x%X, buffer=0x%08X\", pipe, unk2, size, addr);\n+\n+    if (DSP::HLE::GetPipeReadableSize(pipe) >= size) {\n+        std::vector<u8> response = DSP::HLE::PipeRead(pipe, size);\n+\n+        Memory::WriteBlock(addr, response.data(), response.size());\n+\n+        cmd_buff[1] = RESULT_SUCCESS.raw; // No error\n+        cmd_buff[2] = static_cast<u32>(response.size());\n+    } else {\n+        cmd_buff[1] = RESULT_SUCCESS.raw; // No error\n+        cmd_buff[2] = 0; // Return no data\n     }\n \n-    std::vector<u8> response = DSP::HLE::PipeRead(pipe, size);\n+    LOG_DEBUG(Service_DSP, \"pipe=0x%08X, unk2=0x%08X, size=0x%X, buffer=0x%08X, return cmd_buff[2]=0x%08X\", pipe, unk2, size, addr, cmd_buff[2]);\n+}\n \n-    Memory::WriteBlock(addr, response.data(), response.size());\n+/**\n+ * DSP_DSP::ReadPipe service function\n+ *  Inputs:\n+ *      1 : Pipe Number\n+ *      2 : Unknown\n+ *      3 : Size in bytes of read (observed only lower half word used)\n+ *      0x41 : Virtual address to read from DSP pipe to in memory","path":"src/core/hle/service/dsp_dsp.cpp","position":112,"original_position":112,"commit_id":"277d20dc47c812b94145b9cc4cb0c61ac7e55425","original_commit_id":"277d20dc47c812b94145b9cc4cb0c61ac7e55425","user":{"login":"bunnei","id":6956688,"avatar_url":"https://avatars.githubusercontent.com/u/6956688?v=3","gravatar_id":"","url":"https://api.github.com/users/bunnei","html_url":"https://github.com/bunnei","followers_url":"https://api.github.com/users/bunnei/followers","following_url":"https://api.github.com/users/bunnei/following{/other_user}","gists_url":"https://api.github.com/users/bunnei/gists{/gist_id}","starred_url":"https://api.github.com/users/bunnei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bunnei/subscriptions","organizations_url":"https://api.github.com/users/bunnei/orgs","repos_url":"https://api.github.com/users/bunnei/repos","events_url":"https://api.github.com/users/bunnei/events{/privacy}","received_events_url":"https://api.github.com/users/bunnei/received_events","type":"User","site_admin":false},"body":"*Virtual address to read from DSP pipe in memory","created_at":"2016-03-03T02:12:00Z","updated_at":"2016-03-03T02:12:00Z","html_url":"https://github.com/citra-emu/citra/pull/1441#discussion_r54827043","pull_request_url":"https://api.github.com/repos/citra-emu/citra/pulls/1441","_links":{"self":{"href":"https://api.github.com/repos/citra-emu/citra/pulls/comments/54827043"},"html":{"href":"https://github.com/citra-emu/citra/pull/1441#discussion_r54827043"},"pull_request":{"href":"https://api.github.com/repos/citra-emu/citra/pulls/1441"}}},"pull_request":{"url":"https://api.github.com/repos/citra-emu/citra/pulls/1441","id":61471958,"html_url":"https://github.com/citra-emu/citra/pull/1441","diff_url":"https://github.com/citra-emu/citra/pull/1441.diff","patch_url":"https://github.com/citra-emu/citra/pull/1441.patch","issue_url":"https://api.github.com/repos/citra-emu/citra/issues/1441","number":1441,"state":"open","locked":false,"title":"AudioCore: Implement Pipe 2","user":{"login":"MerryMage","id":8682882,"avatar_url":"https://avatars.githubusercontent.com/u/8682882?v=3","gravatar_id":"","url":"https://api.github.com/users/MerryMage","html_url":"https://github.com/MerryMage","followers_url":"https://api.github.com/users/MerryMage/followers","following_url":"https://api.github.com/users/MerryMage/following{/other_user}","gists_url":"https://api.github.com/users/MerryMage/gists{/gist_id}","starred_url":"https://api.github.com/users/MerryMage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MerryMage/subscriptions","organizations_url":"https://api.github.com/users/MerryMage/orgs","repos_url":"https://api.github.com/users/MerryMage/repos","events_url":"https://api.github.com/users/MerryMage/events{/privacy}","received_events_url":"https://api.github.com/users/MerryMage/received_events","type":"User","site_admin":false},"body":"Pipe 2 is a DSP pipe that is used to initialize both the DSP hardware (the application signals to the DSP to initialize) and the application (the DSP provides the memory location of structures in the shared memory region).\r\n\r\nThis PR implements that pipe, in addition to several service functions in the dsp::DSP service.","created_at":"2016-03-02T21:42:44Z","updated_at":"2016-03-03T02:12:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"32e8acbdcd5553d2d34735b674b239e8ff0982ab","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/citra-emu/citra/pulls/1441/commits","review_comments_url":"https://api.github.com/repos/citra-emu/citra/pulls/1441/comments","review_comment_url":"https://api.github.com/repos/citra-emu/citra/pulls/comments{/number}","comments_url":"https://api.github.com/repos/citra-emu/citra/issues/1441/comments","statuses_url":"https://api.github.com/repos/citra-emu/citra/statuses/277d20dc47c812b94145b9cc4cb0c61ac7e55425","head":{"label":"MerryMage:dsp-pipes","ref":"dsp-pipes","sha":"277d20dc47c812b94145b9cc4cb0c61ac7e55425","user":{"login":"MerryMage","id":8682882,"avatar_url":"https://avatars.githubusercontent.com/u/8682882?v=3","gravatar_id":"","url":"https://api.github.com/users/MerryMage","html_url":"https://github.com/MerryMage","followers_url":"https://api.github.com/users/MerryMage/followers","following_url":"https://api.github.com/users/MerryMage/following{/other_user}","gists_url":"https://api.github.com/users/MerryMage/gists{/gist_id}","starred_url":"https://api.github.com/users/MerryMage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MerryMage/subscriptions","organizations_url":"https://api.github.com/users/MerryMage/orgs","repos_url":"https://api.github.com/users/MerryMage/repos","events_url":"https://api.github.com/users/MerryMage/events{/privacy}","received_events_url":"https://api.github.com/users/MerryMage/received_events","type":"User","site_admin":false},"repo":{"id":49902315,"name":"citra","full_name":"MerryMage/citra","owner":{"login":"MerryMage","id":8682882,"avatar_url":"https://avatars.githubusercontent.com/u/8682882?v=3","gravatar_id":"","url":"https://api.github.com/users/MerryMage","html_url":"https://github.com/MerryMage","followers_url":"https://api.github.com/users/MerryMage/followers","following_url":"https://api.github.com/users/MerryMage/following{/other_user}","gists_url":"https://api.github.com/users/MerryMage/gists{/gist_id}","starred_url":"https://api.github.com/users/MerryMage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MerryMage/subscriptions","organizations_url":"https://api.github.com/users/MerryMage/orgs","repos_url":"https://api.github.com/users/MerryMage/repos","events_url":"https://api.github.com/users/MerryMage/events{/privacy}","received_events_url":"https://api.github.com/users/MerryMage/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MerryMage/citra","description":"Nintendo 3DS emulator/debugger","fork":true,"url":"https://api.github.com/repos/MerryMage/citra","forks_url":"https://api.github.com/repos/MerryMage/citra/forks","keys_url":"https://api.github.com/repos/MerryMage/citra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MerryMage/citra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MerryMage/citra/teams","hooks_url":"https://api.github.com/repos/MerryMage/citra/hooks","issue_events_url":"https://api.github.com/repos/MerryMage/citra/issues/events{/number}","events_url":"https://api.github.com/repos/MerryMage/citra/events","assignees_url":"https://api.github.com/repos/MerryMage/citra/assignees{/user}","branches_url":"https://api.github.com/repos/MerryMage/citra/branches{/branch}","tags_url":"https://api.github.com/repos/MerryMage/citra/tags","blobs_url":"https://api.github.com/repos/MerryMage/citra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MerryMage/citra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MerryMage/citra/git/refs{/sha}","trees_url":"https://api.github.com/repos/MerryMage/citra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MerryMage/citra/statuses/{sha}","languages_url":"https://api.github.com/repos/MerryMage/citra/languages","stargazers_url":"https://api.github.com/repos/MerryMage/citra/stargazers","contributors_url":"https://api.github.com/repos/MerryMage/citra/contributors","subscribers_url":"https://api.github.com/repos/MerryMage/citra/subscribers","subscription_url":"https://api.github.com/repos/MerryMage/citra/subscription","commits_url":"https://api.github.com/repos/MerryMage/citra/commits{/sha}","git_commits_url":"https://api.github.com/repos/MerryMage/citra/git/commits{/sha}","comments_url":"https://api.github.com/repos/MerryMage/citra/comments{/number}","issue_comment_url":"https://api.github.com/repos/MerryMage/citra/issues/comments{/number}","contents_url":"https://api.github.com/repos/MerryMage/citra/contents/{+path}","compare_url":"https://api.github.com/repos/MerryMage/citra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MerryMage/citra/merges","archive_url":"https://api.github.com/repos/MerryMage/citra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MerryMage/citra/downloads","issues_url":"https://api.github.com/repos/MerryMage/citra/issues{/number}","pulls_url":"https://api.github.com/repos/MerryMage/citra/pulls{/number}","milestones_url":"https://api.github.com/repos/MerryMage/citra/milestones{/number}","notifications_url":"https://api.github.com/repos/MerryMage/citra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MerryMage/citra/labels{/name}","releases_url":"https://api.github.com/repos/MerryMage/citra/releases{/id}","deployments_url":"https://api.github.com/repos/MerryMage/citra/deployments","created_at":"2016-01-18T20:13:00Z","updated_at":"2016-01-26T06:34:03Z","pushed_at":"2016-03-03T01:43:16Z","git_url":"git://github.com/MerryMage/citra.git","ssh_url":"git@github.com:MerryMage/citra.git","clone_url":"https://github.com/MerryMage/citra.git","svn_url":"https://github.com/MerryMage/citra","homepage":null,"size":11675,"stargazers_count":3,"watchers_count":3,"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":3,"default_branch":"audio-core"}},"base":{"label":"citra-emu:master","ref":"master","sha":"699b2a6571849bddda4fee3eb31f2f7b7e83a882","user":{"login":"citra-emu","id":7605670,"avatar_url":"https://avatars.githubusercontent.com/u/7605670?v=3","gravatar_id":"","url":"https://api.github.com/users/citra-emu","html_url":"https://github.com/citra-emu","followers_url":"https://api.github.com/users/citra-emu/followers","following_url":"https://api.github.com/users/citra-emu/following{/other_user}","gists_url":"https://api.github.com/users/citra-emu/gists{/gist_id}","starred_url":"https://api.github.com/users/citra-emu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/citra-emu/subscriptions","organizations_url":"https://api.github.com/users/citra-emu/orgs","repos_url":"https://api.github.com/users/citra-emu/repos","events_url":"https://api.github.com/users/citra-emu/events{/privacy}","received_events_url":"https://api.github.com/users/citra-emu/received_events","type":"Organization","site_admin":false},"repo":{"id":19866730,"name":"citra","full_name":"citra-emu/citra","owner":{"login":"citra-emu","id":7605670,"avatar_url":"https://avatars.githubusercontent.com/u/7605670?v=3","gravatar_id":"","url":"https://api.github.com/users/citra-emu","html_url":"https://github.com/citra-emu","followers_url":"https://api.github.com/users/citra-emu/followers","following_url":"https://api.github.com/users/citra-emu/following{/other_user}","gists_url":"https://api.github.com/users/citra-emu/gists{/gist_id}","starred_url":"https://api.github.com/users/citra-emu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/citra-emu/subscriptions","organizations_url":"https://api.github.com/users/citra-emu/orgs","repos_url":"https://api.github.com/users/citra-emu/repos","events_url":"https://api.github.com/users/citra-emu/events{/privacy}","received_events_url":"https://api.github.com/users/citra-emu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/citra-emu/citra","description":"Nintendo 3DS Emulator","fork":false,"url":"https://api.github.com/repos/citra-emu/citra","forks_url":"https://api.github.com/repos/citra-emu/citra/forks","keys_url":"https://api.github.com/repos/citra-emu/citra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/citra-emu/citra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/citra-emu/citra/teams","hooks_url":"https://api.github.com/repos/citra-emu/citra/hooks","issue_events_url":"https://api.github.com/repos/citra-emu/citra/issues/events{/number}","events_url":"https://api.github.com/repos/citra-emu/citra/events","assignees_url":"https://api.github.com/repos/citra-emu/citra/assignees{/user}","branches_url":"https://api.github.com/repos/citra-emu/citra/branches{/branch}","tags_url":"https://api.github.com/repos/citra-emu/citra/tags","blobs_url":"https://api.github.com/repos/citra-emu/citra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/citra-emu/citra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/citra-emu/citra/git/refs{/sha}","trees_url":"https://api.github.com/repos/citra-emu/citra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/citra-emu/citra/statuses/{sha}","languages_url":"https://api.github.com/repos/citra-emu/citra/languages","stargazers_url":"https://api.github.com/repos/citra-emu/citra/stargazers","contributors_url":"https://api.github.com/repos/citra-emu/citra/contributors","subscribers_url":"https://api.github.com/repos/citra-emu/citra/subscribers","subscription_url":"https://api.github.com/repos/citra-emu/citra/subscription","commits_url":"https://api.github.com/repos/citra-emu/citra/commits{/sha}","git_commits_url":"https://api.github.com/repos/citra-emu/citra/git/commits{/sha}","comments_url":"https://api.github.com/repos/citra-emu/citra/comments{/number}","issue_comment_url":"https://api.github.com/repos/citra-emu/citra/issues/comments{/number}","contents_url":"https://api.github.com/repos/citra-emu/citra/contents/{+path}","compare_url":"https://api.github.com/repos/citra-emu/citra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/citra-emu/citra/merges","archive_url":"https://api.github.com/repos/citra-emu/citra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/citra-emu/citra/downloads","issues_url":"https://api.github.com/repos/citra-emu/citra/issues{/number}","pulls_url":"https://api.github.com/repos/citra-emu/citra/pulls{/number}","milestones_url":"https://api.github.com/repos/citra-emu/citra/milestones{/number}","notifications_url":"https://api.github.com/repos/citra-emu/citra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/citra-emu/citra/labels{/name}","releases_url":"https://api.github.com/repos/citra-emu/citra/releases{/id}","deployments_url":"https://api.github.com/repos/citra-emu/citra/deployments","created_at":"2014-05-16T18:33:15Z","updated_at":"2016-03-02T21:33:03Z","pushed_at":"2016-03-03T01:43:16Z","git_url":"git://github.com/citra-emu/citra.git","ssh_url":"git@github.com:citra-emu/citra.git","clone_url":"https://github.com/citra-emu/citra.git","svn_url":"https://github.com/citra-emu/citra","homepage":"https://citra-emu.org","size":18602,"stargazers_count":1563,"watchers_count":1563,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":368,"mirror_url":null,"open_issues_count":153,"forks":368,"open_issues":153,"watchers":1563,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/citra-emu/citra/pulls/1441"},"html":{"href":"https://github.com/citra-emu/citra/pull/1441"},"issue":{"href":"https://api.github.com/repos/citra-emu/citra/issues/1441"},"comments":{"href":"https://api.github.com/repos/citra-emu/citra/issues/1441/comments"},"review_comments":{"href":"https://api.github.com/repos/citra-emu/citra/pulls/1441/comments"},"review_comment":{"href":"https://api.github.com/repos/citra-emu/citra/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/citra-emu/citra/pulls/1441/commits"},"statuses":{"href":"https://api.github.com/repos/citra-emu/citra/statuses/277d20dc47c812b94145b9cc4cb0c61ac7e55425"}}}}