public override byte[] GetBytes(uint imageBase, bool DX, Dictionary <string, uint> labels, List <uint> njOffsets, out uint address) { List <byte> result = new List <byte>(); uint materialAddress = 0; if (Material != null && Material.Count > 0) { if (labels.ContainsKey(MaterialName)) { materialAddress = labels[MaterialName]; } else { materialAddress = imageBase; labels.Add(MaterialName, materialAddress); foreach (NJS_MATERIAL item in Material) { result.AddRange(item.GetBytes()); } } } uint meshAddress; if (labels.ContainsKey(MeshName)) { meshAddress = labels[MeshName]; } else { uint[] polyAddrs = new uint[Mesh.Count]; uint[] polyNormalAddrs = new uint[Mesh.Count]; uint[] vColorAddrs = new uint[Mesh.Count]; uint[] uVAddrs = new uint[Mesh.Count]; for (int i = 0; i < Mesh.Count; i++) { if (labels.ContainsKey(Mesh[i].PolyName)) { polyAddrs[i] = labels[Mesh[i].PolyName]; } else { result.Align(4); polyAddrs[i] = (uint)result.Count + imageBase; labels.Add(Mesh[i].PolyName, polyAddrs[i]); for (int j = 0; j < Mesh[i].Poly.Count; j++) { result.AddRange(Mesh[i].Poly[j].GetBytes()); } } } for (int i = 0; i < Mesh.Count; i++) { if (Mesh[i].PolyNormal != null && Mesh[i].PolyNormal.Length > 0) { if (labels.ContainsKey(Mesh[i].PolyNormalName)) { polyNormalAddrs[i] = labels[Mesh[i].PolyNormalName]; } else { result.Align(4); polyNormalAddrs[i] = (uint)result.Count + imageBase; labels.Add(Mesh[i].PolyNormalName, polyNormalAddrs[i]); for (int j = 0; j < Mesh[i].PolyNormal.Length; j++) { result.AddRange(Mesh[i].PolyNormal[j].GetBytes()); } } } } for (int i = 0; i < Mesh.Count; i++) { if (Mesh[i].VColor != null && Mesh[i].VColor.Length > 0) { if (labels.ContainsKey(Mesh[i].VColorName)) { vColorAddrs[i] = labels[Mesh[i].VColorName]; } else { result.Align(4); vColorAddrs[i] = (uint)result.Count + imageBase; labels.Add(Mesh[i].VColorName, vColorAddrs[i]); for (int j = 0; j < Mesh[i].VColor.Length; j++) { result.AddRange(VColor.GetBytes(Mesh[i].VColor[j])); } } } } for (int i = 0; i < Mesh.Count; i++) { if (Mesh[i].UV != null && Mesh[i].UV.Length > 0) { if (labels.ContainsKey(Mesh[i].UVName)) { uVAddrs[i] = labels[Mesh[i].UVName]; } else { result.Align(4); uVAddrs[i] = (uint)result.Count + imageBase; labels.Add(Mesh[i].UVName, uVAddrs[i]); for (int j = 0; j < Mesh[i].UV.Length; j++) { result.AddRange(Mesh[i].UV[j].GetBytes()); } } } } result.Align(4); meshAddress = (uint)result.Count + imageBase; labels.Add(MeshName, meshAddress); for (int i = 0; i < Mesh.Count; i++) { //POF0 if (polyAddrs[i] != 0) { njOffsets.Add((uint)(result.Count + imageBase + 0x4)); } if (polyNormalAddrs[i] != 0) { njOffsets.Add((uint)(result.Count + imageBase + 0xC)); } if (vColorAddrs[i] != 0) { njOffsets.Add((uint)(result.Count + imageBase + 0x10)); } if (uVAddrs[i] != 0) { njOffsets.Add((uint)(result.Count + imageBase + 0x14)); } result.AddRange(Mesh[i].GetBytes(polyAddrs[i], polyNormalAddrs[i], vColorAddrs[i], uVAddrs[i], DX)); } } result.Align(4); uint vertexAddress; if (labels.ContainsKey(VertexName)) { vertexAddress = labels[VertexName]; } else { vertexAddress = (uint)result.Count + imageBase; labels.Add(VertexName, vertexAddress); foreach (Vertex item in Vertex) { if (item == null) { result.AddRange(new byte[SAModel.Vertex.Size]); } else { result.AddRange(item.GetBytes()); } } } result.Align(4); uint normalAddress; if (labels.ContainsKey(NormalName)) { normalAddress = labels[NormalName]; } else { normalAddress = (uint)result.Count + imageBase; labels.Add(NormalName, normalAddress); foreach (Vertex item in Normal) { if (item == null) { result.AddRange(new byte[SAModel.Vertex.Size]); } else { result.AddRange(item.GetBytes()); } } } result.Align(4); address = (uint)result.Count; //POF0 if (vertexAddress != 0) { njOffsets.Add((uint)(result.Count + imageBase)); } if (normalAddress != 0) { njOffsets.Add((uint)(result.Count + imageBase + 0x4)); } if (meshAddress != 0) { njOffsets.Add((uint)(result.Count + imageBase + 0xC)); } if (materialAddress != 0) { njOffsets.Add((uint)(result.Count + imageBase + 0x10)); } result.AddRange(ByteConverter.GetBytes(vertexAddress)); result.AddRange(ByteConverter.GetBytes(normalAddress)); result.AddRange(ByteConverter.GetBytes(Vertex.Length)); result.AddRange(ByteConverter.GetBytes(meshAddress)); result.AddRange(ByteConverter.GetBytes(materialAddress)); result.AddRange(ByteConverter.GetBytes((short)Mesh.Count)); result.AddRange(ByteConverter.GetBytes((short)Material.Count)); result.AddRange(Bounds.GetBytes()); if (DX) { result.AddRange(new byte[4]); } labels.Add(Name, address + imageBase); return(result.ToArray()); }
public byte[] GetBytes() { VertexChunk next = null; int vertlimit; int vertcount = Vertices.Count; switch (Type) { case ChunkType.Vertex_VertexSH: vertlimit = 65535 / 4; if (Vertices.Count > vertlimit) { next = new VertexChunk(Type) { Vertices = Vertices.Skip(vertlimit).ToList() }; vertcount = vertlimit; } break; case ChunkType.Vertex_VertexNormalSH: vertlimit = 65535 / 8; if (Vertices.Count > vertlimit) { next = new VertexChunk(Type) { Vertices = Vertices.Skip(vertlimit).ToList(), Normals = Normals.Skip(vertlimit).ToList() }; vertcount = vertlimit; } break; case ChunkType.Vertex_Vertex: vertlimit = 65535 / 3; if (Vertices.Count > vertlimit) { next = new VertexChunk(Type) { Vertices = Vertices.Skip(vertlimit).ToList() }; vertcount = vertlimit; } break; case ChunkType.Vertex_VertexDiffuse8: vertlimit = 65535 / 4; if (Vertices.Count > vertlimit) { next = new VertexChunk(Type) { Vertices = Vertices.Skip(vertlimit).ToList(), Diffuse = Diffuse.Skip(vertlimit).ToList() }; vertcount = vertlimit; } break; case ChunkType.Vertex_VertexUserFlags: vertlimit = 65535 / 4; if (Vertices.Count > vertlimit) { next = new VertexChunk(Type) { Vertices = Vertices.Skip(vertlimit).ToList(), UserFlags = UserFlags.Skip(vertlimit).ToList() }; vertcount = vertlimit; } break; case ChunkType.Vertex_VertexNinjaFlags: vertlimit = 65535 / 4; if (Vertices.Count > vertlimit) { next = new VertexChunk(Type) { Vertices = Vertices.Skip(vertlimit).ToList(), NinjaFlags = NinjaFlags.Skip(vertlimit).ToList() }; vertcount = vertlimit; } break; case ChunkType.Vertex_VertexDiffuseSpecular5: case ChunkType.Vertex_VertexDiffuseSpecular4: vertlimit = 65535 / 4; if (Vertices.Count > vertlimit) { next = new VertexChunk(Type) { Vertices = Vertices.Skip(vertlimit).ToList(), Diffuse = Diffuse.Skip(vertlimit).ToList(), Specular = Specular.Skip(vertlimit).ToList() }; vertcount = vertlimit; } break; case ChunkType.Vertex_VertexNormal: vertlimit = 65535 / 6; if (Vertices.Count > vertlimit) { next = new VertexChunk(Type) { Vertices = Vertices.Skip(vertlimit).ToList(), Normals = Normals.Skip(vertlimit).ToList() }; vertcount = vertlimit; } break; case ChunkType.Vertex_VertexNormalDiffuse8: vertlimit = 65535 / 7; if (Vertices.Count > vertlimit) { next = new VertexChunk(Type) { Vertices = Vertices.Skip(vertlimit).ToList(), Normals = Normals.Skip(vertlimit).ToList(), Diffuse = Diffuse.Skip(vertlimit).ToList() }; vertcount = vertlimit; } break; case ChunkType.Vertex_VertexNormalUserFlags: vertlimit = 65535 / 7; if (Vertices.Count > vertlimit) { next = new VertexChunk(Type) { Vertices = Vertices.Skip(vertlimit).ToList(), Normals = Normals.Skip(vertlimit).ToList(), UserFlags = UserFlags.Skip(vertlimit).ToList() }; vertcount = vertlimit; } break; case ChunkType.Vertex_VertexNormalNinjaFlags: vertlimit = 65535 / 7; if (Vertices.Count > vertlimit) { next = new VertexChunk(Type) { Vertices = Vertices.Skip(vertlimit).ToList(), Normals = Normals.Skip(vertlimit).ToList(), NinjaFlags = NinjaFlags.Skip(vertlimit).ToList() }; vertcount = vertlimit; } break; case ChunkType.Vertex_VertexNormalDiffuseSpecular5: case ChunkType.Vertex_VertexNormalDiffuseSpecular4: vertlimit = 65535 / 7; if (Vertices.Count > vertlimit) { next = new VertexChunk(Type) { Vertices = Vertices.Skip(vertlimit).ToList(), Normals = Normals.Skip(vertlimit).ToList(), Diffuse = Diffuse.Skip(vertlimit).ToList(), Specular = Specular.Skip(vertlimit).ToList() }; vertcount = vertlimit; } break; case ChunkType.End: break; default: throw new NotSupportedException("Unsupported chunk type " + Type + "."); } SetVertCount(vertcount); switch (Type) { case ChunkType.Vertex_Vertex: Size = (ushort)(vertcount * 3 + 1); break; case ChunkType.Vertex_VertexSH: case ChunkType.Vertex_VertexDiffuse8: case ChunkType.Vertex_VertexUserFlags: case ChunkType.Vertex_VertexNinjaFlags: case ChunkType.Vertex_VertexDiffuseSpecular5: case ChunkType.Vertex_VertexDiffuseSpecular4: Size = (ushort)(vertcount * 4 + 1); break; case ChunkType.Vertex_VertexNormal: Size = (ushort)(vertcount * 6 + 1); break; case ChunkType.Vertex_VertexNormalDiffuse8: case ChunkType.Vertex_VertexNormalUserFlags: case ChunkType.Vertex_VertexNormalNinjaFlags: case ChunkType.Vertex_VertexNormalDiffuseSpecular5: case ChunkType.Vertex_VertexNormalDiffuseSpecular4: Size = (ushort)(vertcount * 7 + 1); break; case ChunkType.Vertex_VertexNormalSH: Size = (ushort)(vertcount * 8 + 1); break; } List <byte> result = new List <byte>((Size * 4) + 4); result.AddRange(ByteConverter.GetBytes(Header1)); result.AddRange(ByteConverter.GetBytes(Header2)); for (int i = 0; i < vertcount; i++) { switch (Type) { case ChunkType.Vertex_VertexSH: result.AddRange(Vertices[i].GetBytes()); result.AddRange(ByteConverter.GetBytes(1.0f)); break; case ChunkType.Vertex_VertexNormalSH: result.AddRange(Vertices[i].GetBytes()); result.AddRange(ByteConverter.GetBytes(1.0f)); result.AddRange(Normals[i].GetBytes()); result.AddRange(ByteConverter.GetBytes(1.0f)); break; case ChunkType.Vertex_Vertex: result.AddRange(Vertices[i].GetBytes()); break; case ChunkType.Vertex_VertexDiffuse8: result.AddRange(Vertices[i].GetBytes()); result.AddRange(VColor.GetBytes(Diffuse[i], ColorType.ARGB8888_32)); break; case ChunkType.Vertex_VertexUserFlags: result.AddRange(Vertices[i].GetBytes()); result.AddRange(ByteConverter.GetBytes(UserFlags[i])); break; case ChunkType.Vertex_VertexNinjaFlags: result.AddRange(Vertices[i].GetBytes()); result.AddRange(ByteConverter.GetBytes(NinjaFlags[i])); break; case ChunkType.Vertex_VertexDiffuseSpecular5: result.AddRange(Vertices[i].GetBytes()); result.AddRange(ByteConverter.GetBytes( ByteConverter.ToUInt16(VColor.GetBytes(Diffuse[i], ColorType.RGB565), 0) | (ByteConverter.ToUInt16(VColor.GetBytes(Specular[i], ColorType.RGB565), 0) << 16))); break; case ChunkType.Vertex_VertexDiffuseSpecular4: result.AddRange(Vertices[i].GetBytes()); result.AddRange(ByteConverter.GetBytes( ByteConverter.ToUInt16(VColor.GetBytes(Diffuse[i], ColorType.ARGB4444), 0) | (ByteConverter.ToUInt16(VColor.GetBytes(Specular[i], ColorType.RGB565), 0) << 16))); break; case ChunkType.Vertex_VertexNormal: result.AddRange(Vertices[i].GetBytes()); result.AddRange(Normals[i].GetBytes()); break; case ChunkType.Vertex_VertexNormalDiffuse8: result.AddRange(Vertices[i].GetBytes()); result.AddRange(Normals[i].GetBytes()); result.AddRange(VColor.GetBytes(Diffuse[i], ColorType.ARGB8888_32)); break; case ChunkType.Vertex_VertexNormalUserFlags: result.AddRange(Vertices[i].GetBytes()); result.AddRange(Normals[i].GetBytes()); result.AddRange(ByteConverter.GetBytes(UserFlags[i])); break; case ChunkType.Vertex_VertexNormalNinjaFlags: result.AddRange(Vertices[i].GetBytes()); result.AddRange(Normals[i].GetBytes()); result.AddRange(ByteConverter.GetBytes(NinjaFlags[i])); break; case ChunkType.Vertex_VertexNormalDiffuseSpecular5: result.AddRange(Vertices[i].GetBytes()); result.AddRange(Normals[i].GetBytes()); result.AddRange(ByteConverter.GetBytes( ByteConverter.ToUInt16(VColor.GetBytes(Diffuse[i], ColorType.RGB565), 0) | (ByteConverter.ToUInt16(VColor.GetBytes(Specular[i], ColorType.RGB565), 0) << 16))); break; case ChunkType.Vertex_VertexNormalDiffuseSpecular4: result.AddRange(Vertices[i].GetBytes()); result.AddRange(Normals[i].GetBytes()); result.AddRange(ByteConverter.GetBytes( ByteConverter.ToUInt16(VColor.GetBytes(Diffuse[i], ColorType.ARGB4444), 0) | (ByteConverter.ToUInt16(VColor.GetBytes(Specular[i], ColorType.RGB565), 0) << 16))); break; } } if (next != null) { result.AddRange(next.GetBytes()); } return(result.ToArray()); }
public PolyChunkMaterial(byte[] file, int address) { Header = ByteConverter.ToUInt16(file, address); address += sizeof(ushort); Size = ByteConverter.ToUInt16(file, address); address += sizeof(ushort); switch (Type) { case ChunkType.Material_Diffuse: case ChunkType.Material_DiffuseAmbient: case ChunkType.Material_DiffuseSpecular: case ChunkType.Material_DiffuseAmbientSpecular: case ChunkType.Material_Diffuse2: case ChunkType.Material_DiffuseAmbient2: case ChunkType.Material_DiffuseSpecular2: case ChunkType.Material_DiffuseAmbientSpecular2: Diffuse = VColor.FromBytes(file, address, ColorType.ARGB8888_16); address += VColor.Size(ColorType.ARGB8888_16); break; } switch (Type) { case ChunkType.Material_Ambient: case ChunkType.Material_DiffuseAmbient: case ChunkType.Material_AmbientSpecular: case ChunkType.Material_DiffuseAmbientSpecular: case ChunkType.Material_Ambient2: case ChunkType.Material_DiffuseAmbient2: case ChunkType.Material_AmbientSpecular2: case ChunkType.Material_DiffuseAmbientSpecular2: Ambient = VColor.FromBytes(file, address, ColorType.XRGB8888_16); address += VColor.Size(ColorType.XRGB8888_16); break; } switch (Type) { case ChunkType.Material_Specular: case ChunkType.Material_DiffuseSpecular: case ChunkType.Material_AmbientSpecular: case ChunkType.Material_DiffuseAmbientSpecular: case ChunkType.Material_Specular2: case ChunkType.Material_DiffuseSpecular2: case ChunkType.Material_AmbientSpecular2: case ChunkType.Material_DiffuseAmbientSpecular2: Specular = VColor.FromBytes(file, address, ColorType.XRGB8888_16); SpecularExponent = (byte)(ByteConverter.ToUInt16(file, address + 2) >> 8); address += VColor.Size(ColorType.XRGB8888_16); break; } switch (Type) { case ChunkType.Material_Diffuse2: case ChunkType.Material_Ambient2: case ChunkType.Material_DiffuseAmbient2: case ChunkType.Material_Specular2: case ChunkType.Material_DiffuseSpecular2: case ChunkType.Material_AmbientSpecular2: case ChunkType.Material_DiffuseAmbientSpecular2: Second = true; break; } }
public VertexChunk(byte[] file, int address) : this() { Header1 = ByteConverter.ToUInt32(file, address); Header2 = ByteConverter.ToUInt32(file, address + 4); address += 8; for (int i = 0; i < GetVertCount(); i++) { switch (Type) { case ChunkType.Vertex_VertexSH: Vertices.Add(new Vertex(file, address)); address += Vertex.Size + sizeof(float); break; case ChunkType.Vertex_VertexNormalSH: Vertices.Add(new Vertex(file, address)); address += Vertex.Size + sizeof(float); Normals.Add(new Vertex(file, address)); address += Vertex.Size + sizeof(float); break; case ChunkType.Vertex_Vertex: Vertices.Add(new Vertex(file, address)); address += Vertex.Size; break; case ChunkType.Vertex_VertexDiffuse8: Vertices.Add(new Vertex(file, address)); address += Vertex.Size; Diffuse.Add(VColor.FromBytes(file, address, ColorType.ARGB8888_32)); address += VColor.Size(ColorType.ARGB8888_32); break; case ChunkType.Vertex_VertexUserFlags: Vertices.Add(new Vertex(file, address)); address += Vertex.Size; UserFlags.Add(ByteConverter.ToUInt32(file, address)); address += sizeof(uint); break; case ChunkType.Vertex_VertexNinjaFlags: Vertices.Add(new Vertex(file, address)); address += Vertex.Size; NinjaFlags.Add(ByteConverter.ToUInt32(file, address)); address += sizeof(uint); break; case ChunkType.Vertex_VertexDiffuseSpecular5: Vertices.Add(new Vertex(file, address)); address += Vertex.Size; uint tmpcolor = ByteConverter.ToUInt32(file, address); address += sizeof(uint); Diffuse.Add(VColor.FromBytes(ByteConverter.GetBytes((ushort)(tmpcolor & 0xFFFF)), 0, ColorType.RGB565)); Specular.Add(VColor.FromBytes(ByteConverter.GetBytes((ushort)(tmpcolor >> 16)), 0, ColorType.RGB565)); break; case ChunkType.Vertex_VertexDiffuseSpecular4: Vertices.Add(new Vertex(file, address)); address += Vertex.Size; tmpcolor = ByteConverter.ToUInt32(file, address); address += sizeof(uint); Diffuse.Add(VColor.FromBytes(ByteConverter.GetBytes((ushort)(tmpcolor & 0xFFFF)), 0, ColorType.ARGB4444)); Specular.Add(VColor.FromBytes(ByteConverter.GetBytes((ushort)(tmpcolor >> 16)), 0, ColorType.RGB565)); break; case ChunkType.Vertex_VertexNormal: Vertices.Add(new Vertex(file, address)); address += Vertex.Size; Normals.Add(new Vertex(file, address)); address += Vertex.Size; break; case ChunkType.Vertex_VertexNormalDiffuse8: Vertices.Add(new Vertex(file, address)); address += Vertex.Size; Normals.Add(new Vertex(file, address)); address += Vertex.Size; Diffuse.Add(VColor.FromBytes(file, address, ColorType.ARGB8888_32)); address += VColor.Size(ColorType.ARGB8888_32); break; case ChunkType.Vertex_VertexNormalUserFlags: Vertices.Add(new Vertex(file, address)); address += Vertex.Size; Normals.Add(new Vertex(file, address)); address += Vertex.Size; UserFlags.Add(ByteConverter.ToUInt32(file, address)); address += sizeof(uint); break; case ChunkType.Vertex_VertexNormalNinjaFlags: Vertices.Add(new Vertex(file, address)); address += Vertex.Size; Normals.Add(new Vertex(file, address)); address += Vertex.Size; NinjaFlags.Add(ByteConverter.ToUInt32(file, address)); address += sizeof(uint); break; case ChunkType.Vertex_VertexNormalDiffuseSpecular5: Vertices.Add(new Vertex(file, address)); address += Vertex.Size; Normals.Add(new Vertex(file, address)); address += Vertex.Size; tmpcolor = ByteConverter.ToUInt32(file, address); address += sizeof(uint); Diffuse.Add(VColor.FromBytes(ByteConverter.GetBytes((ushort)(tmpcolor & 0xFFFF)), 0, ColorType.RGB565)); Specular.Add(VColor.FromBytes(ByteConverter.GetBytes((ushort)(tmpcolor >> 16)), 0, ColorType.RGB565)); break; case ChunkType.Vertex_VertexNormalDiffuseSpecular4: Vertices.Add(new Vertex(file, address)); address += Vertex.Size; Normals.Add(new Vertex(file, address)); address += Vertex.Size; tmpcolor = ByteConverter.ToUInt32(file, address); address += sizeof(uint); Diffuse.Add(VColor.FromBytes(ByteConverter.GetBytes((ushort)(tmpcolor & 0xFFFF)), 0, ColorType.ARGB4444)); Specular.Add(VColor.FromBytes(ByteConverter.GetBytes((ushort)(tmpcolor >> 16)), 0, ColorType.RGB565)); break; default: throw new NotSupportedException("Unsupported chunk type " + Type + " at " + address.ToString("X8") + "."); } } }
public Strip(byte[] file, int address, ChunkType type, byte userFlags) { Indexes = new ushort[Math.Abs(ByteConverter.ToInt16(file, address))]; Reversed = (ByteConverter.ToUInt16(file, address) & 0x8000) == 0x8000; address += 2; switch (type) { case ChunkType.Strip_StripUVN: case ChunkType.Strip_StripUVH: case ChunkType.Strip_StripUVN2: case ChunkType.Strip_StripUVH2: UVs = new UV[Indexes.Length]; break; case ChunkType.Strip_StripColor: VColors = new Color[Indexes.Length]; break; case ChunkType.Strip_StripUVNColor: case ChunkType.Strip_StripUVHColor: UVs = new UV[Indexes.Length]; VColors = new Color[Indexes.Length]; break; } if (userFlags > 0) { UserFlags1 = new ushort[Indexes.Length - 2]; } if (userFlags > 1) { UserFlags2 = new ushort[Indexes.Length - 2]; } if (userFlags > 2) { UserFlags3 = new ushort[Indexes.Length - 2]; } for (int i = 0; i < Indexes.Length; i++) { Indexes[i] = ByteConverter.ToUInt16(file, address); address += 2; switch (type) { case ChunkType.Strip_StripUVN: case ChunkType.Strip_StripUVNColor: case ChunkType.Strip_StripUVN2: UVs[i] = new UV(file, address, false, true); address += UV.Size; break; case ChunkType.Strip_StripUVH: case ChunkType.Strip_StripUVHColor: case ChunkType.Strip_StripUVH2: UVs[i] = new UV(file, address, true, true); address += UV.Size; break; } switch (type) { case ChunkType.Strip_StripColor: case ChunkType.Strip_StripUVNColor: case ChunkType.Strip_StripUVHColor: VColors[i] = VColor.FromBytes(file, address, ColorType.ARGB8888_16); address += VColor.Size(ColorType.ARGB8888_16); break; } if (i > 1) { if (userFlags > 0) { UserFlags1[i - 2] = ByteConverter.ToUInt16(file, address); address += 2; if (userFlags > 1) { UserFlags2[i - 2] = ByteConverter.ToUInt16(file, address); address += 2; if (userFlags > 2) { UserFlags3[i - 2] = ByteConverter.ToUInt16(file, address); address += 2; } } } } } }