Пример #1
0
        public SCEEditor(X360IO IO)
        {
            InitializeComponent();
            Header = new SCEHeader();
            Header.Load(IO);
            lblHdrVersion.Text = string.Format("Header Version: 0x{0:X2}", Header.Version);
            lblFileType.Text = string.Format("File Type: 0x{0:X2} ({1})", Header.FileType,
                                               SCEHeader.FileTypes[Header.FileType]);
            lblFlags.Text = string.Format("Flags: 0x{0:X4}", Header.Flags);
            if (Header.IsContentEncrypted)
                lblFlags.Text += " (ENCRYPTED)";
            else
                lblFlags.Text += " (DECRYPTED)";
            lblHdrSize.Text = string.Format("Header Size: 0x{0:X2}", Header.HeaderSize);
            lblUnk1.Text = string.Format("Unknown 1: 0x{0:X2}", Header.Unknown1);
            lblUnk2.Text = string.Format("Unknown 2: 0x{0:X2}", Header.Unknown2);
            if (Header.FileType == 1 && !Header.IsContentEncrypted)
                cmdUnfself.Enabled = true;
            /*lblImgVersion.Text = string.Format("Image Version: {0:X2}", Package.ImageVersion);
            lblFileCount.Text = string.Format("File Count: {0}", Package.FileCount);
            lblHeaderSize.Text = string.Format("Header Size: {0:X2}", Package.HeaderSize);
            lblDataSize.Text = string.Format("Data Size: {0:X2}", Package.DataSize);
            txtHeaderHash.Text = Program.BytesToHexString(Package.HeaderHash);
            txtPadding.Text = Program.BytesToHexString(Package.Padding);*/

            tsmiExtractAll.Enabled = true;
        }
Пример #2
0
 public void Load(X360IO io)
 {
     IO = io;
     IO.Stream.Position = 0x0;
     Magic = IO.Reader.ReadUInt32();
     if (Magic != 0x53434500)
         return;
     Version = IO.Reader.ReadUInt32();
     Flags = IO.Reader.ReadUInt16();
     FileType = IO.Reader.ReadUInt16();
     Unknown1 = IO.Reader.ReadUInt32();
     HeaderSize = IO.Reader.ReadUInt64();
     Unknown2 = IO.Reader.ReadUInt64();
     switch(FileType)
     {
         case 1:
             MainHeader = new SCEELFHeader(this);
             break;
         case 3:
             MainHeader = new SCEPKGHeader(this);
             break;
     }
     if(MainHeader != null)
         MainHeader.Load();
 }
Пример #3
0
 public DataBaseEditor(X360IO IO)
 {
     InitializeComponent();
     DataBase = new PackageDataBase();
     DataBase.Load(IO);
     LoadEntries();
 }
Пример #4
0
 public RegistryEditor(X360IO IO)
 {
     InitializeComponent();
     Registry = new PS3Registry();
     Registry.Load(IO);
     lvwColumnSorter = new ListViewColumnSorter();
     lvEntries.ListViewItemSorter = lvwColumnSorter;
     LoadEntries();
 }
Пример #5
0
 public void Load(X360IO io)
 {
     IO = io;
     IO.Stream.Position = 0x0;
     Magic = IO.Reader.ReadUInt32();
     Entries = new List<DataBaseEntry>();
     while (IO.Stream.Position < IO.Stream.Length)
     {
         DataBaseEntry entry = new DataBaseEntry();
         entry.Load(IO);
         Entries.Add(entry);
     }
 }
Пример #6
0
        public void Load(X360IO io)
        {
            IO = io;
            IO.Stream.Position = 0x0;
            Magic = IO.Reader.ReadUInt32();
            Unknown1 = IO.Reader.ReadUInt32();
            Unknown2 = IO.Reader.ReadUInt32();
            Magic2 = IO.Reader.ReadUInt32();
            if (Magic != 0xBCADADBC || Magic2 != 0xBCADADBC)
                return;
            IO.Stream.Position = 0x10;
            SettingEntries = new List<SettingEntry>();
            DataEntries = new List<SettingDataEntry>();
            while (true)
            {
                SettingEntry entry = new SettingEntry();
                if (!entry.Load(IO))
                    break;
                SettingEntries.Add(entry);
            }
            IO.Stream.Position = 0xFFF0;
            DataMagic = IO.Reader.ReadUInt16();
            if (DataMagic != 0x4D26)
                return;

            // data
            while (true)
            {
                SettingDataEntry entry = new SettingDataEntry();
                entry.Load(IO);
                if (!(entry.Flags == 0xAABB && entry.FileNameOffset == 0xCCDD && entry.Checksum == 0xEE00))
                    DataEntries.Add(entry);
                else
                    break;
            }

            foreach (SettingDataEntry entry in DataEntries)
            {
                if (entry.Flags != 0x7A)
                {
                    SettingEntry ent = SettingEntries.Find(sec => sec.IsEntryOffset(entry.FileNameOffset + 0x10));
                    if (ent == null)
                    {
                        break;
                    }
                    ent.DataExists = true;
                    entry.FileNameEntry = ent;
                }
            }
        }
