Esempio n. 1
0
        static byte[] ReadIci(IBinaryStream ici, uint key)
        {
            var rio      = new CRioArchive(ici);
            var ici_data = rio.ReadEncrypted(key);

            return(DecryptIci(ici_data));
        }
Esempio n. 2
0
        public override ImageMetaData ReadMetaData(IBinaryStream file)
        {
            if (file.Signature != CRioArchive.ObjectSignature)
            {
                return(null);
            }
            var  rio = new CRioArchive(file);
            uint signature;
            var  class_ref  = rio.LoadRioTypeCore(out signature);
            uint object_pos = (uint)file.Position;

            if ("CS5i" != class_ref)
            {
                return(null);
            }
            file.Seek(8, SeekOrigin.Current);
            return(new S5iMetaData
            {
                Width = file.ReadUInt16(),
                Height = file.ReadUInt16(),
                BPP = 32,
                ObjectOffset = object_pos,
                Schema = rio.Schema,
            });
        }
Esempio n. 3
0
        // signature set to 0 because all serialized rUGP objects have same signature.

        public override ImageMetaData ReadMetaData(IBinaryStream file)
        {
            if (file.Signature != CRioArchive.ObjectSignature)
            {
                return(null);
            }
            var  rio = new CRioArchive(file);
            uint signature;
            var  class_ref = rio.LoadRioTypeCore(out signature);
            CRip img;

            if ("CRip007" == class_ref)
            {
                img = new CRip007();
            }
            else if ("CRip" == class_ref)
            {
                img = new CRip();
            }
            else
            {
                return(null);
            }
            return(img.ReadMetaData(rio));
        }
Esempio n. 4
0
        public virtual ImageMetaData ReadMetaData(CRioArchive arc)
        {
            uint object_pos = (uint)arc.Input.Position;

            arc.ReadInt32();
            int x = arc.ReadUInt16();
            int y = arc.ReadUInt16();

            arc.ReadInt32();
            uint w     = arc.ReadUInt16();
            uint h     = arc.ReadUInt16();
            int  flags = arc.ReadInt32() & 0xFF;

            if (flags < 1 || flags > 3)
            {
                return(null);
            }
            return(new RioMetaData
            {
                OffsetX = x,
                OffsetY = y,
                Width = w,
                Height = h,
                BPP = 1 == flags ? 8 : 2 == flags ? 24 : 32,
                ObjectOffset = object_pos,
                Rip = this,
            });
        }
Esempio n. 5
0
 void ReadRelic(CRioArchive arc)
 {
     Version = arc.ReadInt32();
     if (Version >= 0x24)
     {
         field_24 = arc.ReadRioReference("CDatabaseBase"); // UnivUI
         field_28 = arc.ReadRioReference("CDatabaseBase");
         field_10 = arc.ReadRioReference("CBoxOcean");     // rvmm
         field_14 = arc.ReadRioReference("CObjectOcean");  // UnivUI
         field_18 = arc.ReadRioReference("CObjectOcean");  // UnivUI
         field_0C = arc.ReadRioReference("CProcessOcean"); // Vm60
         if (Version >= 0x25)
         {
             field_30 = arc.ReadRioReference("CStdb");  // UnivUI
         }
         if (Version >= 0x26)
         {
             field_2C = arc.ReadRioReference("CRio");  // UnivUI
         }
         if (Version >= 0x27)
         {
             field_1C = arc.ReadRioReference("CRio");
         }
         if (Version >= 0x29)
         {
             field_38 = arc.ReadRioReference("CRio");
         }
         field_34.Deserialize(arc);
         if (Version >= 0x28)
         {
             field_08 = arc.ReadRioReference("CRio");
         }
     }
     else if (Version >= 0x20)
     {
         field_0C = arc.ReadRioReference("CProcessOcean");
         field_10 = arc.ReadRioReference("CBoxOcean");
         field_14 = arc.ReadRioReference("CObjectOcean");
         field_18 = arc.ReadRioReference("CObjectOcean");
         field_1C = arc.ReadRioReference("CSoundManEx");
         if (Version >= 0x23)
         {
             field_24 = arc.ReadRioReference("CDatabaseBase");
         }
         if (Version >= 0x22)
         {
             field_28 = arc.ReadRioReference("CDatabaseBase");
         }
         if (Version >= 0x21)
         {
             field_34.Deserialize(arc);
         }
     }
     else
     {
         throw new NotSupportedException(string.Format("rUGP schema {0} not supported", Version));
     }
 }
