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