22#ifndef COMMON_RECORDERFILE_H
23#define COMMON_RECORDERFILE_H
25#include "common/scummsys.h"
26#include "common/events.h"
27#include "common/mutex.h"
28#include "common/memstream.h"
29#include "common/config-manager.h"
30#include "common/savefile.h"
33#define kMaxBufferedRecords 10000
34#define kRecordBuffSize sizeof(RecorderEvent) * kMaxBufferedRecords
42enum RecorderEventType {
43 kRecorderEventTypeNormal = 0,
44 kRecorderEventTypeTimer = 1,
45 kRecorderEventTypeTimeDate = 2,
46 kRecorderEventTypeScreenUpdate = 3,
47 kRecorderEventTypePoll = 4,
51 RecorderEventType recordedtype;
58 recordedtype = kRecorderEventTypeNormal;
70 recordedtype = kRecorderEventTypeNormal;
91 enum PlaybackFileState {
92 kFileStateCheckFormat,
93 kFileStateCheckVersion,
94 kFileStateProcessHash,
95 kFileStateProcessHeader,
96 kFileStateProcessRandom,
97 kFileStateSelectSection,
98 kFileStateProcessSettings,
99 kFileStateProcessSave,
104 kFormatIdTag =
MKTAG(
'P',
'B',
'C',
'K'),
105 kVersionTag =
MKTAG(
'V',
'E',
'R',
'S'),
106 kHeaderSectionTag =
MKTAG(
'H',
'E',
'A',
'D'),
107 kHashSectionTag =
MKTAG(
'H',
'A',
'S',
'H'),
108 kRandomSectionTag =
MKTAG(
'R',
'A',
'N',
'D'),
109 kEventTag =
MKTAG(
'E',
'V',
'N',
'T'),
110 kScreenShotTag =
MKTAG(
'T',
'H',
'M',
'B'),
111 kSettingsSectionTag =
MKTAG(
'S',
'E',
'T',
'T'),
112 kAuthorTag =
MKTAG(
'H',
'A',
'U',
'T'),
113 kCommentsTag =
MKTAG(
'H',
'C',
'M',
'T'),
114 kNameTag =
MKTAG(
'H',
'N',
'A',
'M'),
115 kHashRecordTag =
MKTAG(
'H',
'R',
'C',
'D'),
116 kRandomRecordTag =
MKTAG(
'R',
'R',
'C',
'D'),
117 kSettingsRecordTag =
MKTAG(
'S',
'R',
'E',
'C'),
118 kSettingsRecordKeyTag =
MKTAG(
'S',
'K',
'E',
'Y'),
119 kSettingsRecordValueTag =
MKTAG(
'S',
'V',
'A',
'L'),
120 kSaveTag =
MKTAG(
'S',
'A',
'V',
'E'),
121 kSaveRecordTag =
MKTAG(
'R',
'S',
'A',
'V'),
122 kSaveRecordNameTag =
MKTAG(
'S',
'N',
'A',
'M'),
123 kSaveRecordBufferTag =
MKTAG(
'S',
'B',
'U',
'F'),
124 kMD5Tag =
MKTAG(
'M',
'D',
'5',
' ')
149 bool openWrite(
const String &fileName);
150 bool openRead(
const String &fileName);
153 bool hasNextEvent()
const;
160 int getScreensCount();
162 bool isEventsBufferEmpty()
const;
167 uint32 getVersion()
const {
return _version;}
169 Array<byte> _tmpBuffer;
170 WriteStream *_recordFile;
171 WriteStream *_writeStream;
172 WriteStream *_screenshotsFile;
173 MemoryReadStream _tmpPlaybackFile;
174 SeekableReadStream *_readStream;
175 SeekableMemoryWriteStream _tmpRecordFile;
181 PlaybackFileHeader _header;
182 PlaybackFileState _playbackParseState;
187 bool processChunk(ChunkHeader &nextChunk);
188 void returnToChunkHeader();
190 bool readSaveRecord();
191 void checkRecordedMD5();
192 bool readChunkHeader(ChunkHeader &nextChunk);
193 void processRndSeedRecord(ChunkHeader chunk);
194 bool processSettingsRecord();
196 bool checkPlaybackFileVersion();
198 void dumpHeaderToFile();
199 void writeSaveFilesSection();
200 void writeGameSettings();
201 void writeHeaderSection();
202 void writeGameHash();
203 void writeRandomRecords();
205 void dumpRecordsToFile();
207 String readString(
int len);
208 void readHashMap(ChunkHeader chunk);
210 bool skipToNextScreenshot();
211 void readEvent(RecorderEvent& event);
212 void readEventsToBuffer(uint32 size);
Definition: recorderfile.h:84
Definition: managed_surface.h:51
#define MKTAG(a0, a1, a2, a3)
Definition: endian.h:188
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: recorderfile.h:131
Definition: recorderfile.h:50
int tm_year
Definition: system.h:117
int tm_mon
Definition: system.h:116
int tm_wday
Definition: system.h:118
int tm_mday
Definition: system.h:115
int tm_sec
Definition: system.h:112
int tm_min
Definition: system.h:113
int tm_hour
Definition: system.h:114