{"action":"created","issue":{"url":"https://api.github.com/repos/spxtr/p3/issues/4","labels_url":"https://api.github.com/repos/spxtr/p3/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/spxtr/p3/issues/4/comments","events_url":"https://api.github.com/repos/spxtr/p3/issues/4/events","html_url":"https://github.com/spxtr/p3/issues/4","id":126418048,"number":4,"title":"Create a system for managing addresses","user":{"login":"sepharoth213","id":2124824,"avatar_url":"https://avatars.githubusercontent.com/u/2124824?v=3","gravatar_id":"","url":"https://api.github.com/users/sepharoth213","html_url":"https://github.com/sepharoth213","followers_url":"https://api.github.com/users/sepharoth213/followers","following_url":"https://api.github.com/users/sepharoth213/following{/other_user}","gists_url":"https://api.github.com/users/sepharoth213/gists{/gist_id}","starred_url":"https://api.github.com/users/sepharoth213/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sepharoth213/subscriptions","organizations_url":"https://api.github.com/users/sepharoth213/orgs","repos_url":"https://api.github.com/users/sepharoth213/repos","events_url":"https://api.github.com/users/sepharoth213/events{/privacy}","received_events_url":"https://api.github.com/users/sepharoth213/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2016-01-13T13:29:24Z","updated_at":"2016-01-25T21:10:23Z","closed_at":null,"body":"In [this branch](/sepharoth213/p3/tree/addresses) I've created a possible way to handle addresses, that is, to have a map of addresses to address objects so that parsing can happen like so:\r\n\r\n```python\r\n#addr.py\r\n\r\naddresses = [\r\n#                      name               address     mask        bitshift\r\n    at.IntegerAddress(\"playerOnePercent\", \"804530E0\", 0x00FF0000, 16),\r\n    at.IntegerAddress(\"playerTwoPercent\", \"80453F70\", 0x00FF0000, 16),\r\n    at.IntegerAddress(\"globalFrameCounter\", \"804D7420\", 0xFFFFFFFF, 0),\r\n]\r\n\r\nfor address in addresses:\r\n    names[address.address] = address\r\n\r\n#usage:\r\nfor address, value in mw:\r\n    if(address in addr.names):\r\n        parsedValue = addr.names[address].get_value(value)\r\n```\r\n\r\nThere will likely be many addresses to manage in p3 and I believe that this is a sane way, however, that may not make sense depending on the structure of p3. If p3 moves towards being event-driven I feel that this approach is best, since the above implementation would naturally extend to being able to subscribe to events by name. This would also allow for the Melee game state to be managed as a map of names to values. "},"comment":{"url":"https://api.github.com/repos/spxtr/p3/issues/comments/174663952","html_url":"https://github.com/spxtr/p3/issues/4#issuecomment-174663952","issue_url":"https://api.github.com/repos/spxtr/p3/issues/4","id":174663952,"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-25T21:10:23Z","updated_at":"2016-01-25T21:10:23Z","body":"It'd be awesome if we could be sure of it, but for now we have to make do.\r\n\r\nI'm going to talk with the dolphin devs a bit more about how to do this properly, but it's a hard problem. We don't want to slow down the emulator by checking a list of addresses each time any part of memory changes."}}