/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #ifndef LINGODEC_SCRIPT_H #define LINGODEC_SCRIPT_H #include "common/ptr.h" #include "common/str.h" #include "./enums.h" namespace Common { class ReadStream; } namespace LingoDec { class CodeWriterVisitor; struct Datum; struct Handler; struct ScriptContext; /* LiteralStore */ struct LiteralStore { LiteralType type; uint32 offset; Common::SharedPtr value; void readRecord(Common::SeekableReadStream &stream, int version); void readData(Common::SeekableReadStream &stream, uint32 startOffset); }; /* Script */ struct Script { /* 8 */ uint32 totalLength; /* 12 */ uint32 totalLength2; /* 16 */ uint16 headerLength; /* 18 */ uint16 scriptNumber; /* 20 */ int16 unk20; /* 22 */ int16 parentNumber; /* 38 */ uint32 scriptFlags; /* 42 */ int16 unk42; /* 44 */ int16 unk43; // This castID is not reliable /* 46 */ int16 castID; /* 48 */ int16 factoryNameID; /* 50 */ uint16 handlerVectorsCount; /* 52 */ uint32 handlerVectorsOffset; /* 56 */ uint32 handlerVectorsSize; /* 60 */ uint16 propertiesCount; /* 62 */ uint32 propertiesOffset; /* 66 */ uint16 globalsCount; /* 68 */ uint32 globalsOffset; /* 72 */ uint16 handlersCount; /* 74 */ uint32 handlersOffset; /* 78 */ uint16 literalsCount; /* 80 */ uint32 literalsOffset; /* 84 */ uint32 literalsDataCount; /* 88 */ uint32 literalsDataOffset; Common::Array propertyNameIDs; Common::Array globalNameIDs; Common::String factoryName; Common::Array propertyNames; Common::Array globalNames; Common::Array handlers; Common::Array literals; Common::Array