/* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ #ifndef MEDIASTATION_BOOT_H #define MEDIASTATION_BOOT_H #include "common/path.h" #include "common/str.h" #include "common/array.h" #include "common/hashmap.h" #include "mediastation/datafile.h" namespace MediaStation { // Contains information about the engine (also called // "title compiler") used in this particular game. // Engine version information is not present in early games. class VersionInfo { public: VersionInfo(Chunk &chunk); ~VersionInfo(); // The version number of this engine, // in the form 4.0r8 (major . minor r revision). uint32 _majorVersion = 0; uint32 _minorVersion = 0; uint32 _revision = 0; // A textual description of this engine. // Example: "Title Compiler T4.0r8 built Feb 13 1998 10:16:52" // ^^^^^^^^^^^^^^ ^^^^^ // | Engine name | Version number Common::String *string = nullptr; }; enum ContextDeclarationSectionType { kContextDeclarationEmptySection = 0x0000, kContextDeclarationPlaceholder = 0x0003, kContextDeclarationFileNumber1 = 0x0004, kContextDeclarationFileNumber2 = 0x0005, kContextDeclarationFileReference = 0x0006, kContextDeclarationName = 0x0bb8 }; class ContextDeclaration { public: ContextDeclaration(Chunk &chunk); ~ContextDeclaration(); Common::Array _fileReferences; uint32 _fileNumber = 0; Common::String *_contextName = nullptr; // Signal that there are no more declarations to read. bool _isLast = false; private: ContextDeclarationSectionType getSectionType(Chunk &chunk); }; enum UnknownDeclarationSectionType { kUnknownDeclarationEmptySection = 0x0000, kUnknownDeclarationUnk1 = 0x0009, kUnknownDeclarationUnk2 = 0x0004 }; class UnknownDeclaration { public: uint16 _unk = 0; // Signal that there are no more declarations to read. bool _isLast = false; UnknownDeclaration(Chunk &chunk); private: UnknownDeclarationSectionType getSectionType(Chunk& chunk); }; enum FileDeclarationSectionType { kFileDeclarationEmptySection = 0x0000, kFileDeclarationFileId = 0x002b, kFileDeclarationFileNameAndType = 0x002d }; // Indicates where a file is intended to be stored. // NOTE: This might not be correct and this might be a more general "file type". enum IntendedFileLocation { // Usually all files that have numbers remain on the CD-ROM. kFileIntendedOnCdRom = 0x0007, // These UNKs only appear in George Shrinks. kFileIntendedForUnk1 = 0x0008, kFileIntendedForUnk2 = 0x0009, // Usually only INSTALL.CXT is copied to the hard disk. kFileIntendedOnHardDisk = 0x000b }; class FileDeclaration { public: FileDeclaration(Chunk &chunk); ~FileDeclaration(); uint32 _id = 0; IntendedFileLocation _intendedLocation; Common::String *_name = nullptr; // Signal that there are no more declarations to read. bool _isLast = false; private: FileDeclarationSectionType getSectionType(Chunk &chunk); }; enum SubfileDeclarationSectionType { kSubfileDeclarationEmptySection = 0x0000, kSubfileDeclarationAssetId = 0x002a, kSubfileDeclarationFileId = 0x002b, kSubfileDeclarationStartOffset = 0x002c }; class SubfileDeclaration { public: SubfileDeclaration(Chunk &chunk); uint16 _assetId = 0; uint16 _fileId = 0; uint32 _startOffsetInFile = 0; // Signal that there are no more context declarations to read. bool _isLast = false; private: SubfileDeclarationSectionType getSectionType(Chunk &chunk); }; // Declares a cursor, which is stored as a cursor resource in the game executable. class CursorDeclaration { public: CursorDeclaration(Chunk &chunk); ~CursorDeclaration(); uint16 _id = 0; uint16 _unk = 0; Common::String *_name = nullptr; }; class EngineResourceDeclaration { public: Common::String *_resourceName = nullptr; int _resourceId = 0; EngineResourceDeclaration(Common::String *resourceName, int resourceId); ~EngineResourceDeclaration(); }; enum BootSectionType { kBootLastSection = 0x0000, kBootEmptySection = 0x002e, kBootContextDeclaration = 0x0002, kBootVersionInformation = 0x0190, kBootUnk1 = 0x0191, kBootUnk2 = 0x0192, kBootUnk3 = 0x0193, kBootEngineResource = 0x0bba, kBootEngineResourceId = 0x0bbb, kBootUnknownDeclaration = 0x0007, kBootFileDeclaration = 0x000a, kBootSubfileDeclaration = 0x000b, kBootUnk5 = 0x000c, kBootCursorDeclaration = 0x0015, kBootEntryScreen = 0x002f, kBootAllowMultipleSounds = 0x0035, kBootAllowMultipleStreams = 0x0036, kBootUnk4 = 0x057b }; class Boot : Datafile { private: BootSectionType getSectionType(Chunk &chunk); public: Common::String *_gameTitle = nullptr; VersionInfo *_versionInfo = nullptr; Common::String *_sourceString = nullptr; Common::HashMap _contextDeclarations; Common::Array _unknownDeclarations; Common::HashMap _fileDeclarations; Common::HashMap _subfileDeclarations; Common::HashMap _cursorDeclarations; Common::HashMap _engineResourceDeclarations; uint32 _entryContextId = 0; bool _allowMultipleSounds = false; bool _allowMultipleStreams = false; Boot(const Common::Path &path); ~Boot(); }; } // End of namespace MediaStation #endif