A partition within a NintendoOpticalDiscVolume, which is in turn within a Disc.
Inheritance: Glare.Assets.FolderAsset
Exemplo n.º 1
0
 internal NintendoOpticalDiscPartitionFile(FolderAsset parent, int index, int nameOffset, BinaryReader reader, NintendoOpticalDiscSystem system)
     : base(parent, "")
 {
     Index      = index;
     NameOffset = nameOffset;
     DataOffset = NintendoOpticalDiscPartition.LoadOffset(reader, system);
     Size       = reader.ReadUInt32();
 }
Exemplo n.º 2
0
 /// <summary>Create a stream.</summary>
 /// <param name="partition"></param>
 public DiscPartitionStream(NintendoOpticalDiscPartition partition)
 {
     if (partition == null)
     {
         throw new ArgumentNullException("partition");
     }
     Partition = partition;
 }
Exemplo n.º 3
0
        internal void ReadName(BinaryReader reader, long baseNameOffset)
        {
            Name = reader.ReadStringzAt(baseNameOffset + NameOffset, Encoding.ASCII);

            foreach (Asset child in Children)
            {
                NintendoOpticalDiscPartition.LoadFileName(child, reader, baseNameOffset);
            }
        }
Exemplo n.º 4
0
        internal NintendoOpticalDiscPartitionFolder(FolderAsset parent, ref int index, int nameOffset, BinaryReader reader, NintendoOpticalDiscSystem system)
            : base(parent, "")
        {
            Index      = index;
            NameOffset = nameOffset;
            int firstIndex = reader.ReadInt32();

            /*if (firstIndex != index + 1)
             *      throw new InvalidDataException();*/
            int endIndex = reader.ReadInt32();

            index++;
            while (index < endIndex)
            {
                NintendoOpticalDiscPartition.LoadFile(this, reader, ref index, system);
            }
        }
Exemplo n.º 5
0
        internal NintendoOpticalDisc(AssetLoader loader)
            : base(loader)
        {
            BinaryReader reader;

            int magic = loader.Reader.ReadInt32();

            loader.Reader.BaseStream.Seek(-4, SeekOrigin.Current);
            if (magic == DolphinCompressedDisc.Magic)
            {
                var disc   = new DolphinCompressedDisc(loader.Reader);
                var stream = new DolphinCompressedDiscStream(disc);
                loader.Reader = new BigEndianBinaryReader(stream);
            }
            else
            {
                loader.MakeBigEndian();
            }

            reader = Reader = loader.Reader;

            DiscId               = (NintendoOpticalDiscId)reader.ReadByte();
            DiscGame             = (NintendoOpticalDiscGame)reader.ReadInt16();
            DiscRegion           = (NintendoOpticalDiscRegion)reader.ReadByte();
            DiscMaker            = (NintendoOpticalDiscMaker)reader.ReadInt16();
            DiscNumber           = reader.ReadByte();
            DiscVersion          = reader.ReadByte();
            DiscAudioStreaming   = reader.ReadByte();
            DiscStreamBufferSize = reader.ReadByte();
            Unknowns.ReadBytes(reader, 14);
            int wiiMagic      = reader.ReadInt32();
            int gameCubeMagic = reader.ReadInt32();

            if (wiiMagic == (int)NintendoOpticalDiscSystem.Wii)
            {
                DiscSystem = NintendoOpticalDiscSystem.Wii;
            }
            else if (gameCubeMagic == (int)NintendoOpticalDiscSystem.GameCube)
            {
                DiscSystem = Wii.NintendoOpticalDiscSystem.GameCube;
            }
            else
            {
                throw new InvalidDataException();
            }

            DiscTitle = reader.ReadStringz(64, Encoding.ASCII);

            if (DiscSystem == Wii.NintendoOpticalDiscSystem.GameCube)
            {
                NintendoOpticalDiscPartition.LoadFileTable(this, reader, DiscSystem);
            }
            else
            {
                reader.BaseStream.Position = VolumeTableOffset;
                for (int volumeIndex = 0; volumeIndex < 4; volumeIndex++)
                {
                    int  partitionCount       = reader.ReadInt32();
                    long partitionTableOffset = reader.ReadUInt32() * 4L;

                    if (partitionCount > 0)
                    {
                        new NintendoOpticalDiscVolume(this, volumeIndex, partitionCount, partitionTableOffset);
                    }
                }

                foreach (NintendoOpticalDiscVolume volume in Children)
                {
                    volume.LoadPartitions(loader);
                }
                foreach (NintendoOpticalDiscVolume volume in Children)
                {
                    foreach (NintendoOpticalDiscPartition partition in volume.Children)
                    {
                        partition.LoadHeaders(loader);
                    }
                }
            }
        }
 /// <summary>Create a stream.</summary>
 /// <param name="partition"></param>
 public DiscPartitionStream(NintendoOpticalDiscPartition partition)
 {
     if (partition == null)
         throw new ArgumentNullException("partition");
     Partition = partition;
 }