Exemplo n.º 1
0
        public override void LoadFromBinaryReader(System.IO.Stream binaryReader)
        {
            base.LoadFromBinaryReader(binaryReader);

            if (BinaryHelper.ConvertByteArrayToUTF8String(binaryReader.PeekBytes(4)) == "BOMP")
            {
                var BOMP = new ImageBomp(this);
                BOMP.LoadFromBinaryReader(binaryReader);
                Childrens.Add(BOMP);
            }
            else
            {
                var SMAP = new ImageStripTable(this, _imageSize);
                SMAP.LoadFromBinaryReader(binaryReader);
                Childrens.Add(SMAP);
            }

            var  nextBlockName = BinaryHelper.ConvertByteArrayToUTF8String(binaryReader.PeekBytes(4));
            byte planeNumber   = 0;

            while (nextBlockName.Substring(0, 2) == "ZP" && (int.Parse(nextBlockName.Substring(2)) < 99))
            {
                planeNumber++;

                var zPlane = new ZPlane(this, planeNumber, _imageSize);
                zPlane.LoadFromBinaryReader(binaryReader);
                Childrens.Add(zPlane);

                nextBlockName = BinaryHelper.ConvertByteArrayToUTF8String(binaryReader.PeekBytes(4));
            }
        }
Exemplo n.º 2
0
        public override void LoadFromBinaryReader(System.IO.Stream binaryReader)
        {
            base.LoadFromBinaryReader(binaryReader);

            Offsets = new List <uint>();

            while (BinaryHelper.ConvertByteArrayToUTF8String(binaryReader.PeekBytes(4)) != "APAL")
            {
                Offsets.Add(binaryReader.ReadUint32());
            }
        }
Exemplo n.º 3
0
        public override void LoadFromBinaryReader(System.IO.Stream binaryReader)
        {
            base.LoadFromBinaryReader(binaryReader);
            Contents = binaryReader.ReadBytes((int)(BlockSize - 8));

            //Hack para o monkey island 2 com vozes.
            if (BinaryHelper.ConvertByteArrayToUTF8String(binaryReader.PeekBytes(4)) == "021_")
            {
                var lstBytes = new List <byte>(Contents);
                lstBytes.AddRange(binaryReader.ReadBytes(8));

                Contents = lstBytes.ToArray();
            }
        }
Exemplo n.º 4
0
        public virtual void LoadFromBinaryReader(Stream binaryReader)
        {
            //if (binaryReader.Position == 3091223) Debugger.Break();

            BlockOffSet = binaryReader.Position;
            string typeRead = BinaryHelper.ConvertByteArrayToUTF8String(binaryReader.ReadBytes(4));

            if (BlockType != typeRead)
            {
                throw new InvalidFileFormatException(string.Format("Sequencia de caracteres não esperada. Esperado '{0}' mas veio '{1}'", BlockType, typeRead));
            }

            BlockSize = binaryReader.ReadUint32(true);
        }
Exemplo n.º 5
0
        public override void LoadFromBinaryReader(Stream binaryReader)
        {
            base.LoadFromBinaryReader(binaryReader);

            var ROOM = new RoomBlock(this);

            ROOM.LoadFromBinaryReader(binaryReader);
            Childrens.Add(ROOM);

            var blocosPossiveis = new [] { "SCRP", "SOUN", "COST", "CHAR" };

            string typeRead = BinaryHelper.ConvertByteArrayToUTF8String(binaryReader.PeekBytes(4));

            while (blocosPossiveis.Any(x => x.Equals(typeRead)))
            {
                switch (typeRead)
                {
                case "COST":
                    var costumeBlock = new Costume(this);
                    costumeBlock.LoadFromBinaryReader(binaryReader);
                    Childrens.Add(costumeBlock);
                    break;

                default:
                    var Default = new NotImplementedDataBlock(this, typeRead);
                    Default.LoadFromBinaryReader(binaryReader);
                    Childrens.Add(Default);
                    break;
                }

                typeRead = BinaryHelper.ConvertByteArrayToUTF8String(binaryReader.PeekBytes(4));
            }

            /*
             * while (BinaryHelper.ConvertByteArrayToUTF8String(binaryReader.PeekBytes(4)) == "SCRP")
             * {
             *  var scriptBlock = new NotImplementedDataBlock(this, "SCRP");
             *  scriptBlock.LoadFromBinaryReader(binaryReader);
             *  Childrens.Add(scriptBlock);
             * }
             *
             * while (BinaryHelper.ConvertByteArrayToUTF8String(binaryReader.PeekBytes(4)) == "SOUN")
             * {
             *  var soundBlock = new NotImplementedDataBlock(this, "SOUN");
             *  soundBlock.LoadFromBinaryReader(binaryReader);
             *  Childrens.Add(soundBlock);
             * }
             *
             * while (BinaryHelper.ConvertByteArrayToUTF8String(binaryReader.PeekBytes(4)) == "COST")
             * {
             *  var costumeBlock = new Costume(this);
             *  costumeBlock.LoadFromBinaryReader(binaryReader);
             *  Childrens.Add(costumeBlock);
             * }
             *
             * while (BinaryHelper.ConvertByteArrayToUTF8String(binaryReader.PeekBytes(4)) == "CHAR")
             * {
             *  var charsetBlock = new NotImplementedDataBlock(this, "CHAR");
             *  charsetBlock.LoadFromBinaryReader(binaryReader);
             *  Childrens.Add(charsetBlock);
             * }
             */
        }
