From 6b0847c4725c89f937f8107c28cc4fef611a85d4 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 9 Oct 2017 11:37:25 -0700 Subject: [PATCH] Python: Add subscripting to root memory object --- src/platform/python/mgba/memory.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/platform/python/mgba/memory.py b/src/platform/python/mgba/memory.py index c59f5a792..cb7fedef1 100644 --- a/src/platform/python/mgba/memory.py +++ b/src/platform/python/mgba/memory.py @@ -153,3 +153,9 @@ class Memory(object): 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]