diff options
Diffstat (limited to 'saveload.h')
-rw-r--r-- | saveload.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/saveload.h b/saveload.h index 3076a49626..70253734ac 100644 --- a/saveload.h +++ b/saveload.h @@ -22,6 +22,12 @@ #ifndef SAVELOAD_H #define SAVELOAD_H +struct SaveLoadEntry { + uint32 offs; + uint8 type; + uint8 size; +}; + struct SerializerStream { #ifdef NONSTANDARD_SAVE void *context; @@ -48,4 +54,38 @@ struct SerializerStream { #endif }; +typedef int SerializerSaveReference(void *me, byte type, void *ref); +typedef void *SerializerLoadReference(void *me, byte type, int ref); + +struct Serializer { + SerializerStream _saveLoadStream; + + union { + SerializerSaveReference *_save_ref; + SerializerLoadReference *_load_ref; + void *_saveload_ref; + }; + void *_ref_me; + + bool _saveOrLoad; + + void saveLoadBytes(void *b, int len); + void saveLoadArrayOf(void *b, int len, int datasize, byte filetype); + void saveLoadEntries(void *d, const SaveLoadEntry *sle); + void saveLoadArrayOf(void *b, int num, int datasize, const SaveLoadEntry *sle); + + void saveUint32(uint32 d); + void saveWord(uint16 d); + void saveByte(byte b); + + byte loadByte(); + uint16 loadWord(); + uint32 loadUint32(); + + bool isSaving() { return _saveOrLoad; } + + bool checkEOFLoadStream(); + +}; + #endif |