protected override void Load(bool loadentries = true) { base.Load(loadentries); if (loadentries) { UOFile file = _idxFile ?? (UOFile)this; int count = (int)file.Length / 12; Entries = new UOFileIndex3D[count]; for (int i = 0; i < count; i++) { Entries[i] = new UOFileIndex3D(file.ReadInt(), file.ReadInt(), 0, file.ReadInt()); } //UOFileIndex5D[] patches = Verdata.Patches; //for (int i = 0; i < patches.Length; i++) //{ // UOFileIndex5D patch = patches[i]; // if (patch.FileID == _patch && patch.BlockID >= 0 && patch.BlockID < Entries.Length) // { // ref UOFileIndex3D entry = ref Entries[patch.BlockID]; // entry = new UOFileIndex3D(patch.Position, patch.Length | (1 << 31), 0, patch.GumpData); // } //} } }
public override Task Load() { return(Task.Run(() => { string path = Path.Combine(FileManager.UoFolderPath, "multi.mul"); string pathidx = Path.Combine(FileManager.UoFolderPath, "multi.idx"); if (File.Exists(path) && File.Exists(pathidx)) { _file = new UOFileMul(path, pathidx, Constants.MAX_MULTI_DATA_INDEX_COUNT, 14); } else { throw new FileNotFoundException(); } Count = _itemOffset = FileManager.ClientVersion >= ClientVersions.CV_7090 ? UnsafeMemoryManager.SizeOf <MultiBlockNew>() : UnsafeMemoryManager.SizeOf <MultiBlock>(); string uopPath = Path.Combine(FileManager.UoFolderPath, "MultiCollection.uop"); if (File.Exists(uopPath)) { Count = Constants.MAX_MULTI_DATA_INDEX_COUNT; _fileUop = new UOFileUopNoFormat(uopPath); _reader = new DataReader(); for (int i = 0; i < _fileUop.Entries.Length; i++) { long offset = _fileUop.Entries[i].Offset; int csize = _fileUop.Entries[i].Length; int dsize = _fileUop.Entries[i].DecompressedLength; _fileUop.Seek(offset); byte[] cdata = _fileUop.ReadArray <byte>(csize); byte[] ddata = new byte[dsize]; ZLib.Decompress(cdata, 0, ddata, dsize); _reader.SetData(ddata, dsize); uint id = _reader.ReadUInt(); if (id < Constants.MAX_MULTI_DATA_INDEX_COUNT && id < _file.Entries.Length) { ref UOFileIndex3D index = ref _file.Entries[id]; int count = _reader.ReadInt(); index = new UOFileIndex3D(offset, csize, dsize, (int)MathHelper.Combine(count, index.Extra)); } } _reader.ReleaseData(); } }));
public override bool TryGetEntryInfo(int entry, out long address, out long size, out long compressedsize) { entry += 0x4000; if (entry < _file.Length && entry >= 0) { UOFileIndex3D e = _file.Entries[entry]; address = _file.StartAddress.ToInt64() + e.Offset; size = e.DecompressedLength == 0 ? e.Length : e.DecompressedLength; compressedsize = e.Length; return(true); } return(base.TryGetEntryInfo(entry, out address, out size, out compressedsize)); }
public override Task Load() { return(Task.Run(() => { string path = Path.Combine(FileManager.UoFolderPath, "soundLegacyMUL.uop"); if (File.Exists(path)) { _file = new UOFileUop(path, ".dat", Constants.MAX_SOUND_DATA_INDEX_COUNT); } else { path = Path.Combine(FileManager.UoFolderPath, "sound.mul"); string idxpath = Path.Combine(FileManager.UoFolderPath, "soundidx.mul"); if (File.Exists(path) && File.Exists(idxpath)) { _file = new UOFileMul(path, idxpath, Constants.MAX_SOUND_DATA_INDEX_COUNT); } else { throw new FileNotFoundException("no sounds found"); } } string def = Path.Combine(FileManager.UoFolderPath, "Sound.def"); if (File.Exists(def)) { using (DefReader reader = new DefReader(def)) { while (reader.Next()) { int index = reader.ReadInt(); if (index < 0 || index >= Constants.MAX_SOUND_DATA_INDEX_COUNT || index >= _file.Length || _file.Entries[index].Length != 0) { continue; } int[] group = reader.ReadGroup(); if (group == null) { continue; } for (int i = 0; i < group.Length; i++) { int checkIndex = group[i]; if (checkIndex < -1 || checkIndex >= Constants.MAX_SOUND_DATA_INDEX_COUNT) { continue; } ref UOFileIndex3D ind = ref _file.Entries[index]; if (checkIndex == -1) { ind = default; } else { ref readonly UOFileIndex3D outInd = ref _file.Entries[checkIndex];
protected override void Load() { base.Load(); Seek(0); if (ReadInt() != UOP_MAGIC_NUMBER) { throw new ArgumentException("Bad uop file"); } Skip(8); long nextblock = ReadLong(); Skip(4); Seek(nextblock); Dictionary <ulong, UOFileIndex3D> hashes = new Dictionary <ulong, UOFileIndex3D>(); Entries = new UOFileIndex3D[4096]; do { int fileCount = ReadInt(); nextblock = ReadLong(); for (int i = 0; i < fileCount; i++) { long offset = ReadLong(); int headerLength = ReadInt(); int compressedLength = ReadInt(); int decompressedLength = ReadInt(); ulong hash = ReadULong(); Skip(6); if (offset == 0) { continue; } UOFileIndex3D data = new UOFileIndex3D(offset + headerLength, compressedLength, 0, decompressedLength); hashes.Add(hash, data); } Seek(nextblock); } while (nextblock != 0); int idx = 0; for (int animID = 0; animID < 2048; animID++) { for (int grpID = 0; grpID < 100; grpID++) { string hashstring = string.Format("build/animationlegacyframe/{0:D6}/{1:D2}.bin", animID, grpID); ulong hash = UOFileUop.CreateHash(hashstring); if (hashes.TryGetValue(hash, out var data)) { if (data.AnimID <= 0) { data.AnimID = idx++; } Entries[animID + grpID] = data; } } } }