public PakFormat(string pakFile, string pabFile, string dbgFile, PakFormatType type, bool autoDetectFiles) { _structItemChildrenType = Nanook.QueenBee.Parser.StructItemChildrenType.NotSet; bool debugFile = false; PakFormatType = type; switch (type) { case PakFormatType.Wii: FriendlyName = "Wii"; EndianType = EndianType.Big; FileExtension = "ngc"; QbDebugExtension = "dbg"; LastHeaderLength = 64; IsCompressed = false; FilePadSize = 0x20; break; case PakFormatType.PC: FriendlyName = "PC"; EndianType = EndianType.Big; FileExtension = "xen"; QbDebugExtension = "dbg"; LastHeaderLength = 48; IsCompressed = false; FilePadSize = 0x20; break; case PakFormatType.XBox: FriendlyName = "XBox"; EndianType = EndianType.Big; FileExtension = "xen"; QbDebugExtension = "dbg"; LastHeaderLength = 48; IsCompressed = true; FilePadSize = 0x20; break; case PakFormatType.XBox_XBX: FriendlyName = "XBOX XBX"; EndianType = EndianType.Little; FileExtension = "xbx"; QbDebugExtension = "dbg"; LastHeaderLength = 48; IsCompressed = false; FilePadSize = 0x80; break; case PakFormatType.PS2: FriendlyName = "PS2"; EndianType = EndianType.Little; FileExtension = "ps2"; QbDebugExtension = "dbg"; LastHeaderLength = 48; IsCompressed = false; FilePadSize = 0x10; break; case PakFormatType.PC_WPC: FriendlyName = "PC WPC"; EndianType = EndianType.Little; FileExtension = "wpc"; QbDebugExtension = "dbg"; LastHeaderLength = 48; IsCompressed = false; FilePadSize = 0x20; break; default: break; } if (!File.Exists(pakFile)) { return; } this.CompressionType = CompressionType.None; FileInfo fi = new FileInfo(pakFile); PakPath = fi.Directory.FullName; FullPakFilename = fi.FullName; PakFilename = fi.Name; NonDebugQbKeyFilename = string.Empty; FullNonDebugQbKeyFilename = string.Empty; if (PakFilename.StartsWith(string.Format(@"dbg.pak.{0}", FileExtension))) { debugFile = true; //SupportsPabFile = false; } bool exists = false; if (!debugFile) { //if (SupportsPabFile) //{ FullPabFilename = pabFile; if (autoDetectFiles && FullPabFilename.Length == 0) { FullPabFilename = FullPakFilename.Replace(@".pak.", ".pab."); } if (File.Exists(FullPabFilename)) { fi = new FileInfo(FullPabFilename); PabFilename = fi.Name; exists = true; } //} NonDebugQbKeyFilename = string.Format("{0}.UserDbg", fi.Name); FullNonDebugQbKeyFilename = string.Format("{0}.UserDbg", fi.FullName); loadNonDebugQbKey(); } if (!exists) { FullPabFilename = string.Empty; PabFilename = string.Empty; } exists = false; FullDebugFilename = dbgFile; if (autoDetectFiles && FullDebugFilename.Length == 0) { FullDebugFilename = string.Format(@"{0}\dbg.pak.{1}", PakPath.TrimEnd('\\'), FileExtension); if (FullDebugFilename.ToLower() == FullPakFilename.ToLower()) { FullDebugFilename = ""; } } if (File.Exists(FullDebugFilename)) { fi = new FileInfo(FullDebugFilename); DebugFilename = fi.Name; exists = true; } if (!exists) { FullDebugFilename = string.Empty; DebugFilename = string.Empty; } //allow debug file as pak when has real extension and not .decompressed if ((!debugFile || (debugFile && PakFilename.EndsWith(FileExtension))) && PakFormatType == PakFormatType.XBox) { if (PakFileExists) { CompressedPakFilename = PakFilename; PakFilename = string.Format("{0}.decompressed", PakFilename); FullCompressedPakFilename = FullPakFilename; FullPakFilename = string.Format("{0}.decompressed", FullPakFilename); CompressedPakFilesize = (new FileInfo(FullCompressedPakFilename)).Length; } if (PabFileExists) { CompressedPabFilename = PabFilename; PabFilename = string.Format("{0}.decompressed", PabFilename); FullCompressedPabFilename = FullPabFilename; FullPabFilename = string.Format("{0}.decompressed", FullPabFilename); CompressedPabFilesize = (new FileInfo(FullCompressedPabFilename)).Length; } if (DebugFileExists) { CompressedDebugFilename = DebugFilename; DebugFilename = string.Format("{0}.decompressed", DebugFilename); FullCompressedDebugFilename = FullDebugFilename; FullDebugFilename = string.Format("{0}.decompressed", FullDebugFilename); } } else { CompressedDebugFilename = string.Empty; FullCompressedPakFilename = string.Empty; CompressedPabFilename = string.Empty; FullCompressedPabFilename = string.Empty; CompressedDebugFilename = string.Empty; FullCompressedDebugFilename = string.Empty; } }
public PakFormat(string pakFile, string pabFile, string dbgFile, PakFormatType type, bool autoDetectFiles) { _structItemChildrenType = Nanook.QueenBee.Parser.StructItemChildrenType.NotSet; bool debugFile = false; PakFormatType = type; switch (type) { case PakFormatType.Wii: FriendlyName = "Wii"; EndianType = EndianType.Big; FileExtension = "ngc"; QbDebugExtension = "dbg"; LastHeaderLength = 64; IsCompressed = false; FilePadSize = 0x20; break; case PakFormatType.PC: FriendlyName = "PC"; EndianType = EndianType.Big; FileExtension = "xen"; QbDebugExtension = "dbg"; LastHeaderLength = 48; IsCompressed = false; FilePadSize = 0x20; break; case PakFormatType.XBox: FriendlyName = "XBox"; EndianType = EndianType.Big; FileExtension = "xen"; QbDebugExtension = "dbg"; LastHeaderLength = 48; IsCompressed = true; FilePadSize = 0x20; break; case PakFormatType.XBox_XBX: FriendlyName = "XBOX XBX"; EndianType = EndianType.Little; FileExtension = "xbx"; QbDebugExtension = "dbg"; LastHeaderLength = 48; IsCompressed = false; FilePadSize = 0x80; break; case PakFormatType.PS2: FriendlyName = "PS2"; EndianType = EndianType.Little; FileExtension = "ps2"; QbDebugExtension = "dbg"; LastHeaderLength = 48; IsCompressed = false; FilePadSize = 0x10; break; case PakFormatType.PC_WPC: FriendlyName = "PC WPC"; EndianType = EndianType.Little; FileExtension = "wpc"; QbDebugExtension = "dbg"; LastHeaderLength = 48; IsCompressed = false; FilePadSize = 0x20; break; default: break; } if (!File.Exists(pakFile)) return; this.CompressionType = CompressionType.None; FileInfo fi = new FileInfo(pakFile); PakPath = fi.Directory.FullName; FullPakFilename = fi.FullName; PakFilename = fi.Name; NonDebugQbKeyFilename = string.Empty; FullNonDebugQbKeyFilename = string.Empty; if (PakFilename.StartsWith(string.Format(@"dbg.pak.{0}", FileExtension))) { debugFile = true; //SupportsPabFile = false; } bool exists = false; if (!debugFile) { //if (SupportsPabFile) //{ FullPabFilename = pabFile; if (autoDetectFiles && FullPabFilename.Length == 0) FullPabFilename = FullPakFilename.Replace(@".pak.", ".pab."); if (File.Exists(FullPabFilename)) { fi = new FileInfo(FullPabFilename); PabFilename = fi.Name; exists = true; } //} NonDebugQbKeyFilename = string.Format("{0}.UserDbg", fi.Name); FullNonDebugQbKeyFilename = string.Format("{0}.UserDbg", fi.FullName); loadNonDebugQbKey(); } if (!exists) { FullPabFilename = string.Empty; PabFilename = string.Empty; } exists = false; FullDebugFilename = dbgFile; if (autoDetectFiles && FullDebugFilename.Length == 0) { FullDebugFilename = string.Format(@"{0}\dbg.pak.{1}", PakPath.TrimEnd('\\'), FileExtension); if (FullDebugFilename.ToLower() == FullPakFilename.ToLower()) FullDebugFilename = ""; } if (File.Exists(FullDebugFilename)) { fi = new FileInfo(FullDebugFilename); DebugFilename = fi.Name; exists = true; } if (!exists) { FullDebugFilename = string.Empty; DebugFilename = string.Empty; } //allow debug file as pak when has real extension and not .decompressed if ((!debugFile || (debugFile && PakFilename.EndsWith(FileExtension))) && PakFormatType == PakFormatType.XBox) { if (PakFileExists) { CompressedPakFilename = PakFilename; PakFilename = string.Format("{0}.decompressed", PakFilename); FullCompressedPakFilename = FullPakFilename; FullPakFilename = string.Format("{0}.decompressed", FullPakFilename); CompressedPakFilesize = (new FileInfo(FullCompressedPakFilename)).Length; } if (PabFileExists) { CompressedPabFilename = PabFilename; PabFilename = string.Format("{0}.decompressed", PabFilename); FullCompressedPabFilename = FullPabFilename; FullPabFilename = string.Format("{0}.decompressed", FullPabFilename); CompressedPabFilesize = (new FileInfo(FullCompressedPabFilename)).Length; } if (DebugFileExists) { CompressedDebugFilename = DebugFilename; DebugFilename = string.Format("{0}.decompressed", DebugFilename); FullCompressedDebugFilename = FullDebugFilename; FullDebugFilename = string.Format("{0}.decompressed", FullDebugFilename); } } else { CompressedDebugFilename = string.Empty; FullCompressedPakFilename = string.Empty; CompressedPabFilename = string.Empty; FullCompressedPabFilename = string.Empty; CompressedDebugFilename = string.Empty; FullCompressedDebugFilename = string.Empty; } }
public PakFormat(string pakFile, string pabFile, string dbgFile, PakFormatType type) : this(pakFile, pabFile, dbgFile, type, true) { }
public PakFormat(string pakFile, string pabFile, string dbgFile, PakFormatType type) : this(pakFile, pabFile, dbgFile, type, true) { }