Page 1 of 1

War Thunder .ddsx image format

Posted: Fri Oct 31, 2014 5:51 pm
by InnerCircle
Hello everyone!

I have a Problem regarding .ddsx Files. I´m creating skins for the F2P Game War Thunder. Although the game has an built-in Feature to create Skin Templates for Planes and Tanks (supports .dds/png./tga/.jpg), but some of those templates are missing elements like Normalmaps, additional Textures, etc...

A Guy from the WT Community made a tool to open/extract the content for most of the game archives. Almost every image inside those are in .ddsx though my attempts at finding a solution how to convert them have failed so far.

I´ve attached an example file so i would be very grateful if smeone could help me out here :)

Re: War Thunder .ddsx image format

Posted: Sat Nov 01, 2014 9:50 am
by deepshit
It's compressed by lzma.
Here's decompressed data.It's headerless dds.

Re: War Thunder .ddsx image format

Posted: Sun Nov 02, 2014 2:38 pm
by InnerCircle
Thank you :)

I found a topic on this forum which seems kinda related since this Game uses the same Engine: viewtopic.php?p=30696#p30696
then I looked at the dds files in a hex editor and just pasted a valid dds header over it which was dxt5 and no mip maps.
Could you tell me how to do this? I know I´m a total noob with Hex Editing and stuff :D

Re: War Thunder .ddsx image format

Posted: Sun Nov 16, 2014 11:35 pm
by InnerCircle
Anyone else who might help me please?

Re: War Thunder .ddsx image format

Posted: Mon Nov 17, 2014 7:02 pm
by Acewell
InnerCircle wrote:
then I looked at the dds files in a hex editor and just pasted a valid dds header over it which was dxt5 and no mip maps.
Could you tell me how to do this? I know I´m a total noob with Hex Editing and stuff :D
to do it through hex editing you would copy the header from another dds file and paste it at the beginning of your uncompressed headerless file.

Example DXT5 header with no mipmaps

Code: Select all

44 44 53 20 7C 00 00 00 07 10 08 00 C8 00 00 00
38 01 00 00 C0 F3 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00
04 00 00 00 44 58 54 35 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
If you don't want to mess with hex editing you could open the uncompressed file in TextureFinder with correct settings and save it as *.bmp then convert it to *.dds.
h-75n.zip
:D

Re: War Thunder .ddsx image format

Posted: Mon Nov 17, 2014 7:20 pm
by barti
AceWell wrote:To do it through hex editing you would copy the header from another dds file and paste it at the beginning of your uncompressed headerless file.
-snip-
If you don't want to mess with a hex editor you could open the uncompressed file in TextureFinder with correct settings and save it as *.bmp then convert it to *.dds.
I think what he means is how to unpack .ddsx textures - I've tried it myself, with QuickBMS and different variations of LZMA with different offsets, but none of them worked.

Re: War Thunder .ddsx image format

Posted: Mon Nov 17, 2014 8:06 pm
by merlinsvk

Code: Select all

# War Thunder
# DDSx to DDS converter
# by MerlinSVK    Oct 2014
# version 1.0
# script for QuickBMS    http://aluigi.org/papers.htm#quickbms

set MEMORY_FILE binary "\x44\x44\x53\x20\x7C\x00\x00\x00\x07\x10\x08\x00\xAA\xAA\xAA\xAA\xBB\xBB\xBB\xBB\xCC\xCC\xCC\xCC\x00\x00\x00\x00\x01\x00\x00\x00\x4D\x45\x52\x4C\x49\x4E\x3A\x29\x01\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x04\x00\x00\x00\xEE\xEE\xEE\xEE\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"

get NAME basename
string HNAME = NAME
string HNAME += ".head"
string NAME += ".dds"

log HNAME 0 0x20	# save header for backward conversion

idstring "DDSx"
getdstring FORMAT 4
if FORMAT == "DXT1"
	math FORMAT = 0x31545844
else if FORMAT == "DXT3"
	math FORMAT = 0x33545844
else if FORMAT == "DXT5"
	math FORMAT = 0x35545844
else
	print "-- UNSUPPORTED FORMAT --"
	cleanexit
endif
get UNK byte
get UNK short
get UNK byte
get WIDTH short
get HEIGHT short
goto 0x18
get SIZE long
get ZSIZE asize
math ZSIZE -= 0x20

putVarChr MEMORY_FILE 0XC HEIGHT long
putVarChr MEMORY_FILE 0x10 WIDTH long
putVarChr MEMORY_FILE 0x14 SIZE long
putVarChr MEMORY_FILE 0x54 FORMAT long

append
comtype lzma_dynamic
clog MEMORY_FILE 0x20 ZSIZE SIZE
append

get DDSSIZE asize MEMORY_FILE
log NAME 0 DDSSIZE MEMORY_FILE
I got also a repack script, but I did not tested repacked texture in the game, so it may not work.

