Пример #1
0
        public ScriptContextChunk(ref ShockwaveReader input, ChunkHeader header)
            : base(header)
        {
            Remnants.Enqueue(input.ReadInt32());
            Remnants.Enqueue(input.ReadInt32());

            Sections = new List <ScriptContextSection>(input.ReadInt32());
            input.ReadInt32();

            short entryOffset = input.ReadInt16();

            input.ReadInt16();

            Remnants.Enqueue(input.ReadInt32()); //0
            Type = input.ReadInt32();            //TODO: Enum
            Remnants.Enqueue(input.ReadInt32());

            NameListChunkId = input.ReadInt32();

            ValidCount  = input.ReadInt16(); //validCount - tremor "length"
            Flags       = input.ReadInt16(); //TODO: 1, 5
            FreeChunkId = input.ReadInt16();

            input.Position = entryOffset;

            for (int i = 0; i < Sections.Capacity; i++)
            {
                Sections.Add(new ScriptContextSection(ref input));
            }
        }
 public LingoContextSection(ref ShockwaveReader input)
 {
     Unknown = input.ReadInt32();
     Id      = input.ReadInt32();
     Flags   = (LingoContextSectionFlags)input.ReadInt16();
     Link    = input.ReadInt16();
 }
        public LingoScriptChunk(ref ShockwaveReader input, ChunkHeader header)
            : base(header)
        {
            input.IsBigEndian = true;

            input.ReadInt32();
            input.ReadInt32();

            input.ReadInt32();
            input.ReadInt32();

            input.ReadInt16();
            ScriptNumber = input.ReadInt16();

            Remnants.Enqueue(input.ReadInt16());
            input.ReadBEInt32();
            input.ReadBEInt32();
            Remnants.Enqueue(input.ReadBEInt32());
            input.ReadBEInt32();

            Type = input.ReadInt32(); //TODO: enum, Behav=0, Global=2

            Remnants.Enqueue(input.ReadInt32());
            CastMemberRef = input.ReadInt16();     //scriptId

            Remnants.Enqueue(input.ReadBEInt16()); //factoryNameId?

            Pool = new LingoValuePool(this, ref input);
        }
Пример #4
0
        public ScriptChunk(ref ShockwaveReader input, ChunkHeader header)
            : base(header)
        {
            input.IsBigEndian = true;

            Remnants.Enqueue(input.ReadInt32());
            Remnants.Enqueue(input.ReadInt32());

            input.ReadInt32();
            input.ReadInt32();

            input.ReadInt16();
            ScriptNumber = input.ReadInt16();

            Remnants.Enqueue(input.ReadInt16());
            Remnants.Enqueue(input.ReadBEInt32()); // -1
            Remnants.Enqueue(input.ReadBEInt32()); // 0
            Remnants.Enqueue(input.ReadBEInt32());
            Remnants.Enqueue(input.ReadBEInt32()); // 0

            BehaviourScript = input.ReadInt32();   //enum, Behav=0, Global=2

            Remnants.Enqueue(input.ReadInt32());
            Remnants.Enqueue(input.ReadInt16()); //scriptId

            Remnants.Enqueue(input.ReadBEInt16());

            Pool = new LingoValuePool(this, ref input);
        }
Пример #5
0
 public ChunkEntry(ShockwaveReader input)
     : this(new ChunkHeader(input))
 {
     Offset  = input.ReadInt32();
     Flags   = (ChunkEntryFlags)input.ReadInt16();
     Unknown = input.ReadInt16();
     Link    = input.ReadInt32();
 }
Пример #6
0
        public CastListEntry(ref ShockwaveReader input)
        {
            Name     = input.ReadString();
            FilePath = input.ReadString();

            PreloadSettings = input.ReadInt16();
            MemberMin       = input.ReadInt16();
            MemberCount     = input.ReadInt16();

            Id = input.ReadInt32();
        }
Пример #7
0
 public TextFormat(ref ShockwaveReader input)
 {
     Offset   = input.ReadInt32();
     Height   = input.ReadInt16();
     Ascent   = input.ReadInt16();
     FontId   = input.ReadInt16();
     Slant    = input.ReadBoolean();
     Padding  = input.ReadByte();
     FontSize = input.ReadInt16();
     Color    = input.ReadColor();
 }
Пример #8
0
        public ShapeCastProperties(ref ShockwaveReader input)
        {
            Type      = (ShapeType)input.ReadInt16();
            Rectangle = input.ReadRect();

            Pattern         = input.ReadInt16();
            ForegroundColor = input.ReadByte();
            BackgroundColor = input.ReadByte();
            IsFilled        = input.ReadBoolean(); //TODO:
            LineSize        = input.ReadByte();    //-1
            LineDirection   = input.ReadByte();    //-5
        }
