all repos — mgba @ 5b8d64b0b5e5b3aa1edac7a98be6cbf471869dd0

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
13#include <mgba/core/interface.h>
14
15enum GBModel {
16	GB_MODEL_AUTODETECT = 0xFF,
17	GB_MODEL_DMG  = 0x00,
18	GB_MODEL_SGB  = 0x20,
19	GB_MODEL_MGB  = 0x40,
20	GB_MODEL_SGB2 = 0x60,
21	GB_MODEL_CGB  = 0x80,
22	GB_MODEL_AGB  = 0xC0
23};
24
25enum GBMemoryBankControllerType {
26	GB_MBC_AUTODETECT = -1,
27	GB_MBC_NONE = 0,
28	GB_MBC1 = 1,
29	GB_MBC2 = 2,
30	GB_MBC3 = 3,
31	GB_MBC5 = 5,
32	GB_MBC6 = 6,
33	GB_MBC7 = 7,
34	GB_MMM01 = 0x10,
35	GB_HuC1 = 0x11,
36	GB_HuC3 = 0x12,
37	GB_POCKETCAM = 0x13,
38	GB_TAMA5 = 0x14,
39	GB_MBC3_RTC = 0x103,
40	GB_MBC5_RUMBLE = 0x105,
41	GB_UNL_WISDOM_TREE = 0x200,
42	GB_UNL_PKJD = 0x203,
43	GB_UNL_BBD = 0x220, // Also used as a mask for MBCs that need special read behavior
44	GB_UNL_HITEK = 0x221,
45};
46
47enum GBVideoLayer {
48	GB_LAYER_BACKGROUND = 0,
49	GB_LAYER_WINDOW,
50	GB_LAYER_OBJ
51};
52
53struct GBSIODriver {
54	struct GBSIO* p;
55
56	bool (*init)(struct GBSIODriver* driver);
57	void (*deinit)(struct GBSIODriver* driver);
58	void (*writeSB)(struct GBSIODriver* driver, uint8_t value);
59	uint8_t (*writeSC)(struct GBSIODriver* driver, uint8_t value);
60};
61
62struct VFile;
63
64bool GBIsROM(struct VFile* vf);
65bool GBIsBIOS(struct VFile* vf);
66
67enum GBModel GBNameToModel(const char*);
68const char* GBModelToName(enum GBModel);
69
70int GBValidModels(const uint8_t* bank0);
71
72CXX_GUARD_END
73
74#endif