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