-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge initial ram synchronization work #3
Conversation
…t messages from the server
# Conflicts: # games/superopti.py
brains/andalite.py
Outdated
self.receiveBytes() | ||
return Sapiens.Step(self) | ||
|
||
def Event(self, evt): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are Event, Path, Victory necessary here? (in fact, pretty sure Victory's gone from the base class)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope i'll clean 'em up
brains/andalite.py
Outdated
thread.daemon = True | ||
thread.start() | ||
#asyncio.get_event_loop().run_forever() | ||
def threadMain(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(PEP8) style nit: i think this method needs one more \n
before it and one fewer \n
after it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also it looks like all the new methods are lowerCamel while the existing stuff is UpperCamel and the PEP8 standard (as well as that of the libretro C API) is snake_case. we should probably standardize on one style... can be decided later and done in a different commit tho
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed. let's snap to snake_case since that's more pythonic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
created issue #4
brains/andalite.py
Outdated
|
||
|
||
async def handleSocket(self): | ||
async with websockets.connect('ws://localhost:8765') as websocket: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably make the address be a parameter given to the brain (with this as the default)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hard to do this with the way args are parsed... created #6 to track
async def messageConsumer(self, websocket): | ||
while True: | ||
message = await websocket.recv() | ||
data = ast.literal_eval(message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this'll do for now, but we may want to think about a different wire format than hoping eval(str(x))
remains an identity function for all the types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed. this is also pretty inefficient tbh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
created #5
brains/andalite.py
Outdated
return Sapiens.Victory(self) | ||
|
||
def sendMemory(self): | ||
self.sendNewBytes(0xcc24, 11) # menu data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0x11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
carp 🐟
brains/andalite.py
Outdated
if lastData == None or start != None and lastData.get('data') != data.get('data'): | ||
print("writing data") | ||
self.game.PokeMemoryRegion(data['offset'], data['data']) | ||
self.lastSent['offset'] = data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be self.lastSent[start]
No description provided.