mirror of https://github.com/mgba-emu/mgba.git
Python: gamedata integration
This commit is contained in:
parent
6b0847c472
commit
5fe6eb97ea
|
@ -258,6 +258,10 @@ class Core(object):
|
|||
def addFrameCallback(self, cb):
|
||||
self._callbacks.videoFrameEnded.append(cb)
|
||||
|
||||
@property
|
||||
def crc32(self):
|
||||
return self._native.romCrc32
|
||||
|
||||
class ICoreOwner(object):
|
||||
def claim(self):
|
||||
raise NotImplementedError
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
# Copyright (c) 2013-2017 Jeffrey Pfau
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
try:
|
||||
import mgba_gamedata
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
def search(core):
|
||||
crc32 = None
|
||||
if hasattr(core, 'PLATFORM_GBA') and core.platform() == core.PLATFORM_GBA:
|
||||
platform = 'GBA'
|
||||
crc32 = core.crc32
|
||||
if hasattr(core, 'PLATFORM_GB') and core.platform() == core.PLATFORM_GB:
|
||||
platform = 'GB'
|
||||
crc32 = core.crc32
|
||||
cls = mgba_gamedata.registry.search(platform, {'crc32': crc32})
|
||||
if not cls:
|
||||
return None
|
||||
return cls(core.memory.u8)
|
Loading…
Reference in New Issue