public static ushort ReadUInt16(this Stream s, EndianUtils.Endianness endian = EndianUtils.Endianness.LittleEndian) { int b1 = s.ReadByte(); int b2 = s.ReadByte(); switch (endian) { case EndianUtils.Endianness.LittleEndian: return((ushort)(b2 << 8 | b1)); case EndianUtils.Endianness.BigEndian: return((ushort)(b1 << 8 | b2)); default: throw new Exception("unknown endianness"); } }
public Sen2SystemDataForm(Sen2SystemData data, string path, EndianUtils.Endianness endian) { this.SystemData = data; this.SystemDataPath = path; this.Endian = endian; InitializeComponent(); InitButtonMappingCombobox(comboBoxDPadUp, data.DPadUpButtonMapping, ZoomIn); InitButtonMappingCombobox(comboBoxDPadDown, data.DPadDownButtonMapping, ZoomOut); InitButtonMappingCombobox(comboBoxDPadLeft, data.DPadLeftButtonMapping, TurnCharacter); InitButtonMappingCombobox(comboBoxDPadRight, data.DPadRightButtonMapping, TurnCharacter); InitButtonMappingCombobox(comboBoxL1, data.L1ButtonMapping, ChangeLeaderNext, false); InitButtonMappingCombobox(comboBoxR1, data.R1ButtonMapping, Dash, false); InitButtonMappingCombobox(comboBoxCircle, data.CircleButtonMapping, Walk, false); }
public EncounterGroup(System.IO.Stream stream, uint refStringStart, EndianUtils.Endianness endian, BitUtils.Bitness bits) { uint entryLength = stream.ReadUInt32().FromEndian(endian); ID = stream.ReadUInt32().FromEndian(endian); StringDicID = stream.ReadUInt32().FromEndian(endian); InGameID = stream.ReadUInt32().FromEndian(endian); ulong refLoc = stream.ReadUInt(bits, endian); EnemyGroupIDs = new uint[10]; for (int i = 0; i < 10; ++i) { EnemyGroupIDs[i] = stream.ReadUInt32().FromEndian(endian); } RefString = stream.ReadAsciiNulltermFromLocationAndReset((long)(refStringStart + refLoc)); }
public EnemyGroup(System.IO.Stream stream, uint refStringStart, EndianUtils.Endianness endian, BitUtils.Bitness bits) { uint entryLength = stream.ReadUInt32().FromEndian(endian); ID = stream.ReadUInt32().FromEndian(endian); StringDicID = stream.ReadUInt32().FromEndian(endian); InGameID = stream.ReadUInt32().FromEndian(endian); ulong refLoc = stream.ReadUInt(bits, endian); EnemyIDs = new int[8]; for (int i = 0; i < EnemyIDs.Length; ++i) { EnemyIDs[i] = (int)stream.ReadUInt32().FromEndian(endian); } UnknownFloats = new float[8]; for (int i = 0; i < UnknownFloats.Length; ++i) { UnknownFloats[i] = stream.ReadUInt32().FromEndian(endian).UIntToFloat(); } PosX = new float[8]; for (int i = 0; i < PosX.Length; ++i) { PosX[i] = stream.ReadUInt32().FromEndian(endian).UIntToFloat(); } PosY = new float[8]; for (int i = 0; i < PosY.Length; ++i) { PosY[i] = stream.ReadUInt32().FromEndian(endian).UIntToFloat(); } Scale = new float[8]; for (int i = 0; i < Scale.Length; ++i) { Scale[i] = stream.ReadUInt32().FromEndian(endian).UIntToFloat(); } SomeFlag = stream.ReadUInt32().FromEndian(endian); UnknownInts = new uint[8]; for (int i = 0; i < UnknownInts.Length; ++i) { UnknownInts[i] = stream.ReadUInt32().FromEndian(endian); } RefString = stream.ReadAsciiNulltermFromLocationAndReset((long)(refStringStart + refLoc)); }
private bool LoadFile(Stream stream, EndianUtils.Endianness endian) { string magic = stream.ReadAscii(8); uint unknown1 = stream.ReadUInt32().FromEndian(endian); uint entryCount = stream.ReadUInt32().FromEndian(endian); uint unknown2 = stream.ReadUInt32().FromEndian(endian); stream.DiscardBytes(12); BattleBookEntryList = new List <BattleBookEntry>((int)entryCount); for (uint i = 0; i < entryCount; ++i) { BattleBookEntry e = new BattleBookEntry(stream, endian); BattleBookEntryList.Add(e); } return(true); }
private static List <string> ParseBookFunction(Stream s, long end, EndianUtils.Endianness e) { List <string> text = new List <string>(); short dataCounter = s.ReadInt16(e); for (int i = 0; i < dataCounter; ++i) { s.DiscardBytes(0x26); } List <byte> sb = new List <byte>(); List <byte> contentbytes = new List <byte>(); ReadString(s, sb, contentbytes); string str = Encoding.UTF8.GetString(sb.ToArray()); text.AddRange(str.Split(new string[] { "\\n" }, StringSplitOptions.None)); return(text); }
private bool LoadFile(Stream stream, TextUtils.GameTextEncoding encoding, EndianUtils.Endianness endian, BitUtils.Bitness bits) { uint magic = stream.ReadUInt32().SwapEndian(); uint headerSize = stream.ReadUInt32().FromEndian(endian); stream.ReadUInt32().FromEndian(endian); uint textStart = stream.ReadUInt32().FromEndian(endian); stream.ReadUInt32().FromEndian(endian); stream.ReadUInt32().FromEndian(endian); uint textLength = stream.ReadUInt32().FromEndian(endian); stream.ReadUInt32().FromEndian(endian); EntryList = FindText(stream, textStart, encoding, endian, bits); return(true); }
public T8BTVAEntry(System.IO.Stream stream, uint refStringStart, EndianUtils.Endianness endian, uint byteCount) { if ((byteCount % 4) != 0) { throw new Exception("T8BTVAEntry byte count must be divisible by 4"); } Data = new uint[byteCount / 4]; for (int i = 0; i < Data.Length; ++i) { Data[i] = stream.ReadUInt32().FromEndian(endian); } RefString = stream.ReadAsciiNulltermFromLocationAndReset(refStringStart + Data[22]); ScenarioStart = Data[2]; ScenarioEnd = Data[3]; CharacterBitmask = Data[5]; KillCharacterBitmask = Data[6]; }
public static uint ReadUInt32(this Stream s, EndianUtils.Endianness endian = EndianUtils.Endianness.LittleEndian) { int b1 = s.ReadByte(); int b2 = s.ReadByte(); int b3 = s.ReadByte(); int b4 = s.ReadByte(); switch (endian) { case EndianUtils.Endianness.LittleEndian: return((uint)(b4 << 24 | b3 << 16 | b2 << 8 | b1)); case EndianUtils.Endianness.BigEndian: return((uint)(b1 << 24 | b2 << 16 | b3 << 8 | b4)); default: throw new Exception("unknown endianness"); } }
public GradeShopEntry(System.IO.Stream stream, uint refStringStart, EndianUtils.Endianness endian, BitUtils.Bitness bits) { uint entrySize = stream.ReadUInt32().FromEndian(endian); if (entrySize != (0x18 + bits.NumberOfBytes())) { throw new Exception("Unexpected GradeShopEntry size."); } ID = stream.ReadUInt32().FromEndian(endian); InGameID = stream.ReadUInt32().FromEndian(endian); ulong refStringLocation = stream.ReadUInt(bits, endian); NameStringDicID = stream.ReadUInt32().FromEndian(endian); DescStringDicID = stream.ReadUInt32().FromEndian(endian); GradeCost = stream.ReadUInt32().FromEndian(endian); RefString = stream.ReadAsciiNulltermFromLocationAndReset((long)(refStringStart + refStringLocation)); }
private bool LoadFile(Stream stream, EndianUtils.Endianness endian) { string magic = stream.ReadAscii(8); if (magic != "T8BTVA ") { throw new Exception("Invalid magic."); } uint blockCount = stream.ReadUInt32().FromEndian(endian); uint refStringStart = stream.ReadUInt32().FromEndian(endian); Blocks = new List <T8BTVABlock>((int)blockCount); for (uint i = 0; i < blockCount; ++i) { Blocks.Add(new T8BTVABlock(stream, refStringStart, endian)); } return(true); }
public static DuplicatableStream Pack(List <SpkdPackFileData> packs, EndianUtils.Endianness e = EndianUtils.Endianness.BigEndian) { using (MemoryStream ms = new MemoryStream()) { ms.WriteUInt32(0x444B5053, EndianUtils.Endianness.LittleEndian); ms.WriteUInt32((uint)packs.Count, e); ms.WriteUInt32(0, e); ms.WriteUInt32(0x20, e); ms.WriteAlign(0x20); long headerstart = ms.Position; for (int i = 0; i < packs.Count; ++i) { var p = packs[i]; ms.WriteAscii(p.Name, 0x10); ms.WriteUInt32(p.Unknown, e); // file offsets, we'll fill these in later... ms.WriteUInt32(0xffffffffu, e); ms.WriteUInt32(0xffffffffu, e); ms.WriteUInt32(0xffffffffu, e); } for (int i = 0; i < packs.Count; ++i) { var p = packs[i]; for (int j = 0; j < 3; ++j) { DuplicatableStream inject = j == 0 ? p.File0 : j == 1 ? p.File1 : p.File2; if (inject != null) { long pos = ms.Position; ms.Position = headerstart + (i * 0x20) + 0x14 + (j * 4); ms.WriteUInt32((uint)pos, e); ms.Position = pos; using (var ds = inject.Duplicate()) { ds.Position = 0; StreamUtils.CopyStream(ds, ms); } ms.WriteAlign(0x10); } } } return(ms.CopyToByteArrayStreamAndDispose()); } }
static void Main(string[] args) { if (args.Length < 1) { Console.WriteLine("Usage: DKC2SramChecksum in.srm [out.srm]"); return; } var data = new DuplicatableFileStream(args[0]).CopyToMemoryAndDispose(); if (data.Length != 2048) { Console.WriteLine("Not a valid filesize for a DKC2 save file (must be 2048 bytes)."); return; } EndianUtils.Endianness e = EndianUtils.Endianness.LittleEndian; int[] saveOffsets = new int[] { 0x8, 0x2b0, 0x558 }; for (int i = 0; i < 3; ++i) { ushort checksum = 0; ushort checkxor = 0; data.Position = saveOffsets[i] + 0x6; for (int j = 6; j != 0x2a2; j += 2) { ushort value = data.ReadUInt16(e); checksum += value; checkxor ^= value; } data.Position = saveOffsets[i]; data.WriteUInt16(checksum, e); data.WriteUInt16(checkxor, e); } using (var fs = new FileStream(args.Length < 2 ? (args[0] + ".out") : args[1], FileMode.Create)) { data.Position = 0; StreamUtils.CopyStream(data, fs); } return; }
private bool LoadFile(Stream stream) { string magic = stream.ReadAscii(4); switch (magic) { case "G1TG": Endian = EndianUtils.Endianness.BigEndian; break; case "GT1G": Endian = EndianUtils.Endianness.LittleEndian; break; default: throw new Exception("Not a g1t file!"); } uint version = stream.ReadUInt32().FromEndian(Endian); switch (version) { case 0x30303530: break; case 0x30303630: break; default: throw new Exception("Unsupported g1t version!"); } uint fileSize = stream.ReadUInt32().FromEndian(Endian); uint headerSize = stream.ReadUInt32().FromEndian(Endian); uint numberTextures = stream.ReadUInt32().FromEndian(Endian); uint unknown = stream.ReadUInt32().FromEndian(Endian); stream.Position = headerSize; uint bytesUnknownData = stream.ReadUInt32().FromEndian(Endian); stream.Position = headerSize + bytesUnknownData; Textures = new List <g1tTexture>((int)numberTextures); for (uint i = 0; i < numberTextures; ++i) { var g = new g1tTexture(stream, Endian); Textures.Add(g); } return(true); }
public static ulong ReadUInt40(this Stream s, EndianUtils.Endianness endian = EndianUtils.Endianness.LittleEndian) { ulong b1 = (ulong)s.ReadByte(); ulong b2 = (ulong)s.ReadByte(); ulong b3 = (ulong)s.ReadByte(); ulong b4 = (ulong)s.ReadByte(); ulong b5 = (ulong)s.ReadByte(); switch (endian) { case EndianUtils.Endianness.LittleEndian: return((ulong)(b5 << 32 | b4 << 24 | b3 << 16 | b2 << 8 | b1)); case EndianUtils.Endianness.BigEndian: return((ulong)(b1 << 32 | b2 << 24 | b3 << 16 | b4 << 8 | b5)); default: throw new Exception("unknown endianness"); } }
private bool LoadFile(Stream stream, EndianUtils.Endianness endian, BitUtils.Bitness bits) { string magic = stream.ReadAscii(8); if (magic != "T8BTGR ") { throw new Exception("Invalid magic."); } uint entryCount = stream.ReadUInt32().FromEndian(endian); uint refStringStart = stream.ReadUInt32().FromEndian(endian); GradeShopEntryList = new List <GradeShopEntry>((int)entryCount); for (uint i = 0; i < entryCount; ++i) { GradeShopEntry e = new GradeShopEntry(stream, refStringStart, endian, bits); GradeShopEntryList.Add(e); } return(true); }
private bool LoadFile(Stream stream, EndianUtils.Endianness endian, BitUtils.Bitness bits) { string magic = stream.ReadAscii(8); if (magic != "T8BTXTMT") { throw new Exception("Invalid magic."); } uint infoCount = stream.ReadUInt32().FromEndian(endian); uint refStringStart = stream.ReadUInt32().FromEndian(endian); TreasureInfoList = new List <TreasureInfo>((int)infoCount); for (uint i = 0; i < infoCount; ++i) { TreasureInfo ti = new TreasureInfo(stream, refStringStart, endian, bits); TreasureInfoList.Add(ti); } return(true); }
public Sen2SystemData(Stream s, EndianUtils.Endianness endian) { Always7 = s.ReadUInt32(endian); Unknown1 = s.ReadUInt8(); Unknown2 = s.ReadUInt8(); TitleScreenVariant = s.ReadUInt8(); Unknown4 = s.ReadUInt8(); MemoriesBitfield = s.ReadUInt32(endian); Unknown9 = s.ReadUInt8(); Unknown10 = s.ReadUInt8(); Unknown11 = s.ReadUInt8(); Unknown12 = s.ReadUInt8(); BgmVolume = s.ReadUInt16(endian); SeVolume = s.ReadUInt16(endian); VoiceVolume = s.ReadUInt16(endian); VerticalCamera = s.ReadUInt16(endian); HorizontalCamera = s.ReadUInt16(endian); L2ButtonMapping = s.ReadUInt16(endian); R2ButtonMapping = s.ReadUInt16(endian); DPadUpButtonMapping = s.ReadUInt16(endian); DPadDownButtonMapping = s.ReadUInt16(endian); DPadLeftButtonMapping = s.ReadUInt16(endian); DPadRightButtonMapping = s.ReadUInt16(endian); L1ButtonMapping = s.ReadUInt16(endian); R1ButtonMapping = s.ReadUInt16(endian); CircleButtonMapping = s.ReadUInt16(endian); Minimap = s.ReadUInt16(endian); Vibration = s.ReadUInt16(endian); ScreenWidth = s.ReadUInt16(endian); ScreenHeight = s.ReadUInt16(endian); ScreenBrightness = s.ReadUInt16(endian); ActiveVoice = s.ReadUInt16(endian); Unknown13 = s.ReadUInt64(endian); Unknown14 = s.ReadUInt64(endian); Unknown15 = s.ReadUInt64(endian); Unknown16 = s.ReadUInt64(endian); Unknown17 = s.ReadUInt64(endian); Unknown18 = s.ReadUInt64(endian); Unknown19 = s.ReadUInt64(endian); Unknown20 = s.ReadUInt64(endian); }
public void SerializeToStream(Stream s, EndianUtils.Endianness endian) { s.WriteUInt32(Always7, endian); s.WriteUInt8(Unknown1); s.WriteUInt8(Unknown2); s.WriteUInt8(TitleScreenVariant); s.WriteUInt8(Unknown4); s.WriteUInt32(MemoriesBitfield, endian); s.WriteUInt8(Unknown9); s.WriteUInt8(Unknown10); s.WriteUInt8(Unknown11); s.WriteUInt8(Unknown12); s.WriteUInt16(BgmVolume, endian); s.WriteUInt16(SeVolume, endian); s.WriteUInt16(VoiceVolume, endian); s.WriteUInt16(VerticalCamera, endian); s.WriteUInt16(HorizontalCamera, endian); s.WriteUInt16(L2ButtonMapping, endian); s.WriteUInt16(R2ButtonMapping, endian); s.WriteUInt16(DPadUpButtonMapping, endian); s.WriteUInt16(DPadDownButtonMapping, endian); s.WriteUInt16(DPadLeftButtonMapping, endian); s.WriteUInt16(DPadRightButtonMapping, endian); s.WriteUInt16(L1ButtonMapping, endian); s.WriteUInt16(R1ButtonMapping, endian); s.WriteUInt16(CircleButtonMapping, endian); s.WriteUInt16(Minimap, endian); s.WriteUInt16(Vibration, endian); s.WriteUInt16(ScreenWidth, endian); s.WriteUInt16(ScreenHeight, endian); s.WriteUInt16(ScreenBrightness, endian); s.WriteUInt16(ActiveVoice, endian); s.WriteUInt64(Unknown13, endian); s.WriteUInt64(Unknown14, endian); s.WriteUInt64(Unknown15, endian); s.WriteUInt64(Unknown16, endian); s.WriteUInt64(Unknown17, endian); s.WriteUInt64(Unknown18, endian); s.WriteUInt64(Unknown19, endian); s.WriteUInt64(Unknown20, endian); }
public t_voice_tbl(Stream stream) { Stream s = new DuplicatableByteArrayStream(stream.CopyToByteArray()); EndianUtils.Endianness e = EndianUtils.Endianness.LittleEndian; ushort count = s.ReadUInt16(e); if (s.PeekUInt32(e) == 1) { // CS2 has something odd I don't fully understand at the start of the file, try to skip past that s.Position += 0xe; } Entries = new List <t_voice_tbl_entry>(); for (int i = 0; i < count; ++i) { Entries.Add(new t_voice_tbl_entry(s, e)); } return; }
public VoiceTable(Stream s, EndianUtils.Endianness e = EndianUtils.Endianness.LittleEndian) { s.Position = 0; ushort count = s.ReadUInt16(e); if (s.PeekUInt32(e) == 1) { // CS2 has something odd I don't fully understand at the start of the file, try to skip past that UnknownStartOfFileData = s.ReadUInt8Array(0xe); } else { UnknownStartOfFileData = null; } Entries = new List <VoiceTableEntry>(); for (int i = 0; i < count; ++i) { Entries.Add(new VoiceTableEntry(s, e)); } }
public static void WriteUInt16(this Stream s, ushort num, EndianUtils.Endianness endian = EndianUtils.Endianness.LittleEndian) { byte b1 = (byte)(num & 0xFF); byte b2 = (byte)((num >> 8) & 0xFF); switch (endian) { case EndianUtils.Endianness.LittleEndian: s.WriteByte(b1); s.WriteByte(b2); return; case EndianUtils.Endianness.BigEndian: s.WriteByte(b2); s.WriteByte(b1); return; default: throw new Exception("unknown endianness"); } }
private bool LoadFile(Stream stream, EndianUtils.Endianness endian) { string magic = stream.ReadAscii(8); if (magic != "TOVSEAF\0") { throw new Exception("Invalid magic."); } uint fileSize = stream.ReadUInt32().FromEndian(endian); uint definitionsStart = stream.ReadUInt32().FromEndian(endian); uint definitionsCount = stream.ReadUInt32().FromEndian(endian); // 64 bytes per entry uint contentsStart = stream.ReadUInt32().FromEndian(endian); uint contentsCount = stream.ReadUInt32().FromEndian(endian); // 16 bytes per entry uint itemsStart = stream.ReadUInt32().FromEndian(endian); uint itemsCount = stream.ReadUInt32().FromEndian(endian); // 8 bytes per entry uint refStringStart = stream.ReadUInt32().FromEndian(endian); stream.Position = definitionsStart; SearchPointDefinitions = new List <SearchPointDefinition>((int)definitionsCount); for (uint i = 0; i < definitionsCount; ++i) { SearchPointDefinitions.Add(new SearchPointDefinition(stream, endian)); } stream.Position = contentsStart; SearchPointContents = new List <SearchPointContent>((int)contentsCount); for (uint i = 0; i < contentsCount; ++i) { SearchPointContents.Add(new SearchPointContent(stream, endian)); } stream.Position = itemsStart; SearchPointItems = new List <SearchPointItem>((int)itemsCount); for (uint i = 0; i < itemsCount; ++i) { SearchPointItems.Add(new SearchPointItem(stream, endian)); } return(true); }
public static void WriteUInt64(this Stream s, ulong num, EndianUtils.Endianness endian = EndianUtils.Endianness.LittleEndian) { byte b1 = (byte)(num & 0xFF); byte b2 = (byte)((num >> 8) & 0xFF); byte b3 = (byte)((num >> 16) & 0xFF); byte b4 = (byte)((num >> 24) & 0xFF); byte b5 = (byte)((num >> 32) & 0xFF); byte b6 = (byte)((num >> 40) & 0xFF); byte b7 = (byte)((num >> 48) & 0xFF); byte b8 = (byte)((num >> 56) & 0xFF); switch (endian) { case EndianUtils.Endianness.LittleEndian: s.WriteByte(b1); s.WriteByte(b2); s.WriteByte(b3); s.WriteByte(b4); s.WriteByte(b5); s.WriteByte(b6); s.WriteByte(b7); s.WriteByte(b8); return; case EndianUtils.Endianness.BigEndian: s.WriteByte(b8); s.WriteByte(b7); s.WriteByte(b6); s.WriteByte(b5); s.WriteByte(b4); s.WriteByte(b3); s.WriteByte(b2); s.WriteByte(b1); return; default: throw new Exception("unknown endianness"); } }
public SPKD(DuplicatableStream duplicatableStream, EndianUtils.Endianness e = EndianUtils.Endianness.BigEndian) { Stream = duplicatableStream.Duplicate(); Stream.Position = 4; uint fileCount = Stream.ReadUInt32(e); Stream.Position = 12; uint dataStart = Stream.ReadUInt32(e); Files = new List <SpkdFileData>((int)fileCount); Stream.Position = dataStart; for (uint i = 0; i < fileCount; ++i) { var f = new SpkdFileData(); f.Name = Stream.ReadAscii(16).TrimNull(); f.Unknown = Stream.ReadUInt32(e); f.FileStart0 = Stream.ReadUInt32(e); f.FileStart1 = Stream.ReadUInt32(e); f.FileStart2 = Stream.ReadUInt32(e); Files.Add(f); } LastFileEnd = (uint)Stream.Length; }
public t_voice_tbl_entry(Stream s, EndianUtils.Endianness e) { string magic = s.ReadAscii(6); if (magic != "voice\0") { throw new Exception("unexpected format"); } ushort entrysize = s.ReadUInt16(e); Index = s.ReadUInt16(e); Name = s.ReadAscii(entrysize - 0x11); Unknown1 = s.ReadUInt56(EndianUtils.Endianness.BigEndian); Unknown2 = s.ReadUInt64(EndianUtils.Endianness.BigEndian); if (Unknown1 != 0 || Unknown2 != 0x1000000c842) { throw new Exception("unexpected format"); } return; }
private bool LoadFile(Stream stream, EndianUtils.Endianness endian) { string magic = stream.ReadAscii(8); if (magic != "SYNPDAT\0") { throw new Exception("Invalid magic."); } uint entrySize = stream.ReadUInt32().FromEndian(endian); uint synopsisCount = stream.ReadUInt32().FromEndian(endian); uint unknown = stream.ReadUInt32().FromEndian(endian); stream.DiscardBytes(0xC); SynopsisList = new List <SynopsisEntry>((int)synopsisCount); for (uint i = 0; i < synopsisCount; ++i) { SynopsisEntry l = new SynopsisEntry(stream, endian); SynopsisList.Add(l); } return(true); }
private bool LoadFile(Stream stream, EndianUtils.Endianness endian, BitUtils.Bitness bits) { string magic = stream.ReadAscii(8); if (magic != "TOVNPCL\0") { throw new Exception("Invalid magic."); } uint fileSize = stream.ReadUInt32().FromEndian(endian); uint dataStart = stream.ReadUInt32().FromEndian(endian); uint dataCount = stream.ReadUInt32().FromEndian(endian); uint refStringStart = stream.ReadUInt32().FromEndian(endian); stream.Position = dataStart; NpcFileList = new List <NpcFileReference>((int)dataCount); for (uint i = 0; i < dataCount; ++i) { NpcFileReference n = new NpcFileReference(stream, refStringStart, endian, bits); NpcFileList.Add(n); } return(true); }
public uint SearchPointContentCount; // usually 5, rarely 3 public SearchPointDefinition(System.IO.Stream stream, EndianUtils.Endianness endian) { Index = stream.ReadUInt32().FromEndian(endian); ScenarioBegin = stream.ReadUInt32().FromEndian(endian); ScenarioEnd = stream.ReadUInt32().FromEndian(endian); SearchPointType = stream.ReadUInt32().FromEndian(endian); Unknown5 = stream.ReadUInt32().FromEndian(endian); CoordX = stream.ReadUInt32().FromEndian(endian).AsSigned(); CoordY = stream.ReadUInt32().FromEndian(endian).AsSigned(); CoordZ = stream.ReadUInt32().FromEndian(endian).AsSigned(); Unknown9 = stream.ReadUInt32().FromEndian(endian); Unknown10 = stream.ReadUInt32().FromEndian(endian); Unknown11 = stream.ReadUInt32().FromEndian(endian); Unknown12 = stream.ReadUInt32().FromEndian(endian); Unknown13 = stream.ReadUInt32().FromEndian(endian); Unknown14a = stream.ReadUInt16().FromEndian(endian); Unknown14b = stream.ReadUInt16().FromEndian(endian); SearchPointContentIndex = stream.ReadUInt32().FromEndian(endian); SearchPointContentCount = stream.ReadUInt32().FromEndian(endian); }
public FloorInfo(System.IO.Stream stream, uint refStringStart, EndianUtils.Endianness endian, BitUtils.Bitness bits) { uint atLeastBytes = (0x10 + 2 * (bits.NumberOfBytes())); EntrySize = stream.ReadUInt32().FromEndian(endian); if (EntrySize < atLeastBytes) { throw new Exception("This file confuses me."); } uint unknown2 = stream.ReadUInt32().FromEndian(endian); uint unknown3 = stream.ReadUInt32().FromEndian(endian); ulong unknown4 = stream.ReadUInt(bits, endian); uint unknown5 = stream.ReadUInt32().FromEndian(endian); ulong unknown6 = stream.ReadUInt(bits, endian); if (EntrySize > atLeastBytes) { stream.DiscardBytes(EntrySize - atLeastBytes); } RefString1 = stream.ReadAsciiNulltermFromLocationAndReset((long)(refStringStart + unknown4)); RefString2 = stream.ReadAsciiNulltermFromLocationAndReset((long)(refStringStart + unknown6)); }