all repos — mgba @ b1828dbc59b8a9cc080c8c7f9472c46a3d39e90c

mGBA Game Boy Advance Emulator

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

  1/* Copyright (c) 2013-2015 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 GBA_INTERFACE_H
  7#define GBA_INTERFACE_H
  8
  9#include <mgba-util/common.h>
 10
 11CXX_GUARD_START
 12
 13#include <mgba/core/interface.h>
 14#include <mgba/core/timing.h>
 15
 16enum {
 17	GBA_VIDEO_HORIZONTAL_PIXELS = 240,
 18	GBA_VIDEO_VERTICAL_PIXELS = 160,
 19};
 20
 21enum GBASIOMode {
 22	SIO_NORMAL_8 = 0,
 23	SIO_NORMAL_32 = 1,
 24	SIO_MULTI = 2,
 25	SIO_UART = 3,
 26	SIO_GPIO = 8,
 27	SIO_JOYBUS = 12
 28};
 29
 30enum GBASIOJOYCommand {
 31	JOY_RESET = 0xFF,
 32	JOY_POLL = 0x00,
 33	JOY_TRANS = 0x14,
 34	JOY_RECV = 0x15
 35};
 36
 37enum GBAVideoLayer {
 38	GBA_LAYER_BG0 = 0,
 39	GBA_LAYER_BG1,
 40	GBA_LAYER_BG2,
 41	GBA_LAYER_BG3,
 42	GBA_LAYER_OBJ,
 43	GBA_LAYER_WIN0,
 44	GBA_LAYER_WIN1,
 45	GBA_LAYER_OBJWIN,
 46};
 47
 48struct GBA;
 49struct GBAAudio;
 50struct GBASIO;
 51struct GBAVideoRenderer;
 52struct VFile;
 53
 54extern MGBA_EXPORT const int GBA_LUX_LEVELS[10];
 55
 56enum {
 57	mPERIPH_GBA_LUMINANCE = 0x1000,
 58	mPERIPH_GBA_BATTLECHIP_GATE,
 59};
 60
 61bool GBAIsROM(struct VFile* vf);
 62bool GBAIsMB(struct VFile* vf);
 63bool GBAIsBIOS(struct VFile* vf);
 64
 65struct GBALuminanceSource {
 66	void (*sample)(struct GBALuminanceSource*);
 67
 68	uint8_t (*readLuminance)(struct GBALuminanceSource*);
 69};
 70
 71struct GBASIODriver {
 72	struct GBASIO* p;
 73
 74	bool (*init)(struct GBASIODriver* driver);
 75	void (*deinit)(struct GBASIODriver* driver);
 76	bool (*load)(struct GBASIODriver* driver);
 77	bool (*unload)(struct GBASIODriver* driver);
 78	uint16_t (*writeRegister)(struct GBASIODriver* driver, uint32_t address, uint16_t value);
 79};
 80
 81enum GBASIOBattleChipGateFlavor {
 82	GBA_FLAVOR_BATTLECHIP_GATE = 4,
 83	GBA_FLAVOR_PROGRESS_GATE = 5,
 84	GBA_FLAVOR_BEAST_LINK_GATE = 6,
 85	GBA_FLAVOR_BEAST_LINK_GATE_US = 7,
 86};
 87
 88struct GBASIOBattlechipGate {
 89	struct GBASIODriver d;
 90	struct mTimingEvent event;
 91	uint16_t chipId;
 92	uint16_t data[2];
 93	int state;
 94	int flavor;
 95};
 96
 97void GBASIOBattlechipGateCreate(struct GBASIOBattlechipGate*);
 98
 99void GBAEReaderQueueCard(struct GBA* gba, const void* data, size_t size);
100
101CXX_GUARD_END
102
103#endif