예제 #1
0
파일: ArcGRP.cs 프로젝트: uboaa/GARbro
        Stream OpenAudio(ArcFile arc, Entry entry)
        {
            int  unpacked_size = arc.File.View.ReadInt32(entry.Offset);
            byte pack_type     = arc.File.View.ReadByte(entry.Offset + 5);
            byte channels      = arc.File.View.ReadByte(entry.Offset + 6);
            byte header_size   = arc.File.View.ReadByte(entry.Offset + 7);

            if (unpacked_size <= 0 || header_size > unpacked_size ||
                !('A' == pack_type || 'S' == pack_type))
            {
                return(base.OpenEntry(arc, entry));
            }
            var unpacked = new byte[unpacked_size];

            arc.File.View.Read(entry.Offset + 8, unpacked, 0, header_size);
            uint packed_size = entry.Size - 8 - header_size;

            using (var packed = arc.File.CreateStream(entry.Offset + 8 + header_size, packed_size))
                using (var reader = new GrpUnpacker(packed))
                {
                    if ('A' == pack_type)
                    {
                        reader.UnpackA(unpacked, header_size, channels);
                    }
                    else
                    {
                        reader.UnpackS(unpacked, header_size, channels);
                    }
                    return(new BinMemoryStream(unpacked, entry.Name));
                }
        }
예제 #2
0
파일: ArcGRP.cs 프로젝트: uboaa/GARbro
 Stream OpenImage(ArcFile arc, PackedEntry entry)
 {
     using (var packed = arc.File.CreateStream(entry.Offset + 8, entry.Size - 8))
         using (var reader = new GrpUnpacker(packed))
         {
             var unpacked = new byte[entry.UnpackedSize];
             reader.UnpackHDJ(unpacked, 0);
             return(new BinMemoryStream(unpacked, entry.Name));
         }
 }
예제 #3
0
        Stream OpenImage(ArcFile arc, Entry entry)
        {
            int unpacked_size = arc.File.View.ReadInt32(entry.Offset);

            if (unpacked_size <= 0)
            {
                return(base.OpenEntry(arc, entry));
            }
            using (var packed = arc.File.CreateStream(entry.Offset + 8, entry.Size - 8))
                using (var reader = new GrpUnpacker(packed))
                {
                    var unpacked = new byte[unpacked_size];
                    reader.UnpackHDJ(unpacked, 0);
                    return(new MemoryStream(unpacked));
                }
        }
예제 #4
0
파일: ArcGRP.cs 프로젝트: Casidi/GARbro
 Stream OpenImage(ArcFile arc, Entry entry)
 {
     int unpacked_size = arc.File.View.ReadInt32 (entry.Offset);
     if (unpacked_size <= 0)
         return base.OpenEntry (arc, entry);
     using (var packed = arc.File.CreateStream (entry.Offset+8, entry.Size-8))
     using (var reader = new GrpUnpacker (packed))
     {
         var unpacked = new byte[unpacked_size];
         reader.UnpackHDJ (unpacked, 0);
         return new MemoryStream (unpacked);
     }
 }
예제 #5
0
파일: ArcGRP.cs 프로젝트: Casidi/GARbro
 Stream OpenAudio(ArcFile arc, Entry entry)
 {
     int unpacked_size = arc.File.View.ReadInt32 (entry.Offset);
     byte pack_type = arc.File.View.ReadByte (entry.Offset+5);
     byte channels = arc.File.View.ReadByte (entry.Offset+6);
     byte header_size = arc.File.View.ReadByte (entry.Offset+7);
     if (unpacked_size <= 0 || header_size > unpacked_size
         || !('A' == pack_type || 'S' == pack_type))
         return base.OpenEntry (arc, entry);
     var unpacked = new byte[unpacked_size];
     arc.File.View.Read (entry.Offset+8, unpacked, 0, header_size);
     uint packed_size = entry.Size - 8 - header_size;
     using (var packed = arc.File.CreateStream (entry.Offset+8+header_size, packed_size))
     using (var reader = new GrpUnpacker (packed))
     {
         if ('A' == pack_type)
             reader.UnpackA (unpacked, header_size, channels);
         else
             reader.UnpackS (unpacked, header_size, channels);
         return new MemoryStream (unpacked);
     }
 }