Пример #7
0
        public PUPFile(X360IO IO)
        {
            InitializeComponent();
            Package = new PlaystationUpdatePackage();
            Package.Load(IO);
            lblPkgVersion.Text = string.Format("Update Package Version: 0x{0:X2}", Package.Version);
            lblImgVersion.Text = string.Format("Image Version: 0x{0:X2}", Package.ImageVersion);
            lblFileCount.Text = string.Format("File Count: {0}", Package.FileCount);
            lblHeaderSize.Text = string.Format("Header Size: 0x{0:X2}", Package.HeaderSize);
            lblDataSize.Text = string.Format("Data Size: 0x{0:X2}", Package.DataSize);
            txtHeaderHash.Text = Program.BytesToHexString(Package.HeaderHash);
            txtPadding.Text = Program.BytesToHexString(Package.Padding);
            PlaystationUpdatePackage.FileEntry versionentry = Package.Files.Find(sec => sec.ID == 0x100);
            if(versionentry != null)
            {
                byte[] data = Package.GetFileData(versionentry);
                string version = Encoding.ASCII.GetString(data);
                lblVersion.Text = "Version: " + version;
            }
            else
                lblVersion.Text = "Version: N/A";

            foreach(PlaystationUpdatePackage.FileEntry entry in Package.Files)
            {
                ListViewItem item = new ListViewItem(entry.ID.ToString("X2"));
                string filename = (string) PlaystationUpdatePackage.FileNames[entry.ID];
                if (String.IsNullOrEmpty(filename))
                    filename = string.Format("file_{0:X2}.tar", entry.ID);
                item.SubItems.Add(filename);
                item.SubItems.Add(entry.Size.ToString());
                item.SubItems.Add(entry.Offset.ToString());
                item.SubItems.Add(Program.BytesToHexString(entry.Hash.HMACSHA1));
                item.Tag = entry;
                lvFiles.Items.Add(item);
            }
            tsmiExtractAll.Enabled = true;
        }
 public void Load(X360IO io)
 {
     IO = io;
     IO.Stream.Position = 0x0;
     Magic = IO.Reader.ReadInt64();
     if (Magic != 0x5343455546000000)
         return;
     Version = IO.Reader.ReadInt64();
     ImageVersion = IO.Reader.ReadInt64();
     FileCount = IO.Reader.ReadInt64();
     HeaderSize = IO.Reader.ReadInt64();
     DataSize = IO.Reader.ReadInt64();
     Files = new List<FileEntry>();
     for(int i = 0; i < FileCount; i++)
     {
         FileEntry entry = new FileEntry
                               {
                                   ID = IO.Reader.ReadInt64(),
                                   Offset = IO.Reader.ReadInt64(),
                                   Size = IO.Reader.ReadInt64(),
                                   Padding = IO.Reader.ReadInt64()
                               };
         Files.Add(entry);
     }
     Hashes = new List<HashEntry>();
     for(int i = 0; i < FileCount; i++)
     {
         HashEntry entry = new HashEntry();
         entry.FileID = IO.Reader.ReadInt64();
         entry.HMACSHA1 = IO.Reader.ReadBytes(0x14);
         entry.Padding = IO.Reader.ReadInt32();
         Hashes.Add(entry);
         Files[(int) entry.FileID].Hash = entry;
     }
     HeaderHash = IO.Reader.ReadBytes(0x14);
     Padding = IO.Reader.ReadBytes(0xC);
 }
Пример #9
0
 public bool Save(X360IO io)
 {
     Offset = io.Stream.Position;
     Size = (uint)Data.Length;
     Size2 = Size;
     io.Writer.Write((uint)ID);
     io.Writer.Write(Size);
     io.Writer.Write(Size2);
     io.Writer.Write(Data);
     return true;
 }