Пример #9
0
        public ScoreChunk(ref ShockwaveReader input, ChunkHeader header)
            : base(header)
        {
            int totalLength = input.ReadInt32();
            int headerType  = input.ReadInt32(); //-3

            int spritePropertiesOffsetThingy = input.ReadInt32();

            int[] spritePropertyOffsets = new int[input.ReadInt32() + 1];

            int notationOffset           = input.ReadInt32() * sizeof(int) + 12 + spritePropertiesOffsetThingy; //..* 4 *..
            int lastSpritePropertyOffset = input.ReadInt32();

            for (int i = 0; i < spritePropertyOffsets.Length; i++)
            {
                spritePropertyOffsets[i] = input.ReadInt32();
            }

            //notationOffset

            int frameEndOffset = input.ReadInt32();

            Remnants.Enqueue(input.ReadInt32());

            Frames = new Frame[input.ReadInt32()];
            short framesType = input.ReadInt16(); //13, 14

            short channelLength  = input.ReadInt16();
            short lastChannelMax = input.ReadInt16(); //1006
            short lastChannel    = input.ReadInt16();

            for (int i = 0; i < Frames.Length; i++)
            {
                Frames[i] = new Frame(ref input);
            }

            int[] spritePropertyOffsetIndices = new int[input.ReadInt32()];
            for (int i = 0; i < spritePropertyOffsetIndices.Length; i++)
            {
                spritePropertyOffsetIndices[i] = input.ReadInt32();
            }

            SpriteProperties[] spriteProperties = new SpriteProperties[spritePropertyOffsetIndices.Length];
            for (int i = 0; i < spritePropertyOffsetIndices.Length; i++)
            {
                int spritePropertyOffset = spritePropertyOffsets[spritePropertyOffsetIndices[i]];

                input.Position      = notationOffset + spritePropertyOffset;
                spriteProperties[i] = new SpriteProperties(ref input);
            }
        }
Пример #10
0
        public TextCastProperties(ref ShockwaveReader input)
        {
            input.Advance(4);

            Alignment       = (TextAlignment)input.ReadInt16();
            BackgroundColor = input.ReadColor();

            Font       = input.ReadInt16();
            Rectangle  = input.ReadRect();
            LineHeight = input.ReadInt16();

            input.Advance(4);
            ButtonType = input.ReadInt16();
        }
Пример #11
0
        public AssociationTableChunk(ShockwaveReader input, ChunkHeader header)
            : base(header)
        {
            input.ReadInt16();
            input.ReadInt16();
            CastEntries   = new List <CastEntry>(input.ReadInt32());
            AssignedCount = input.ReadInt32();

            for (int i = 0; i < CastEntries.Capacity; i++)
            {
                CastEntries.Add(new CastEntry(input));
            }

            //CastEntries.RemoveRange(AssignedCount, TotalCount - AssignedCount);
        }
Пример #12
0
        public XtraListChunk(ref ShockwaveReader input, ChunkHeader header)
            : base(header)
        {
            Remnants.Enqueue(input.ReadInt32());

            int xtraCount = input.ReadInt32();

            for (int i = 0; i < xtraCount; i++)
            {
                long xtraEndOffset = input.Position + input.ReadInt32() + 4;

                int  unk2 = input.ReadInt32();
                int  unk3 = input.ReadInt32(); //Flags or just booleans?
                Guid guid = new Guid(input.ReadBytes(16));

                int[] offsets = new int[input.ReadInt16() + 1];
                for (int j = 0; j < offsets.Length; j++)
                {
                    offsets[j] = input.ReadInt32();
                }

                do
                {
                    byte unk4 = input.ReadByte(); // 1 when kind = URL
                    byte kind = input.ReadByte(); // 2 -> Name | 0 -> URL, 5 -> File, x32 ?!? no idea

                    string str = input.ReadString();
                    input.ReadByte();
                }while (input.Position != xtraEndOffset);
            }
        }
Пример #13
0
        public TextCastProperties(ref ShockwaveReader input)
        {
            BorderSize    = (SizeType)input.ReadByte();
            GutterSize    = (SizeType)input.ReadByte();
            BoxShadowSize = (SizeType)input.ReadByte();
            BoxType       = (TextBoxType)input.ReadByte();

            Alignment       = (TextAlignment)input.ReadInt16();
            BackgroundColor = input.ReadColor();
            Font            = input.ReadInt16();
            Rectangle       = input.ReadRect();
            LineHeight      = input.ReadInt16();

            TextShadowSize = (SizeType)input.ReadByte();
            MysteryFlags   = input.ReadByte();
        }
