all repos — mgba @ 1402593855729beaca177d43700eb462bd8c123d

mGBA Game Boy Advance Emulator

src/platform/python/mgba/gamedata.py (view raw)

 1# Copyright (c) 2013-2017 Jeffrey Pfau
 2#
 3# This Source Code Form is subject to the terms of the Mozilla Public
 4# License, v. 2.0. If a copy of the MPL was not distributed with this
 5# file, You can obtain one at http://mozilla.org/MPL/2.0/.
 6try:
 7    import mgba_gamedata
 8except ImportError:
 9    pass
10
11
12def search(core):
13    crc32 = None
14    if hasattr(core, 'PLATFORM_GBA') and core.platform == core.PLATFORM_GBA:
15        platform = 'GBA'
16        crc32 = core.crc32
17    if hasattr(core, 'PLATFORM_GB') and core.platform == core.PLATFORM_GB:
18        platform = 'GB'
19        crc32 = core.crc32
20    cls = mgba_gamedata.registry.search(platform, {'crc32': crc32})
21    if not cls:
22        return None
23    return cls(core.memory.u8)