ScummVM API documentation
save_manager.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 ZVISION_SAVE_MANAGER_H
23#define ZVISION_SAVE_MANAGER_H
24
25#include "common/memstream.h"
26#include "common/savefile.h"
27
28namespace Common {
29class String;
30}
31
32namespace Graphics {
33struct Surface;
34}
35
36namespace ZVision {
37
38class ZVision;
39
41 byte version;
42 Common::String saveName;
43 Graphics::Surface *thumbnail;
44 int16 saveYear, saveMonth, saveDay;
45 int16 saveHour, saveMinutes;
46 uint32 playTime;
47};
48
50public:
51 SaveManager(ZVision *engine) : _engine(engine), _tempSave(NULL), _tempThumbnail(NULL), _lastSaveTime(0) {}
52 ~SaveManager() {
53 flushSaveBuffer();
54 }
55
56 uint32 getLastSaveTime() const {
57 return _lastSaveTime;
58 }
59
60private:
61 ZVision *_engine;
62 uint32 _lastSaveTime;
63 static const uint32 SAVEGAME_ID;
64
65 enum {
66 SAVE_ORIGINAL = 0,
67 SAVE_VERSION = 2
68 };
69
72
73public:
82 void saveGame(uint slot, const Common::String &saveName, bool useSaveBuffer);
90
91 Common::SeekableReadStream *getSlotFile(uint slot);
92 bool readSaveGameHeader(Common::SeekableReadStream *in, SaveGameHeader &header, bool skipThumbnail = true);
93
94 void prepareSaveBuffer();
95 void flushSaveBuffer();
96 bool scummVMSaveLoadDialog(bool isSave);
97private:
98 void writeSaveGameHeader(Common::OutSaveFile *file, const Common::String &saveName, bool useSaveBuffer);
99};
100
101} // End of namespace ZVision
102
103#endif
Definition: error.h:81
Definition: memstream.h:194
Definition: savefile.h:54
Definition: stream.h:745
Definition: str.h:59
Definition: save_manager.h:49
void saveGame(uint slot, const Common::String &saveName, bool useSaveBuffer)
Common::Error loadGame(int slot)
bool skipThumbnail(Common::SeekableReadStream &in)
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: focus_list.h:27
Definition: surface.h:67
Definition: save_manager.h:40