Skip to content
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

Merged
merged 14 commits into from
Aug 29, 2017
Merged

Merge initial ram synchronization work #3

merged 14 commits into from
Aug 29, 2017

Conversation

vivlim
Copy link
Collaborator

@vivlim vivlim commented Aug 29, 2017

No description provided.

@vivlim vivlim requested a review from lifning August 29, 2017 04:37
self.receiveBytes()
return Sapiens.Step(self)

def Event(self, evt):
Copy link
Owner

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)

Copy link
Collaborator Author

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

thread.daemon = True
thread.start()
#asyncio.get_event_loop().run_forever()
def threadMain(self):
Copy link
Owner

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

Copy link
Owner

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

Copy link
Collaborator Author

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created issue #4



async def handleSocket(self):
async with websockets.connect('ws://localhost:8765') as websocket:
Copy link
Owner

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)

Copy link
Collaborator Author

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)
Copy link
Owner

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.

Copy link
Collaborator Author

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created #5

return Sapiens.Victory(self)

def sendMemory(self):
self.sendNewBytes(0xcc24, 11) # menu data
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0x11

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

carp 🐟

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
Copy link
Owner

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]

@vivlim vivlim merged commit 1dee79c into master Aug 29, 2017
@vivlim vivlim deleted the vivlim/pkmnbox branch August 29, 2017 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants