public override unsafe Task Load() { return(Task.Run ( () => { string uopPath = UOFileManager.GetUOFilePath("MultiCollection.uop"); if (Client.IsUOPInstallation && System.IO.File.Exists(uopPath)) { Count = Constants.MAX_MULTI_DATA_INDEX_COUNT; File = new UOFileUop(uopPath, "build/multicollection/{0:D6}.bin"); Entries = new UOFileIndex[Count]; _reader = new DataReader(); IsUOP = true; } else { string path = UOFileManager.GetUOFilePath("multi.mul"); string pathidx = UOFileManager.GetUOFilePath("multi.idx"); if (System.IO.File.Exists(path) && System.IO.File.Exists(pathidx)) { File = new UOFileMul(path, pathidx, Constants.MAX_MULTI_DATA_INDEX_COUNT, 14); Count = Offset = Client.Version >= ClientVersion.CV_7090 ? sizeof(MultiBlockNew) + 2 : sizeof(MultiBlock); } } File.FillEntries(ref Entries); } )); }
public static void Load() { string path; bool foundedOneMap = false; for (int i = 0; i < MAPS_COUNT; i++) { path = Path.Combine(FileManager.UoFolderPath, $"map{i}LegacyMUL.uop"); if (File.Exists(path)) { _filesMap[i] = new UOFileUop(path, ".dat", loadentries: false); foundedOneMap = true; } else { path = Path.Combine(FileManager.UoFolderPath, $"map{i}.mul"); if (File.Exists(path)) { _filesMap[i] = new UOFileMul(path, false); foundedOneMap = true; } } path = Path.Combine(FileManager.UoFolderPath, $"statics{i}.mul"); if (File.Exists(path)) { _filesStatics[i] = new UOFileMul(path, false); } path = Path.Combine(FileManager.UoFolderPath, $"staidx{i}.mul"); if (File.Exists(path)) { _filesIdxStatics[i] = new UOFileMul(path, false); } } if (!foundedOneMap) { throw new FileNotFoundException("No maps founded."); } int mapblocksize = UnsafeMemoryManager.SizeOf <MapBlock>(); if (_filesMap[0].Length / mapblocksize == 393216 || FileManager.ClientVersion < ClientVersions.CV_4011D) { MapsDefaultSize[0][0] = MapsDefaultSize[1][0] = 6144; } for (int i = 0; i < MAPS_COUNT; i++) { MapBlocksSize[i] = new int[2] { MapsDefaultSize[i][0] >> 3, MapsDefaultSize[i][1] >> 3 }; //LoadMap(i); } }
public override void Load() { int[] un = { 0x40000, 0x10000, 0x20000, 0x20000, 0x20000 }; Dictionary <ulong, UopFileData> hashes = new Dictionary <ulong, UopFileData>(); for (int i = 0; i < 5; i++) { string pathmul = Path.Combine(FileManager.UoFolderPath, "anim" + (i == 0 ? string.Empty : (i + 1).ToString()) + ".mul"); string pathidx = Path.Combine(FileManager.UoFolderPath, "anim" + (i == 0 ? string.Empty : (i + 1).ToString()) + ".idx"); if (File.Exists(pathmul) && File.Exists(pathidx)) { _mulFiles[i] = new UOFileMul(pathmul, pathidx, un[i], i == 0 ? 6 : -1); } if (i > 0 && FileManager.ClientVersion >= ClientVersions.CV_7000) { string pathuop = Path.Combine(FileManager.UoFolderPath, $"AnimationFrame{i}.uop"); if (File.Exists(pathuop)) { _uopFiles[i - 1] = new UOFileUopNoFormat(pathuop, i - 1); _uopFiles[i - 1].LoadEx(ref hashes); } } } for (int animID = 0; animID < Constants.MAX_ANIMATIONS_DATA_INDEX_COUNT; animID++) { for (int grpID = 0; grpID < 100; grpID++) { string hashstring = $"build/animationlegacyframe/{animID:D6}/{grpID:D2}.bin"; ulong hash = UOFileUop.CreateHash(hashstring); if (hashes.TryGetValue(hash, out UopFileData data) && data.Offset != 0) { _animationIsUop[animID, grpID] = data; //for (int d = 0; d < 5; d++) //{ // ref var anim = ref _animations[animID, grpID, d]; //} } } } ReadMobTypes(); ReadBody(); ReadBodyconv(); ReadCorpse(); //LoadAnimations(0x029A, 1, 0); }
public override unsafe Task Load() { return(Task.Run(() => { bool foundOneMap = false; for (int i = 0; i < Constants.MAPS_COUNT; i++) { string path = UOFileManager.GetUOFilePath($"map{i}LegacyMUL.uop"); if (Client.IsUOPInstallation && File.Exists(path)) { _filesMap[i] = new UOFileUop(path, $"build/map{i}legacymul/{{0:D8}}.dat"); Entries[i] = new UOFileIndex[((UOFileUop)_filesMap[i]).TotalEntriesCount]; ((UOFileUop)_filesMap[i]).FillEntries(ref Entries[i], false); foundOneMap = true; } else { path = UOFileManager.GetUOFilePath($"map{i}.mul"); if (File.Exists(path)) { _filesMap[i] = new UOFileMul(path); foundOneMap = true; } path = UOFileManager.GetUOFilePath($"mapdifl{i}.mul"); if (File.Exists(path)) { _mapDifl[i] = new UOFileMul(path); _mapDif[i] = new UOFileMul(UOFileManager.GetUOFilePath($"mapdif{i}.mul")); _staDifl[i] = new UOFileMul(UOFileManager.GetUOFilePath($"stadifl{i}.mul")); _staDifi[i] = new UOFileMul(UOFileManager.GetUOFilePath($"stadifi{i}.mul")); _staDif[i] = new UOFileMul(UOFileManager.GetUOFilePath($"stadif{i}.mul")); } } path = UOFileManager.GetUOFilePath($"statics{i}.mul"); if (File.Exists(path)) { _filesStatics[i] = new UOFileMul(path); } path = UOFileManager.GetUOFilePath($"staidx{i}.mul"); if (File.Exists(path)) { _filesIdxStatics[i] = new UOFileMul(path); } } if (!foundOneMap) { throw new FileNotFoundException("No maps found."); } int mapblocksize = sizeof(MapBlock); if (_filesMap[0].Length / mapblocksize == 393216 || Client.Version < ClientVersion.CV_4011D) { MapsDefaultSize[0, 0] = MapsDefaultSize[1, 0] = 6144; } // This is an hack to patch correctly all maps when you have to fake map1 if (_filesMap[1] == null || _filesMap[1].StartAddress == IntPtr.Zero) { _filesMap[1] = _filesMap[0]; _filesStatics[1] = _filesStatics[0]; _filesIdxStatics[1] = _filesIdxStatics[0]; } //for (int i = 0; i < MAPS_COUNT; i++) Parallel.For(0, Constants.MAPS_COUNT, i => { MapBlocksSize[i, 0] = MapsDefaultSize[i, 0] >> 3; MapBlocksSize[i, 1] = MapsDefaultSize[i, 1] >> 3; LoadMap(i); }); Entries = null; })); }
public override Task Load() { return(Task.Run(() => { bool foundOneMap = false; for (int i = 0; i < MAPS_COUNT; i++) { string path = Path.Combine(FileManager.UoFolderPath, $"map{i}LegacyMUL.uop"); if (File.Exists(path)) { _filesMap[i] = new UOFileUop(path, ".dat", loadentries: false); foundOneMap = true; } else { path = Path.Combine(FileManager.UoFolderPath, $"map{i}.mul"); if (File.Exists(path)) { _filesMap[i] = new UOFileMul(path, false); foundOneMap = true; } path = Path.Combine(FileManager.UoFolderPath, $"mapdifl{i}.mul"); if (File.Exists(path)) { _mapDifl[i] = new UOFileMul(path); _mapDif[i] = new UOFileMul(Path.Combine(FileManager.UoFolderPath, $"mapdif{i}.mul")); _staDifl[i] = new UOFileMul(Path.Combine(FileManager.UoFolderPath, $"stadifl{i}.mul")); _staDifi[i] = new UOFileMul(Path.Combine(FileManager.UoFolderPath, $"stadifi{i}.mul")); _staDif[i] = new UOFileMul(Path.Combine(FileManager.UoFolderPath, $"stadif{i}.mul")); } } path = Path.Combine(FileManager.UoFolderPath, $"statics{i}.mul"); if (File.Exists(path)) { _filesStatics[i] = new UOFileMul(path, false); } path = Path.Combine(FileManager.UoFolderPath, $"staidx{i}.mul"); if (File.Exists(path)) { _filesIdxStatics[i] = new UOFileMul(path, false); } } if (!foundOneMap) { throw new FileNotFoundException("No maps founded."); } int mapblocksize = UnsafeMemoryManager.SizeOf <MapBlock>(); if (_filesMap[0].Length / mapblocksize == 393216 || FileManager.ClientVersion < ClientVersions.CV_4011D) { MapsDefaultSize[0, 0] = MapsDefaultSize[1, 0] = 6144; } //for (int i = 0; i < MAPS_COUNT; i++) Parallel.For(0, MAPS_COUNT, i => { MapBlocksSize[i, 0] = MapsDefaultSize[i, 0] >> 3; MapBlocksSize[i, 1] = MapsDefaultSize[i, 1] >> 3; LoadMap(i); }); })); }
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; } } } }
public override Task Load() { return(Task.Run(() => { bool foundOneMap = false; for (int i = 0; i < MAPS_COUNT; i++) { string path = UOFileManager.GetUOFilePath($"map{i}LegacyMUL.uop"); if (File.Exists(path)) { _filesMap[i] = new UOFileUop(path, $"build/map{i}legacymul/{{0:D8}}.dat"); Entries[i] = new UOFileIndex[((UOFileUop)_filesMap[i]).TotalEntriesCount]; ((UOFileUop)_filesMap[i]).FillEntries(ref Entries[i], false); foundOneMap = true; } else { path = UOFileManager.GetUOFilePath($"map{i}.mul"); if (File.Exists(path)) { _filesMap[i] = new UOFileMul(path); foundOneMap = true; } path = UOFileManager.GetUOFilePath($"mapdifl{i}.mul"); if (File.Exists(path)) { _mapDifl[i] = new UOFileMul(path); _mapDif[i] = new UOFileMul(UOFileManager.GetUOFilePath($"mapdif{i}.mul")); _staDifl[i] = new UOFileMul(UOFileManager.GetUOFilePath($"stadifl{i}.mul")); _staDifi[i] = new UOFileMul(UOFileManager.GetUOFilePath($"stadifi{i}.mul")); _staDif[i] = new UOFileMul(UOFileManager.GetUOFilePath($"stadif{i}.mul")); } } path = UOFileManager.GetUOFilePath($"statics{i}.mul"); if (File.Exists(path)) { _filesStatics[i] = new UOFileMul(path); } path = UOFileManager.GetUOFilePath($"staidx{i}.mul"); if (File.Exists(path)) { _filesIdxStatics[i] = new UOFileMul(path); } } if (!foundOneMap) { throw new FileNotFoundException("No maps found."); } int mapblocksize = UnsafeMemoryManager.SizeOf <MapBlock>(); if (_filesMap[0].Length / mapblocksize == 393216 || Client.Version < ClientVersion.CV_4011D) { MapsDefaultSize[0, 0] = MapsDefaultSize[1, 0] = 6144; } //for (int i = 0; i < MAPS_COUNT; i++) Parallel.For(0, MAPS_COUNT, i => { MapBlocksSize[i, 0] = MapsDefaultSize[i, 0] >> 3; MapBlocksSize[i, 1] = MapsDefaultSize[i, 1] >> 3; LoadMap(i); }); Entries = null; })); }
public unsafe static void Load() { string path = string.Empty; for (int i = 0; i < MAPS_COUNT; i++) { path = Path.Combine(FileManager.UoFolderPath, string.Format("map{0}LegacyMUL.uop", i)); if (File.Exists(path)) { _filesMap[i] = new UOFileUop(path, ".dat"); } else { path = Path.Combine(FileManager.UoFolderPath, string.Format("map{0}.mul", i)); if (!File.Exists(path)) { throw new FileNotFoundException(); } _filesMap[i] = new UOFileMul(path); } path = Path.Combine(FileManager.UoFolderPath, string.Format("statics{0}.mul", i)); if (File.Exists(path)) { _filesStatics[i] = new UOFileMul(path); } path = Path.Combine(FileManager.UoFolderPath, string.Format("staidx{0}.mul", i)); if (File.Exists(path)) { _filesIdxStatics[i] = new UOFileMul(path); } } if (FileManager.ClientVersion < ClientVersions.CV_4011D) { _mapsDefaultSize[0][0] = _mapsDefaultSize[1][0] = 6144; } int mapblocksize = Marshal.SizeOf <MapBlock>(); int staticidxblocksize = Marshal.SizeOf <StaidxBlock>(); int staticblocksize = Marshal.SizeOf <StaticsBlock>(); for (int i = 0; i < MAPS_COUNT; i++) { _mapsBlockSize[i] = new int[2] { _mapsDefaultSize[i][0] / 8, _mapsDefaultSize[i][1] / 8 }; int width = _mapsBlockSize[i][0]; int height = _mapsBlockSize[i][1]; int maxblockcount = width * height; _blockData[i] = new IndexMap[maxblockcount]; UOFile file = _filesMap[i]; UOFile fileidx = _filesIdxStatics[i]; UOFile staticfile = _filesStatics[i]; ulong staticidxaddress = (ulong)fileidx.StartAddress; ulong endstaticidxaddress = staticidxaddress + (ulong)fileidx.Length; ulong staticaddress = (ulong)staticfile.StartAddress; ulong endstaticaddress = staticaddress + (ulong)staticfile.Length; ulong mapddress = (ulong)file.StartAddress; ulong endmapaddress = mapddress + (ulong)file.Length; ulong uopoffset = 0; int fileNumber = -1; bool isuop = file is UOFileUop; for (int block = 0; block < maxblockcount; block++) { ulong realmapaddress = 0, realstaticaddress = 0; uint realstaticcount = 0; int blocknum = block; if (isuop) { blocknum &= 4095; int shifted = block >> 12; if (fileNumber != shifted) { fileNumber = shifted; if (shifted < file.Entries.Length) { uopoffset = (ulong)file.Entries[shifted].Offset; } } } ulong address = mapddress + uopoffset + (ulong)(blocknum * mapblocksize); MapBlock mapblock = Marshal.PtrToStructure <MapBlock>((IntPtr)address); if (address < endmapaddress) { realmapaddress = address; } ulong stidxaddress = (staticidxaddress + (ulong)(block * staticidxblocksize)); StaidxBlock bb = Marshal.PtrToStructure <StaidxBlock>((IntPtr)stidxaddress); if (stidxaddress < endstaticidxaddress && bb.Size > 0 && bb.Position != 0xFFFFFFFF) { ulong address1 = staticaddress + bb.Position; if (address1 < endstaticaddress) { StaticsBlock sss = Marshal.PtrToStructure <StaticsBlock>((IntPtr)address1); realstaticaddress = address1; realstaticcount = (uint)(bb.Size / staticblocksize); if (realstaticcount > 1024) { realstaticcount = 1024; } } } _blockData[i][block].OriginalMapAddress = realmapaddress; _blockData[i][block].OriginalStaticAddress = realstaticaddress; _blockData[i][block].OriginalStaticCount = realstaticcount; _blockData[i][block].MapAddress = realmapaddress; _blockData[i][block].StaticAddress = realstaticaddress; _blockData[i][block].StaticCount = realstaticcount; } } }