5 #include "common/FileBuffer.h"
6 #define MAX_REPLAYS 8 // how many automatic replays to save
22 struct ReplayRecording
42 int ffwdto
, ffwd_accel
;
45 int termtimer
; // blinks "TERMINATED" after replay ends
50 RS_UNUSED
, // there is no file in this slot
51 RS_UNLOCKED
, // there is an unlocked file in this slot
52 RS_LOCKED
// there is a locked file in this slot
57 char filename
[MAXPATHLEN
]; // filename of the replay for this slot, if there is one
58 int status
; // status of this slot
59 ReplayHeader hdr
; // header from slot
65 bool begin_record(const char *fname
);
68 bool begin_playback(const char *fname
);
74 void OnGameStarting();
75 bool begin_record_next();
81 void set_ffwd(int frame
, bool accel
=true);
82 void set_stopat(int frame
);
85 bool LoadHeader(const char *fname
, ReplayHeader
*hdr
);
86 bool SaveHeader(const char *fname
, ReplayHeader
*hdr
);
88 void GetSlotInfo(int slotno
, ReplaySlotInfo
*slot
);
89 void FramesToTime(int framecount
, char *buffer
);
90 int GetPlaybackPosition(int max
);
92 static uint32_t EncodeBits(bool *values
, int nvalues
);
93 static void DecodeBits(uint32_t value
, bool *array
, int len
);
95 static void run_record();
96 static void run_playback();
98 static int GetAvailableSlot(void);
102 const char *GetReplayName(int slotno
, char *buffer
= NULL
);