25 #include "common/scummsys.h" 26 #include "common/array.h" 27 #include "common/file.h" 28 #include "common/memstream.h" 29 #include "common/savefile.h" 30 #include "common/serializer.h" 31 #include "common/str-array.h" 32 #include "graphics/surface.h" 33 #include "mm/shared/xeen/cc_archive.h" 34 #include "mm/shared/xeen/file.h" 39 using Shared::Xeen::BaseCCArchive;
40 using Shared::Xeen::CCArchive;
41 using Shared::Xeen::CCEntry;
42 using Shared::Xeen::File;
50 #define SYNC_AS(SUFFIX,STREAM,TYPE,SIZE) \ 51 template<typename T> \ 52 void syncAs ## SUFFIX(T &val, Version minVersion = 0, Version maxVersion = kLastVersion) { \ 53 if (_version < minVersion || _version > maxVersion) \ 56 val = static_cast<TYPE>(_loadStream->read ## STREAM()); \ 58 TYPE tmp = (TYPE)val; \ 59 _saveStream->write ## STREAM(tmp); \ 61 _bytesSynced += SIZE; \ 70 CCArchive *_xeenCc =
nullptr, *_darkCc =
nullptr,
72 SaveArchive *_xeenSave =
nullptr, *_darkSave =
nullptr;
122 _parentStream(parentStream), _begin(parentStream->
pos()) {
125 uint32
write(
const void *dataPtr, uint32 dataSize)
override {
126 return _parentStream->
write(dataPtr, dataSize);
130 int64
pos()
const override {
return _parentStream->
pos() - _begin; }
141 SYNC_AS(Sint8, Byte, int8, 1)
144 if (_in && _filesize == -1)
145 _filesize = _in->
size();
146 return _in !=
nullptr && _in->
pos() >= _filesize;
194 void replaceEntry(uint16
id,
const byte *data,
size_t size);
213 void finalize()
override;
218 uint32 write(
const void *dataPtr, uint32 dataSize)
override;
223 int64 pos()
const override;
virtual int64 size() const =0
virtual int64 pos() const =0
void save(Common::WriteStream &s)
void setGameCc(int ccMode)
Definition: memstream.h:194
virtual bool flush()
Definition: stream.h:103
Definition: serializer.h:79
bool flush() override
Definition: files.h:128
void finalize() override
Definition: files.h:129
virtual int64 pos() const =0
void load(Common::SeekableReadStream &stream)
Definition: detection.h:27
uint32 write(const void *dataPtr, uint32 dataSize) override
Definition: files.h:125
Definition: cc_archive.h:51
int64 pos() const override
Definition: files.h:130
FileManager(XeenEngine *vm)
Definition: cc_archive.h:94
virtual uint32 write(const void *dataPtr, uint32 dataSize)=0