all repos — mgba @ 22245617f434049f4646916d1b2930d376503b0d

mGBA Game Boy Advance Emulator

src/gba/supervisor/rr.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_RR_H
 7#define GBA_RR_H
 8
 9#include "util/common.h"
10
11#include "gba/serialize.h"
12
13struct VFile;
14
15enum GBARRInitFrom {
16	INIT_EX_NIHILO = 0,
17	INIT_FROM_SAVEGAME = 1,
18	INIT_FROM_SAVESTATE = 2,
19	INIT_FROM_BOTH = 3,
20};
21
22struct GBARRContext {
23	void (*destroy)(struct GBARRContext*);
24
25	bool (*startPlaying)(struct GBARRContext*, bool autorecord);
26	void (*stopPlaying)(struct GBARRContext*);
27	bool (*startRecording)(struct GBARRContext*);
28	void (*stopRecording)(struct GBARRContext*);
29
30	bool (*isPlaying)(const struct GBARRContext*);
31	bool (*isRecording)(const struct GBARRContext*);
32
33	void (*nextFrame)(struct GBARRContext*);
34	void (*logInput)(struct GBARRContext*, uint16_t input);
35	uint16_t (*queryInput)(struct GBARRContext*);
36
37	void (*stateSaved)(struct GBARRContext*, struct GBASerializedState*);
38	void (*stateLoaded)(struct GBARRContext*, const struct GBASerializedState*);
39
40	struct VFile* (*openSavedata)(struct GBARRContext* mgm, int flags);
41	struct VFile* (*openSavestate)(struct GBARRContext* mgm, int flags);
42
43	uint32_t frames;
44	uint32_t lagFrames;
45	enum GBARRInitFrom initFrom;
46
47	uint32_t rrCount;
48
49	struct VFile* savedata;
50};
51
52void GBARRDestroy(struct GBARRContext*);
53
54void GBARRInitRecord(struct GBA*);
55void GBARRInitPlay(struct GBA*);
56
57#endif