Esempio n. 6
0
        public override void Deserialize(CRioArchive arc)
        {
            int count = arc.ReadCount();

            SetSize(count);
            for (int i = 0; i < count; ++i)
            {
                m_data[i] = arc.ReadString();
            }
        }
Esempio n. 7
0
        public override ImageData Read(IBinaryStream file, ImageMetaData info)
        {
            var meta = (RioMetaData)info;

            file.Position = meta.ObjectOffset;
            var arc = new CRioArchive(file);
            var img = meta.Rip;

            img.Deserialize(arc);
            return(ImageData.Create(info, img.Format, null, img.Pixels));
        }
Esempio n. 8
0
 public override void Deserialize(CRioArchive arc)
 {
     Version = arc.ReadInt32();
     if (Version >= 2)
     {
         field_04 = arc.ReadString();
     }
     field_08 = arc.ReadString();
     field_0C = arc.ReadString();
     field_14 = arc.ReadString();
     field_1C = arc.ReadString();
     field_18 = arc.ReadInt32();
     if (0 == Version)
     {
         return;
     }
     if (Version >= 2)
     {
         field_28 = arc.ReadBytes(16);
         field_38 = arc.ReadInt32();
     }
     field_3C = arc.ReadString();
     field_40 = arc.ReadString();
     if (Version >= 3)
     {
         field_44 = arc.ReadString();
     }
     if (Version >= 4)
     {
         field_10 = arc.ReadString();
         field_20 = arc.ReadInt32();
     }
     if (Version >= 5)
     {
         field_24 = arc.ReadInt32();
     }
     else if (Version >= 2)
     {
         if (field_28.ToUInt16(0) < 0x7D3)
         {
             field_24 = 2;
         }
         else
         {
             field_24 = 1;
         }
     }
     if (Version >= 6)
     {
         field_48 = arc.ReadString();
         field_4C = arc.ReadString();
         field_50 = arc.ReadString();
     }
 }
Esempio n. 9
0
        public override void Deserialize(CRioArchive arc)
        {
            int count = arc.ReadCount();

            SetSize(count);
            for (int i = 0; i < count; ++i)
            {
                if (arc.ReadBool())
                {
                    var obj = new CType();
                    m_data[i] = obj;
                    obj.Deserialize(arc);
                }
            }
        }
Esempio n. 10
0
        public override void Deserialize(CRioArchive arc)
        {
            Version = arc.ReadUInt16();
            if (Version >= 7)
            {
                field_14 = arc.ReadInt32();
                field_18 = arc.ReadInt32();
                arc.ReadByte();
                arc.ReadString();
            }
            arc.ReadString(); // registry branch
            arc.ReadString(); // disk name
            arc.ReadString(); // rio filename [src]
            arc.ReadString();
            arc.ReadString();
            arc.ReadInt64(); // rio offset [=0]
            arc.ReadInt64(); // rio size
            if (Version < 6)
            {
                arc.ReadInt32();
                arc.ReadInt32();
            }
            else
            {
                arc.ReadInt32();
            }
            RioName   = arc.ReadString();
            RioOffset = arc.ReadInt64();
            RioSize   = arc.ReadInt64();
            if (Version < 6)
            {
                arc.ReadInt64();
            }
            arc.ReadInt32();
            arc.ReadString();
            arc.ReadInt32();
            arc.ReadInt32();
            arc.ReadInt32();
            arc.ReadInt32();
            arc.ReadInt32();
            arc.ReadString();
            int count = arc.ReadCount();

            arc.ReadBytes(count * 4);
            PrepareBuffer(); // sub_10011700 (this);
            arc.Read(field_D4, 0, field_D4.Length);
        }
