Python: Add subscripting to root memory object
Vicki Pfau vi@endrift.com
Mon, 09 Oct 2017 11:37:25 -0700
1 files changed,
6 insertions(+),
0 deletions(-)
M
src/platform/python/mgba/memory.py
→
src/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]