GTA IV LZX compression on resource data

Read or post about compression. And decompression. Or ask questions how to decompress your files.
User avatar
Dageron
advanced
Posts: 56
Joined: Mon May 25, 2009 8:22 am
Location: Russian Empire
Has thanked: 11 times
Been thanked: 58 times
Contact:

GTA IV LZX compression on resource data

Post by Dageron » Mon May 25, 2009 8:45 am

I want to ask help for solving Xbox360 resource compression problem, it is very important to me...

Every GTAIV resource (xtd-textures for example) has got following stucture:
4 bytes - Magic ('RSC')
4 bytes - Type (version - textures has "7")
4 bytes - Flags
<<Data in ZLIB on PC and LZX on XBox360>>
From 'flags' value can be calculated sizes of SysSegment and GpuSegment of unpacked data.
Delphi:

Code: Select all

 CpuSegSiz := (flags and $7FF) shl (((flags shr 11) and $F) + 8);
 GpuSegSiz := ((flags shr 15) and $7FF) shl (((flags shr 26) and $F) + 8);
C#:

Code: Select all

uint systemSegSize = (flags & 0x7FF) << (((flags >> 11) & 0xF) + 8);
uint gpuSegSize = ((flags >> 15) & 0x7FF) << (((flags >> 26) & 0xF) + 8);
Of course on PC everything is very easy because of primitive compression, but I dont know how to work with X360 data. Here it is archive which includes three examples of texture RSC.
http://www.sendspace.com/file/u4dk34
News about game research: http://dageron.com
Twitter: @DageronStudio

Rheini
Moderator
Posts: 653
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 40 times
Contact:

Re: GTA IV LZX compression on resource data

Post by Rheini » Mon May 25, 2009 11:33 am

So why don't you just write an extractor if you already know that it is LZX?
Already seen some C code for decompression.

User avatar
Dageron
advanced
Posts: 56
Joined: Mon May 25, 2009 8:22 am
Location: Russian Empire
Has thanked: 11 times
Been thanked: 58 times
Contact:

Re: GTA IV LZX compression on resource data

Post by Dageron » Mon May 25, 2009 12:25 pm

Unfortunally I am not so strong in C++/C#, it is the reason of my ask.
Anyway, I will be happy to look at decompress code (can not found it)
News about game research: http://dageron.com
Twitter: @DageronStudio

Rheini
Moderator
Posts: 653
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 40 times
Contact:

Re: GTA IV LZX compression on resource data

Post by Rheini » Mon May 25, 2009 12:28 pm

http://www.gtaforums.com/index.php?showtopic=410041
At the bottom. You already posted in that thread it seems.

User avatar
Dageron
advanced
Posts: 56
Joined: Mon May 25, 2009 8:22 am
Location: Russian Empire
Has thanked: 11 times
Been thanked: 58 times
Contact:

Re: GTA IV LZX compression on resource data

Post by Dageron » Mon May 25, 2009 12:41 pm

This is not decompress code, this is code for segment sizes calculation. Tool "unlzx" is not useful.
But I found some info about decompression in SparkIV source:
http://www.google.com/codesearch/p?hl=r ... ZXCodec.cs
Major part removed - it "is ommitted due to licensing issues".
Nobody of gtaF knows how to work with LZX, and who know will not tell because of some "staff agreement"
News about game research: http://dageron.com
Twitter: @DageronStudio

Rheini
Moderator
Posts: 653
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 40 times
Contact:

Re: GTA IV LZX compression on resource data

Post by Rheini » Mon May 25, 2009 12:46 pm

Yeah exactly that unlzx code.
You just need to adapt some things (OS and platform-specific stuff).

User avatar
Dageron
advanced
Posts: 56
Joined: Mon May 25, 2009 8:22 am
Location: Russian Empire
Has thanked: 11 times
Been thanked: 58 times
Contact:

Re: GTA IV LZX compression on resource data

Post by Dageron » Mon May 25, 2009 1:15 pm

No future... :( If you could help me with decompressor writing it will be more than good, for all people who interested in X360 GTAIV.
News about game research: http://dageron.com
Twitter: @DageronStudio

Rheini
Moderator
Posts: 653
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 40 times
Contact:

Re: GTA IV LZX compression on resource data

Post by Rheini » Mon May 25, 2009 1:34 pm

I'm too busy. Going through all that code takes some time.

User avatar
Dageron
advanced
Posts: 56
Joined: Mon May 25, 2009 8:22 am
Location: Russian Empire
Has thanked: 11 times
Been thanked: 58 times
Contact:

Re: GTA IV LZX compression on resource data

Post by Dageron » Mon May 25, 2009 1:36 pm

Maybe a bit later? (Week/Mounth and etc?...) Want to hope because it is very important
News about game research: http://dageron.com
Twitter: @DageronStudio

Rheini
Moderator
Posts: 653
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 40 times
Contact:

Re: GTA IV LZX compression on resource data

Post by Rheini » Mon May 25, 2009 1:47 pm

Years is more likely :wink:

User avatar
aluigi
VVIP member
VVIP member
Posts: 1917
Joined: Thu Dec 08, 2005 12:26 pm
Location: www.ZENHAX.com
Has thanked: 4 times
Been thanked: 650 times
Contact:

Re: GTA IV LZX compression on resource data

Post by aluigi » Mon May 25, 2009 3:19 pm

are you really sure that it's a LZX block?
I have tried to use the m$ lzx decompression which comes in libmspack but it doesn't work.

*edit*: with "doesn't work" I mean that the input data is not accepted as valid by the lzx_decompressor function ("bad block type") and even scanning the first bytes there are ever errors reported

Rheini
Moderator
Posts: 653
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 40 times
Contact:

Re: GTA IV LZX compression on resource data

Post by Rheini » Fri May 29, 2009 5:53 pm

Maybe it's a variation of LZX.

User avatar
Gocha
veteran
Posts: 109
Joined: Fri Dec 12, 2008 8:16 pm
Location: Batumi, Georgia, GE
Has thanked: 57 times
Been thanked: 8 times
Contact:

Re: GTA IV LZX compression on resource data

Post by Gocha » Fri May 29, 2009 6:19 pm

Are you kidding people?!! There are a lot of tools at the moment about editing the game such is GTA4! Where are you searching it? Through the Internet or into the Jungles? :D

[Edited, sorry for bad English]
Last edited by Gocha on Sat May 30, 2009 6:36 pm, edited 1 time in total.
My great respect and appreciation for them, who research game files! Special thanks to: aluigi, bacter, DerPlaya, Rick, Turfster, twig, Zench. Sorry if someone is missing in my list, I'll update when I'll notice it again

Rheini
Moderator
Posts: 653
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 40 times
Contact:

Re: GTA IV LZX compression on resource data

Post by Rheini » Sat May 30, 2009 4:29 pm

Learn english before speaking.
This is about the xbox version of gta.

AnthonyFiveSixTwo
ultra-n00b
Posts: 5
Joined: Fri Oct 24, 2008 4:52 am
Been thanked: 1 time

Re: GTA IV LZX compression on resource data

Post by AnthonyFiveSixTwo » Mon Jun 22, 2009 7:58 am

Well today I got around to looking at the xtd files that were posted and I was able to decompress them. I will make a tool to do it later on once we get a bit more info on the actual format of the decompressed data.

Im kinda tired right now but maybe tomorrow ill post some more info. :wink:
Last edited by AnthonyFiveSixTwo on Thu Jun 25, 2009 6:32 pm, edited 1 time in total.

Post Reply