private SqHeaderStruct parseSqHeader(Stream pStream) { SqHeaderStruct ret; byte[] temp; // used to reverse from big endian to little endian // magic bytes ret = new SqHeaderStruct(); ret.MagicBytes = ParseFile.ParseSimpleOffset(pStream, 0, 4); // pQES // version temp = ParseFile.ParseSimpleOffset(pStream, 4, 4); Array.Reverse(temp); ret.Version = BitConverter.ToUInt32(temp, 0); // resolution temp = ParseFile.ParseSimpleOffset(pStream, 8, 2); Array.Reverse(temp); ret.Resolution = BitConverter.ToUInt16(temp, 0); // tempo temp = new byte[4]; Array.Copy(ParseFile.ParseSimpleOffset(pStream, 10, 3), 0, temp, 1, 3); Array.Reverse(temp); ret.InitialTempo = BitConverter.ToUInt32(temp, 0); // unknown temp = ParseFile.ParseSimpleOffset(pStream, 13, 2); Array.Reverse(temp); ret.unknown = BitConverter.ToUInt16(temp, 0); return(ret); }
public PsxSequence(Stream pStream, PsxSqInitStruct pPsxSqInitStruct) { this.sqHeader = parseSqHeader(pStream); this.force2Loops = pPsxSqInitStruct.force2Loops; this.forceOppositeFormatType = pPsxSqInitStruct.forceOppositeFormatType; this.forceSepType = pPsxSqInitStruct.forceSepType; this.forceSeqType = pPsxSqInitStruct.forceSeqType; this.dataBytesPerCommand = new Dictionary <int, int>(); this.dataBytesPerCommand.Add(0x80, 2); this.dataBytesPerCommand.Add(0x90, 2); this.dataBytesPerCommand.Add(0xA0, 2); this.dataBytesPerCommand.Add(0xB0, 2); this.dataBytesPerCommand.Add(0xC0, 1); this.dataBytesPerCommand.Add(0xD0, 1); this.dataBytesPerCommand.Add(0xE0, 2); this.dataBytesPerCommand.Add(0xF0, 0); timingInfo = getTimingInfo(pStream); }