Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Some stuff to add/remove...
#1
1. Can you remove this:
Quote:Table Index:19262
Table Offset:0x001831A0
Table Size:0x00000044
...or make it optional?
Reason: with +2000 files it's a little annoying when you must remove this by hand...

2. BatchExport will be nice...
Reason: with +2000 files it's a little annoying when you must export all classes by hand...

3. There is a little problem with iterators...
Decompiled:
Code:
I = 0;
J0x5A:
if(I < CapturePoints.Length)
{
    //...
    ++ I;
    goto J0x5A;
}

Original:
Code:
for(i = 0; i < CapturePoints.length; i++)
{
    //...
}

4. Support for decompression...
Reply
#2
(07-01-2013, 03:26 AM)VendorX Wrote: 1. Can you remove this:
Quote:Table Index:19262
Table Offset:0x001831A0
Table Size:0x00000044
...or make it optional?
Reason: with +2000 files it's a little annoying when you must remove this by hand...

2. BatchExport will be nice...
Reason: with +2000 files it's a little annoying when you must export all classes by hand...

3. There is a little problem with iterators...
Decompiled:
Code:
I = 0;
J0x5A:
if(I < CapturePoints.Length)
{
    //...
    ++ I;
    goto J0x5A;
}

Original:
Code:
for(i = 0; i < CapturePoints.length; i++)
{
    //...
}

4. Support for decompression...

1. This is only shown for objects decompiled through the Exports tab.

2. Tools -> Export classes? That's a feature that's always been there, there's also a commandline argument for this, it's explained here somewhere on the forums.

3. That's because "for" loops are compiled to "goto" statements by the Unreal Engine.

4. I've tried but failed to get it working. I might see if I can add auto decompression linked to Gildor's tool.
Reply
#3
4. It's easy to do... Which language you using? Anyways, UnHood is a good example of how to decompress UE package - source can be found in net.
Reply
#4
C#, I got this implemented but the third party library just throws an arithmetic exception upon execution, not sure if I made a mistake or if the library is broken.
Reply
#5
Easy way:
Decompressed data will start directly with the NameTable... Use the same PackageHeader except PackageFlags (set it to 1) and everything below CookerVersion (UE3...). Next step is to line up decompressed data to NameTableOffset - calculate the empty space between end of header and name table (NameTableOffset - SizeOfHeader). Into TempFile write modified header, empty space and decompressed data. Use TempFile to process...
Reply
#6
Well, https://gist.github.com/EliotVU/aaa50d9f285dbdc810b5 is my compression code, it just reads the chunks and attempts to decompress those chunks. But because this didn't work I threw out any code that tries to make a temporary decompressed file.
Reply
#7
Tomorrow I can take a look at your decompression code.
Reply
#8
Have you looked yet? Smile
Reply
#9
Problem is in CompressedChunkBlock.Deserialize - you can't read BlockCompressedData directly after reading BlockHeader, because first is BlockCount * BlockHeader then BlockCount * BlockCompressedData.

Compressed UE package:

// LZOChunk:
UncompressedOffset
UncompressedSize
CompressedOffset
CompressedSize

// CompressedChunk:
Signature
BlockSize
CompressedChunkSize
UncompressedChunkSize

// CompressedBlock:
// BlockCount * CompressedBlockHeader
CompressedBlockSize;
UncompressedBlockSize;

// BlockCount * CompressedBlockData
CompressedBlockData;

Try this:
Code:
public struct CompressedChunkHeader : IUnrealDeserializableClass
            {
                private uint _Signature;
                private int _BlockSize;
                private int _CompressedSize;
                private int _UncompressedSize;

                public CompressedChunkBlock[] Blocks;//UArray<CompressedChunkBlock> Blocks;

                public void Deserialize(BinaryReader stream)//IUnrealStream stream)
                {
                    _Signature = stream.ReadUInt32();
                    if (_Signature != 2653586369)//UnrealPackage.Signature)
                        throw new System.IO.FileLoadException("Unrecognized signature!");

                    _BlockSize = stream.ReadInt32();
                    _CompressedSize = stream.ReadInt32();
                    _UncompressedSize = stream.ReadInt32();

                    int BlockCount = (int)Math.Ceiling(_UncompressedSize / (float)_BlockSize);
                    Blocks = new CompressedChunkBlock[BlockCount];//UArray<CompressedChunkBlock>(stream, blockCount);

                    int BlockHeaderOffset = (int)stream.BaseStream.Position;
                    int CompressedBlockOffset = BlockHeaderOffset + BlockCount * 8;

                    // Bypass of your UArray...
                    for (int i = 0; i < Blocks.Length; i++)
                    {
                        CompressedChunkBlock inBlock = new CompressedChunkBlock();

                        stream.BaseStream.Position = BlockHeaderOffset;
                        inBlock.Deserialize(stream);
                        BlockHeaderOffset += 8;

                        stream.BaseStream.Position = CompressedBlockOffset;
                        inBlock._CompressedData = stream.ReadBytes(inBlock._CompressedSize);
                        CompressedBlockOffset += inBlock._CompressedSize;

                        Blocks[i] = inBlock;
                    }
                }

                public struct CompressedChunkBlock : IUnrealDeserializableClass
                {
                    public int _CompressedSize;
                    public int _UncompressedSize;
                    public byte[] _CompressedData;

                    public void Deserialize(BinaryReader stream)//IUnrealStream stream)
                    {
                        _CompressedSize = stream.ReadInt32();
                        _UncompressedSize = stream.ReadInt32();
                    }

                    public byte[] Decompress()
                    {
                        var _DecompressedData = new byte[_UncompressedSize];
                        ManagedLZO.MiniLZO.Decompress( _CompressedData, _DecompressedData );
                        return _DecompressedData;
                    }
                }
            }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)