Пример #14
0
        public LingoHandler(LingoScriptChunk script, ref ShockwaveReader input)
            : this(script)
        {
            NameIndex             = input.ReadInt16();
            HandlerVectorPosition = input.ReadInt16();

            Body = new LingoHandlerBody(this, ref input);
            int codeOffset = input.ReadInt32();

            Arguments.Capacity = input.ReadInt16();
            int argumentsOffset = input.ReadInt32();

            Locals.Capacity = input.ReadInt16();
            int localsOffset = input.ReadInt32();

            input.ReadInt16(); //offset(?)
            input.ReadInt32(); //length(?)

            input.ReadInt32(); //offset?
            input.ReadInt16(); //length?

            BytesPerLine.Capacity = input.ReadInt16();
            int lineOffset = input.ReadInt32();

            Body.StackHeight = input.ReadInt32();

            int handlerEndOffset = input.Position;

            input.Position = codeOffset;
            input.ReadBytes(Body.Code);

            input.Position = argumentsOffset;
            for (int i = 0; i < Arguments.Capacity; i++)
            {
                Arguments.Add(input.ReadInt16());
            }

            input.Position = localsOffset;
            for (int i = 0; i < Locals.Capacity; i++)
            {
                Locals.Add(input.ReadInt16());
            }

            input.Position = lineOffset;
            for (int i = 0; i < BytesPerLine.Capacity; i++)
            {
                BytesPerLine.Add(input.ReadByte());
            }

            input.Position = handlerEndOffset;
        }
Пример #15
0
        public ShapeCastProperties(ref ShockwaveReader input)
        {
            Type      = (ShapeType)input.ReadInt16();
            Rectangle = input.ReadRect();

            Pattern         = input.ReadInt16();
            ForegroundColor = input.ReadByte();
            BackgroundColor = input.ReadByte();

            byte flags = input.ReadByte(); //TODO:

            IsFilled = (flags << 1) == 1;
            Ink      = (InkType)(flags & 0x3F);

            LineSize      = (byte)(input.ReadByte() - 1);
            LineDirection = (byte)(input.ReadByte() - 5);
        }
Пример #16
0
        public LingoHandler(ScriptChunk script, ref ShockwaveReader input)
            : this(script)
        {
            NameIndex             = input.ReadInt16();
            HandlerVectorPosition = input.ReadInt16();

            Body        = new LingoHandlerBody(this, input);
            _codeOffset = input.ReadInt32();

            Arguments.Capacity = input.ReadInt16();
            _argumentsOffset   = input.ReadInt32();

            Locals.Capacity = input.ReadInt16();
            _localsOffset   = input.ReadInt32();

            short unk1Length = input.ReadInt16();
            int   unk1Offset = input.ReadInt32();

            int unk2Length = input.ReadInt32();
            int unk2Offset = input.ReadInt16();

            BytesPerLine.Capacity = input.ReadInt16();
            _lineOffset           = input.ReadInt32();

            Body.StackHeight = input.ReadInt32();
        }
Пример #17
0
        public Frame(ref ShockwaveReader input)
        {
            Debug.WriteLine("## Frame start");

            long endOffset = input.Position + input.ReadInt16();

            if ((endOffset - input.Position) < 0)
            {
                Debugger.Break(); //We at padding of the framez I guess
            }
            while ((endOffset - input.Position) > 0)
            {
                short  channelLength     = input.ReadInt16();
                ushort channelOffset     = input.ReadUInt16();
                ReadOnlySpan <byte> data = input.ReadBytes(channelLength);

                Debug.WriteLine($"Channel: {channelOffset / 48} To: {channelOffset} | Len: {channelLength} | Left: {(endOffset - input.Position)}");
            }
        }
Пример #18
0
        public ScoreReferenceChunk(ref ShockwaveReader input, ChunkHeader header)
            : base(header)
        {
            input.ReadInt32();
            input.ReadInt32();

            int entryCount = input.ReadInt32();

            input.ReadInt32();

            input.ReadInt16();
            input.ReadInt16();

            Remnants.Enqueue(input.ReadInt32());

            Entries = new Dictionary <short, int>(entryCount);
            for (int i = 0; i < entryCount; i++)
            {
                Entries.Add(input.ReadInt16(), input.ReadInt32());
            }
        }
