mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-19 00:15:30 +00:00
cleanup
svn-id: r39658
This commit is contained in:
parent
48d73ff6bf
commit
47f9b2eb6d
@ -33,7 +33,7 @@ namespace Common {
|
||||
|
||||
|
||||
#define SYNC_AS(SUFFIX,TYPE,SIZE) \
|
||||
template <class T> \
|
||||
template <typename T> \
|
||||
void syncAs ## SUFFIX(T &val) { \
|
||||
if (_loadStream) \
|
||||
val = static_cast<T>(_loadStream->read ## SUFFIX()); \
|
||||
@ -57,8 +57,29 @@ public:
|
||||
bool isSaving() { return (_saveStream != 0); }
|
||||
bool isLoading() { return (_loadStream != 0); }
|
||||
|
||||
/**
|
||||
* Return the total number of bytes synced so far.
|
||||
*/
|
||||
uint bytesSynced() const { return _bytesSynced; }
|
||||
|
||||
|
||||
/**
|
||||
* Skip a number of bytes in the data stream.
|
||||
* This is useful to skip obsolete fields in old savestates.
|
||||
*/
|
||||
void skip(uint32 size) {
|
||||
_bytesSynced += size;
|
||||
if (_loadStream)
|
||||
_loadStream->skip(size);
|
||||
else {
|
||||
while (size--)
|
||||
_saveStream->writeByte(0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sync a block of arbitrary fixed-length data.
|
||||
*/
|
||||
void syncBytes(byte *buf, uint32 size) {
|
||||
if (_loadStream)
|
||||
_loadStream->read(buf, size);
|
||||
@ -93,16 +114,6 @@ public:
|
||||
syncBytes((byte *)buf, size);
|
||||
}
|
||||
|
||||
void skip(uint32 size) {
|
||||
_bytesSynced += size;
|
||||
if (_loadStream)
|
||||
_loadStream->skip(size);
|
||||
else {
|
||||
while (size--)
|
||||
_saveStream->writeByte(0);
|
||||
}
|
||||
}
|
||||
|
||||
SYNC_AS(Byte, byte, 1)
|
||||
|
||||
SYNC_AS(Uint16LE, uint16, 2)
|
||||
|
Loading…
x
Reference in New Issue
Block a user