public labelBlock(EndianBinaryReader er, int NrCells, out bool OK) { bool OK1; this.Header = new DataBlockHeader(er, "LBAL", out OK1); if (!OK1) { OK = false; } else { this.Offsets = new uint[NrCells]; int length = NrCells; for (int newSize = 0; newSize < NrCells; ++newSize) { this.Offsets[newSize] = er.ReadUInt32(); if (this.Offsets[newSize] > this.Header.size) { length = newSize; Array.Resize <uint>(ref this.Offsets, newSize); er.Position -= 4L; break; } } this.Names = new string[length]; long position = er.Position; for (int index = 0; index < length; ++index) { er.Position = position + (long)this.Offsets[index]; this.Names[index] = er.ReadStringNT(); } OK = true; } }
public HeadSection(EndianBinaryReader er, out bool OK) { bool OK1; this.Header = new DataBlockHeader(er, "HEAD", out OK1); if (!OK1) { OK = false; } else { long position = er.BaseStream.Position; this.nWaveType = er.ReadByte(); this.bLoop = er.ReadByte(); this.NrChannel = er.ReadByte(); this.Unknown = er.ReadByte(); this.nSampleRate = er.ReadUInt16(); this.nTime = er.ReadUInt16(); this.nLoopOffset = er.ReadUInt32(); this.nSample = er.ReadUInt32(); this.nDataOffset = er.ReadUInt32(); this.nBlock = er.ReadUInt32(); this.nBlockLength = er.ReadUInt32(); this.nBlockSample = er.ReadUInt32(); this.nLastBlockLen = er.ReadUInt32(); this.nLastBlockSample = er.ReadUInt32(); er.ReadBytes(32); OK = true; } }
public DataSection(EndianBinaryReader er, out bool OK) { bool OK1; this.Header = new DataBlockHeader(er, "DATA", out OK1); if (!OK1) { OK = false; } else { long position = er.BaseStream.Position; this.Info = new SWAV.SWAVInfo(er); if (this.Info.nWaveType == (byte)2) { er.BaseStream.Position = position + 12L; this.Data = er.ReadBytes((int)((long)((int)this.Info.nLoopOffset * 4) + (long)(this.Info.nNonLoopLen * 4U) - 4L)); } else { this.Data = er.ReadBytes((int)(er.BaseStream.Length - er.BaseStream.Position)); } OK = true; } }
public DataSection(EndianBinaryReader er, out bool OK) { bool OK1; this.Header = new DataBlockHeader(er, "DATA", out OK1); if (!OK1) { OK = false; } else { this.DataOffset = er.ReadUInt32(); this.NrRecord = er.ReadUInt32(); this.Records = new SSAR.DataSection.Record[(IntPtr)this.NrRecord]; for (int index = 0; (long)index < (long)this.NrRecord; ++index) { this.Records[index] = new SSAR.DataSection.Record(er); } long position = er.BaseStream.Position; er.BaseStream.Position = (long)this.DataOffset; this.Data = er.ReadBytes((int)(er.BaseStream.Length - (long)this.DataOffset)); er.BaseStream.Position = position; OK = true; } }
public VisAnmSet(EndianBinaryReader er, out bool OK) { er.SetMarkerOnCurrentOffset(nameof(VisAnmSet)); bool OK1; this.header = new DataBlockHeader(er, "VIS0", out OK1); if (!OK1) { OK = false; } else { this.dict = new Dictionary <NSBVA.VisAnmSet.VisAnmSetData>(er); this.visAnm = new NSBVA.VisAnmSet.VisAnm[(int)this.dict.numEntry]; long position = er.BaseStream.Position; for (int index = 0; index < (int)this.dict.numEntry; ++index) { er.BaseStream.Position = er.GetMarker(nameof(VisAnmSet)) + (long)this.dict[index].Value.Offset; this.visAnm[index] = new NSBVA.VisAnmSet.VisAnm(er, out OK1); if (!OK1) { OK = false; return; } } er.BaseStream.Position = position; OK = true; } }
public Palettedata(byte[] Palette, Graphic.GXTexFmt mode) { this.Header = new DataBlockHeader("TTLP", (uint)(24 + Palette.Length)); this.fmt = mode; this.bExtendedPlt = false; this.szByte = (uint)Palette.Length; this.pRawData = 16U; this.Data = Palette; }
public Screendata(byte[] data, int width, int height, Graphic.NNSG2dColorMode mode) { this.Header = new DataBlockHeader("NRCS", 0U); this.screenWidth = (ushort)width; this.screenHeight = (ushort)height; this.colorMode = mode; this.screenFormat = Graphic.NNSG2dScreenFormat.NNS_G2D_SCREENFORMAT_TEXT; this.szByte = (uint)data.Length; this.Data = data; }
public FMTBlock(uint SampleRate, ushort BitsPerSample, ushort NrChannel) { this.Header = new DataBlockHeader("fmt ", 16U); this.AudioFormat = WAV.WaveData.FMTBlock.WaveFormat.WAVE_FORMAT_PCM; this.NrChannel = NrChannel; this.SampleRate = SampleRate; this.BitsPerSample = BitsPerSample; this.ByteRate = SampleRate * (uint)BitsPerSample * (uint)NrChannel / 8U; this.BlockAlign = (ushort)((int)NrChannel * (int)BitsPerSample / 8); }
public Characterdata(byte[] data, int width, int height, Graphic.GXTexFmt fmt) { this.Header = new DataBlockHeader("RAHC", 0U); this.W = (ushort)(width / 8); this.H = (ushort)(height / 8); this.pixelFmt = fmt; this.mapingType = Graphic.GXOBJVRamModeChar.GX_OBJVRAMMODE_CHAR_2D; this.characterFmt = Graphic.NNSG2dCharacterFmt.NNS_G2D_CHARACTER_FMT_CHAR; this.szByte = (uint)data.Length; this.pRawData = 24U; this.Data = data; }
public DAT1Section(EndianBinaryReader er, BMG.INF1Section Offsets, out bool OK) { bool OK1; this.Header = new DataBlockHeader(er, "DAT1", out OK1); if (!OK1) { OK = false; } else { er.SetMarkerOnCurrentOffset("DAT1"); this.Strings = new string[(int)Offsets.NrOffset]; for (int index = 0; index < (int)Offsets.NrOffset; ++index) { er.BaseStream.Position = er.GetMarker("DAT1") + (long)Offsets.Offsets[index]; string str1 = ""; while (true) { char ch = er.ReadChar(Encoding.Unicode); switch (ch) { case char.MinValue: goto label_8; case '\n': str1 += "\r\n"; continue; case '\x001A': string str2 = str1 + "[#"; int count = (int)er.ReadByte() - 2; --er.BaseStream.Position; str1 = str2 + BitConverter.ToString(er.ReadBytes(count)).Replace("-", "") + "]"; continue; default: str1 += (string)(object)ch; continue; } } label_8: this.Strings[index] = str1; } while (er.BaseStream.Position % 4L != 0L) { int num = (int)er.ReadByte(); } OK = true; } }
public DataSection(EndianBinaryReader er, out bool OK) { bool OK1; this.Header = new DataBlockHeader(er, "DATA", out OK1); if (!OK1) { OK = false; } else { this.Data = er.ReadBytes((int)this.Header.size - 8); OK = true; } }
public cellBankBlock(EndianBinaryReader er, out bool OK) { bool OK1; this.Header = new DataBlockHeader(er, "KBEC", out OK1); if (!OK1) { OK = false; } else { this.CellDataBank = new NCER.cellBankBlock.cellDataBank(er); OK = true; } }
public ANK1Section(EndianBinaryReader er, out bool OK) { bool OK1; this.Header = new DataBlockHeader(er, "ANK1", out OK1); if (!OK1) { OK = false; } else { this.LoopFlags = er.ReadByte(); this.AngleMultiplier = er.ReadByte(); this.AnimLength = er.ReadUInt16(); this.NrJoints = er.ReadUInt16(); this.NrScale = er.ReadUInt16(); this.NrRot = er.ReadUInt16(); this.NrTrans = er.ReadUInt16(); this.JointOffset = er.ReadUInt32(); this.ScaleOffset = er.ReadUInt32(); this.RotOffset = er.ReadUInt32(); this.TransOffset = er.ReadUInt32(); er.BaseStream.Position = (long)(32U + this.ScaleOffset); this.Scale = er.ReadSingles((int)this.NrScale); er.BaseStream.Position = (long)(32U + this.RotOffset); this.Rotation = er.ReadInt16s((int)this.NrRot); er.BaseStream.Position = (long)(32U + this.TransOffset); this.Translation = er.ReadSingles((int)this.NrTrans); float RotScale = (float)(Math.Pow(2.0, (double)this.AngleMultiplier) * Math.PI / 32768.0); er.BaseStream.Position = (long)(32U + this.JointOffset); this.Joints = new AnimatedJoint[(int)this.NrJoints]; for (int index = 0; index < (int)this.NrJoints; ++index) { var animatedJoint = new AnimatedJoint(er); animatedJoint.SetValues(this.Scale, this.Rotation, this.Translation, RotScale); this.Joints[index] = animatedJoint; } OK = true; } }
public Palettedata(EndianBinaryReader er, out bool OK) { bool OK1; this.Header = new DataBlockHeader(er, "PALT", out OK1); if (!OK1) { OK = false; } else { this.HeaderSize = er.ReadUInt32(); this.pRawData = er.ReadUInt32(); this.Data = er.ReadBytes((int)this.Header.size - 16); OK = true; } }
public CharacterposInfoBlock(EndianBinaryReader er, out bool OK) { bool OK1; this.Header = new DataBlockHeader(er, "SOPC", out OK1); if (!OK1) { OK = false; } else { this.srcPosX = er.ReadUInt16(); this.srcPosY = er.ReadUInt16(); this.srcW = er.ReadUInt16(); this.srcH = er.ReadUInt16(); OK = true; } }
public FileBlock(EndianBinaryReader er, out bool OK) { bool OK1; this.Header = new DataBlockHeader(er, "FILE", out OK1); if (!OK1) { OK = false; } else { this.nCount = er.ReadUInt32(); while (er.BaseStream.Position % 32L != 0L) { int num = (int)er.ReadByte(); } OK = true; } }
public INF1Section(EndianBinaryReader er, out bool OK) { bool OK1; this.Header = new DataBlockHeader(er, "INF1", out OK1); if (!OK1) { OK = false; } else { this.NrOffset = er.ReadUInt16(); this.Unknown1 = er.ReadUInt16(); this.Unknown2 = er.ReadUInt32(); this.Offsets = er.ReadUInt32s((int)this.NrOffset); er.ReadBytes((int)((long)this.Header.size - (long)((int)this.NrOffset * 4) - 16L)); OK = true; } }
public Palettedata(EndianBinaryReader er, out bool OK) { bool OK1; this.Header = new DataBlockHeader(er, "TTLP", out OK1); if (!OK1) { OK = false; } else { this.fmt = (Graphic.GXTexFmt)er.ReadUInt32(); this.bExtendedPlt = er.ReadUInt32() == 1U; this.szByte = er.ReadUInt32(); this.pRawData = er.ReadUInt32(); this.Data = er.ReadBytes((int)this.Header.size - 24); OK = true; } }
public TexplttSet(EndianBinaryReader er, out bool OK) { bool OK1; this.Header = new DataBlockHeader(er, "TEX0", out OK1); if (!OK1) { OK = false; } else { this.TexInfo = new NSBTX.TexplttSet.texInfo(er); this.Tex4x4Info = new NSBTX.TexplttSet.tex4x4Info(er); this.PlttInfo = new NSBTX.TexplttSet.plttInfo(er); this.dictTex = new Dictionary <NSBTX.TexplttSet.DictTexData>(er); for (int index = 0; index < (int)this.dictTex.numEntry; ++index) { this.dictTex[index].Value.ReadData(er, this.TexInfo.ofsTex, this.Tex4x4Info.ofsTex, this.Tex4x4Info.ofsTexPlttIdx); } this.dictPltt = new Dictionary <NSBTX.TexplttSet.DictPlttData>(er); List <uint> source = new List <uint>(); for (int index = 0; index < (int)this.dictPltt.numEntry; ++index) { source.Add(this.dictPltt[index].Value.offset); } List <uint> list = source.Distinct <uint>().ToList <uint>(); list.Sort(); for (int index1 = 0; index1 < (int)this.dictPltt.numEntry; ++index1) { int index2 = list.IndexOf(this.dictPltt[index1].Value.offset); if (index2 == list.Count - 1) { this.dictPltt[index1].Value.ReadData(er, this.PlttInfo.ofsPlttData, (uint)er.BaseStream.Length - (list[index2] + this.PlttInfo.ofsPlttData + (uint)er.GetMarker(nameof(TexplttSet)))); } else { this.dictPltt[index1].Value.ReadData(er, this.PlttInfo.ofsPlttData, list[index2 + 1] - list[index2]); } } OK = true; } }
public FatBlock(EndianBinaryReader er, out bool OK) { bool OK1; this.Header = new DataBlockHeader(er, "FAT ", out OK1); if (!OK1) { OK = false; } else { this.nCount = er.ReadUInt32(); this.Records = new SDAT.FatBlock.FatRecord[(IntPtr)this.nCount]; for (int index = 0; (long)index < (long)this.nCount; ++index) { this.Records[index] = new SDAT.FatBlock.FatRecord(er); } OK = true; } }
public FMTBlock(EndianBinaryReader er, out bool OK) { bool OK1; this.Header = new DataBlockHeader(er, "fmt ", out OK1); if (!OK1) { OK = false; } else { this.AudioFormat = (WAV.WaveData.FMTBlock.WaveFormat)er.ReadUInt16(); this.NrChannel = er.ReadUInt16(); this.SampleRate = er.ReadUInt32(); this.ByteRate = er.ReadUInt32(); this.BlockAlign = er.ReadUInt16(); this.BitsPerSample = er.ReadUInt16(); OK = true; } }
public Screendata(EndianBinaryReader er, out bool OK) { bool OK1; this.Header = new DataBlockHeader(er, "NRCS", out OK1); if (!OK1) { OK = false; } else { this.screenWidth = er.ReadUInt16(); this.screenHeight = er.ReadUInt16(); this.colorMode = (Graphic.NNSG2dColorMode)er.ReadUInt16(); this.screenFormat = (Graphic.NNSG2dScreenFormat)er.ReadUInt16(); this.szByte = er.ReadUInt32(); this.Data = er.ReadBytes((int)this.szByte); OK = true; } }
public PAL(byte[] file) { EndianBinaryReader er = new EndianBinaryReader((Stream) new MemoryStream(file), Endianness.LittleEndian); bool OK; this.Header = new DataBlockHeader(er, "RIFF", out OK); if (!OK) { int num1 = (int)MessageBox.Show("Error 1"); } else { this.PALdata = new PAL.PALdataSection(er, out OK); if (!OK) { int num2 = (int)MessageBox.Show("Error 2"); } } er.Close(); }
public PalettecompressData(EndianBinaryReader er, out bool OK) { bool OK1; this.Header = new DataBlockHeader(er, "PMCP", out OK1); if (!OK1) { OK = false; } else { OK = true; this.numPalette = er.ReadUInt16(); this.pad16 = er.ReadUInt16(); this.pPlttIdxTbl = er.ReadUInt32(); this.Data = new ushort[(int)this.numPalette]; for (int index = 0; index < (int)this.numPalette; ++index) { this.Data[index] = er.ReadUInt16(); } } }
public Characterdata(EndianBinaryReader er, out bool OK) { bool OK1; this.Header = new DataBlockHeader(er, "RAHC", out OK1); if (!OK1) { OK = false; } else { this.H = er.ReadUInt16(); this.W = er.ReadUInt16(); this.pixelFmt = (Graphic.GXTexFmt)er.ReadUInt32(); this.mapingType = (Graphic.GXOBJVRamModeChar)er.ReadUInt32(); this.characterFmt = (Graphic.NNSG2dCharacterFmt)er.ReadUInt32(); this.szByte = er.ReadUInt32(); this.pRawData = er.ReadUInt32(); this.Data = er.ReadBytes((int)this.szByte); OK = true; } }
public DataSection(EndianBinaryReader er, out bool OK) { bool OK1; this.Header = new DataBlockHeader(er, "DATA", out OK1); if (!OK1) { OK = false; } else { er.ReadBytes(32); this.nSample = er.ReadUInt32(); this.Offsets = er.ReadUInt32s((int)this.nSample); this.SamplesInfo = new SWAV.SWAVInfo[(IntPtr)this.nSample]; this.SampleData = new byte[(IntPtr)this.nSample][]; for (int index = 0; (long)index < (long)this.nSample; ++index) { this.SamplesInfo[index] = new SWAV.SWAVInfo(er); this.SampleData[index] = index >= this.Offsets.Length - 1 ? er.ReadBytes((int)(er.BaseStream.Length - (long)this.Offsets[index]) - 12) : er.ReadBytes((int)this.Offsets[index + 1] - (int)this.Offsets[index] - 12); } OK = true; } }
public SymbolBlock(EndianBinaryReader er, out bool OK) { er.SetMarkerOnCurrentOffset("Symbol"); bool OK1; this.Header = new DataBlockHeader(er, "SYMB", out OK1); if (!OK1) { OK = false; } else { this.nRecOffset = er.ReadUInt32s(8); er.ReadBytes(24); long position = er.BaseStream.Position; er.BaseStream.Position = (long)this.nRecOffset[0] + er.GetMarker("Symbol"); this.SEQRecord = new SDAT.SymbolBlock.SymbolRecord(er); er.BaseStream.Position = (long)this.nRecOffset[1] + er.GetMarker("Symbol"); this.SEQARCRecord = new SDAT.SymbolBlock.SymbolRecord2(er); er.BaseStream.Position = (long)this.nRecOffset[2] + er.GetMarker("Symbol"); this.BANKRecord = new SDAT.SymbolBlock.SymbolRecord(er); er.BaseStream.Position = (long)this.nRecOffset[3] + er.GetMarker("Symbol"); this.WAVEARCRecord = new SDAT.SymbolBlock.SymbolRecord(er); er.BaseStream.Position = (long)this.nRecOffset[4] + er.GetMarker("Symbol"); this.PLAYERRecord = new SDAT.SymbolBlock.SymbolRecord(er); er.BaseStream.Position = (long)this.nRecOffset[5] + er.GetMarker("Symbol"); this.GROUPRecord = new SDAT.SymbolBlock.SymbolRecord(er); er.BaseStream.Position = (long)this.nRecOffset[6] + er.GetMarker("Symbol"); this.PLAYER2Record = new SDAT.SymbolBlock.SymbolRecord(er); er.BaseStream.Position = (long)this.nRecOffset[7] + er.GetMarker("Symbol"); this.STRMRecord = new SDAT.SymbolBlock.SymbolRecord(er); er.BaseStream.Position = position; er.RemoveMarker("Symbol"); OK = true; } }
public InfoBlock(EndianBinaryReader er, out bool OK) { er.SetMarkerOnCurrentOffset("Info"); bool OK1; this.Header = new DataBlockHeader(er, "INFO", out OK1); if (!OK1) { OK = false; } else { this.nRecOffset = er.ReadUInt32s(8); er.ReadBytes(24); long position = er.BaseStream.Position; er.BaseStream.Position = (long)this.nRecOffset[0] + er.GetMarker("Info"); this.SEQRecord = new SDAT.InfoBlock.InfoRecord <SDAT.InfoBlock.SEQInfo>(er); er.BaseStream.Position = (long)this.nRecOffset[1] + er.GetMarker("Info"); this.SEQARCRecord = new SDAT.InfoBlock.InfoRecord <SDAT.InfoBlock.SEQARCInfo>(er); er.BaseStream.Position = (long)this.nRecOffset[2] + er.GetMarker("Info"); this.BANKRecord = new SDAT.InfoBlock.InfoRecord <SDAT.InfoBlock.BANKInfo>(er); er.BaseStream.Position = (long)this.nRecOffset[3] + er.GetMarker("Info"); this.WAVEARCRecord = new SDAT.InfoBlock.InfoRecord <SDAT.InfoBlock.WAVEARCInfo>(er); er.BaseStream.Position = (long)this.nRecOffset[4] + er.GetMarker("Info"); this.PLAYERRecord = new SDAT.InfoBlock.InfoRecord <SDAT.InfoBlock.PLAYERInfo>(er); er.BaseStream.Position = (long)this.nRecOffset[5] + er.GetMarker("Info"); this.GROUPRecord = new SDAT.InfoBlock.InfoRecord <SDAT.InfoBlock.GROUPInfo>(er); er.BaseStream.Position = (long)this.nRecOffset[6] + er.GetMarker("Info"); this.STREAMPLAYERRecord = new SDAT.InfoBlock.InfoRecord <SDAT.InfoBlock.STREAMPLAYERInfo>(er); er.BaseStream.Position = (long)this.nRecOffset[7] + er.GetMarker("Info"); this.STREAMRecord = new SDAT.InfoBlock.InfoRecord <SDAT.InfoBlock.STREAMInfo>(er); er.BaseStream.Position = position; er.RemoveMarker("Info"); OK = true; } }
public PAL(Color[] Palette) { this.Header = new DataBlockHeader("RIFF", (uint)(12 + Palette.Length * 4)); this.PALdata = new PAL.PALdataSection(Palette); }
public DataSection(SWAV.SWAVInfo Info, byte[] Data) { this.Header = new DataBlockHeader("DATA", (uint)(20 + Data.Length)); this.Info = Info; this.Data = Data; }