[v0.1.1] Fixed bug reading MEM2
This commit is contained in:
parent
82f82eba3e
commit
8dc66466cc
3 changed files with 12 additions and 5 deletions
5
CHANGELOG.md
Normal file
5
CHANGELOG.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Change Log
|
||||
## 0.1.1 (2023/03/27)
|
||||
- Fixed bug reading MEM2
|
||||
## 0.1.0 (2023/03/09)
|
||||
- Implemented WebSocket server
|
|
@ -1,6 +1,6 @@
|
|||
[metadata]
|
||||
name = supDolphinWS-server
|
||||
version = 0.1.0
|
||||
version = 0.1.1
|
||||
author = sup39
|
||||
author_email = sms@sup39.dev
|
||||
description = A WebSocket server for accessing memory of emulated games in Dolphin
|
||||
|
|
|
@ -46,24 +46,26 @@ class Dolphin():
|
|||
self.m = None
|
||||
def _read_bytes(self, addr, size):
|
||||
'''
|
||||
addr: int
|
||||
addr: int|None
|
||||
size: int
|
||||
'''
|
||||
if addr is None: return None
|
||||
if MEM1_START <= addr <= MEM1_END-size:
|
||||
idx = addr-MEM1_START
|
||||
elif MEM2_START <= addr <= MEM2_END-size and len(self.m) > MEM2_OFFSET:
|
||||
elif MEM2_START <= addr <= MEM2_END-size and len(self.m.buf) > MEM2_OFFSET:
|
||||
idx = MEM2_OFFSET + addr-MEM2_START
|
||||
else: return None
|
||||
return self.m.buf[idx:idx+size].tobytes()
|
||||
def _write_bytes(self, addr, payload):
|
||||
'''
|
||||
addr: int
|
||||
addr: int|None
|
||||
payload: bytes
|
||||
'''
|
||||
if addr is None: return None
|
||||
size = len(payload)
|
||||
if MEM1_START <= addr <= MEM1_END-size:
|
||||
idx = addr-MEM1_START
|
||||
elif MEM2_START <= addr <= MEM2_END-size and len(self.m) > MEM2_OFFSET:
|
||||
elif MEM2_START <= addr <= MEM2_END-size and len(self.m.buf) > MEM2_OFFSET:
|
||||
idx = MEM2_OFFSET + addr-MEM2_START
|
||||
else: return None
|
||||
self.m.buf[idx:idx+size] = payload
|
||||
|
|
Reference in a new issue