Exemplo n.º 6
0
        private void LoadScummV5(Stream binaryReader)
        {
            //Leitura Simplificada dos Blocos, le todos e ignora os desconhecidos. Assim a leitura fica mais generica.
            //Isso vai possibilitar ler arquivos como o primeiro monkey island com full speech, que teve sua estrutura não padronizada.

            //Adicionado CDHD e VERB e OBNA, nenhum jogo testado por mim antes tinha esse bloco - apareceu apenas no Monkey Island 2 - Talkie.
            //Esses tres verbos deveriam ficar sempre dentro do OBCD...
            var blocosPossiveis = new [] { "RMHD", "CYCL", "TRNS", "EPAL", "BOXD", "BOXM",
                                           "CLUT", "SCAL", "RMIM", "OBIM", "OBCD", "EXCD",
                                           "ENCD", "NLSC", "LSCR", "CDHD", "VERB", "OBNA" };

            string typeRead = BinaryHelper.ConvertByteArrayToUTF8String(binaryReader.PeekBytes(4));

            while (blocosPossiveis.Any(x => x.Equals(typeRead)))
            {
                switch (typeRead)
                {
                case "RMHD":
                    var RMHD = new RoomHeader(this);
                    RMHD.LoadFromBinaryReader(binaryReader);
                    Childrens.Add(RMHD);
                    break;

                case "CYCL":
                    var CYCL = new ColorCycles(this);
                    CYCL.LoadFromBinaryReader(binaryReader);
                    Childrens.Add(CYCL);
                    break;

                case "TRNS":
                    var TRNS = new ValuePaddingBlock(this, "TRNS");
                    TRNS.LoadFromBinaryReader(binaryReader);
                    Childrens.Add(TRNS);
                    break;

                case "CLUT":
                    var CLUT = new PaletteData(this, "CLUT");
                    CLUT.LoadFromBinaryReader(binaryReader);
                    Childrens.Add(CLUT);
                    break;

                case "RMIM":
                    var RMIM = new RoomImage(this, this);
                    RMIM.LoadFromBinaryReader(binaryReader);
                    Childrens.Add(RMIM);
                    break;

                case "OBIM":
                    var OBIM = new ObjectImage(this);
                    OBIM.LoadFromBinaryReader(binaryReader);
                    Childrens.Add(OBIM);
                    break;

                case "NLSC":
                    var NLSC = new ValuePaddingBlock(this, "NLSC");
                    NLSC.LoadFromBinaryReader(binaryReader);
                    Childrens.Add(NLSC);
                    break;

                default:
                    var Default = new NotImplementedDataBlock(this, typeRead);
                    Default.LoadFromBinaryReader(binaryReader);
                    Childrens.Add(Default);
                    break;
                }

                typeRead = BinaryHelper.ConvertByteArrayToUTF8String(binaryReader.PeekBytes(4));
            }


            /*
             * var RMHD = new RoomHeader(this);
             * RMHD.LoadFromBinaryReader(binaryReader);
             * Childrens.Add(RMHD);
             *
             * var CYCL = new ColorCycles(this);
             * CYCL.LoadFromBinaryReader(binaryReader);
             * Childrens.Add(CYCL);
             *
             * var TRNS = new ValuePaddingBlock(this, "TRNS");
             * TRNS.LoadFromBinaryReader(binaryReader);
             * Childrens.Add(TRNS);
             *
             * var EPAL = new NotImplementedDataBlock(this, "EPAL");
             * EPAL.LoadFromBinaryReader(binaryReader);
             * Childrens.Add(EPAL);
             *
             * var BOXD = new NotImplementedDataBlock(this, "BOXD");
             * BOXD.LoadFromBinaryReader(binaryReader);
             * Childrens.Add(BOXD);
             *
             * var BOXM = new NotImplementedDataBlock(this, "BOXM");
             * BOXM.LoadFromBinaryReader(binaryReader);
             * Childrens.Add(BOXM);
             *
             * var CLUT = new PaletteData(this, "CLUT");
             * CLUT.LoadFromBinaryReader(binaryReader);
             * Childrens.Add(CLUT);
             *
             * var SCAL = new NotImplementedDataBlock(this, "SCAL");
             * SCAL.LoadFromBinaryReader(binaryReader);
             * Childrens.Add(SCAL);
             *
             * var RMIM = new RoomImage(this, this);
             * RMIM.LoadFromBinaryReader(binaryReader);
             * Childrens.Add(RMIM);
             *
             * while (BinaryHelper.ConvertByteArrayToUTF8String(binaryReader.PeekBytes(4)) == "OBIM")
             * {
             *  var OBIM = new ObjectImage(this);
             *  OBIM.LoadFromBinaryReader(binaryReader);
             *  Childrens.Add(OBIM);
             * }
             *
             * while (BinaryHelper.ConvertByteArrayToUTF8String(binaryReader.PeekBytes(4)) == "OBCD")
             * {
             *  var OBCD = new NotImplementedDataBlock(this, "OBCD");
             *  OBCD.LoadFromBinaryReader(binaryReader);
             *  Childrens.Add(OBCD);
             * }
             *
             * var EXCD = new NotImplementedDataBlock(this, "EXCD");
             * EXCD.LoadFromBinaryReader(binaryReader);
             * Childrens.Add(EXCD);
             *
             * var ENCD = new NotImplementedDataBlock(this, "ENCD");
             * ENCD.LoadFromBinaryReader(binaryReader);
             * Childrens.Add(ENCD);
             *
             * var NLSC = new ValuePaddingBlock(this, "NLSC");
             * NLSC.LoadFromBinaryReader(binaryReader);
             * Childrens.Add(NLSC);
             *
             * for (int i = 0; i < NLSC.Value; i++)
             * {
             *  var LSCR = new NotImplementedDataBlock(this, "LSCR");
             *  LSCR.LoadFromBinaryReader(binaryReader);
             *  Childrens.Add(LSCR);
             * }
             *
             */
        }