Esempio n. 11
0
        public override ImageMetaData ReadMetaData(CRioArchive arc)
        {
            uint object_pos = (uint)arc.Input.Position;

            arc.ReadInt32();
            uint w = arc.ReadUInt16();
            uint h = arc.ReadUInt16();

            return(new RioMetaData
            {
                Width = w,
                Height = h,
                BPP = 32,
                ObjectOffset = object_pos,
                Rip = this,
            });
        }
Esempio n. 12
0
        public override void Deserialize(CRioArchive arc)
        {
            Version  = arc.ReadInt32();
            m_x      = arc.ReadUInt16();
            m_y      = arc.ReadUInt16();
            m_width  = arc.ReadUInt16();
            m_height = arc.ReadUInt16();
            m_w      = arc.ReadUInt16();
            m_h      = arc.ReadUInt16();
            m_flags  = arc.ReadInt32();
            int size = arc.ReadInt32();

            arc.ReadInt32(); // field_34
            var data = arc.ReadBytes(size);

            m_pixels = Uncompress(data);
        }
Esempio n. 13
0
        static public RioReader Create(ArcView file)
        {
            if (CRioArchive.RioSignature == file.View.ReadUInt32(0))
            {
                return(new RioReader(file));
            }

            if (file.Name.HasExtension(".ici"))
            {
                return(null);
            }
            var ici_name = file.Name + ".ici";

            if (!VFS.FileExists(ici_name))
            {
                ici_name = Path.ChangeExtension(file.Name, ".ici");
                if (!VFS.FileExists(ici_name))
                {
                    return(null);
                }
            }
            byte[] ici_data;
            using (var ici = VFS.OpenBinaryStream(ici_name))
                ici_data = ReadIci(ici, IciKey);

            CObjectArcMan arc_man;

            using (var ici = new BinMemoryStream(ici_data))
            {
                var rio = new CRioArchive(ici);
                arc_man = rio.DeserializeRoot() as CObjectArcMan;
                if (null == arc_man)
                {
                    return(null);
                }
            }
            var arc_object = arc_man.ArcList.FirstOrDefault();

            if (null == arc_object || !VFS.IsPathEqualsToFileName(file.Name, arc_object.RioName))
            {
                return(null);
            }
            return(new RioReader(arc_man, file));
        }
Esempio n. 14
0
        private RioReader(CObjectArcMan arc_man, ArcView file)
        {
            long toc_offset = arc_man.TocOffset;
            uint signature  = file.View.ReadUInt32(toc_offset);
            int  shift      = 0;

            if (signature != CRioArchive.EncryptedSignature)
            {
                toc_offset *= 2;
                signature   = file.View.ReadUInt32(toc_offset);
                if (signature != CRioArchive.EncryptedSignature)
                {
                    throw new InvalidFormatException("CPmArchive signature not found");
                }
                shift = 1;
            }
            m_input = file.CreateStream();
            m_toc   = file.CreateStream(toc_offset, (uint)arc_man.TocSize);
            m_arc   = new CRioArchive(m_toc, shift, true);
        }
Esempio n. 15
0
        public virtual ImageMetaData ReadMetaData(CRioArchive arc)
        {
            uint object_pos = (uint)arc.Input.Position;

            arc.ReadInt32();
            int  x     = arc.ReadUInt16();
            int  y     = arc.ReadUInt16();
            uint w1    = arc.ReadUInt16();
            uint h1    = arc.ReadUInt16();
            uint w2    = arc.ReadUInt16();
            uint h2    = arc.ReadUInt16();
            int  flags = arc.ReadInt32() & 0xFF;

            if (flags < 1 || flags > 3)
            {
                return(null);
            }
            uint width, height;

            if (3 == flags)
            {
                width  = w2;
                height = h2;
            }
            else
            {
                width  = w1;
                height = h1;
            }
            return(new RioMetaData
            {
                OffsetX = x,
                OffsetY = y,
                Width = width,
                Height = height,
                BPP = 1 == flags ? 8 : 32,
                ObjectOffset = object_pos,
                Rip = this,
            });
        }
