diff --git a/CHANGES b/CHANGES index 8f5dde7e7..52fc56bc9 100644 --- a/CHANGES +++ b/CHANGES @@ -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 diff --git a/src/platform/python/mgba/core.py b/src/platform/python/mgba/core.py index 8d86e3127..4d140567b 100644 --- a/src/platform/python/mgba/core.py +++ b/src/platform/python/mgba/core.py @@ -39,6 +39,12 @@ def needsReset(f): 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 @@ class Core(object): 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 @@ class Core(object): 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