public BitmapCastProperties(ref ShockwaveReader input) { int v27 = input.ReadUInt16(); TotalWidth = v27 & 0x7FFF; //TODO: what does that last bit even do.. some sneaky flag? //DIRAPI checks if TotalWidth & 0x8000 == 0 Rectangle = input.ReadRect(); AlphaThreshold = input.ReadByte(); OLE = input.ReadBytes(7).ToArray(); RegistrationPoint = input.ReadPoint(); Flags = (BitmapFlags)input.ReadByte(); if (!input.IsDataAvailable) { return; } BitDepth = input.ReadByte(); if (!input.IsDataAvailable) { return; } Palette = input.ReadInt32(); //TODO: PaletteRef or something if (!IsSystemPalette) { Palette &= 0x7FFF; } }
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); } }
public FavoriteColorsChunk(ref ShockwaveReader input, ChunkHeader header) : base(header) { Remnants.Enqueue(input.ReadInt32()); //1 Remnants.Enqueue(input.ReadInt32()); //1 for (int i = 0; i < Colors.Length; i++) { Colors[i] = Color.FromArgb(input.ReadByte(), input.ReadByte(), input.ReadByte()); } }
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 }
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(); }
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); }
public VideoCastProperties(ShockwaveReader input) { Type = input.ReadString((int)input.ReadBigEndian <uint>()); input.Position += 10; byte videoFlags = input.ReadByte(); Streaming = ((videoFlags & 1) == 1); videoFlags = input.ReadByte(); HasSound = ((videoFlags & 1) == 1); PausedAtStart = ((videoFlags & 2) == 2); Flags = (VideoCastFlags)input.ReadByte(); input.Position += 3; Framerate = input.ReadByte(); input.Position += 32; Rectangle = input.ReadRect(); }
public TextFormat(ShockwaveReader input) { Offset = input.ReadBigEndian <int>(); Height = input.ReadBigEndian <short>(); Ascent = input.ReadBigEndian <short>(); FontId = input.ReadBigEndian <short>(); Slant = input.ReadBoolean(); Padding = input.ReadByte(); FontSize = input.ReadBigEndian <short>(); Color = input.ReadColor(); }
public VideoCastProperties(ref ShockwaveReader input) { //TODO: A lot of unknown values. Type = input.ReadString((int)input.ReadUInt32()); input.Advance(10); byte videoFlags = input.ReadByte(); Streaming = ((videoFlags & 1) == 1); videoFlags = input.ReadByte(); HasSound = ((videoFlags & 1) == 1); PausedAtStart = ((videoFlags & 2) == 2); Flags = (VideoCastFlags)input.ReadByte(); input.Advance(3); Framerate = input.ReadByte(); input.Advance(32); Rectangle = input.ReadRect(); }
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(); }
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; }
public FileInfoChunk(ShockwaveReader input, ChunkHeader header) : base(header) { int bitfieldLen = input.ReadBigEndian <int>(); BitField = input.ReadBytes(bitfieldLen); Offsets = new List <int>(input.ReadBigEndian <short>()); input.ReadByte(); for (short i = 0; i < Offsets.Capacity; i++) { Offsets.Add(input.ReadBigEndian <int>()); } input.ReadByte(); CreatedBy = input.ReadString(); input.ReadByte(); ModifiedBy = input.ReadString(); input.ReadByte(); FilePath = input.ReadString(); }
public void PopulateMedia(BitmapCastProperties properties) { BitDepth = properties.BitDepth; Flags = properties.Flags; TotalWidth = properties.TotalWidth; Width = properties.Rectangle.Width; Height = properties.Rectangle.Height; if (Data.Length == TotalWidth * Height) { return; } //TODO: A closer look Span <byte> outputSpan = TotalWidth * Height < 1024 ? stackalloc byte[TotalWidth * Height] : new byte[TotalWidth * Height]; var output = new ShockwaveWriter(outputSpan, false); var input = new ShockwaveReader(Data.AsSpan()); while (input.IsDataAvailable) { byte marker = input.ReadByte(); if (marker >= 128) { Span <byte> buffer = stackalloc byte[257 - marker]; buffer.Fill(input.ReadByte()); output.Write(buffer); } else { output.Write(input.ReadBytes(marker + 1)); } } Data = outputSpan.ToArray(); }
public void PopulateMedia(BitmapCastProperties properties) { BitDepth = properties.BitDepth; Flags = properties.Flags; TotalWidth = properties.TotalWidth; Width = properties.Rectangle.Width; Height = properties.Rectangle.Height; if (Data.Length == TotalWidth * Height) { return; } using var ms = new MemoryStream(TotalWidth * Height); using var output = new ShockwaveWriter(ms); using var input = new ShockwaveReader(Data); while (input.IsDataAvailable) { byte marker = input.ReadByte(); if (marker >= 128) { Span <byte> buffer = stackalloc byte[257 - marker]; buffer.Fill(input.ReadByte()); output.Write(buffer); } else { output.Write(input.ReadBytes(++marker)); } } Data = ms.ToArray(); }
public BitmapCastProperties(ChunkHeader header, ShockwaveReader input) { bool IsDataAvailable() => input.Position < header.Offset + header.Length; TotalWidth = input.ReadBigEndian <ushort>() & 0x7FFF; Rectangle = input.ReadRect(); AlphaThreshold = input.ReadByte(); OLE = input.ReadBytes(7); //TODO: short regX = input.ReadBigEndian <short>(); short regY = input.ReadBigEndian <short>(); RegistrationPoint = new Point(regX, regY); Flags = (BitmapFlags)input.ReadByte(); if (!IsDataAvailable()) { return; } BitDepth = input.ReadByte(); if (!IsDataAvailable()) { return; } Palette = input.ReadBigEndian <int>(); //TODO: PaletteRef or something if (!IsSystemPalette) { Palette &= 0x7FFF; } }
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(); }
public AfterburnerMapChunk(ref ShockwaveReader input, ChunkHeader header) : base(header) { input.ReadByte(); Remnants.Enqueue(input.Read7BitEncodedInt()); using var deflaterInput = CreateDeflateReader(ref input); Remnants.Enqueue(deflaterInput.Read7BitEncodedInt()); Remnants.Enqueue(deflaterInput.Read7BitEncodedInt()); Entries = new AfterBurnerMapEntry[deflaterInput.Read7BitEncodedInt()]; for (int i = 0; i < Entries.Length; i++) { Entries[i] = new AfterBurnerMapEntry(deflaterInput); } }
public AfterburnerMapChunk(ShockwaveReader input, ChunkHeader header) : base(header) { input.ReadByte(); Remnants.Enqueue(input.Read7BitEncodedInt()); var decompressedInput = WrapDecompressor(input); Remnants.Enqueue(decompressedInput.Read7BitEncodedInt()); Remnants.Enqueue(decompressedInput.Read7BitEncodedInt()); Entries = new List <AfterBurnerMapEntry>(decompressedInput.Read7BitEncodedInt()); for (int i = 0; i < Entries.Capacity; i++) { Entries.Add(new AfterBurnerMapEntry(decompressedInput)); } }
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(); }
public ConfigChunk(ShockwaveReader input, ChunkHeader header) : base(header) { input.ReadBigEndian <short>(); Version = (DirectorVersion)input.ReadBigEndian <ushort>(); StageRectangle = input.ReadRect(); MinMember = input.ReadBigEndian <short>(); //Obsolete MaxMember = input.ReadBigEndian <short>(); //Obsolete Tempo = input.ReadByte(); Remnants.Enqueue(input.ReadByte()); byte g = input.ReadByte(); byte b = input.ReadByte(); Remnants.Enqueue(input.ReadBigEndian <short>()); Remnants.Enqueue(input.ReadBigEndian <short>()); Remnants.Enqueue(input.ReadBigEndian <short>()); //https://www.youtube.com/watch?v=sA_eCl4Txzs byte r = input.ReadByte(); StageBackgroundColor = Color.FromArgb(r, g, b); Remnants.Enqueue(input.ReadByte()); Remnants.Enqueue(input.ReadBigEndian <short>()); Remnants.Enqueue(input.ReadByte()); //-2 when version < 0x551 Remnants.Enqueue(input.ReadByte()); Remnants.Enqueue(input.ReadBigEndian <int>()); MovieVersion = (DirectorVersion)input.ReadBigEndian <short>(); Remnants.Enqueue(input.ReadBigEndian <short>());//16? Remnants.Enqueue(input.ReadBigEndian <int>()); Remnants.Enqueue(input.ReadBigEndian <int>()); Remnants.Enqueue(input.ReadBigEndian <int>()); Remnants.Enqueue(input.ReadByte()); Remnants.Enqueue(input.ReadByte()); Remnants.Enqueue(input.ReadBigEndian <short>()); Remnants.Enqueue(input.ReadBigEndian <short>()); RandomNumber = input.ReadBigEndian <short>(); Remnants.Enqueue(input.ReadBigEndian <int>()); Remnants.Enqueue(input.ReadBigEndian <int>()); OldDefaultPalette = input.ReadBigEndian <short>(); Remnants.Enqueue(input.ReadBigEndian <short>()); Remnants.Enqueue(input.ReadBigEndian <int>()); DefaultPalette = input.ReadBigEndian <int>(); //TODO: Remnants.Enqueue(input.ReadBigEndian <short>()); Remnants.Enqueue(input.ReadBigEndian <short>()); DownloadFramesBeforePlaying = input.ReadBigEndian <int>(); //90 //Zeros Remnants.Enqueue(input.ReadBigEndian <short>()); Remnants.Enqueue(input.ReadBigEndian <short>()); Remnants.Enqueue(input.ReadBigEndian <short>()); Remnants.Enqueue(input.ReadBigEndian <short>()); Remnants.Enqueue(input.ReadBigEndian <short>()); Remnants.Enqueue(input.ReadBigEndian <short>()); }
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()); }