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/math/rect32.h"
34 #include "engines/wintermute/base/gfx/xmath.h"
35 #include "engines/savestate.h"
36 #include "common/stream.h"
37 #include "common/str.h"
38 #include "common/system.h"
39 #include "common/rect.h"
40 
41 #ifdef ENABLE_WME3D
42 namespace Math {
43 
44 class Angle;
45 template<int rows, int cols> class Matrix;
46 typedef Matrix<4, 4> Matrix4;
47 typedef Matrix<3, 1> Vector3d;
48 
49 } // namespace Math
50 #endif
51 
52 namespace Wintermute {
53 
54 class Vector2;
55 class BaseGame;
57 public:
58  char *_savedDescription;
59  Common::String _savePrefix;
60  Common::String _savedName;
61  bool saveFile(const Common::String &filename);
62  uint32 getDWORD();
63  void putDWORD(uint32 val);
64  char *getString();
65  Common::String getStringObj();
66  void putString(const char *val);
67  float getFloat();
68  void putFloat(float val);
69  double getDouble();
70  void putDouble(double val);
71  void cleanup();
72  void getSaveStateDesc(int slot, SaveStateDescriptor &desc);
73  bool deleteSaveSlot(int slot);
74  uint32 getMaxUsedSlot();
75  bool getSaveExists(int slot);
76  bool initLoad(const Common::String &filename);
77  bool initSave(const Common::String &desc);
78  bool getBytes(byte *buffer, uint32 size);
79  bool putBytes(byte *buffer, uint32 size);
80  uint32 _offset;
81 
82  bool getIsSaving() { return _saving; }
83  TimeDate getSavedTimestamp() { return _savedTimestamp; }
84 
85  uint32 _richBufferSize;
86  byte *_richBuffer;
87 
88  bool transferPtr(const char *name, void *val);
89  bool transferSint32(const char *name, int32 *val);
90  bool transferUint32(const char *name, uint32 *val);
91  bool transferFloat(const char *name, float *val);
92  bool transferDouble(const char *name, double *val);
93  bool transferBool(const char *name, bool *val);
94  bool transferByte(const char *name, byte *val);
95  bool transferRect32(const char *name, Rect32 *val);
96  bool transferPoint32(const char *name, Point32 *val);
97  bool transferConstChar(const char *name, const char **val);
98  bool transferCharPtr(const char *name, char **val);
99  bool transferString(const char *name, Common::String *val);
100  bool transferVector2(const char *name, Vector2 *val);
101  bool transferVector3d(const char *name, DXVector3 *val);
102  bool transferVector4d(const char *name, DXVector4 *val);
103  bool transferMatrix4(const char *name, DXMatrix *val);
104  bool transferAngle(const char *name, float *val);
105  BasePersistenceManager(const Common::String &savePrefix = "", bool deleteSingleton = false);
106  virtual ~BasePersistenceManager();
107  bool checkVersion(byte verMajor, byte verMinor, byte verBuild);
108 
109  uint32 _thumbnailDataSize;
110  byte *_thumbnailData;
111  uint32 _scummVMThumbSize;
112  byte *_scummVMThumbnailData;
113  Common::String getFilenameForSlot(int slot) const;
114 private:
115  bool _deleteSingleton;
116  bool readHeader(const Common::String &filename);
117  TimeDate getTimeDate();
118  bool putTimeDate(const TimeDate &t);
119  Common::WriteStream *_saveStream;
120  Common::SeekableReadStream *_loadStream;
121  TimeDate _savedTimestamp;
122  uint32 _savedPlayTime;
123  byte _savedVerMajor;
124  byte _savedVerMinor;
125  byte _savedVerBuild;
126  byte _savedExtMajor;
127  byte _savedExtMinor;
128  bool _saving;
129  // Separate from Base, as this class can do SOME operations without a _gameRef.
130  BaseGame *_gameRef;
131 };
132 
133 } // End of namespace Wintermute
134 
135 #endif
Definition: base_game.h:76
Definition: system.h:106
Definition: str.h:59
Definition: base_persistence_manager.h:56
Definition: xmath.h:50
Definition: stream.h:77
Definition: rect32.h:31
Definition: stream.h:745
Definition: savestate.h:56
Definition: vector2.h:33
Definition: wma.h:38
Definition: rect32.h:60
Definition: xmath.h:116
Definition: xmath.h:79
Definition: achievements_tables.h:27