all repos — mgba @ d75f43f779194848cc8b74f8ebd4be8369c5ea63

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

d75f43f779194848cc8b74f8ebd4be8369c5ea63

parent

4f3754b74a543b014f7ad0e24cd164d0eae4e865

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

jump to
M CHANGESCHANGES

@@ -17,6 +17,7 @@ Features:

- ELF support Bugfixes: - GB Audio: Make audio unsigned with bias (fixes mgba.io/i/749) + - Python: Fix importing .gb or .gba before .core Misc: - GBA Timer: Use global cycles for timers - GBA: Extend oddly-sized ROMs to full address space (fixes mgba.io/i/722)
M src/platform/python/mgba/core.pysrc/platform/python/mgba/core.py

@@ -91,6 +91,12 @@ for cb in self.sleep:

cb() 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

@@ -117,8 +123,10 @@

@classmethod def _detect(cls, 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)

@@ -253,12 +261,3 @@ raise NotImplementedError

def isPaused(self): raise NotImplementedError - -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