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
11def search(core):
12 crc32 = None
13 if hasattr(core, 'PLATFORM_GBA') and core.platform() == core.PLATFORM_GBA:
14 platform = 'GBA'
15 crc32 = core.crc32
16 if hasattr(core, 'PLATFORM_GB') and core.platform() == core.PLATFORM_GB:
17 platform = 'GB'
18 crc32 = core.crc32
19 cls = mgba_gamedata.registry.search(platform, {'crc32': crc32})
20 if not cls:
21 return None
22 return cls(core.memory.u8)