public byte[] DemuxBMDBytes(PkmnMapHeader_Bw map, int type) { if (_stream.GetRemainingLength() < 0x18L) { throw new Exception("File too short to contain NSBMD!"); } _stream.Position = map.BMDOffset; if (_stream.GetRemainingLength() < 0x10L) { throw new Exception("File too short to contain NSBMD!"); } int num = 0; for (int i = 0; i < 4; i++) { num = _reader.ReadInt32(); if (num == 0x30444d42) { break; } } if (num != 0x30444d42) { throw new InvalidDataException("No BMD0 Header at expected offset!"); } Stream stream1 = _stream; stream1.Position -= 4L; return(_reader.ReadBytes((int)map.BMDOSize)); }
public static PkmnMapHeader_Bw FromReader(BinaryReader reader) { PkmnMapHeader_Bw bw = new PkmnMapHeader_Bw(); reader.BaseStream.Seek(2L, SeekOrigin.Current); byte num = reader.ReadByte(); reader.ReadByte(); switch (num) { case 3: bw.BMDOffset = reader.ReadUInt32(); bw.MovOffset = reader.ReadUInt32(); bw.ObjOffset = reader.ReadUInt32(); bw.BdhcOffset = reader.ReadUInt32(); return(bw); case 2: bw.BMDOffset = reader.ReadUInt32(); bw.MovOffset = reader.ReadUInt32(); bw.ObjOffset = reader.ReadUInt32(); bw.BdhcOffset = bw.ObjOffset; return(bw); case 1: bw.BMDOffset = reader.ReadUInt32(); bw.MovOffset = reader.ReadUInt32(); bw.ObjOffset = bw.MovOffset; bw.BdhcOffset = bw.MovOffset; break; default: bw.BMDOffset = reader.ReadUInt32(); bw.MovOffset = reader.ReadUInt32(); bw.ObjOffset = reader.ReadUInt32(); bw.BdhcOffset = reader.ReadUInt32(); return(bw); } return(bw); }
public byte[] DemuxObjBytes(PkmnMapHeader_Bw map) { _stream.Position = map.ObjOffset; return(_reader.ReadBytes((int)map.ObjSize)); }