public DownloadHandler(BinaryReader stream, BackgroundWorkerEx worker)
        {
            worker?.ReportProgress(0, "Loading \"download\"...");

            stream.Skip(2); // DL

            byte b1 = stream.ReadByte();
            byte b2 = stream.ReadByte();
            byte b3 = stream.ReadByte();

            int numFiles = stream.ReadInt32BE();

            short numTags = stream.ReadInt16BE();

            int numMaskBytes = (numFiles + 7) / 8;

            for (int i = 0; i < numFiles; i++)
            {
                MD5Hash key = stream.Read<MD5Hash>();

                //byte[] unk = stream.ReadBytes(0xA);
                stream.Skip(0xA);

                //var entry = new DownloadEntry() { Index = i, Unk = unk };
                var entry = new DownloadEntry() { Index = i };

                DownloadData.Add(key, entry);

                worker?.ReportProgress((int)((i + 1) / (float)numFiles * 100));
            }

            for (int i = 0; i < numTags; i++)
            {
                DownloadTag tag = new DownloadTag();
                string name = stream.ReadCString();
                tag.Type = stream.ReadInt16BE();

                byte[] bits = stream.ReadBytes(numMaskBytes);

                for (int j = 0; j < numMaskBytes; j++)
                    bits[j] = (byte)((bits[j] * 0x0202020202 & 0x010884422010) % 1023);

                tag.Bits = new BitArray(bits);

                Tags.Add(name, tag);
            }
        }
Example #2
0
        public InstallHandler(BinaryReader stream, BackgroundWorkerEx worker)
        {
            worker?.ReportProgress(0, "Loading \"install\"...");

            stream.ReadBytes(2); // IN

            byte b1 = stream.ReadByte();
            byte b2 = stream.ReadByte();
            short numTags = stream.ReadInt16BE();
            int numFiles = stream.ReadInt32BE();

            int numMaskBytes = (numFiles + 7) / 8;

            List<InstallTag> Tags = new List<InstallTag>();

            for (int i = 0; i < numTags; i++)
            {
                InstallTag tag = new InstallTag();
                tag.Name = stream.ReadCString();
                tag.Type = stream.ReadInt16BE();

                byte[] bits = stream.ReadBytes(numMaskBytes);

                for (int j = 0; j < numMaskBytes; j++)
                    bits[j] = (byte)((bits[j] * 0x0202020202 & 0x010884422010) % 1023);

                tag.Bits = new BitArray(bits);

                Tags.Add(tag);
            }

            for (int i = 0; i < numFiles; i++)
            {
                InstallEntry entry = new InstallEntry();
                entry.Name = stream.ReadCString();
                entry.MD5 = stream.ReadBytes(16);
                entry.Size = stream.ReadInt32BE();

                InstallData.Add(entry);

                entry.Tags = Tags.FindAll(tag => tag.Bits[i]);

                worker?.ReportProgress((int)((i + 1) / (float)numFiles * 100));
            }
        }
Example #3
0
        public DownloadHandler(BinaryReader stream)
        {
            stream.Skip(2); // DL

            byte b1 = stream.ReadByte();
            byte b2 = stream.ReadByte();
            byte b3 = stream.ReadByte();

            int numFiles = stream.ReadInt32BE();

            short numTags = stream.ReadInt16BE();

            int numMaskBytes = numFiles / 8 + (numFiles % 8 > 0 ? 1 : 0);

            for (int i = 0; i < numFiles; i++)
            {
                byte[] key = stream.ReadBytes(0x10);
                byte[] unk = stream.ReadBytes(0xA);
                DownloadEntry entry = new DownloadEntry() { Index = i, Unk = unk };

                DownloadData.Add(key, entry);
            }

            for (int i = 0; i < numTags; i++)
            {
                DownloadTag tag = new DownloadTag();
                string name = stream.ReadCString();
                tag.Type = stream.ReadInt16BE();

                byte[] bits = stream.ReadBytes(numMaskBytes);

                for (int j = 0; j < numMaskBytes; j++)
                    bits[j] = (byte)((bits[j] * 0x0202020202 & 0x010884422010) % 1023);

                tag.Bits = new BitArray(bits);

                Tags.Add(name, tag);
            }
        }
