{"action":"created","comment":{"url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/comments/48463929","id":48463929,"diff_hunk":"@@ -50,6 +51,8 @@ enum {\n \tF_ARAMDUMP_IDX,\n \tF_FAKEVMEMDUMP_IDX,\n \tF_GCSRAM_IDX,\n+\tF_MWCONFIG_IDX,\n+\tF_MWSOCK_IDX,","path":"Source/Core/Common/FileUtil.h","position":13,"original_position":13,"commit_id":"cefbe79e0e48a0d0fddce548f6bc0a16a3033f73","original_commit_id":"cefbe79e0e48a0d0fddce548f6bc0a16a3033f73","user":{"login":"lioncash","id":712067,"avatar_url":"https://avatars.githubusercontent.com/u/712067?v=3","gravatar_id":"","url":"https://api.github.com/users/lioncash","html_url":"https://github.com/lioncash","followers_url":"https://api.github.com/users/lioncash/followers","following_url":"https://api.github.com/users/lioncash/following{/other_user}","gists_url":"https://api.github.com/users/lioncash/gists{/gist_id}","starred_url":"https://api.github.com/users/lioncash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lioncash/subscriptions","organizations_url":"https://api.github.com/users/lioncash/orgs","repos_url":"https://api.github.com/users/lioncash/repos","events_url":"https://api.github.com/users/lioncash/events{/privacy}","received_events_url":"https://api.github.com/users/lioncash/received_events","type":"User","site_admin":false},"body":"MW/MEMWATCHER → MEMORYWATCHER","created_at":"2015-12-28T05:52:12Z","updated_at":"2015-12-28T05:52:12Z","html_url":"https://github.com/dolphin-emu/dolphin/pull/3403#discussion_r48463929","pull_request_url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/3403","_links":{"self":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/comments/48463929"},"html":{"href":"https://github.com/dolphin-emu/dolphin/pull/3403#discussion_r48463929"},"pull_request":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/3403"}}},"pull_request":{"url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/3403","id":54631728,"html_url":"https://github.com/dolphin-emu/dolphin/pull/3403","diff_url":"https://github.com/dolphin-emu/dolphin/pull/3403.diff","patch_url":"https://github.com/dolphin-emu/dolphin/pull/3403.patch","issue_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues/3403","number":3403,"state":"open","locked":false,"title":"Add support for sending game memory changes to outside processes","user":{"login":"spxtr","id":7368979,"avatar_url":"https://avatars.githubusercontent.com/u/7368979?v=3","gravatar_id":"","url":"https://api.github.com/users/spxtr","html_url":"https://github.com/spxtr","followers_url":"https://api.github.com/users/spxtr/followers","following_url":"https://api.github.com/users/spxtr/following{/other_user}","gists_url":"https://api.github.com/users/spxtr/gists{/gist_id}","starred_url":"https://api.github.com/users/spxtr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spxtr/subscriptions","organizations_url":"https://api.github.com/users/spxtr/orgs","repos_url":"https://api.github.com/users/spxtr/repos","events_url":"https://api.github.com/users/spxtr/events{/privacy}","received_events_url":"https://api.github.com/users/spxtr/received_events","type":"User","site_admin":false},"body":"I previously added support for sending controller inputs from another process to Dolphin, and here I add support for sending game memory pieces to other processes. Currently only supported on Unix, but porting to Windows isn't too big of a deal, although Windows uses named pipes for this. Use it like this:\r\n\r\nCreate a folder in the user directory called `MemWatcher`, and a file in it called `Locations.txt`. To that file, write out the memory locations that you want to watch. If this file isn't found or is empty, the polling thread won't be started. For SSBM, for instance, to watch player one and two percent, put in:\r\n\r\n ```\r\n804530E0\r\n80453F70\r\n```\r\nNow listen to `MemWatcher/MemWatcher` like so (C code, but this will work with other languages of course):\r\n\r\n```c\r\n#include <errno.h>\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <unistd.h>\r\n#include <sys/socket.h>\r\n#include <sys/un.h>\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n\tchar *path = \"/path/to/MemWatcher/MemWatcher\";\r\n\tint fd = socket(AF_UNIX, SOCK_DGRAM, 0);\r\n\tif (fd < 0)\r\n\t\tprintf(\"Can't create socket: %d\\n\", errno);\r\n\tstruct sockaddr_un addr;\r\n\tmemset(&addr, 0, sizeof(addr));\r\n\taddr.sun_family = AF_UNIX;\r\n\tunlink(path);\r\n\tstrncpy(addr.sun_path, path, sizeof(addr.sun_path) - 1);\r\n\tif (bind(fd, (struct sockaddr*) &addr, sizeof(addr)) < 0)\r\n\t\tprintf(\"Can't bind: %d\\n\", errno);\r\n\r\n\tint buf[2];\r\n\twhile (1)\r\n\t{\r\n\t\tstruct sockaddr remaddr;\r\n\t\tsocklen_t addr_len;\r\n\t\trecvfrom(fd, buf, sizeof(buf), 0, &remaddr, &addr_len);\r\n\t\tprintf(\"%d %d\\n\", buf[0], buf[1]);\r\n\t}\r\n\treturn 0;\r\n}\r\n```\r\nEvery time the locations you specified change in game memory, the address and the new value will be sent to that socket. I've currently set it to poll every 10 ms.\r\n\r\nI am not sure that this is the right way to do this, but it works. Please suggest alternatives. Also, where should I document this + the controller inputs?","created_at":"2015-12-28T04:35:28Z","updated_at":"2015-12-28T05:52:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"04ca4e5d6d4e35cab0bab40e878722ba3050f132","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/3403/commits","review_comments_url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/3403/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/3403/comments","statuses_url":"https://api.github.com/repos/dolphin-emu/dolphin/statuses/cefbe79e0e48a0d0fddce548f6bc0a16a3033f73","head":{"label":"spxtr:reporter","ref":"reporter","sha":"cefbe79e0e48a0d0fddce548f6bc0a16a3033f73","user":{"login":"spxtr","id":7368979,"avatar_url":"https://avatars.githubusercontent.com/u/7368979?v=3","gravatar_id":"","url":"https://api.github.com/users/spxtr","html_url":"https://github.com/spxtr","followers_url":"https://api.github.com/users/spxtr/followers","following_url":"https://api.github.com/users/spxtr/following{/other_user}","gists_url":"https://api.github.com/users/spxtr/gists{/gist_id}","starred_url":"https://api.github.com/users/spxtr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spxtr/subscriptions","organizations_url":"https://api.github.com/users/spxtr/orgs","repos_url":"https://api.github.com/users/spxtr/repos","events_url":"https://api.github.com/users/spxtr/events{/privacy}","received_events_url":"https://api.github.com/users/spxtr/received_events","type":"User","site_admin":false},"repo":{"id":47168108,"name":"dolphin","full_name":"spxtr/dolphin","owner":{"login":"spxtr","id":7368979,"avatar_url":"https://avatars.githubusercontent.com/u/7368979?v=3","gravatar_id":"","url":"https://api.github.com/users/spxtr","html_url":"https://github.com/spxtr","followers_url":"https://api.github.com/users/spxtr/followers","following_url":"https://api.github.com/users/spxtr/following{/other_user}","gists_url":"https://api.github.com/users/spxtr/gists{/gist_id}","starred_url":"https://api.github.com/users/spxtr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spxtr/subscriptions","organizations_url":"https://api.github.com/users/spxtr/orgs","repos_url":"https://api.github.com/users/spxtr/repos","events_url":"https://api.github.com/users/spxtr/events{/privacy}","received_events_url":"https://api.github.com/users/spxtr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/spxtr/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/spxtr/dolphin","forks_url":"https://api.github.com/repos/spxtr/dolphin/forks","keys_url":"https://api.github.com/repos/spxtr/dolphin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spxtr/dolphin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spxtr/dolphin/teams","hooks_url":"https://api.github.com/repos/spxtr/dolphin/hooks","issue_events_url":"https://api.github.com/repos/spxtr/dolphin/issues/events{/number}","events_url":"https://api.github.com/repos/spxtr/dolphin/events","assignees_url":"https://api.github.com/repos/spxtr/dolphin/assignees{/user}","branches_url":"https://api.github.com/repos/spxtr/dolphin/branches{/branch}","tags_url":"https://api.github.com/repos/spxtr/dolphin/tags","blobs_url":"https://api.github.com/repos/spxtr/dolphin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spxtr/dolphin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spxtr/dolphin/git/refs{/sha}","trees_url":"https://api.github.com/repos/spxtr/dolphin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spxtr/dolphin/statuses/{sha}","languages_url":"https://api.github.com/repos/spxtr/dolphin/languages","stargazers_url":"https://api.github.com/repos/spxtr/dolphin/stargazers","contributors_url":"https://api.github.com/repos/spxtr/dolphin/contributors","subscribers_url":"https://api.github.com/repos/spxtr/dolphin/subscribers","subscription_url":"https://api.github.com/repos/spxtr/dolphin/subscription","commits_url":"https://api.github.com/repos/spxtr/dolphin/commits{/sha}","git_commits_url":"https://api.github.com/repos/spxtr/dolphin/git/commits{/sha}","comments_url":"https://api.github.com/repos/spxtr/dolphin/comments{/number}","issue_comment_url":"https://api.github.com/repos/spxtr/dolphin/issues/comments{/number}","contents_url":"https://api.github.com/repos/spxtr/dolphin/contents/{+path}","compare_url":"https://api.github.com/repos/spxtr/dolphin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spxtr/dolphin/merges","archive_url":"https://api.github.com/repos/spxtr/dolphin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spxtr/dolphin/downloads","issues_url":"https://api.github.com/repos/spxtr/dolphin/issues{/number}","pulls_url":"https://api.github.com/repos/spxtr/dolphin/pulls{/number}","milestones_url":"https://api.github.com/repos/spxtr/dolphin/milestones{/number}","notifications_url":"https://api.github.com/repos/spxtr/dolphin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spxtr/dolphin/labels{/name}","releases_url":"https://api.github.com/repos/spxtr/dolphin/releases{/id}","created_at":"2015-12-01T05:38:35Z","updated_at":"2015-12-01T05:39:13Z","pushed_at":"2015-12-28T05:42:09Z","git_url":"git://github.com/spxtr/dolphin.git","ssh_url":"git@github.com:spxtr/dolphin.git","clone_url":"https://github.com/spxtr/dolphin.git","svn_url":"https://github.com/spxtr/dolphin","homepage":"https://dolphin-emu.org/","size":228413,"stargazers_count":0,"watchers_count":0,"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":0,"default_branch":"master"}},"base":{"label":"dolphin-emu:master","ref":"master","sha":"294bb753164b58eb0a1e9317eaf05ce3d5bb0209","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-12-27T22:46:28Z","pushed_at":"2015-12-28T05:42:10Z","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":251919,"stargazers_count":1890,"watchers_count":1890,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":577,"mirror_url":null,"open_issues_count":85,"forks":577,"open_issues":85,"watchers":1890,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/3403"},"html":{"href":"https://github.com/dolphin-emu/dolphin/pull/3403"},"issue":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/issues/3403"},"comments":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/issues/3403/comments"},"review_comments":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/3403/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/3403/commits"},"statuses":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/statuses/cefbe79e0e48a0d0fddce548f6bc0a16a3033f73"}}}}