internal FATXEntry(long Pos, byte[] xData, ref FATXDrive xdrive) { xDrive = xdrive; xOffset = Pos; try { DJsIO xIO = new DJsIO(xData, true); xNLen = xIO.ReadByte(); if (xNLen == 0xE5 || xNLen == 0xFF || xNLen == 0 || xNLen > 0x2A) return; byte xatt = (byte)((xIO.ReadByte() >> 4) & 1); byte xLen = (byte)(xNLen & 0x3F); xName = xIO.ReadString(StringForm.ASCII, xLen); xName.IsValidXboxName(); xIO.Position = 0x2C; xStartBlock = xIO.ReadUInt32(); if (xStartBlock == Constants.FATX32End) return; xSize = xIO.ReadInt32(); xT1 = xIO.ReadInt32(); xT2 = xIO.ReadInt32(); xT3 = xIO.ReadInt32(); if (xatt == 1) xIsFolder = true; else if (xSize == 0) return; xIsValid = true; } catch { xIsValid = false; } }
internal ItemEntry(byte[] xDataIn, long DirectOffset, ushort xID, STFSPackage xPackageIn) { try { xPackage = xPackageIn; DJsIO xFileIO = new DJsIO(xDataIn, true); xFileIO.Position = 0; xEntryID = xID; xFileIO.Position = 0x28; xFlag = xFileIO.ReadByte(); if (xNameLength > 0x28) xNameLength = 0x28; xFileIO.Position = 0; if (xNameLength == 0) return; xName = xFileIO.ReadString(StringForm.ASCII, xNameLength); xName.IsValidXboxName(); xFileIO.Position = 0x2F; xStartBlock = xFileIO.ReadUInt24(false); xFolderPointer = xFileIO.ReadUInt16(); xSize = xFileIO.ReadInt32(); xBlockCount = (uint)(((xSize - 1) / 0x1000) + 1); xCreated = xFileIO.ReadInt32(); xAccessed = xFileIO.ReadInt32(); xDirectoryOffset = DirectOffset; } catch { xNameLength = 0; } }
/// <summary> /// Initializes this object /// </summary> /// <param name="FileLocale"></param> public MusicFile(string FileLocale) { xActive = true; DJsIO xIO = new DJsIO(FileLocale, DJFileMode.Open, true); if (!xIO.Accessed) throw STFSExcepts.ParseError; try { xIO.Position = 0; xIO.IsBigEndian = true; if (xIO.ReadUInt32() != 0x464D494D) throw MusicExcepts.NotMusic; xIO.Position = 0xC; so = xIO.ReadString(StringForm.Unicode, 0x100); al = xIO.ReadString(StringForm.Unicode, 0x100); ar = xIO.ReadString(StringForm.Unicode, 0x100); xIO.Position += 0x200; ge = xIO.ReadString(StringForm.Unicode, 0x100); IO = xIO; xActive = false; } catch { xIO.Dispose(); throw STFSExcepts.ParseError; } }
void read(DJsIO xIO, STFSPackage xPackage, PackageMagic MagicType) { xMagic = MagicType; xIO.Position = 0x22C; if (xPackage != null) xPackage.AddToLog("Reading Liscenses"); xLisc = new List<STFSLicense>(); for (int i = 0; i < 0x10; i++) xLisc.Add(new STFSLicense(xIO.ReadInt64(), xIO.ReadInt32(), xIO.ReadInt32(), i == 0)); if (xPackage != null) xPackage.AddToLog("Reading Package locks"); xIO.Position = 0x344; if (xPackage != null) xPackage.AddToLog("Reading Header Values"); xThisType = (PackageType)xIO.ReadUInt32(); ; MetaDataVersion = xIO.ReadUInt32(); xContentSize = xIO.ReadInt64(); MediaID = xIO.ReadUInt32(); Version_ = xIO.ReadUInt32(); Version_Base = xIO.ReadUInt32(); TitleID = xIO.ReadUInt32(); Platform = xIO.ReadByte(); ExecutableType = xIO.ReadByte(); DiscNumber = xIO.ReadByte(); DiscInSet = xIO.ReadByte(); SaveGameID = xIO.ReadUInt32(); SaveConsoleID = (long)xIO.ReadUInt40(); ProfileID = xIO.ReadInt64(); xIO.Position = 0x39D; DataFileCount = xIO.ReadUInt32(); DataFileSize = xIO.ReadInt64(); Reserved = xIO.ReadInt64(); xSeriesID = xIO.ReadBytes(0x10); xSeasonID = xIO.ReadBytes(0x10); SeasonNumber = xIO.ReadUInt16(); EpidsodeNumber = xIO.ReadUInt16(); xIO.Position += 0x28; xDeviceID = xIO.ReadBytes(0x14); for (int i = 0; i < 9; i++) xTitles[i] = xIO.ReadString(StringForm.Unicode, 0x80).Replace("\0", ""); for (int i = 0; i < 9; i++) xDescriptions[i] = xIO.ReadString(StringForm.Unicode, 0x80).Replace("\0", ""); xPublisher = xIO.ReadString(StringForm.Unicode, 0x40).Replace("\0", ""); xTitle = xIO.ReadString(StringForm.Unicode, 0x40).Replace("\0", ""); IDTransferByte = xIO.ReadByte(); // Package Image int xSize = xIO.ReadInt32(); xIO.Position = 0x171A; if (xSize < 0x4000) xPackageImage = xIO.ReadBytes(xSize); else xPackageImage = xIO.ReadBytes(0x4000); // Content Image xIO.Position = 0x1716; xSize = xIO.ReadInt32(); xIO.Position = 0x571A; if (xSize < 0x4000) xContentImage = xIO.ReadBytes(xSize); else xContentImage = xIO.ReadBytes(0x4000); xLoaded = true; }