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  kContextDeclarationEmptySection = 0x0000,
36  kContextDeclarationPlaceholder = 0x0003,
37  kContextDeclarationContextId = 0x0004,
38  kContextDeclarationStreamId = 0x0005,
39  kContextDeclarationParentContextId = 0x0006,
40  kContextDeclarationName = 0x0bb8
41 };
42 
44 public:
45  ContextDeclaration(Chunk &chunk);
46  ContextDeclaration() {};
47 
48  uint _contextId = 0;
49  uint _streamId = 0;
50  Common::String _name;
51  Common::Array<uint> _parentContextIds;
52 
53 private:
54  ContextDeclarationSectionType getSectionType(Chunk &chunk);
55 };
56 
57 enum ScreenDeclarationSectionType {
58  kScreenDeclarationEmpty = 0x0000,
59  kScreenDeclarationAssetId = 0x0009,
60  kScreenDeclarationScreenId = 0x0004
61 };
62 
64 public:
65  ScreenDeclaration(Chunk &chunk);
66  ScreenDeclaration() {};
67 
68  uint _assetId = 0;
69  uint _screenId = 0;
70 
71 private:
72  ScreenDeclarationSectionType getSectionType(Chunk &chunk);
73 };
74 
75 enum FileDeclarationSectionType {
76  kFileDeclarationEmptySection = 0x0000,
77  kFileDeclarationFileId = 0x002b,
78  kFileDeclarationFileNameAndType = 0x002d
79 };
80 
81 // Indicates where a file is intended to be stored.
82 // NOTE: This might not be correct and this might be a more general "file type".
83 enum IntendedFileLocation {
84  kFileLocationEmpty = 0x0000,
85  // Usually all files that have numbers remain on the CD-ROM.
86  kFileIntendedOnCdRom = 0x0007,
87  // These UNKs only appear in George Shrinks.
88  kFileIntendedForUnk1 = 0x0008,
89  kFileIntendedForUnk2 = 0x0009,
90  // Usually only INSTALL.CXT is copied to the hard disk.
91  kFileIntendedOnHardDisk = 0x000b
92 };
93 
95 public:
96  FileDeclaration(Chunk &chunk);
97  FileDeclaration() {};
98 
99  uint _id = 0;
100  IntendedFileLocation _intendedLocation = kFileLocationEmpty;
101  Common::String _name;
102 
103 private:
104  FileDeclarationSectionType getSectionType(Chunk &chunk);
105 };
106 
107 enum SubfileDeclarationSectionType {
108  kSubfileDeclarationEmptySection = 0x0000,
109  kSubfileDeclarationAssetId = 0x002a,
110  kSubfileDeclarationFileId = 0x002b,
111  kSubfileDeclarationStartOffset = 0x002c
112 };
113 
115 public:
116  SubfileDeclaration(Chunk &chunk);
117  SubfileDeclaration() {};
118 
119  uint _assetId = 0;
120  uint _fileId = 0;
121  uint _startOffsetInFile = 0;
122 
123 private:
124  SubfileDeclarationSectionType getSectionType(Chunk &chunk);
125 };
126 
127 // Declares a cursor, which is stored as a cursor resource in the game executable.
129 public:
130  CursorDeclaration(Chunk &chunk);
131  CursorDeclaration() {};
132 
133  uint _id = 0;
134  uint _unk = 0;
135  Common::String _name;
136 };
137 
139 public:
140  EngineResourceDeclaration(Common::String resourceName, int resourceId) : _name(resourceName), _id(resourceId) {};
142 
143  Common::String _name;
144  int _id = 0;
145 };
146 
147 enum BootSectionType {
148  kBootLastSection = 0x0000,
149  kBootEmptySection = 0x002e,
150  kBootContextDeclaration = 0x0002,
151  kBootVersionInformation = 0x0190,
152  kBootUnk1 = 0x0191,
153  kBootUnk2 = 0x0192,
154  kBootUnk3 = 0x0193,
155  kBootEngineResource = 0x0bba,
156  kBootEngineResourceId = 0x0bbb,
157  kBootScreenDeclaration = 0x0007,
158  kBootFileDeclaration = 0x000a,
159  kBootSubfileDeclaration = 0x000b,
160  kBootUnk5 = 0x000c,
161  kBootCursorDeclaration = 0x0015,
162  kBootEntryScreen = 0x002f,
163  kBootAllowMultipleSounds = 0x0035,
164  kBootAllowMultipleStreams = 0x0036,
165  kBootUnk4 = 0x057b
166 };
167 
168 class Boot : Datafile {
169 private:
170  BootSectionType getSectionType(Chunk &chunk);
171 
172 public:
173  Common::String _gameTitle;
174  VersionInfo _versionInfo;
175  Common::String _engineInfo;
176  Common::String _sourceString;
177  Common::HashMap<uint32, ContextDeclaration> _contextDeclarations;
178  Common::HashMap<uint32, ScreenDeclaration> _screenDeclarations;
180  Common::HashMap<uint32, SubfileDeclaration> _subfileDeclarations;
181  Common::HashMap<uint32, CursorDeclaration> _cursorDeclarations;
182  Common::HashMap<uint32, EngineResourceDeclaration> _engineResourceDeclarations;
183 
184  uint32 _entryContextId = 0;
185  bool _allowMultipleSounds = false;
186  bool _allowMultipleStreams = false;
187 
188  Boot(const Common::Path &path);
189  ~Boot();
190 };
191 
192 } // End of namespace MediaStation
193 
194 #endif
Definition: boot.h:114
Definition: datafile.h:35
Definition: str.h:59
Definition: datafile.h:145
Definition: asset.h:32
Definition: datafile.h:103
Definition: path.h:52
Definition: boot.h:94
Definition: boot.h:168
Definition: hashmap.h:85
Definition: boot.h:63
Definition: boot.h:128