|
|
|
@ -649,51 +649,24 @@ void SlWriteByte(byte b)
|
|
|
|
|
_sl.dumper->WriteByte(b);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int SlReadUint16()
|
|
|
|
|
{
|
|
|
|
|
int x = SlReadByte() << 8;
|
|
|
|
|
return x | SlReadByte();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline uint32 SlReadUint32()
|
|
|
|
|
{
|
|
|
|
|
uint32 x = SlReadUint16() << 16;
|
|
|
|
|
return x | SlReadUint16();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline uint64 SlReadUint64()
|
|
|
|
|
{
|
|
|
|
|
uint32 x = SlReadUint32();
|
|
|
|
|
uint32 y = SlReadUint32();
|
|
|
|
|
return (uint64)x << 32 | y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void SlWriteUint16(uint16 v)
|
|
|
|
|
{
|
|
|
|
|
SlWriteByte(GB(v, 8, 8));
|
|
|
|
|
SlWriteByte(GB(v, 0, 8));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void SlWriteUint32(uint32 v)
|
|
|
|
|
{
|
|
|
|
|
SlWriteUint16(GB(v, 16, 16));
|
|
|
|
|
SlWriteUint16(GB(v, 0, 16));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void SlWriteUint64(uint64 x)
|
|
|
|
|
/**
|
|
|
|
|
* Returns number of bytes read so far
|
|
|
|
|
* May only be called during a load/load check action
|
|
|
|
|
*/
|
|
|
|
|
size_t SlGetBytesRead()
|
|
|
|
|
{
|
|
|
|
|
SlWriteUint32((uint32)(x >> 32));
|
|
|
|
|
SlWriteUint32((uint32)x);
|
|
|
|
|
assert(_sl.action == SLA_LOAD || _sl.action == SLA_LOAD_CHECK);
|
|
|
|
|
return _sl.reader->GetSize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read in bytes from the file/data structure but don't do
|
|
|
|
|
* anything with them, discarding them in effect
|
|
|
|
|
* @param length The amount of bytes that is being treated this way
|
|
|
|
|
* Returns number of bytes written so far
|
|
|
|
|
* May only be called during a save action
|
|
|
|
|
*/
|
|
|
|
|
static inline void SlSkipBytes(size_t length)
|
|
|
|
|
size_t SlGetBytesWritten()
|
|
|
|
|
{
|
|
|
|
|
for (; length != 0; length--) SlReadByte();
|
|
|
|
|
assert(_sl.action == SLA_SAVE);
|
|
|
|
|
return _sl.dumper->GetSize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|