Example #4
0
        public InstallHandler(BinaryReader stream)
        {
            stream.ReadBytes(2); // IN

            byte b1 = stream.ReadByte();
            byte b2 = stream.ReadByte();
            short numTags = stream.ReadInt16BE();
            int numFiles = stream.ReadInt32BE();
            int numMaskBytes = (numFiles + 7) / 8;

            List<InstallTag> Tags = new List<InstallTag>();

            for (int i = 0; i < numTags; i++)
            {
                InstallTag tag = new InstallTag();
                tag.Name = stream.ReadCString();
                tag.Type = stream.ReadInt16BE();

                byte[] bits = stream.ReadBytes(numMaskBytes);

                for (int j = 0; j < numMaskBytes; j++)
                    bits[j] = (byte)((bits[j] * 0x0202020202 & 0x010884422010) % 1023);

                tag.Bits = new BitArray(bits);
                Tags.Add(tag);
            }

            for (int i = 0; i < numFiles; i++)
            {
                InstallEntry entry = new InstallEntry();
                entry.Name = stream.ReadCString();
                entry.MD5 = stream.Read<MD5Hash>();
                entry.Size = stream.ReadInt32BE();

                InstallData.Add(entry);

                entry.Tags = Tags.FindAll(tag => tag.Bits[i]);
            }
        }
Example #5
0
        public Instrument(BinaryReader reader)
            : this()
        {
            SynthMode = reader.ReadInt16BE();
            SampleWaveNo = reader.ReadInt16BE();
            Length = reader.ReadInt16BE();
            Repeat = reader.ReadInt16BE();
            reader.ReadBytes(8);
            Volume = reader.ReadInt16BE();
            FineTuning = reader.ReadInt16BE();
            Portamento = reader.ReadInt16BE();
            VibDelay = reader.ReadInt16BE();
            VibSpeed = reader.ReadInt16BE();
            VibLevel = reader.ReadInt16BE();
            AmfWave = reader.ReadInt16BE();
            AmfDelay = reader.ReadInt16BE();
            AmfLength = reader.ReadInt16BE();
            AmfRepeat = reader.ReadInt16BE();
            AdsrWave = reader.ReadInt16BE();
            AdsrDelay = reader.ReadInt16BE();
            AdsrLength = reader.ReadInt16BE();
            AdsrRepeat = reader.ReadInt16BE();
            SustainPt = reader.ReadInt16BE();
            SustainVal = reader.ReadInt16BE();
            reader.ReadBytes(16);
            EffectNumber = reader.ReadInt16BE();
            Effect1 = reader.ReadInt16BE();
            Effect2 = reader.ReadInt16BE();
            Effect3 = reader.ReadInt16BE();
            EffectDelay = reader.ReadInt16BE();

            ArpegData = new Arpeggiato[3];
            for(int i = 0; i < ArpegData.Length; i++)
            {
                ArpegData[i] = new Arpeggiato(reader);
            }
            Name = new string(reader.ReadChars(30)).Split(new[]{'\0'}, 2)[0];
        }
Example #6
0
 public Voice(BinaryReader reader)
     : this()
 {
     NoteAddress = reader.ReadInt16BE();
     SoundTranspose = reader.ReadByte();
     NoteTranspose = reader.ReadByte();
 }
Example #7
0
 public Song(BinaryReader reader)
     : this()
 {
     SongSpeed = reader.ReadInt16BE();
     PatternLength = reader.ReadInt16BE();
     StartPos = reader.ReadInt16BE();
     StopPos = reader.ReadInt16BE();
     RepeatPos = reader.ReadInt16BE();
     NBIrqps = reader.ReadInt16BE();
 }
Example #8
0
 public Song(BinaryReader reader)
     : this()
 {
     Start = reader.ReadInt16BE();
     End = reader.ReadInt16BE();
     Speed = reader.ReadInt16BE();
 }