saveload.h
changeset 1093 4fdc46eaf423
parent 1024 5e446b5b3ec5
child 1217 59c024cfaf54
equal deleted inserted replaced
1092:e3b4a131db7c 1093:4fdc46eaf423
     1 #ifndef SAVELOAD_H
     1 #ifndef SAVELOAD_H
     2 #define SAVELOAD_H
     2 #define SAVELOAD_H
     3 
     3 
     4 #include <setjmp.h>
     4 #include <setjmp.h>
     5 
     5 
     6 typedef void ChunkSaveLoadProc();
     6 typedef void ChunkSaveLoadProc(void);
     7 typedef void AutolengthProc(void *arg);
     7 typedef void AutolengthProc(void *arg);
     8 
     8 
     9 typedef struct SaveLoadGlobVarList {
     9 typedef struct SaveLoadGlobVarList {
    10 	void *address;
    10 	void *address;
    11 	byte conv;
    11 	byte conv;
    24 typedef struct {
    24 typedef struct {
    25 	byte null;
    25 	byte null;
    26 } NullStruct;
    26 } NullStruct;
    27 
    27 
    28 typedef void WriterProc(uint len);
    28 typedef void WriterProc(uint len);
    29 typedef uint ReaderProc();
    29 typedef uint ReaderProc(void);
    30 
    30 
    31 typedef uint ReferenceToIntProc(void *v, uint t);
    31 typedef uint ReferenceToIntProc(void *v, uint t);
    32 typedef void *IntToReferenceProc(uint r, uint t);
    32 typedef void *IntToReferenceProc(uint r, uint t);
    33 
    33 
    34 typedef struct {
    34 typedef struct {
    60 	// these 3 may be used by compressor/decompressors.
    60 	// these 3 may be used by compressor/decompressors.
    61 	byte *buf; // pointer and size to read/write, initialized by init
    61 	byte *buf; // pointer and size to read/write, initialized by init
    62 	uint bufsize;
    62 	uint bufsize;
    63 	FILE *fh;
    63 	FILE *fh;
    64 
    64 
    65 	void (*excpt_uninit)();
    65 	void (*excpt_uninit)(void);
    66 	const char *excpt_msg;
    66 	const char *excpt_msg;
    67 	jmp_buf excpt; // used to jump to "exception handler"
    67 	jmp_buf excpt; // used to jump to "exception handler"
    68 } SaverLoader;
    68 } SaverLoader;
    69 
    69 
    70 extern SaverLoader _sl;
    70 extern SaverLoader _sl;
   157 
   157 
   158 #define SLE_END() 0xF0
   158 #define SLE_END() 0xF0
   159 
   159 
   160 
   160 
   161 void SlSetArrayIndex(uint index);
   161 void SlSetArrayIndex(uint index);
   162 int SlIterateArray();
   162 int SlIterateArray(void);
   163 void SlArray(void *array, uint length, uint conv);
   163 void SlArray(void *array, uint length, uint conv);
   164 void SlObject(void *object, const void *desc);
   164 void SlObject(void *object, const void *desc);
   165 void SlAutolength(AutolengthProc *proc, void *arg);
   165 void SlAutolength(AutolengthProc *proc, void *arg);
   166 uint SlGetFieldLength();
   166 uint SlGetFieldLength(void);
   167 int SlReadByte();
   167 int SlReadByte(void);
   168 void SlSetLength(uint length);
   168 void SlSetLength(uint length);
   169 void SlWriteByte(byte v);
   169 void SlWriteByte(byte v);
   170 void SlGlobList(const SaveLoadGlobVarList *desc);
   170 void SlGlobList(const SaveLoadGlobVarList *desc);
   171 
   171 
   172 //int GetSavegameType(char *file);
   172 //int GetSavegameType(char *file);