all repos — mgba @ 44116c9beb308b6bd3753d144b2e6805fa583f86

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 mCoreSync;
23struct mCore {
24	void* cpu;
25	void* board;
26
27	bool (*init)(struct mCore*);
28	void (*deinit)(struct mCore*);
29
30	void (*setSync)(struct mCore*, struct mCoreSync*);
31
32	void (*desiredVideoDimensions)(struct mCore*, unsigned* width, unsigned* height);
33	void (*setVideoBuffer)(struct mCore*, color_t* buffer, size_t stride);
34
35	bool (*isROM)(struct mCore*, struct VFile* vf);
36	bool (*loadROM)(struct mCore*, struct VFile* vf, struct VFile* save, const char* fname);
37	void (*unloadROM)(struct mCore*);
38
39	bool (*loadBIOS)(struct mCore*, struct VFile* vf, int biosID);
40	bool (*selectBIOS)(struct mCore*, int biosID);
41
42	void (*reset)(struct mCore*);
43	void (*runFrame)(struct mCore*);
44	void (*runLoop)(struct mCore*);
45	void (*step)(struct mCore*);
46
47	void (*setKeys)(struct mCore*, uint32_t keys);
48	void (*addKeys)(struct mCore*, uint32_t keys);
49	void (*clearKeys)(struct mCore*, uint32_t keys);
50
51	int32_t (*frameCounter)(struct mCore*);
52	int32_t (*frameCycles)(struct mCore*);
53	int32_t (*frequency)(struct mCore*);
54
55	void (*setRTC)(struct mCore*, struct mRTCSource*);
56};
57
58#endif