{"action":"created","issue":{"url":"https://api.github.com/repos/altf4/cpu-level-11/issues/23","labels_url":"https://api.github.com/repos/altf4/cpu-level-11/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/altf4/cpu-level-11/issues/23/comments","events_url":"https://api.github.com/repos/altf4/cpu-level-11/issues/23/events","html_url":"https://github.com/altf4/cpu-level-11/issues/23","id":124564509,"number":23,"title":"Use dolphin's MemoryWatcher","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},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-01T22:33:48Z","updated_at":"2016-01-01T22:52:59Z","closed_at":null,"body":"In dolphin-emu/dolphin#3403 and dolphin-emu/dolphin#3413 I added a little class that watches user-specified game memory locations and outputs changes to a unix socket. It checks for updates every 2 ms, so you'll still have plenty of time to think and send controller inputs in the 16 ms frame window. It's somewhat documented [here](https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/Core/MemoryWatcher.h). I'll add some documentation to the wiki, but here's a simple program to get started:\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    char *path = \"/path/to/.dolphin-emu/MemoryWatcher/MemoryWatcher\";\r\n\r\n    int fd = socket(AF_UNIX, SOCK_DGRAM, 0);\r\n    struct sockaddr_un addr;\r\n    memset(&addr, 0, sizeof(addr));\r\n    addr.sun_family = AF_UNIX;\r\n    unlink(path);\r\n    strncpy(addr.sun_path, path, sizeof(addr.sun_path) - 1);\r\n    bind(fd, (struct sockaddr*) &addr, sizeof(addr))\r\n\r\n    char buf[128];\r\n    while (1)\r\n    {\r\n        struct sockaddr remaddr;\r\n        socklen_t addr_len;\r\n        recvfrom(fd, buf, sizeof(buf), 0, &remaddr, &addr_len);\r\n        printf(\"%s\", buf);\r\n    }\r\n    return 0;\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/altf4/cpu-level-11/issues/comments/168345946","html_url":"https://github.com/altf4/cpu-level-11/issues/23#issuecomment-168345946","issue_url":"https://api.github.com/repos/altf4/cpu-level-11/issues/23","id":168345946,"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},"created_at":"2016-01-01T22:52:59Z","updated_at":"2016-01-01T22:52:59Z","body":"As always, let me know about any issues here or on IRC :)"}}