Example #1
0
        public User(NibbleReader nibbleReader)
        {
            UniqueID = new byte[14];

            UniqueID[0] = nibbleReader.ReadByte();
            UniqueID[1] = nibbleReader.ReadByte();
            Name = nibbleReader.ReadString(16);

            // This group is apparently required in some cases
            UniqueID[10] = nibbleReader.ReadByte();
            UniqueID[11] = nibbleReader.ReadByte();
            UniqueID[12] = nibbleReader.ReadByte();
            UniqueID[13] = nibbleReader.ReadByte();

            UniqueID[2] = nibbleReader.ReadByte();
            UniqueID[3] = nibbleReader.ReadByte();
            Town = nibbleReader.ReadString(16);

            // This group seems to be 00 00 00 00 in Japan, and
            //  00 00 01 00 in the US. All 4 bytes are saved just
            //  in case.
            UniqueID[6] = nibbleReader.ReadByte();
            UniqueID[7] = nibbleReader.ReadByte();
            UniqueID[8] = nibbleReader.ReadByte();
            UniqueID[9] = nibbleReader.ReadByte();

            UniqueID[4] = nibbleReader.ReadByte();
            UniqueID[5] = nibbleReader.ReadByte();
        }
Example #2
0
 public Palette(NibbleReader nibbleReader)
     : this()
 {
     for (int i = 0; i < 15; i++)
         Colors[i] = nibbleReader.ReadByte();
 }
Example #3
0
        private void LoadFromStream(Stream stream)
        {
            BinaryReader binaryReader = new BinaryReader(stream);
            NibbleReader nibbleReader = new NibbleReader(binaryReader);

            byte type = nibbleReader.ReadByte();
            if (type != 0x40)
                throw new NotImplementedException();

            int size = nibbleReader.ReadByte();
            size = (size << 4) | nibbleReader.ReadNibble();
            if (size != 0x26C)
                throw new InvalidDataException("Size is invalid.");

            Title = nibbleReader.ReadString(42);
            Author = new User(nibbleReader);

            ColorPalette = new Palette(nibbleReader);

            nibbleReader.ReadByte(); // Unknown
            nibbleReader.ReadByte(); // Unknown, 0x0A
            Type = (PatternType)nibbleReader.ReadByte();
            nibbleReader.ReadByte(); // Unknown, 0x00
            nibbleReader.ReadByte(); // Unknown, 0x00

            for (int j = 0; j < Data.GetLength(1); j++)
                for (int i = 0; i < Data.GetLength(0); i += 2)
                {
                    Data[i + 1, j] = nibbleReader.ReadNibble();
                    Data[i, j] = nibbleReader.ReadNibble();
                }
        }