ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 // Contains information about the engine (also called
35 // "title compiler") used in this particular game.
36 // Engine version information is not present in early games.
37 class VersionInfo {
38 public:
39  VersionInfo(Chunk &chunk);
40  ~VersionInfo();
41 
42  // The version number of this engine,
43  // in the form 4.0r8 (major . minor r revision).
44  uint32 _majorVersion = 0;
45  uint32 _minorVersion = 0;
46  uint32 _revision = 0;
47 
48  // A textual description of this engine.
49  // Example: "Title Compiler T4.0r8 built Feb 13 1998 10:16:52"
50  // ^^^^^^^^^^^^^^ ^^^^^
51  // | Engine name | Version number
52  Common::String *string = nullptr;
53 };
54 
55 enum ContextDeclarationSectionType {
56  kContextDeclarationEmptySection = 0x0000,
57  kContextDeclarationPlaceholder = 0x0003,
58  kContextDeclarationFileNumber1 = 0x0004,
59  kContextDeclarationFileNumber2 = 0x0005,
60  kContextDeclarationFileReference = 0x0006,
61  kContextDeclarationName = 0x0bb8
62 };
63 
65 public:
66  ContextDeclaration(Chunk &chunk);
68 
69  Common::Array<uint32> _fileReferences;
70  uint32 _fileNumber = 0;
71  Common::String *_contextName = nullptr;
72  // Signal that there are no more declarations to read.
73  bool _isLast = false;
74 
75 private:
76  ContextDeclarationSectionType getSectionType(Chunk &chunk);
77 };
78 
79 enum UnknownDeclarationSectionType {
80  kUnknownDeclarationEmptySection = 0x0000,
81  kUnknownDeclarationUnk1 = 0x0009,
82  kUnknownDeclarationUnk2 = 0x0004
83 };
84 
86 public:
87  uint16 _unk = 0;
88  // Signal that there are no more declarations to read.
89  bool _isLast = false;
90 
91  UnknownDeclaration(Chunk &chunk);
92 
93 private:
94  UnknownDeclarationSectionType getSectionType(Chunk& chunk);
95 };
96 
97 enum FileDeclarationSectionType {
98  kFileDeclarationEmptySection = 0x0000,
99  kFileDeclarationFileId = 0x002b,
100  kFileDeclarationFileNameAndType = 0x002d
101 };
102 
103 // Indicates where a file is intended to be stored.
104 // NOTE: This might not be correct and this might be a more general "file type".
105 enum IntendedFileLocation {
106  // Usually all files that have numbers remain on the CD-ROM.
107  kFileIntendedOnCdRom = 0x0007,
108  // These UNKs only appear in George Shrinks.
109  kFileIntendedForUnk1 = 0x0008,
110  kFileIntendedForUnk2 = 0x0009,
111  // Usually only INSTALL.CXT is copied to the hard disk.
112  kFileIntendedOnHardDisk = 0x000b
113 };
114 
116 public:
117  FileDeclaration(Chunk &chunk);
118  ~FileDeclaration();
119 
120  uint32 _id = 0;
121  IntendedFileLocation _intendedLocation;
122  Common::String *_name = nullptr;
123  // Signal that there are no more declarations to read.
124  bool _isLast = false;
125 
126 private:
127  FileDeclarationSectionType getSectionType(Chunk &chunk);
128 };
129 
130 enum SubfileDeclarationSectionType {
131  kSubfileDeclarationEmptySection = 0x0000,
132  kSubfileDeclarationAssetId = 0x002a,
133  kSubfileDeclarationFileId = 0x002b,
134  kSubfileDeclarationStartOffset = 0x002c
135 };
136 
138 public:
139  SubfileDeclaration(Chunk &chunk);
140 
141  uint16 _assetId = 0;
142  uint16 _fileId = 0;
143  uint32 _startOffsetInFile = 0;
144  // Signal that there are no more context declarations to read.
145  bool _isLast = false;
146 
147 private:
148  SubfileDeclarationSectionType getSectionType(Chunk &chunk);
149 };
150 
151 // Declares a cursor, which is stored as a cursor resource in the game executable.
153 public:
154  CursorDeclaration(Chunk &chunk);
156 
157  uint16 _id = 0;
158  uint16 _unk = 0;
159  Common::String *_name = nullptr;
160 };
161 
163 public:
164  Common::String *_resourceName = nullptr;
165  int _resourceId = 0;
166 
167  EngineResourceDeclaration(Common::String *resourceName, int resourceId);
169 };
170 
171 enum BootSectionType {
172  kBootLastSection = 0x0000,
173  kBootEmptySection = 0x002e,
174  kBootContextDeclaration = 0x0002,
175  kBootVersionInformation = 0x0190,
176  kBootUnk1 = 0x0191,
177  kBootUnk2 = 0x0192,
178  kBootUnk3 = 0x0193,
179  kBootEngineResource = 0x0bba,
180  kBootEngineResourceId = 0x0bbb,
181  kBootUnknownDeclaration = 0x0007,
182  kBootFileDeclaration = 0x000a,
183  kBootSubfileDeclaration = 0x000b,
184  kBootUnk5 = 0x000c,
185  kBootCursorDeclaration = 0x0015,
186  kBootEntryScreen = 0x002f,
187  kBootAllowMultipleSounds = 0x0035,
188  kBootAllowMultipleStreams = 0x0036,
189  kBootUnk4 = 0x057b
190 };
191 
192 class Boot : Datafile {
193 private:
194  BootSectionType getSectionType(Chunk &chunk);
195 
196 public:
197  Common::String *_gameTitle = nullptr;
198  VersionInfo *_versionInfo = nullptr;
199  Common::String *_sourceString = nullptr;
201  Common::Array<UnknownDeclaration *> _unknownDeclarations;
205  Common::HashMap<uint32, EngineResourceDeclaration *> _engineResourceDeclarations;
206 
207  uint32 _entryContextId = 0;
208  bool _allowMultipleSounds = false;
209  bool _allowMultipleStreams = false;
210 
211  Boot(const Common::Path &path);
212  ~Boot();
213 };
214 
215 } // End of namespace MediaStation
216 
217 #endif
Definition: boot.h:137
Definition: str.h:59
Definition: datafile.h:81
Definition: asset.h:33
Definition: datafile.h:39
Definition: path.h:52
Definition: boot.h:115
Definition: boot.h:192
Definition: hashmap.h:85
Definition: boot.h:152
Definition: boot.h:37