Пример #19
0
        public LingoNameChunk(ref ShockwaveReader input, ChunkHeader header)
            : base(header)
        {
            input.IsBigEndian = true;

            Remnants.Enqueue(input.ReadInt32());
            Remnants.Enqueue(input.ReadInt32());
            input.ReadInt32();
            input.ReadInt32();

            short nameOffset = input.ReadInt16();

            Names = new List <string>(input.ReadInt16());

            input.Position = nameOffset;

            for (int i = 0; i < Names.Capacity; i++)
            {
                Names.Add(input.ReadString());
            }
        }
Пример #20
0
        public MemoryMapChunk(ShockwaveReader input, ChunkHeader header)
            : base(header)
        {
            Remnants.Enqueue(input.ReadInt16());
            input.ReadInt16();

            int entryCountMax = input.ReadInt32();
            int entryCount    = input.ReadInt32();

            LastJunkId = input.ReadInt32();
            Remnants.Enqueue(input.ReadInt32());
            LastFreeId = input.ReadInt32();

            Entries = new ChunkEntry[entryCount];
            for (int i = 0; i < Entries.Length; i++)
            {
                var entry = new ChunkEntry(input);
                entry.Header.Id = i;

                Entries[i] = entry;
            }
        }
Пример #21
0
        public FileInfoChunk(ref ShockwaveReader input, ChunkHeader header)
            : base(header)
        {
            /*
             * def parseSubstrings(self, data, hasHeader=True):
             *  if hasHeader:
             *          ci_offset = read32(data)
             *          unk2 = read32(data) # not int!
             *          unk3 = read32(data) # not int!
             *          entryType = read32(data)
             *          data.seek(ci_offset)
             *  else:
             *          unk2 = 0
             *          unk3 = 0
             *          entryType = 0
             *
             *  count = read16(data) + 1
             *  entries = []
             *  for i in range(count):
             *          entries.append(read32(data))
             *  rawdata = data.read(entries[-1])
             *  assert entries[0] == 0
             *  assert entries[-1] == len(rawdata)
             *
             *  strings = []
             *  for i in range(count-1):
             *          strings.append(rawdata[entries[i]:entries[i+1]])
             *
             *  return (strings, unk2, unk3, entryType)
             *
             *
             * */

            BitField = input.ReadBytes(input.ReadInt32()).ToArray();

            Offsets = new List <int>(input.ReadInt16());

            input.ReadByte();

            for (short i = 0; i < Offsets.Capacity; i++)
            {
                Offsets.Add(input.ReadInt32());
            }

            input.ReadByte();
            CreatedBy = input.ReadString();
            input.ReadByte();
            ModifiedBy = input.ReadString();
            input.ReadByte();
            FilePath = input.ReadString();
        }
Пример #22
0
        public StyledTextChunk(ref ShockwaveReader input, ChunkHeader header)
            : base(header)
        {
            input.IsBigEndian = true;

            input.ReadInt32();
            int textLength = input.ReadInt32();

            input.ReadInt32();

            Text = input.ReadString(textLength);

            Formattings = new TextFormat[input.ReadInt16()];
            for (int i = 0; i < Formattings.Length; i++)
            {
                Formattings[i] = new TextFormat(ref input);
            }
        }
Пример #23
0
        public CommonMemberProperties(ref ShockwaveReader input)
        {
            int[] propertyOffsets = new int[input.ReadInt16() + 1];
            for (int i = 0; i < propertyOffsets.Length; i++)
            {
                propertyOffsets[i] = input.ReadInt32();
            }

            for (int i = 0; i < propertyOffsets.Length - 1; i++)
            {
                int length = propertyOffsets[i + 1] - propertyOffsets[i];
                if (length < 1)
                {
                    continue;
                }

                ReadProperty(ref input, i, length);
            }
        }
Пример #24
0
        public MovieCastListChunk(ref ShockwaveReader input, ChunkHeader header)
            : base(header)
        {
            input.IsBigEndian = true;

            input.ReadInt32();
            Entries = new List <CastListEntry>(input.ReadInt32());
            Remnants.Enqueue(input.ReadInt16());

            Unknowns = new int[input.ReadInt32()];
            for (int i = 0; i < Unknowns.Length; i++)
            {
                Unknowns[i] = input.ReadInt32();
            }

            input.ReadInt32();
            for (int i = 0; i < Entries.Capacity; i++)
            {
                Entries.Add(new CastListEntry(ref input));
            }
        }