Exemplo n.º 7
0
        private void LoadScummV6(Stream binaryReader)
        {
            var RMHD = new RoomHeader(this);

            RMHD.LoadFromBinaryReader(binaryReader);
            Childrens.Add(RMHD);

            var CYCL = new ColorCycles(this);

            CYCL.LoadFromBinaryReader(binaryReader);
            Childrens.Add(CYCL);

            var TRNS = new ValuePaddingBlock(this, "TRNS");

            TRNS.LoadFromBinaryReader(binaryReader);
            Childrens.Add(TRNS);

            var PALS = new PalettesData(this);

            PALS.LoadFromBinaryReader(binaryReader);
            Childrens.Add(PALS);

            var RMIM = new RoomImage(this, this);

            RMIM.LoadFromBinaryReader(binaryReader);
            Childrens.Add(RMIM);

            while (BinaryHelper.ConvertByteArrayToUTF8String(binaryReader.PeekBytes(4)) == "OBIM")
            {
                var OBIM = new ObjectImage(this);
                OBIM.LoadFromBinaryReader(binaryReader);
                Childrens.Add(OBIM);
            }

            while (BinaryHelper.ConvertByteArrayToUTF8String(binaryReader.PeekBytes(4)) == "OBCD")
            {
                var OBCD = new NotImplementedDataBlock(this, "OBCD");
                OBCD.LoadFromBinaryReader(binaryReader);
                Childrens.Add(OBCD);
            }

            var EXCD = new NotImplementedDataBlock(this, "EXCD");

            EXCD.LoadFromBinaryReader(binaryReader);
            Childrens.Add(EXCD);

            var ENCD = new NotImplementedDataBlock(this, "ENCD");

            ENCD.LoadFromBinaryReader(binaryReader);
            Childrens.Add(ENCD);

            var NLSC = new ValuePaddingBlock(this, "NLSC");

            NLSC.LoadFromBinaryReader(binaryReader);
            Childrens.Add(NLSC);

            for (int i = 0; i < NLSC.Value; i++)
            {
                var LSCR = new NotImplementedDataBlock(this, "LSCR");
                LSCR.LoadFromBinaryReader(binaryReader);
                Childrens.Add(LSCR);
            }

            var BOXD = new NotImplementedDataBlock(this, "BOXD");

            BOXD.LoadFromBinaryReader(binaryReader);
            Childrens.Add(BOXD);

            var BOXM = new NotImplementedDataBlock(this, "BOXM");

            BOXM.LoadFromBinaryReader(binaryReader);
            Childrens.Add(BOXM);

            var SCAL = new NotImplementedDataBlock(this, "SCAL");

            SCAL.LoadFromBinaryReader(binaryReader);
            Childrens.Add(SCAL);
        }