Esempio n. 16
0
        public override void Deserialize(CRioArchive arc)
        {
            Version      = arc.ReadInt32();
            m_width      = arc.ReadUInt16();
            m_height     = arc.ReadUInt16();
            m_x          = arc.ReadUInt16();
            m_y          = arc.ReadUInt16();
            m_w          = arc.ReadUInt16();
            m_h          = arc.ReadUInt16();
            m_flags      = arc.ReadInt32();
            CompressInfo = arc.ReadBytes(7);
            if (arc.GetObjectSchema() >= 2)
            {
                field_4C = arc.ReadRioReference("CSbm");
            }
            int size = arc.ReadInt32();

            arc.ReadInt32(); // field_3C
            var data = arc.ReadBytes(size);

            m_pixels = Uncompress(data);
            Format   = HasAlpha ? PixelFormats.Bgra32 : PixelFormats.Bgr32;
        }
Esempio n. 17
0
 public override void Deserialize(CRioArchive arc)
 {
     if (arc.IsEncrypted)
     {
         var data = arc.ReadEncrypted(RioKey);
         using (var input = new BinMemoryStream(data))
         {
             var prev_source = arc.SetSource(input);
             try
             {
                 ReadRelic(arc);
             }
             finally
             {
                 arc.SetSource(prev_source);
             }
         }
     }
     else
     {
         ReadRelic(arc);
     }
 }
Esempio n. 18
0
 public override void Deserialize(CRioArchive arc)
 {
     Version  = arc.ReadInt32();
     field_14 = arc.ReadInt32();
     arc.ReadByte();
     arc.ReadByte();
     if (Version < 10)
     {
         field_1C = 0;
         field_20 = 0;
     }
     else
     {
         field_1C = arc.ReadInt32();
         field_20 = arc.ReadInt32();
     }
     arc.ReadInt32();
     arc.ReadInt32();
     arc.ReadInt32();
     if (Version >= 6)
     {
         TocOffset = arc.ReadInt32();
         TocSize   = arc.ReadInt32();
         arc.ReadInt32();
     }
     if (Version >= 8)
     {
         field_38 = arc.ReadInt32();
     }
     Title = arc.ReadString();
     arc.ReadInt32();
     arc.ReadString();
     arc.ReadInt32();
     arc.ReadString();
     arc.ReadString(); // registry branch
     arc.ReadString();
     arc.ReadInt32();
     arc.ReadString();
     field_80.Deserialize(arc);
     arc.ReadInt32();
     if (Version >= 9)
     {
         RioFileName = arc.ReadString();
     }
     if (Version >= 7)
     {
         arc.ReadString(); // InstallManual
     }
     if (Version >= 5)
     {
         field_98 = arc.ReadInt32();
     }
     ArcList.Deserialize(arc);  // CPtrArray::Serialize
     for (int i = 0; i < ArcList.Count; ++i)
     {
         var entry = ArcList[i];
         if (entry != null)
         {
             entry.field_14 = field_1C;
             entry.field_18 = field_20;
         }
     }
 }
Esempio n. 19
0
 private RioReader(ArcView file)
 {
     m_input = file.CreateStream();
     m_toc   = m_input;
     m_arc   = new CRioArchive(m_input);
 }
Esempio n. 20
0
 public override void Deserialize(CRioArchive arc)
 {
     throw new NotImplementedException("COceanNode.Deserialize not impelemented");
 }
Esempio n. 21
0
 public override void Deserialize(CRioArchive arc)
 {
 }
Esempio n. 22
0
 public override void Deserialize(CRioArchive arc)
 {
     field_10 = arc.ReadRioReference("CFrameBuffer");
 }
Esempio n. 23
0
 public override void Deserialize(CRioArchive arc)
 {
     field_0C = arc.ReadString();
 }
Esempio n. 24
0
 public abstract void Deserialize(CRioArchive arc);