all repos — mgba @ 7d77aac68fec49a947c71bb67d03c7f08a8c84eb

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_MBC3_RTC = 0x103,
38	GB_MBC5_RUMBLE = 0x105,
39	GB_UNL_WISDOM_TREE = 0x200,
40	GB_UNL_PKJD = 0x203,
41	GB_UNL_BBD = 0x220, // Also used as a mask for MBCs that need special read behavior
42	GB_UNL_HITEK = 0x221,
43};
44
45enum GBVideoLayer {
46	GB_LAYER_BACKGROUND = 0,
47	GB_LAYER_WINDOW,
48	GB_LAYER_OBJ
49};
50
51struct GBSIODriver {
52	struct GBSIO* p;
53
54	bool (*init)(struct GBSIODriver* driver);
55	void (*deinit)(struct GBSIODriver* driver);
56	void (*writeSB)(struct GBSIODriver* driver, uint8_t value);
57	uint8_t (*writeSC)(struct GBSIODriver* driver, uint8_t value);
58};
59
60struct VFile;
61
62bool GBIsROM(struct VFile* vf);
63bool GBIsBIOS(struct VFile* vf);
64
65enum GBModel GBNameToModel(const char*);
66const char* GBModelToName(enum GBModel);
67
68int GBValidModels(const uint8_t* bank0);
69
70CXX_GUARD_END
71
72#endif