Пример #10
0
 /// <summary>
 ///   Initializes a new instance of the X360Writer class with the specified X360IO.BaseIO instance.
 /// </summary>
 /// <param name = "xIO">The X360IO.BaseIO instance to use.</param>
 internal X360Writer(X360IO xIO)
     : base(xIO.Stream)
 {
     this.xIO = xIO;
 }
Пример #11
0
 /// <summary>
 ///   Initializes a new instance of the X360Reader class with the specified X360IO.BaseIO instance.
 /// </summary>
 internal X360Reader(X360IO io)
     : base(io.Stream)
 {
     xIO = io;
 }
Пример #12
0
 public bool Load(X360IO io)
 {
     Offset = io.Stream.Position;
     ID = (EntryID)io.Reader.ReadUInt32();
     Size = io.Reader.ReadUInt32();
     Size2 = io.Reader.ReadUInt32();
     Data = io.Reader.ReadBytes((int)Size); // BADBADBAD
     return true;
 }
Пример #13
0
 /// <summary>
 ///   Initializes a new instance of the X360Reader class with the specified X360IO.BaseIO instance.
 /// </summary>
 internal X360Reader(X360IO io)
     : base(io.Stream)
 {
     xIO = io;
 }
Пример #14
0
 public void OpenFile(string fileName)
 {
     Text = ver + " - " + fileName;
     X360IO io = new X360IO(fileName, FileMode.Open, true);
     uint magic = io.Reader.ReadUInt32();
     pnlContent.Controls.Clear();
     switch(magic)
     {
         case 0x00000000:
             // PDB?
             DataBaseEditor editor = new DataBaseEditor(io);
             pnlContent.Controls.Add(editor);
             break;
         case 0x53434555:
             // PUP file
             PUPFile file = new PUPFile(io);// {AutoSize = true, BackColor = Color.Transparent};
             pnlContent.Controls.Add(file);
             break;
         case 0x53434500:
             // SCE header
             SCEEditor form1 = new SCEEditor(io);// {AutoSize = true, BackColor = Color.Transparent};
             pnlContent.Controls.Add(form1);
             break;
         case 0xBCADADBC:
             // registry file
             RegistryEditor form = new RegistryEditor(io);// { AutoSize = true, BackColor = Color.Transparent };
             pnlContent.Controls.Add(form);
             break;
         default:
             // unknown
             MessageBox.Show("Unknown file!");
             io.Close();
             Text = ver;
             break;
     }
 }
Пример #15
0
 /// <summary>
 ///   Initializes a new instance of the X360Writer class with the specified X360IO.BaseIO instance.
 /// </summary>
 /// <param name = "xIO">The X360IO.BaseIO instance to use.</param>
 internal X360Writer(X360IO xIO)
     : base(xIO.Stream)
 {
     this.xIO = xIO;
 }
Пример #16
0
 public bool Load(X360IO io)
 {
     Offset = io.Stream.Position;
     Flags = io.Reader.ReadUInt16();
     FileNameOffset = io.Reader.ReadUInt16();
     Checksum = io.Reader.ReadUInt16();
     Length = io.Reader.ReadUInt16();
     Type = io.Reader.ReadByte();
     Value = io.Reader.ReadBytes(Length);
     io.Stream.Position = Offset + 9 + Length;
     Terminator = io.Reader.ReadByte();
     return true;
 }
Пример #17
0
 public void Save(X360IO io)
 {
     io.Stream.Position = Offset;
     io.Writer.Write(ID);
     io.Writer.Write(Value);
     io.Writer.WriteNullTerminatedAsciiString(Setting);
 }
Пример #18
0
 public bool Load(X360IO io)
 {
     Offset = io.Stream.Position;
     ID = io.Reader.ReadUInt32();
     Value = io.Reader.ReadByte();
     if (Value == 0xEE) // 0xAABBCCDDEE
         return false;
     Setting = io.Reader.ReadNullTerminatedAsciiString();
     EndOffset = io.Stream.Position;
     return true;
 }
Пример #19
0
 public bool Save(X360IO io)
 {
     Offset = io.Stream.Position;
     Length = (ushort)Value.Length;
     if (FileNameEntry != null)
         FileNameOffset = (ushort)(FileNameEntry.Offset - 0x10);
     io.Writer.Write(Flags);
     io.Writer.Write(FileNameOffset);
     io.Writer.Write(Checksum);
     io.Writer.Write(Length);
     io.Writer.Write(Type);
     io.Writer.Write(Value);
     io.Stream.Position = Offset + 9 + Length;
     io.Writer.Write(Terminator);
     return true;
 }