Code: Select all

# War Thunder
# DDS to DDSx converter
# by MerlinSVK    Oct 2014
# version 1.0
# script for QuickBMS    http://aluigi.org/papers.htm#quickbms

open FDDE DDS 0 
open FDDE HEAD 1

get NAME basename
string NAME += ".ddsx_NEW"

get DSIZE asize 0
math DSIZE -= 0x80
get HSIZE asize 1

goto 0xC 0
get HEIGHT long 0
get WIDTH long 0
#get DSIZE long 0
goto 0x54 0
get FORMAT long 0

log MEMORY_FILE 0 HSIZE 1		# copy header into the memory_file
append
comtype lzma_compress
clog MEMORY_FILE 0x80 DSIZE DSIZE 0	# compress texture and append it to the header
append
get DSIZE asize MEMORY_FILE
math DSIZE -= 0x20				# substract size of header

# this part is useful when you changed resolution or format of the texture
# otherwise it can be deleted
putVarChr MEMORY_FILE 0x4 FORMAT long
putVarChr MEMORY_FILE 0xC WIDTH short
putVarChr MEMORY_FILE 0xE HEIGHT short
putVarChr MEMORY_FILE 0x18 DSIZE long
#

get DDSXSIZE asize MEMORY_FILE
log NAME 0 DDSXSIZE MEMORY_FILE

Re: War Thunder .ddsx image format

Posted: Tue Nov 18, 2014 8:58 pm
by InnerCircle
merlinsvk wrote:

Code: Select all

# War Thunder
# DDSx to DDS converter
# by MerlinSVK    Oct 2014
# version 1.0
# script for QuickBMS    http://aluigi.org/papers.htm#quickbms

set MEMORY_FILE binary "\x44\x44\x53\x20\x7C\x00\x00\x00\x07\x10\x08\x00\xAA\xAA\xAA\xAA\xBB\xBB\xBB\xBB\xCC\xCC\xCC\xCC\x00\x00\x00\x00\x01\x00\x00\x00\x4D\x45\x52\x4C\x49\x4E\x3A\x29\x01\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x04\x00\x00\x00\xEE\xEE\xEE\xEE\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"

get NAME basename
string HNAME = NAME
string HNAME += ".head"
string NAME += ".dds"

log HNAME 0 0x20	# save header for backward conversion

idstring "DDSx"
getdstring FORMAT 4
if FORMAT == "DXT1"
	math FORMAT = 0x31545844
else if FORMAT == "DXT3"
	math FORMAT = 0x33545844
else if FORMAT == "DXT5"
	math FORMAT = 0x35545844
else
	print "-- UNSUPPORTED FORMAT --"
	cleanexit
endif
get UNK byte
get UNK short
get UNK byte
get WIDTH short
get HEIGHT short
goto 0x18
get SIZE long
get ZSIZE asize
math ZSIZE -= 0x20

putVarChr MEMORY_FILE 0XC HEIGHT long
putVarChr MEMORY_FILE 0x10 WIDTH long
putVarChr MEMORY_FILE 0x14 SIZE long
putVarChr MEMORY_FILE 0x54 FORMAT long

append
comtype lzma_dynamic
clog MEMORY_FILE 0x20 ZSIZE SIZE
append

get DDSSIZE asize MEMORY_FILE
log NAME 0 DDSSIZE MEMORY_FILE
I got also a repack script, but I did not tested repacked texture in the game, so it may not work.

Code: Select all

# War Thunder
# DDS to DDSx converter
# by MerlinSVK    Oct 2014
# version 1.0
# script for QuickBMS    http://aluigi.org/papers.htm#quickbms

open FDDE DDS 0 
open FDDE HEAD 1

get NAME basename
string NAME += ".ddsx_NEW"

get DSIZE asize 0
math DSIZE -= 0x80
get HSIZE asize 1

goto 0xC 0
get HEIGHT long 0
get WIDTH long 0
#get DSIZE long 0
goto 0x54 0
get FORMAT long 0

log MEMORY_FILE 0 HSIZE 1		# copy header into the memory_file
append
comtype lzma_compress
clog MEMORY_FILE 0x80 DSIZE DSIZE 0	# compress texture and append it to the header
append
get DSIZE asize MEMORY_FILE
math DSIZE -= 0x20				# substract size of header

# this part is useful when you changed resolution or format of the texture
# otherwise it can be deleted
putVarChr MEMORY_FILE 0x4 FORMAT long
putVarChr MEMORY_FILE 0xC WIDTH short
putVarChr MEMORY_FILE 0xE HEIGHT short
putVarChr MEMORY_FILE 0x18 DSIZE long
#

get DDSXSIZE asize MEMORY_FILE
log NAME 0 DDSXSIZE MEMORY_FILE
Wow that´s exactly what i needed! Thank you!