ScummVM API documentation
saveload.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef HOPKINS_SAVELOAD_H
23 #define HOPKINS_SAVELOAD_H
24 
25 #include "hopkins/globals.h"
26 #include "hopkins/graphics.h"
27 
28 #include "common/scummsys.h"
29 #include "common/savefile.h"
30 #include "common/serializer.h"
31 #include "common/str.h"
32 
33 namespace Hopkins {
34 
35 class HopkinsEngine;
36 
37 #define HOPKINS_SAVEGAME_VERSION 4
38 
40  uint8 _version;
41  Common::String _saveName;
42  Graphics::Surface *_thumbnail;
43  int _year, _month, _day;
44  int _hour, _minute;
45  int _totalFrames;
46 };
47 
49 private:
50  HopkinsEngine *_vm;
51 
53  void syncSavegameData(Common::Serializer &s, int version);
54  void syncCharacterLocation(Common::Serializer &s, CharacterLocation &item);
55 public:
57 
58  bool saveExists(const Common::String &file);
59  bool save(const Common::String &file, const void *buf, size_t n);
60  bool saveFile(const Common::String &file, const void *buf, size_t n);
61  void load(const Common::String &file, byte *buf);
62 
63  WARN_UNUSED_RESULT static bool readSavegameHeader(Common::InSaveFile *in, hopkinsSavegameHeader &header, bool skipThumbnail = true);
64  void writeSavegameHeader(Common::OutSaveFile *out, hopkinsSavegameHeader &header);
65  WARN_UNUSED_RESULT bool readSavegameHeader(int slot, hopkinsSavegameHeader &header, bool skipThumbnail = true);
66  Common::Error saveGame(int slot, const Common::String &saveName);
67  Common::Error loadGame(int slot);
68 
72  void convertThumb16To8(Graphics::Surface *thumb16, Graphics::Surface *thumb8);
73 };
74 
75 } // End of namespace Hopkins
76 
77 #endif /* HOPKINS_SAVELOAD_H */
Definition: str.h:59
Definition: surface.h:67
Definition: savefile.h:54
Definition: error.h:84
Definition: globals.h:37
Definition: stream.h:745
Definition: saveload.h:39
Definition: serializer.h:79
bool createThumbnail(Graphics::Surface &thumb)
bool skipThumbnail(Common::SeekableReadStream &in)
Definition: anim.h:30
Definition: saveload.h:48
Definition: hopkins.h:86