ScummVM API documentation
rich_game_media.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 AGS_ENGINE_AC_RICH_GAME_MEDIA_H
23 #define AGS_ENGINE_AC_RICH_GAME_MEDIA_H
24 
25 #include "common/str.h"
26 
27 namespace AGS3 {
28 
29 // Windows Vista Rich Save Games, modified to be platform-agnostic
30 
31 #define RM_MAXLENGTH 1024
32 #define RM_MAGICNUMBER MKTAG('H', 'M', 'G', 'R')
33 
34 // Forward declaration
35 namespace AGS {
36 namespace Shared {
37 class Stream;
38 } // namespace Shared
39 } // namespace AGS
40 
41 using namespace AGS; // FIXME later
42 
43 #pragma pack(push)
44 #pragma pack(1)
45 typedef struct _RICH_GAME_MEDIA_HEADER {
46 private:
47  template<class SRC, class DEST>
48  static void uconvert(const SRC *src, DEST *dest, size_t maxSize) {
49  do {
50  *dest++ = *src;
51  } while (*src++ != 0 && --maxSize > 1);
52 
53  *dest = '\0';
54  }
55 public:
56  int dwMagicNumber;
57  int dwHeaderVersion;
58  int dwHeaderSize;
59  int dwThumbnailOffsetLowerDword;
60  int dwThumbnailOffsetHigherDword;
61  int dwThumbnailSize;
62  unsigned char guidGameId[16];
63  unsigned short szGameName[RM_MAXLENGTH];
64  unsigned short szSaveName[RM_MAXLENGTH];
65  unsigned short szLevelName[RM_MAXLENGTH];
66  unsigned short szComments[RM_MAXLENGTH];
67 
68  void ReadFromFile(Shared::Stream *in);
69  void WriteToFile(Shared::Stream *out);
70 
71  void setSaveName(const Common::String &saveName);
72  Common::String getSaveName() const;
74 #pragma pack(pop)
75 
76 } // namespace AGS3
77 
78 #endif
Definition: achievements_tables.h:27
Definition: str.h:59
Definition: rich_game_media.h:45
Definition: stream.h:52
Definition: ags.h:40