all repos — mgba @ 68454549690cb0d4bb60d2fd200b275b5f602571

mGBA Game Boy Advance Emulator

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	// Playback tags
12	TAG_INVALID = 0x00,
13	TAG_INPUT = 0x01,
14	TAG_FRAME = 0x02,
15	TAG_LAG = 0x03,
16
17	// Stream chunking tags
18	TAG_BEGIN = 0x10,
19	TAG_END = 0x11,
20	TAG_PREVIOUSLY = 0x12,
21	TAG_NEXT_TIME = 0x13,
22	TAG_MAX_STREAM = 0x14,
23
24	// Recording information tags
25	TAG_FRAME_COUNT = 0x20,
26	TAG_LAG_COUNT = 0x21,
27	TAG_RR_COUNT = 0x22,
28	TAG_INIT_TYPE = 0x23,
29
30	// User metadata tags
31	TAG_AUTHOR = 0x30,
32	TAG_COMMENT = 0x31
33};
34
35struct GBARRContext {
36	// Playback state
37	bool isPlaying;
38	bool autorecord;
39
40	// Recording state
41	bool isRecording;
42	bool inputThisFrame;
43
44	// Metadata
45	uint32_t frames;
46	uint32_t lagFrames;
47	uint32_t streamId;
48	uint32_t maxStreamId;
49
50	// Streaming state
51	struct VDir* streamDir;
52	struct VFile* movieStream;
53	uint16_t currentInput;
54	enum GBARRTag peekedTag;
55	uint32_t nextTime;
56	uint32_t previously;
57};
58
59void GBARRContextCreate(struct GBA*);
60void GBARRContextDestroy(struct GBA*);
61
62bool GBARRSetStream(struct GBARRContext*, struct VDir*);
63bool GBARRLoadStream(struct GBARRContext*, uint32_t streamId);
64bool GBARRIncrementStream(struct GBARRContext*);
65
66bool GBARRStartPlaying(struct GBARRContext*, bool autorecord);
67void GBARRStopPlaying(struct GBARRContext*);
68bool GBARRStartRecording(struct GBARRContext*);
69void GBARRStopRecording(struct GBARRContext*);
70
71bool GBARRIsPlaying(struct GBARRContext*);
72bool GBARRIsRecording(struct GBARRContext*);
73
74void GBARRNextFrame(struct GBARRContext*);
75void GBARRLogInput(struct GBARRContext*, uint16_t input);
76uint16_t GBARRQueryInput(struct GBARRContext*);
77
78#endif