src/gba/gba-rr.h (view raw)
1#ifndef GBA_RR_H
2#define GBA_RR_H
3
4#include "common.h"
5
6struct GBA;
7struct VDir;
8struct VFile;
9
10enum GBARRTag {
11 TAG_INVALID = 0x00,
12 TAG_INPUT = 0x01,
13 TAG_FRAME = 0x02,
14 TAG_LAG = 0x03,
15 TAG_BEGIN = 0x10,
16 TAG_END = 0x11,
17 TAG_PREVIOUSLY = 0x12,
18 TAG_NEXT_TIME = 0x13
19};
20
21struct GBARRContext {
22 // Playback state
23 bool isPlaying;
24 bool autorecord;
25
26 // Recording state
27 bool isRecording;
28 bool inputThisFrame;
29
30 // Metadata
31 uint32_t frames;
32 uint32_t lagFrames;
33 uint32_t streamId;
34
35 // Streaming state
36 struct VDir* streamDir;
37 struct VFile* movieStream;
38 uint16_t currentInput;
39 enum GBARRTag peekedTag;
40 uint32_t nextTime;
41};
42
43void GBARRContextCreate(struct GBA*);
44void GBARRContextDestroy(struct GBA*);
45
46bool GBARRSetStream(struct GBARRContext*, struct VDir*);
47bool GBARRLoadStream(struct GBARRContext*, uint32_t streamId);
48uint32_t GBARRIncrementStream(struct GBARRContext*);
49
50bool GBARRStartPlaying(struct GBARRContext*, bool autorecord);
51void GBARRStopPlaying(struct GBARRContext*);
52bool GBARRStartRecording(struct GBARRContext*);
53void GBARRStopRecording(struct GBARRContext*);
54
55bool GBARRIsPlaying(struct GBARRContext*);
56bool GBARRIsRecording(struct GBARRContext*);
57
58void GBARRNextFrame(struct GBARRContext*);
59void GBARRLogInput(struct GBARRContext*, uint16_t input);
60uint16_t GBARRQueryInput(struct GBARRContext*);
61
62#endif