all repos — mgba @ 6b0847c4725c89f937f8107c28cc4fef611a85d4

mGBA Game Boy Advance Emulator

Python: Add subscripting to root memory object
Vicki Pfau vi@endrift.com
Mon, 09 Oct 2017 11:37:25 -0700
commit

6b0847c4725c89f937f8107c28cc4fef611a85d4

parent

5a6ee3aadc2abce53f03416a2da3f5c14bb03d75

1 files changed, 6 insertions(+), 0 deletions(-)

jump to
M src/platform/python/mgba/memory.pysrc/platform/python/mgba/memory.py

@@ -153,3 +153,9 @@ lib.mCoreMemorySearch(self._core, params, results, limit)

new_results = [MemorySearchResult(self, lib.mCoreMemorySearchResultsGetPointer(results, i)) for i in range(lib.mCoreMemorySearchResultsSize(results))] lib.mCoreMemorySearchResultsDeinit(results) return new_results + + def __getitem__(self, address): + if isinstance(address, slice): + return bytearray(self.u8[address]) + else: + return self.u8[address]