all repos — mgba @ efe161161442eef655c1ed7730f0052728a15349

mGBA Game Boy Advance Emulator

src/gba/rr/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	bool (*queryReset)(struct GBARRContext*);
37
38	void (*stateSaved)(struct GBARRContext*, struct GBASerializedState*);
39	void (*stateLoaded)(struct GBARRContext*, const struct GBASerializedState*);
40
41	struct VFile* (*openSavedata)(struct GBARRContext* mgm, int flags);
42	struct VFile* (*openSavestate)(struct GBARRContext* mgm, int flags);
43
44	uint32_t frames;
45	uint32_t lagFrames;
46	enum GBARRInitFrom initFrom;
47
48	uint32_t rrCount;
49
50	struct VFile* savedata;
51};
52
53void GBARRDestroy(struct GBARRContext*);
54
55void GBARRInitRecord(struct GBA*);
56void GBARRInitPlay(struct GBA*);
57
58#endif