mirror of
https://github.com/libretro/mgba.git
synced 2024-11-24 00:20:05 +00:00
Python: Add BIOS loading, fix up reference errors
This commit is contained in:
parent
168cad7f9c
commit
5d72a2be9d
@ -139,9 +139,6 @@ class Core(object):
|
||||
raise RuntimeError("Failed to initialize core")
|
||||
return cls._detect(core)
|
||||
|
||||
def _deinit(self):
|
||||
self._core.deinit(self._core)
|
||||
|
||||
@classmethod
|
||||
def _detect(cls, core):
|
||||
if hasattr(cls, 'PLATFORM_GBA') and core.platform(core) == cls.PLATFORM_GBA:
|
||||
@ -164,6 +161,9 @@ class Core(object):
|
||||
def loadROM(self, vf):
|
||||
return bool(self._core.loadROM(self._core, vf.handle))
|
||||
|
||||
def loadBIOS(self, vf, id=0):
|
||||
return bool(self._core.loadBIOS(self._core, vf.handle, id))
|
||||
|
||||
def loadSave(self, vf):
|
||||
return bool(self._core.loadSave(self._core, vf.handle))
|
||||
|
||||
|
@ -43,6 +43,9 @@ class GB(Core):
|
||||
def attachSIO(self, link):
|
||||
lib.GBSIOSetDriver(ffi.addressof(self._native.sio), link._native)
|
||||
|
||||
def __del__(self):
|
||||
lib.GBSIOSetDriver(ffi.addressof(self._native.sio), ffi.NULL)
|
||||
|
||||
createCallback("GBSIOPythonDriver", "init")
|
||||
createCallback("GBSIOPythonDriver", "deinit")
|
||||
createCallback("GBSIOPythonDriver", "writeSB")
|
||||
|
@ -33,6 +33,7 @@ class GBA(Core):
|
||||
self._native = ffi.cast("struct GBA*", native.board)
|
||||
self.sprites = GBAObjs(self)
|
||||
self.cpu = ARMCore(self._core.cpu)
|
||||
self._sio = set()
|
||||
|
||||
@needsReset
|
||||
def _initCache(self, cache):
|
||||
@ -49,8 +50,13 @@ class GBA(Core):
|
||||
self.memory = GBAMemory(self._core, self._native.memory.romSize)
|
||||
|
||||
def attachSIO(self, link, mode=lib.SIO_MULTI):
|
||||
self._sio.add(mode)
|
||||
lib.GBASIOSetDriver(ffi.addressof(self._native.sio), link._native, mode)
|
||||
|
||||
def __del__(self):
|
||||
for mode in self._sio:
|
||||
lib.GBASIOSetDriver(ffi.addressof(self._native.sio), ffi.NULL, mode)
|
||||
|
||||
createCallback("GBASIOPythonDriver", "init")
|
||||
createCallback("GBASIOPythonDriver", "deinit")
|
||||
createCallback("GBASIOPythonDriver", "load")
|
||||
|
Loading…
Reference in New Issue
Block a user