/// <summary> /// Reads Sounds and def /// </summary> public static void Initialize() { m_Cache = new UOSound[0xFFF]; m_Removed = new bool[0xFFF]; m_FileIndex = new FileIndex("soundidx.mul", "sound.mul", "soundLegacyMUL.uop", 0xFFF, 8, ".dat", -1, false); var reg = new Regex(@"(\d{1,3}) \x7B(\d{1,3})\x7D (\d{1,3})", RegexOptions.Compiled); m_Translations = new Dictionary<int, int>(); string line; string path = Files.GetFilePath("Sound.def"); if (path == null) { return; } using (var reader = new StreamReader(path)) { while ((line = reader.ReadLine()) != null) { if (((line = line.Trim()).Length != 0) && !line.StartsWith("#")) { Match match = reg.Match(line); if (match.Success) { m_Translations.Add(int.Parse(match.Groups[1].Value), int.Parse(match.Groups[2].Value)); } } } } }
/// <summary> /// Rereads AnimX files /// </summary> public static void Reload() { m_FileIndex = new FileIndex("Anim.idx", "Anim.mul", 6); m_FileIndex2 = new FileIndex("Anim2.idx", "Anim2.mul", -1); m_FileIndex3 = new FileIndex("Anim3.idx", "Anim3.mul", -1); m_FileIndex4 = new FileIndex("Anim4.idx", "Anim4.mul", -1); m_FileIndex5 = new FileIndex("Anim5.idx", "Anim5.mul", -1); if (m_FileIndex.IdxLength > 0) { animcache = new AnimIdx[m_FileIndex.IdxLength / 12]; } if (m_FileIndex2.IdxLength > 0) { animcache = new AnimIdx[m_FileIndex2.IdxLength / 12]; } if (m_FileIndex3.IdxLength > 0) { animcache = new AnimIdx[m_FileIndex3.IdxLength / 12]; } if (m_FileIndex4.IdxLength > 0) { animcache = new AnimIdx[m_FileIndex4.IdxLength / 12]; } if (m_FileIndex5.IdxLength > 0) { animcache = new AnimIdx[m_FileIndex5.IdxLength / 12]; } }
/// <summary> /// ReReads texmaps /// </summary> public static void Reload() { m_FileIndex = new FileIndex("Texidx.mul", "Texmaps.mul", 0x4000, 10); m_Cache = new Bitmap[0x4000]; m_Removed = new bool[0x4000]; m_patched.Clear(); }
/// <summary> /// ReReads Art.mul /// </summary> public static void Reload() { Files.ReLoadDirectory(); Files.LoadMulPath(); m_FileIndex = new FileIndex("Artidx.mul", "Art.mul", 0x13FDC, 4); m_Cache = new Bitmap[GetIdxLength()]; m_Removed = new bool[GetIdxLength()]; m_patched.Clear(); Modified = false; }
/// <summary> /// Rereads AnimX files /// </summary> public static void Reload() { _fileIndex = new FileIndex("Anim.idx", "Anim.mul", 6); _fileIndex2 = new FileIndex("Anim2.idx", "Anim2.mul", -1); _fileIndex3 = new FileIndex("Anim3.idx", "Anim3.mul", -1); _fileIndex4 = new FileIndex("Anim4.idx", "Anim4.mul", -1); _fileIndex5 = new FileIndex("Anim5.idx", "Anim5.mul", -1); SetAnimCache(); }
/// <summary> /// Rereads AnimX files and bodyconv, body.def /// </summary> public static void Reload() { m_FileIndex = new FileIndex("Anim.idx", "Anim.mul", 0x40000, 6); m_FileIndex2 = new FileIndex("Anim2.idx", "Anim2.mul", 0x10000, -1); m_FileIndex3 = new FileIndex("Anim3.idx", "Anim3.mul", 0x20000, -1); m_FileIndex4 = new FileIndex("Anim4.idx", "Anim4.mul", 0x20000, -1); m_FileIndex5 = new FileIndex("Anim5.idx", "Anim5.mul", 0x20000, -1); BodyConverter.Initialize(); BodyTable.Initialize(); }
/// <summary> /// Inizializza una nuova istanza della classe <see cref="T:System.Object"/>. /// </summary> public Art(Verdata verdata, Files files) { _Files = files; m_Cache = new Bitmap[0xFFFF]; m_Removed = new bool[0xFFFF]; m_FileIndex = new FileIndex("Artidx.mul", "Art.mul", "artLegacyMUL.uop", 0x10000 /*0x13FDC*/, 4, ".tga", 0x13FDC, false, verdata, files); m_patched.Clear(); Modified = false; }
/// <summary> /// Inizializza una nuova istanza della classe <see cref="T:System.Object"/>. /// </summary> public Animations(Verdata verdata, Hues hues, Files files) { _files = files; m_FileIndex = new FileIndex("Anim.idx", "Anim.mul", 0x40000, 6, verdata, _files); m_FileIndex2 = new FileIndex("Anim2.idx", "Anim2.mul", 0x10000, -1, verdata, files); m_FileIndex3 = new FileIndex("Anim3.idx", "Anim3.mul", 0x20000, -1, verdata, files); m_FileIndex4 = new FileIndex("Anim4.idx", "Anim4.mul", 0x20000, -1, verdata, files); m_FileIndex5 = new FileIndex("Anim5.idx", "Anim5.mul", 0x20000, -1, verdata, files); _BodyConverter = new BodyConverter(_files); BodyTable = new BodyTable(_files); _hues = hues; LoadTable(); }
/// <summary> /// ReReads skills.mul /// </summary> public static void Reload() { m_FileIndex = new FileIndex("skills.idx", "skills.mul", 16); m_SkillEntries = new List<SkillInfo>(); for (int i = 0; i < m_FileIndex.Index.Length; ++i) { SkillInfo info = GetSkill(i); if (info == null) { break; } m_SkillEntries.Add(info); } }
/// <summary> /// ReReads skills.mul /// </summary> public static void Reload() { m_FileIndex = new FileIndex("skills.idx", "skills.mul", 16); m_SkillEntries = new List <SkillInfo>(); for (int i = 0; i < m_FileIndex.Index.Length; ++i) { SkillInfo info = GetSkill(i); if (info == null) { break; } m_SkillEntries.Add(info); } }
/// <summary> /// Inizializza una nuova istanza della classe <see cref="T:System.Object"/>. /// </summary> /// public Skills(Verdata verdata, Files files) { _files = files; m_FileIndex = new FileIndex("skills.idx", "skills.mul", 16, verdata, _files); m_SkillEntries = new List <SkillInfo>(); for (int i = 0; i < m_FileIndex.Index.Length; ++i) { SkillInfo info = GetSkill(i); if (info == null) { break; } m_SkillEntries.Add(info); } }
/// <summary> /// ReReads Art.mul /// </summary> public static void Reload() { m_FileIndex = new FileIndex( "Artidx.mul", "Art.mul", "artLegacyMUL.uop", 0x10000 /*0x13FDC*/, 4, ".tga", 0x13FDC, false); m_Cache = new Bitmap[0xFFFF]; m_Removed = new bool[0xFFFF]; m_patched.Clear(); Modified = false; }
/// <summary> /// ReReads gumpart /// </summary> public static void Reload() { try { m_FileIndex = new FileIndex("Gumpidx.mul", "Gumpart.mul", "gumpartLegacyMUL.uop", 12, -1, ".tga", -1, true); m_Cache = new Bitmap[m_FileIndex.Index.Length]; m_Removed = new bool[m_FileIndex.Index.Length]; } catch { m_FileIndex = null; m_Cache = new Bitmap[0xFFFF]; m_Removed = new bool[0xFFFF]; } m_PixelBuffer = null; m_StreamBuffer = null; m_ColorTable = null; m_patched.Clear(); }
/// <summary> /// ReReads gumpart /// </summary> public static void Reload() { try { _fileIndex = new FileIndex("Gumpidx.mul", "Gumpart.mul", "gumpartLegacyMUL.uop", 12, -1, ".tga", -1, true); _cache = new Bitmap[_fileIndex.Index.Length]; _removed = new bool[_fileIndex.Index.Length]; } catch { _fileIndex = null; _cache = new Bitmap[0xFFFF]; _removed = new bool[0xFFFF]; } //_pixelBuffer = null; _streamBuffer = null; //_colorTable = null; _patched.Clear(); }
public AnimIdx(int index, FileIndex fileIndex, int filetype) { Palette = new ushort[0x100]; int length, extra; bool patched; Stream stream = fileIndex.Seek(index, out length, out extra, out patched); if ((stream == null) || (length < 1)) { return; } idxextra = extra; using (BinaryReader bin = new BinaryReader(stream)) { for (int i = 0; i < 0x100; ++i) { Palette[i] = (ushort)(bin.ReadUInt16() ^ 0x8000); } int start = (int)bin.BaseStream.Position; int frameCount = bin.ReadInt32(); int[] lookups = new int[frameCount]; for (int i = 0; i < frameCount; ++i) { lookups[i] = start + bin.ReadInt32(); } Frames = new List <FrameEdit>(); for (int i = 0; i < frameCount; ++i) { stream.Seek(lookups[i], SeekOrigin.Begin); Frames.Add(new FrameEdit(bin)); } } stream.Close(); }
/// <summary> /// ReReads gumpart /// </summary> public static void Reload() { try { Files.ReLoadDirectory(); Files.LoadMulPath(); m_FileIndex = new FileIndex("Gumpidx.mul", "Gumpart.mul", 0x10000, 12); m_Cache = new Bitmap[m_FileIndex.Index.Length]; m_Removed = new bool[m_FileIndex.Index.Length]; } catch { m_FileIndex = null; m_Cache = new Bitmap[0xFFFF]; m_Removed = new bool[0xFFFF]; } m_PixelBuffer = null; m_StreamBuffer = null; m_ColorTable = null; m_patched.Clear(); }
/// <summary> /// ReReads Art.mul /// </summary> public static void Reload() { m_FileIndex = new FileIndex("Artidx.mul", "Art.mul", "artLegacyMUL.uop", 0x10000/*0x13FDC*/, 4, ".tga", 0x13FDC, false); m_Cache = new Bitmap[GetIdxLength()]; m_Removed = new bool[GetIdxLength()]; m_patched.Clear(); Modified = false; }
public AnimIdx(int index, FileIndex fileIndex, int filetype) { Palette = new ushort[0x100]; int length, extra; bool patched; Stream stream = fileIndex.Seek(index, out length, out extra, out patched); if ((stream == null) || (length < 1)) return; idxextra = extra; using (BinaryReader bin = new BinaryReader(stream)) { for (int i = 0; i < 0x100; ++i) Palette[i] = (ushort)(bin.ReadUInt16() ^ 0x8000); int start = (int)bin.BaseStream.Position; int frameCount = bin.ReadInt32(); int[] lookups = new int[frameCount]; for (int i = 0; i < frameCount; ++i) lookups[i] = start + bin.ReadInt32(); Frames = new List<FrameEdit>(); for (int i = 0; i < frameCount; ++i) { stream.Seek(lookups[i], SeekOrigin.Begin); Frames.Add(new FrameEdit(bin)); } } stream.Close(); }
private static void GetFileIndex(int body, int fileType, int action, int direction, out FileIndex fileIndex, out int index) { switch (fileType) { default: case 1: fileIndex = m_FileIndex; if (body < 200) index = body * 110; else if (body < 400) index = 22000 + ((body - 200) * 65); else index = 35000 + ((body - 400) * 175); break; case 2: fileIndex = m_FileIndex2; if (body < 200) index = body * 110; else index = 22000 + ((body - 200) * 65); break; case 3: fileIndex = m_FileIndex3; if (body < 300) index = body * 65; else if (body < 400) index = 33000 + ((body - 300) * 110); else index = 35000 + ((body - 400) * 175); break; case 4: fileIndex = m_FileIndex4; if (body < 200) index = body * 110; else if (body < 400) index = 22000 + ((body - 200) * 65); else index = 35000 + ((body - 400) * 175); break; case 5: fileIndex = m_FileIndex5; if ((body < 200) && (body != 34)) // looks strange, though it works. index = body * 110; else if (body < 400) index = 22000 + ((body - 200) * 65); else index = 35000 + ((body - 400) * 175); break; } index += action * 5; if (direction <= 4) index += direction; else index += direction - (direction - 4) * 2; }
/// <summary> /// ReReads light.mul /// </summary> public static void Reload() { m_FileIndex = new FileIndex("lightidx.mul", "light.mul", 100, -1); m_Cache = new Bitmap[100]; m_Removed = new bool[100]; }
private void ReadUOPFiles(string pattern) { m_UOPReader = new BinaryReader(m_Map); m_UOPReader.BaseStream.Seek(0, SeekOrigin.Begin); if (m_UOPReader.ReadInt32() != 0x50594D) { throw new ArgumentException("Bad UOP file."); } m_UOPReader.ReadInt64(); // version + signature long nextBlock = m_UOPReader.ReadInt64(); m_UOPReader.ReadInt32(); // block capacity int count = m_UOPReader.ReadInt32(); UOPFiles = new UOPFile[count]; Dictionary <ulong, int> hashes = new Dictionary <ulong, int>(); for (int i = 0; i < count; i++) { string file = string.Format("build/{0}/{1:D8}.dat", pattern, i); ulong hash = FileIndex.HashFileName(file); if (!hashes.ContainsKey(hash)) { hashes.Add(hash, i); } } m_UOPReader.BaseStream.Seek(nextBlock, SeekOrigin.Begin); do { int filesCount = m_UOPReader.ReadInt32(); nextBlock = m_UOPReader.ReadInt64(); for (int i = 0; i < filesCount; i++) { long offset = m_UOPReader.ReadInt64(); int headerLength = m_UOPReader.ReadInt32(); int compressedLength = m_UOPReader.ReadInt32(); int decompressedLength = m_UOPReader.ReadInt32(); ulong hash = m_UOPReader.ReadUInt64(); m_UOPReader.ReadUInt32(); // Adler32 short flag = m_UOPReader.ReadInt16(); int length = flag == 1 ? compressedLength : decompressedLength; if (offset == 0) { continue; } int idx; if (hashes.TryGetValue(hash, out idx)) { if (idx < 0 || idx > UOPFiles.Length) { throw new IndexOutOfRangeException( "hashes dictionary and files collection have different count of entries!"); } UOPFiles[idx] = new UOPFile(offset + headerLength, length); } else { throw new ArgumentException(string.Format( "File with hash 0x{0:X8} was not found in hashes dictionary! EA Mythic changed UOP format!", hash)); } } } while (m_UOPReader.BaseStream.Seek(nextBlock, SeekOrigin.Begin) != 0); }
/// <summary> /// ReReads multi.mul /// </summary> public static void Reload() { m_FileIndex = new FileIndex("Multi.idx", "Multi.mul", 0x2000, 14); m_Components = new MultiComponentList[0x2000]; }
/// <summary> /// ReReads Art.mul /// </summary> public static void Reload() { var idxFileInfo = new FileInfo(Files.GetFilePath("ArtIdx.mul")); var mulFileInfo = new FileInfo(Files.GetFilePath("Art.mul")); int entries = idxFileInfo.Exists ? (int)(idxFileInfo.Length / 12) : 0; IsUOHS = IsUOSA = IsPreAlpha = false; if (entries >= 0x13FDC) IsUOHS = true; else if (entries == 0xC000) IsUOSA = true; else if (entries == 0x10000) IsPreAlpha = true; // Нашлись умники, что раздувают артмулы до размеров альфы, так что // пришлось сделать дополнительную проверку, это не совсем полит коректно // но будем считать что у пре-альфа клиента длина art.mul не более 40 Mib if (IsPreAlpha && mulFileInfo.Length > 0x2800000) IsPreAlpha = false; m_FileIndex = new FileIndex("Artidx.mul", "Art.mul", entries, 4); m_Cache = new Bitmap[entries]; m_Removed = new bool[entries]; (m_patched ?? (m_patched = new Hashtable())).Clear(); Modified = false; }
public Art(string mulPath, string idxPath) { m_FileIndex = new FileIndex(idxPath, mulPath, 4); m_Cache = new Bitmap[GetIdxLength()]; m_Removed = new bool[GetIdxLength()]; }
/// <summary> /// ReReads multi.mul /// </summary> public static void Reload() { _fileIndex = new FileIndex("Multi.idx", "Multi.mul", MaximumMultiIndex, 14); _components = new MultiComponentList[MaximumMultiIndex]; }
/// <summary> /// Gets Fileseek index based on fileType,body,action,direction /// </summary> /// <param name="body"></param> /// <param name="action"></param> /// <param name="direction"></param> /// <param name="fileType">animX</param> /// <param name="fileIndex"></param> /// <param name="index"></param> private static void GetFileIndex( int body, int action, int direction, int fileType, out FileIndex fileIndex, out int index) { switch (fileType) { default: case 1: fileIndex = m_FileIndex; if (body < 200) { index = body * 110; } else if (body < 400) { index = 22000 + ((body - 200) * 65); } else { index = 35000 + ((body - 400) * 175); } break; case 2: fileIndex = m_FileIndex2; if (body < 200) { index = body * 110; } else { index = 22000 + ((body - 200) * 65); } break; case 3: fileIndex = m_FileIndex3; if (body < 300) { index = body * 65; } else if (body < 400) { index = 33000 + ((body - 300) * 110); } else { index = 35000 + ((body - 400) * 175); } break; case 4: fileIndex = m_FileIndex4; if (body < 200) { index = body * 110; } else if (body < 400) { index = 22000 + ((body - 200) * 65); } else { index = 35000 + ((body - 400) * 175); } break; case 5: fileIndex = m_FileIndex5; if ((body < 200) && (body != 34)) // looks strange, though it works. { index = body * 110; } else if (body < 400) { index = 22000 + ((body - 200) * 65); } else { index = 35000 + ((body - 400) * 175); } break; } index += action * 5; if (direction <= 4) { index += direction; } else { index += direction - (direction - 4) * 2; } }
/// <summary> /// ReReads light.mul /// </summary> public static void Reload() { _fileIndex = new FileIndex("lightidx.mul", "light.mul", 100, -1); _cache = new Bitmap[100]; _removed = new bool[100]; }