ScummVM API documentation
savegame.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 SCI_ENGINE_SAVEGAME_H
23 #define SCI_ENGINE_SAVEGAME_H
24 
25 #include "common/scummsys.h"
26 #include "common/str.h"
27 
28 #include "sci/sci.h"
29 
30 namespace Sci {
31 
32 struct EngineState;
33 
34 /*
35  * Savegame format history:
36  *
37  * Version - new/changed feature
38  * =============================
39  * 46 - Sync MusicEntry::fadeSetVolume and MusicEntry::fadeCompleted
40  * 45 - Sync MusicEntry::stopAfterFading
41  * 44 - GK2+SCI3 audio resource locks
42  * 43 - stop saving SCI3 mustSetViewVisible array
43  * 42 - SCI3 robots and VM objects
44  * 41 - palette support for newer SCI2.1 games; stable SCI2/2.1 save games
45  * 40 - always store palvary variables
46  * 39 - Accurate SCI32 arrays/strings, score metadata, avatar metadata
47  * 38 - SCI32 cursor
48  * 37 - Segment entry data changed to pointers
49  * 36 - SCI32 bitmap segment
50  * 35 - SCI32 remap
51  * 34 - SCI32 palettes, and store play time in ticks
52  * 33 - new overridePriority flag in MusicEntry
53  * 32 - new playBed flag in MusicEntry
54  * 31 - priority for sound effects/music is now a signed int16, instead of a byte
55  * 30 - synonyms
56  * 29 - system strings
57  * 28 - heap
58  * 27 - script created windows
59  * 26 - play time
60  * 25 - palette intensity
61  * 24 - palvary
62  * 23 - script buffer and heap size
63  * 22 - game signature
64  * 21 - script local variables
65  * 20 - exports/synonyms
66  * 19 - exportsAreWide
67  * 18 - SCI32 arrays/strings
68  * 17 - sound
69  *
70  */
71 
72 enum {
73  CURRENT_SAVEGAME_VERSION = 46,
74  MINIMUM_SAVEGAME_VERSION = 14
75 #ifdef ENABLE_SCI32
76  ,
77  MINIMUM_SCI32_SAVEGAME_VERSION = 41
78 #endif
79 };
80 
81 // Savegame metadata
83  Common::String name;
84  int version;
85  Common::String gameVersion;
86  int saveDate;
87  int saveTime;
88  uint32 playTime;
89  uint16 gameObjectOffset;
90  uint16 script0Size;
91 
92  // Used by Shivers 1
93  uint16 lowScore;
94  uint16 highScore;
95 
96  // Used by MGDX
97  uint8 avatarId;
98 };
99 
108 bool gamestate_save(EngineState *s, int saveId, const Common::String &savename, const Common::String &version);
109 
118 bool gamestate_save(EngineState *s, Common::WriteStream *save, const Common::String &savename, const Common::String &version);
119 
120 // does a few fixups right after restoring a saved game
121 void gamestate_afterRestoreFixUp(EngineState *s, int savegameId);
122 
129 bool gamestate_restore(EngineState *s, int saveId);
130 
137 
142 
146 void set_savegame_metadata(Common::Serializer &ser, Common::WriteStream *fh, const Common::String &savename, const Common::String &version);
147 void set_savegame_metadata(Common::WriteStream *fh, const Common::String &savename, const Common::String &version);
148 
149 } // End of namespace Sci
150 
151 #endif // SCI_ENGINE_SAVEGAME_H
Definition: savegame.h:82
Definition: state.h:100
Definition: str.h:59
Definition: stream.h:77
bool gamestate_save(EngineState *s, int saveId, const Common::String &savename, const Common::String &version)
bool get_savegame_metadata(Common::SeekableReadStream *stream, SavegameMetadata &meta)
Definition: stream.h:745
Definition: serializer.h:79
Definition: console.h:28
void set_savegame_metadata(Common::Serializer &ser, Common::WriteStream *fh, const Common::String &savename, const Common::String &version)
bool gamestate_restore(EngineState *s, int saveId)