Пример #25
0
        public GridChunk(ref ShockwaveReader input, ChunkHeader header)
            : base(header)
        {
            Remnants.Enqueue(input.ReadInt32());

            Width     = input.ReadInt16();
            Height    = input.ReadInt16();
            Display   = (GridDisplay)input.ReadInt16();
            GridColor = input.ReadInt16();

            Guides     = new Guide[input.ReadInt16()];
            GuideColor = input.ReadInt16();
            for (int i = 0; i < Guides.Length; i++)
            {
                Guides[i] = new Guide(ref input);
            }
        }
Пример #26
0
        public FileInfoChunk(ref ShockwaveReader input, ChunkHeader header)
            : base(header)
        {
            input.IsBigEndian = true;

            //TODO: VList
            BitField = input.ReadBytes(input.ReadInt32()).ToArray();

            Offsets = new List <int>(input.ReadInt16());

            input.ReadByte();

            for (short i = 0; i < Offsets.Capacity; i++)
            {
                Offsets.Add(input.ReadInt32());
            }

            input.ReadByte();
            CreatedBy = input.ReadString();
            input.ReadByte();
            ModifiedBy = input.ReadString();
            input.ReadByte();
            FilePath = input.ReadString();
        }
Пример #27
0
 public Guide(ref ShockwaveReader input)
 {
     Axis     = input.ReadInt16();
     Position = input.ReadInt16();
 }
Пример #28
0
 public ScriptCastProperties(ref ShockwaveReader input)
 {
     ScriptNumber = input.ReadInt16();
 }
 public ButtonCastProperties(ref ShockwaveReader input)
     : base(ref input)
 {
     ButtonType = (ButtonType)input.ReadInt16();
 }
Пример #30
0
        public ConfigChunk(ref ShockwaveReader input, ChunkHeader header)
            : base(header)
        {
            input.IsBigEndian = true;

            input.ReadInt16();
            Version = (DirectorVersion)input.ReadUInt16();

            StageRectangle = input.ReadRect();

            MinMember = input.ReadInt16();      //Obsolete
            MaxMember = input.ReadInt16();      //Obsolete

            Tempo = input.ReadByte();           // == 0 => 20
            Remnants.Enqueue(input.ReadByte()); //LightSwitch

            byte g = input.ReadByte();          //??
            byte b = input.ReadByte();          //??

            Remnants.Enqueue(input.ReadInt16());
            Remnants.Enqueue(input.ReadInt16()); //768 - Seen this one alot in DIRAPI
            Remnants.Enqueue(input.ReadInt16());

            byte r = input.ReadByte(); //??????????

            StageBackgroundColor = Color.FromArgb(r, g, b);

            Remnants.Enqueue(input.ReadByte());
            Remnants.Enqueue(input.ReadInt16());
            Remnants.Enqueue(input.ReadByte()); //-2 when version < 0x551
            Remnants.Enqueue(input.ReadByte());
            Remnants.Enqueue(input.ReadInt32());

            MovieVersion = (DirectorVersion)input.ReadInt16();
            Remnants.Enqueue(input.ReadInt16());//16?
            Remnants.Enqueue(input.ReadInt32());
            Remnants.Enqueue(input.ReadInt32());
            Remnants.Enqueue(input.ReadInt32());
            Remnants.Enqueue(input.ReadByte());
            Remnants.Enqueue(input.ReadByte());
            Remnants.Enqueue(input.ReadInt16());
            Remnants.Enqueue(input.ReadInt16());

            RandomNumber = input.ReadInt16();

            Remnants.Enqueue(input.ReadInt32());
            Remnants.Enqueue(input.ReadInt32());
            OldDefaultPalette = input.ReadInt16();
            Remnants.Enqueue(input.ReadInt16());
            Remnants.Enqueue(input.ReadInt32());

            DefaultPalette = input.ReadInt32(); //TODO:
            //two int16?? ^^

            Remnants.Enqueue(input.ReadInt16()); //two bytes? - IDA

            Remnants.Enqueue(input.ReadInt16());

            if (!input.IsDataAvailable)
            {
                return;
            }

            DownloadFramesBeforePlaying = input.ReadInt32(); //90
            //Zeros
            Remnants.Enqueue(input.ReadInt16());
            Remnants.Enqueue(input.ReadInt16());
            Remnants.Enqueue(input.ReadInt16());
            Remnants.Enqueue(input.ReadInt16());
            Remnants.Enqueue(input.ReadInt16());
            Remnants.Enqueue(input.ReadInt16());
        }