mirror of https://github.com/mgba-emu/mgba.git
Python: Fix importing .gb or .gba before .core
This commit is contained in:
parent
f4c4be7b12
commit
69c068c551
4
CHANGES
4
CHANGES
|
@ -1,3 +1,7 @@
|
||||||
|
0.6.1: (Future)
|
||||||
|
Bugfixes:
|
||||||
|
- Python: Fix importing .gb or .gba before .core
|
||||||
|
|
||||||
0.6.0: (2017-07-16)
|
0.6.0: (2017-07-16)
|
||||||
Features:
|
Features:
|
||||||
- Library view
|
- Library view
|
||||||
|
|
|
@ -39,6 +39,12 @@ def needsReset(f):
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
class Core(object):
|
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):
|
def __init__(self, native):
|
||||||
self._core = native
|
self._core = native
|
||||||
self._wasReset = False
|
self._wasReset = False
|
||||||
|
@ -54,8 +60,10 @@ class Core(object):
|
||||||
if not success:
|
if not success:
|
||||||
raise RuntimeError("Failed to initialize core")
|
raise RuntimeError("Failed to initialize core")
|
||||||
if hasattr(cls, 'PLATFORM_GBA') and core.platform(core) == cls.PLATFORM_GBA:
|
if hasattr(cls, 'PLATFORM_GBA') and core.platform(core) == cls.PLATFORM_GBA:
|
||||||
|
from .gba import GBA
|
||||||
return GBA(core)
|
return GBA(core)
|
||||||
if hasattr(cls, 'PLATFORM_GB') and core.platform(core) == cls.PLATFORM_GB:
|
if hasattr(cls, 'PLATFORM_GB') and core.platform(core) == cls.PLATFORM_GB:
|
||||||
|
from .gb import GB
|
||||||
return GB(core)
|
return GB(core)
|
||||||
return Core(core)
|
return Core(core)
|
||||||
|
|
||||||
|
@ -151,12 +159,3 @@ class Core(object):
|
||||||
code = ffi.new("char[12]")
|
code = ffi.new("char[12]")
|
||||||
self._core.getGameCode(self._core, code)
|
self._core.getGameCode(self._core, code)
|
||||||
return ffi.string(code, 12).decode("ascii")
|
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
|
|
||||||
|
|
Loading…
Reference in New Issue