all repos — mgba @ 69c068c551b9a1cf89b4f47ee9aa8e15e83e45c3

mGBA Game Boy Advance Emulator

Python: Fix importing .gb or .gba before .core
Vicki Pfau vi@endrift.com
Sun, 16 Jul 2017 23:22:43 -0700
commit

69c068c551b9a1cf89b4f47ee9aa8e15e83e45c3

parent

f4c4be7b121556f47438dbac940186da4d4199d6

2 files changed, 12 insertions(+), 9 deletions(-)

jump to
M CHANGESCHANGES

@@ -1,3 +1,7 @@

+0.6.1: (Future) +Bugfixes: + - Python: Fix importing .gb or .gba before .core + 0.6.0: (2017-07-16) Features: - Library view
M src/platform/python/mgba/core.pysrc/platform/python/mgba/core.py

@@ -39,6 +39,12 @@ return f(self, *args, **kwargs)

return wrapper class Core(object): + if hasattr(lib, 'PLATFORM_GBA'): + PLATFORM_GBA = lib.PLATFORM_GBA + + if hasattr(lib, 'PLATFORM_GB'): + PLATFORM_GB = lib.PLATFORM_GB + def __init__(self, native): self._core = native self._wasReset = False

@@ -54,8 +60,10 @@ success = bool(core.init(core))

if not success: raise RuntimeError("Failed to initialize core") if hasattr(cls, 'PLATFORM_GBA') and core.platform(core) == cls.PLATFORM_GBA: + from .gba import GBA return GBA(core) if hasattr(cls, 'PLATFORM_GB') and core.platform(core) == cls.PLATFORM_GB: + from .gb import GB return GB(core) return Core(core)

@@ -151,12 +159,3 @@ def getGameCode(self):

code = ffi.new("char[12]") self._core.getGameCode(self._core, code) return ffi.string(code, 12).decode("ascii") - -if hasattr(lib, 'PLATFORM_GBA'): - from .gba import GBA - Core.PLATFORM_GBA = lib.PLATFORM_GBA - -if hasattr(lib, 'PLATFORM_GB'): - from .gb import GB - from .lr35902 import LR35902Core - Core.PLATFORM_GB = lib.PLATFORM_GB