Texture2D with LZO (unreal 3) in The Last Remnant

How to translate the files of a game
cfarl
Posts: 11
Joined: Sun Nov 05, 2017 12:45 am

Texture2D with LZO (unreal 3) in The Last Remnant

Post by cfarl »

Hi all!

I'm working in a pt-br localization of The Last Remnant. Currently, I'm figthting with some upk files to extract textures from them to edit and replace.

Here my upk (from xbox360):

https://drive.google.com/open?id=1M-ZwBeQzuq0HbWfMnIDYEA8fjxC1hRcT

I used Gildor UModel to open, visualize and extract textures as DDS from the upk.

I also used Gildor Unreal Package Extractor to extract .Texture2D files from this upk. Here is this file:

https://drive.google.com/open?id=1g6hnbk5F3m0lDxnLvOUMgq4_0_lir4na

It seems there the DDS texture inside the .Texture2D has a LZO compression, but I had no sucess in extracting it.

So... Here I'm, asking for your help.

How can I extract the DDS file from the .Texture2D? Or, how can I get the DDS from the LZO in this .Texture2D file?

Thanks in advance,

cfarl
cfarl
Posts: 11
Joined: Sun Nov 05, 2017 12:45 am

Re: Texture2D with LZO (unreal 3) in The Last Remnant

Post by cfarl »

Well, I did some improvements...

After looking at this page http://wiki.tesnexus.com/index.php/Savegame_file_format_-_XCOM:EU_2012#Data_Structures I found that there is FCompressedChunk in my Texture2D file.

So, I extracted this part of the Texture2D file, that begins with the magic 9e 2a 83 c1:

https://pasteboard.co/HGAOU21.jpg

Now, using the FCompressedChunk record:

FCompressedChunk
  - FCompressedChunkHeader     // 16 bytes
  - FCompressedBlock
      - FCompressedBlockHeader // 8 bytes
      - Raw compressed data    // variable size

I got:

// FCompressedChunkHeader - 16 bytes
9E 2A 83 C1    4 bytes UE3 package signature (magic)
00 02 00 00    4 bytes Block size
00 00 0b 36    4 bytes Compressed size
00 00 80 00    4 bytes Uncompressed size

// FCompressedBlockHeader - 8 bytes
00 00 0b 36    4 bytes Compressed size
00 00 80 00    4 bytes Uncompressed size

The uncompressed image is a PF_DXT5, width 256, height 32
In fact, I have 0x8000 = 32.768 = 256 x 32 (uncompressed image size) * 4 (as each pixel is RGB and a alpha channel)

// Raw compressed data
From compressed size, 0x0b36 = 2.870 bytes

In the previous image, I selected 2.870 bytes from the end of the Texture2D file. They are the bytes in blue.

So, this is what I have until now.

But... There is 8 unknow bytes just between FCompressedBlockHeader and Raw compressed data: 02 01 00 00 , 00 00 60 00. Do you know what could be this data?

And... the raw data is LZO1X_1 compressed. What I have to do to extract this data? I have to take it and add a lzo header to extract with lzop or another lzo extractor?

Your help is appreciated. Thanks!

 
cfarl
Posts: 11
Joined: Sun Nov 05, 2017 12:45 am

Re: Texture2D with LZO (unreal 3) in The Last Remnant

Post by cfarl »

New advances....

There is no 8 unknow bytes. This bytes are part of the raw data.

So, using the following script I could extract the compressed data:

endian big
comtype lzo1x
get magic long
get lixo long
get ZSIZE long
get SIZE long

print "Value of magic: %magic|x%"
print "Compressed size: %ZSIZE|x%"
print "Uncompressed size: %SIZE|x%"

get trash long
get trash long

clog "extracted.txt" 0x18 ZSIZE SIZE

Result:

offset filesize filename
--------------------------------------
Value of magic: 0x9e2a83c1
Compressed size: 0x00000b36
Uncompressed size: 0x00008000
00000018 32768 extracted.txt

- 1 files found in 0 seconds
coverage file 0 99% 2894 2902 . offset 00000018
cfarl
Posts: 11
Joined: Sun Nov 05, 2017 12:45 am

Re: Texture2D with LZO (unreal 3) in The Last Remnant

Post by cfarl »

Now... I have this extracted data....

It seems to be the DDS data of my 256 x 32 DXT5 image.

https://drive.google.com/open?id=1U8WU5x37iyfZgfY80EUEObCH7LmHvrJZ

As the extracted file comes from xbox, you have to do unswizzle and byte swap, and add a dds header.

If you are extracting the texture2d from pc, just put a dds header.

That's all! :D

Hope this can be usefull!