public void Read(BinaryReaderEx br) { if (File.Exists(Meta.SmplPath)) { ReadSampleNames(Meta.SmplPath); } header = new HowlHeader(br); for (int i = 0; i < header.cntUnk; i++) { if (br.ReadUInt16() != 0) { Console.WriteLine("HOWL Read: upper word not 0."); } unk.Add(br.ReadUInt16()); } for (int i = 0; i < header.cntSfx; i++) { samples1.Add(new SampleDef(br)); } for (int i = 0; i < header.cntEngineSfx; i++) { samples2.Add(new SampleDef(br)); } for (int i = 0; i < header.cntBank; i++) { ptrBanks.Add(br.ReadUInt16() * Meta.SectorSize); } for (int i = 0; i < header.cntSeq; i++) { ptrSeqs.Add(br.ReadUInt16() * Meta.SectorSize); } foreach (var ptr in ptrBanks) { br.Jump(ptr); banks.Add(new Bank(br)); } foreach (var ptr in ptrSeqs) { br.Jump(ptr); sequences.Add(CSEQ.FromReader(br)); } }
public void Read(BinaryReaderEx br) { ReadSampleNames(); header = HowlHeader.FromReader(br); for (int i = 0; i < header.cntUnk; i++) { if (br.ReadUInt16() != 0) { Helpers.Panic(this, "upper word is not 0."); } unk.Add(br.ReadUInt16()); } samples1 = InstanceList <SampleDef> .FromReader(br, (uint)br.BaseStream.Position, (uint)header.cntSfx); samples2 = InstanceList <SampleDef> .FromReader(br, (uint)br.BaseStream.Position, (uint)header.cntEngineSfx); /* * for (int i = 0; i < header.cntSfx; i++) * samples1.Add(SampleDef.FromReader(br)); * * for (int i = 0; i < header.cntEngineSfx; i++) * samples2.Add(SampleDef.FromReader(br)); */ for (int i = 0; i < header.cntBank; i++) { ptrBanks.Add(br.ReadUInt16() * Meta.SectorSize); } for (int i = 0; i < header.cntSeq; i++) { ptrSeqs.Add(br.ReadUInt16() * Meta.SectorSize); } foreach (var ptr in ptrBanks) { br.Jump(ptr); banks.Add(new Bank(br)); } foreach (var ptr in ptrSeqs) { br.Jump(ptr); sequences.Add(CSEQ.FromReader(br)); } }
public bool Read(BinaryReaderEx br) { if (File.Exists(Meta.BasePath + "CTRFramework.Data\\samplenames.txt")) { ReadSampleNames(Meta.BasePath + "CTRFramework.Data\\samplenames.txt"); } header = new HowlHeader(br); for (int i = 0; i < header.cnt4; i++) { if (br.ReadUInt16() != 0) { Console.WriteLine("HOWL Read: upper word not 0."); Console.ReadKey(); } unk.Add(br.ReadUInt16()); } for (int i = 0; i < header.cnt81; i++) { samples1.Add(new SampleDecl(br)); } /* * * dump whole header to sql later * StringBuilder sb = new StringBuilder(); * foreach (SampleDecl sd in samples1) * { * sb.Append(sd.) * } */ for (int i = 0; i < header.cnt82; i++) { samples2.Add(new SampleDecl(br)); } for (int i = 0; i < header.cntBank; i++) { offbanks.Add(br.ReadUInt16() * (int)0x800); } for (int i = 0; i < header.cntSeq; i++) { offseqs.Add(br.ReadUInt16() * (int)0x800); } foreach (int i in offbanks) { br.BaseStream.Position = i; Bank x = new Bank(); x.Read(br); banks.Add(x); } Bank sfx = new Bank(); foreach (Bank b in banks) { foreach (var x in b.samples) { int id = x.Key; if (!sfx.samples.ContainsKey(id)) { sfx.samples.Add(x.Key, x.Value); } else { string xx = Helpers.CalculateMD5(new MemoryStream(sfx.samples[id])); string yy = Helpers.CalculateMD5(new MemoryStream(b.samples[id])); if (xx != yy) { //Console.WriteLine("MD5 differs for same ID!!! " + id + "\r\n" + xx + "\r\n" + yy); } } } } return(true); }