all repos — mgba @ 5c5be73c473a957af45eff152425e4c0207a0d6d

mGBA Game Boy Advance Emulator

include/mgba/gb/interface.h (view raw)

 1/* Copyright (c) 2013-2016 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/. */
 6#ifndef GB_INTERFACE_H
 7#define GB_INTERFACE_H
 8
 9#include <mgba-util/common.h>
10
11CXX_GUARD_START
12
13enum GBModel {
14	GB_MODEL_AUTODETECT = 0xFF,
15	GB_MODEL_DMG  = 0x00,
16	GB_MODEL_SGB  = 0x20,
17	GB_MODEL_MGB  = 0x40,
18	GB_MODEL_SGB2 = 0x60,
19	GB_MODEL_CGB  = 0x80,
20	GB_MODEL_AGB  = 0xC0
21};
22
23enum GBMemoryBankControllerType {
24	GB_MBC_AUTODETECT = -1,
25	GB_MBC_NONE = 0,
26	GB_MBC1 = 1,
27	GB_MBC2 = 2,
28	GB_MBC3 = 3,
29	GB_MBC5 = 5,
30	GB_MBC6 = 6,
31	GB_MBC7 = 7,
32	GB_MMM01 = 0x10,
33	GB_HuC1 = 0x11,
34	GB_HuC3 = 0x12,
35	GB_POCKETCAM = 0x13,
36	GB_TAMA5 = 0x14,
37	GB_UNL_WISDOM_TREE = 0x20,
38	GB_MBC3_RTC = 0x103,
39	GB_MBC5_RUMBLE = 0x105
40};
41
42struct GBSIODriver {
43	struct GBSIO* p;
44
45	bool (*init)(struct GBSIODriver* driver);
46	void (*deinit)(struct GBSIODriver* driver);
47	void (*writeSB)(struct GBSIODriver* driver, uint8_t value);
48	uint8_t (*writeSC)(struct GBSIODriver* driver, uint8_t value);
49};
50
51struct VFile;
52
53bool GBIsROM(struct VFile* vf);
54bool GBIsBIOS(struct VFile* vf);
55
56enum GBModel GBNameToModel(const char*);
57const char* GBModelToName(enum GBModel);
58
59CXX_GUARD_END
60
61#endif