ScummVM API documentation
boot.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 MEDIASTATION_BOOT_H
23 #define MEDIASTATION_BOOT_H
24 
25 #include "common/path.h"
26 #include "common/str.h"
27 #include "common/array.h"
28 #include "common/hashmap.h"
29 
30 #include "mediastation/datafile.h"
31 
32 namespace MediaStation {
33 
34 enum ContextDeclarationSectionType {
35  kContextDeclarationPlaceholder = 0x0003,
36  kContextDeclarationContextId = 0x0004,
37  kContextDeclarationStreamId = 0x0005,
38  kContextDeclarationParentContextId = 0x0006,
39  kContextDeclarationName = 0x0bb8
40 };
41 
43 public:
44  ContextDeclaration(Chunk &chunk);
45  ContextDeclaration() {};
46 
47  uint _contextId = 0;
48  uint _streamId = 0;
49  Common::String _name;
50  Common::Array<uint> _parentContextIds;
51 
52 private:
53  ContextDeclarationSectionType getSectionType(Chunk &chunk);
54 };
55 
56 enum ScreenDeclarationSectionType {
57  kScreenDeclarationActorId = 0x0009,
58  kScreenDeclarationScreenId = 0x0004
59 };
60 
62 public:
63  ScreenDeclaration(Chunk &chunk);
64  ScreenDeclaration() {};
65 
66  uint _actorId = 0;
67  uint _screenId = 0;
68 
69 private:
70  ScreenDeclarationSectionType getSectionType(Chunk &chunk);
71 };
72 
73 enum FileDeclarationSectionType {
74  kFileDeclarationEmptySection = 0x0000,
75  kFileDeclarationFileId = 0x002b,
76  kFileDeclarationFileNameAndType = 0x002d
77 };
78 
79 // Indicates where a file is intended to be stored.
80 // NOTE: This might not be correct and this might be a more general "file type".
81 enum IntendedFileLocation {
82  kFileLocationEmpty = 0x0000,
83  // Usually all files that have numbers remain on the CD-ROM.
84  kFileIntendedOnCdRom = 0x0007,
85  // These UNKs only appear in George Shrinks.
86  kFileIntendedForUnk1 = 0x0008,
87  kFileIntendedForUnk2 = 0x0009,
88  // Usually only INSTALL.CXT is copied to the hard disk.
89  kFileIntendedOnHardDisk = 0x000b
90 };
91 
93 public:
94  FileDeclaration(Chunk &chunk);
95  FileDeclaration() {};
96 
97  uint _id = 0;
98  IntendedFileLocation _intendedLocation = kFileLocationEmpty;
99  Common::String _name;
100 
101 private:
102  FileDeclarationSectionType getSectionType(Chunk &chunk);
103 };
104 
105 enum SubfileDeclarationSectionType {
106  kSubfileDeclarationEmptySection = 0x0000,
107  kSubfileDeclarationActorId = 0x002a,
108  kSubfileDeclarationFileId = 0x002b,
109  kSubfileDeclarationStartOffset = 0x002c
110 };
111 
113 public:
114  SubfileDeclaration(Chunk &chunk);
115  SubfileDeclaration() {};
116 
117  uint _actorId = 0;
118  uint _fileId = 0;
119  uint _startOffsetInFile = 0;
120 
121 private:
122  SubfileDeclarationSectionType getSectionType(Chunk &chunk);
123 };
124 
125 // Declares a cursor, which is stored as a cursor resource in the game executable.
127 public:
128  CursorDeclaration(Chunk &chunk);
129  CursorDeclaration() {};
130 
131  uint _id = 0;
132  uint _unk = 0;
133  Common::String _name;
134 };
135 
137 public:
138  EngineResourceDeclaration(Common::String resourceName, int resourceId) : _name(resourceName), _id(resourceId) {};
140 
141  Common::String _name;
142  int _id = 0;
143 };
144 
145 enum BootStreamType {
146  kBootDocumentDef = 0x01,
147  kBootControlCommands = 0x0d,
148 };
149 
150 enum BootSectionType {
151  kBootLastSection = 0x0000,
152  kBootContextDeclaration = 0x0002,
153  kBootVersionInformation = 0x0190,
154  kBootUnk1 = 0x0191,
155  kBootFunctionTableSize = 0x0192,
156  kBootUnk3 = 0x0193,
157  kBootEngineResource = 0x0bba,
158  kBootEngineResourceId = 0x0bbb,
159  kBootScreenDeclaration = 0x0007,
160  kBootFileDeclaration = 0x000a,
161  kBootSubfileDeclaration = 0x000b,
162 };
163 
164 class Boot : Datafile {
165 private:
166  BootSectionType getSectionType(Chunk &chunk);
167 
168 public:
169  Common::String _gameTitle;
170  VersionInfo _versionInfo;
171  Common::String _engineInfo;
172  Common::String _sourceString;
173  Common::HashMap<uint32, ContextDeclaration> _contextDeclarations;
174  Common::HashMap<uint32, ScreenDeclaration> _screenDeclarations;
177  Common::HashMap<uint32, EngineResourceDeclaration> _engineResourceDeclarations;
178  uint _unk1 = 0;
179  uint _functionTableSize = 0;
180  uint _unk3 = 0;
181 
182  void readDocumentDef(Chunk &chunk);
183  void readDocumentInfoFromStream(Chunk &chunk, BootSectionType sectionType);
184  void readVersionInfoFromStream(Chunk &chunk);
185  void readContextReferencesFromStream(Chunk &chunk);
186  void readScreenDeclarationsFromStream(Chunk &chunk);
187  void readAndAddFileMaps(Chunk &chunk);
188  void readAndAddStreamMaps(Chunk &chunk);
189 
190  void readStartupInformation(Chunk &chunk);
191 
192  Boot(const Common::Path &path);
193  ~Boot();
194 };
195 
196 } // End of namespace MediaStation
197 
198 #endif
Definition: boot.h:112
Definition: datafile.h:35
Definition: str.h:59
Definition: datafile.h:144
Definition: actor.h:33
Definition: datafile.h:102
Definition: path.h:52
Definition: boot.h:92
Definition: boot.h:164
Definition: hashmap.h:85
Definition: boot.h:61
Definition: boot.h:126