ScummVM API documentation
base_persistence_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/*
23 * This file is based on WME Lite.
24 * http://dead-code.org/redir.php?target=wmelite
25 * Copyright (c) 2011 Jan Nedoma
26 */
27
28#ifndef WINTERMUTE_BASE_PERSISTENCE_MANAGER_H
29#define WINTERMUTE_BASE_PERSISTENCE_MANAGER_H
30
31
32#include "engines/wintermute/dctypes.h"
33#include "engines/wintermute/base/gfx/xmath.h"
34#include "engines/savestate.h"
35#include "common/stream.h"
36#include "common/str.h"
37#include "common/system.h"
38#include "common/rect.h"
39
40namespace Wintermute {
41
42class BaseGame;
44public:
45 char *_savedDescription;
46 Common::String _savePrefix;
47 Common::String _savedName;
48 bool saveFile(const Common::String &filename);
49 uint32 getDWORD();
50 void putDWORD(uint32 val);
51 char *getString();
52 Common::String getStringObj();
53 void putString(const char *val);
54 float getFloat();
55 void putFloat(float val);
56 double getDouble();
57 void putDouble(double val);
58 void cleanup();
59 void getSaveStateDesc(int slot, SaveStateDescriptor &desc);
60 bool deleteSaveSlot(int slot);
61 uint32 getMaxUsedSlot();
62 bool getSaveExists(int slot);
63 bool initLoad(const Common::String &filename);
64 bool initSave(const Common::String &desc);
65 bool getBytes(byte *buffer, uint32 size);
66 bool putBytes(byte *buffer, uint32 size);
67 uint32 _offset;
68
69 bool getIsSaving() { return _saving; }
70 TimeDate getSavedTimestamp() { return _savedTimestamp; }
71
72 uint32 _richBufferSize;
73 byte *_richBuffer;
74
75 bool transferPtr(const char *name, void *val);
76 bool transferSint32(const char *name, int32 *val);
77 bool transferUint32(const char *name, uint32 *val);
78 bool transferFloat(const char *name, float *val);
79 bool transferDouble(const char *name, double *val);
80 bool transferBool(const char *name, bool *val);
81 bool transferByte(const char *name, byte *val);
82 bool transferRect32(const char *name, Common::Rect32 *val);
83 bool transferPoint32(const char *name, Common::Point32 *val);
84 bool transferConstChar(const char *name, const char **val);
85 bool transferCharPtr(const char *name, char **val);
86 bool transferString(const char *name, Common::String *val);
87 bool transferVector2(const char *name, DXVector2 *val);
88 bool transferVector3d(const char *name, DXVector3 *val);
89 bool transferVector4d(const char *name, DXVector4 *val);
90 bool transferMatrix4(const char *name, DXMatrix *val);
91 BasePersistenceManager(const Common::String &savePrefix = "", bool deleteSingleton = false);
93 bool checkVersion(byte verMajor, byte verMinor, byte verBuild);
94
95 uint32 _thumbnailDataSize;
96 byte *_thumbnailData;
97 uint32 _scummVMThumbSize;
98 byte *_scummVMThumbnailData;
99 Common::String getFilenameForSlot(int slot) const;
100private:
101 bool _deleteSingleton;
102 bool readHeader(const Common::String &filename);
103 TimeDate getTimeDate();
104 bool putTimeDate(const TimeDate &t);
105 Common::WriteStream *_saveStream;
106 Common::SeekableReadStream *_loadStream;
107 TimeDate _savedTimestamp;
108 uint32 _savedPlayTime;
109 byte _savedVerMajor;
110 byte _savedVerMinor;
111 byte _savedVerBuild;
112 byte _savedExtMajor;
113 byte _savedExtMinor;
114 bool _saving;
115 BaseGame *_game;
116};
117
118} // End of namespace Wintermute
119
120#endif
Definition: stream.h:745
Definition: str.h:59
Definition: stream.h:77
Definition: savestate.h:56
Definition: base_game.h:79
Definition: base_persistence_manager.h:43
Definition: rect.h:146
Definition: rect.h:538
Definition: system.h:111
Definition: xmath.h:139
Definition: xmath.h:42
Definition: xmath.h:72
Definition: xmath.h:101