all repos — mgba @ 46590f98d83da55b3820a35b8cc948d3c0605a86

mGBA Game Boy Advance Emulator

src/core/core.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 M_CORE_H
 7#define M_CORE_H
 8
 9#include "util/common.h"
10
11struct VFile;
12struct mRTCSource;
13
14#ifdef COLOR_16_BIT
15typedef uint16_t color_t;
16#define BYTES_PER_PIXEL 2
17#else
18typedef uint32_t color_t;
19#define BYTES_PER_PIXEL 4
20#endif
21
22struct mCore {
23	void* cpu;
24	void* board;
25
26	bool (*init)(struct mCore*);
27	void (*deinit)(struct mCore*);
28
29	void (*desiredVideoDimensions)(struct mCore*, unsigned* width, unsigned* height);
30	void (*setVideoBuffer)(struct mCore*, color_t* buffer, size_t stride);
31
32	bool (*isROM)(struct mCore*, struct VFile* vf);
33	bool (*loadROM)(struct mCore*, struct VFile* vf, struct VFile* save, const char* fname);
34	void (*unloadROM)(struct mCore*);
35
36	bool (*loadBIOS)(struct mCore*, struct VFile* vf, int biosID);
37	bool (*selectBIOS)(struct mCore*, int biosID);
38
39	void (*reset)(struct mCore*);
40	void (*runFrame)(struct mCore*);
41	void (*runLoop)(struct mCore*);
42	void (*step)(struct mCore*);
43
44	void (*setKeys)(struct mCore*, uint32_t keys);
45
46	int32_t (*frameCounter)(struct mCore*);
47	int32_t (*frameCycles)(struct mCore*);
48	int32_t (*frequency)(struct mCore*);
49
50	void (*setRTC)(struct mCore*, struct mRTCSource*);
51};
52
53#endif