The Forum is up for sale: XeNTaX Forum looking for new owner

Get DDS file size

The Original Forum. Game archives, full of resources. How to open them? Get help here.
Post Reply
krystalgamer
beginner
Posts: 31
Joined: Mon May 02, 2016 11:20 pm
Has thanked: 4 times
Been thanked: 18 times

Get DDS file size

Post by krystalgamer »

Hello, this is my first post so i hope i'm posting in the correction section.

Today i started to try to mod a game called "Ultimate Spiderman" released in 2005. My goal is to write a tool to extract all files from its PCPACKs(unknown ones will be exported as binaries)
I opened a PCPACK file(most probably where the files i want are stored) and i find some unencrypted DDS files inside them, like the web texture, but after looking a little more i found that there are more DDS files than that and the size is variable. Analyzing the DDS_HEADER structure doesn't seem to help too.

So my question is how to get DDS file size so it's easier to export?

I can upload the file that i talked about if needed.

Thanks in advance.
WRS
ultra-veteran
ultra-veteran
Posts: 603
Joined: Fri Nov 06, 2009 12:13 am
Has thanked: 74 times
Been thanked: 136 times

Re: Get DDS file size

Post by WRS »

krystalgamer wrote:Analyzing the DDS_HEADER structure doesn't seem to help too.
why not? what does that structure contain? i have no idea what it looks like!

the dds version will help - different formats pack the texture data differently. it might be stored as another value somewhere. do you also have the width and height?
Useful tool links:
chrrox
Moderator
Posts: 2602
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1411 times

Re: Get DDS file size

Post by chrrox »

you have to do this for each mip
but here is what i use for the main mip.

Code: Select all

DXT1    - dataSize = (imgWidth * imgHeight * 4) // 8
DXT5    - dataSize = (imgWidth * imgHeight * 8) // 8
RGBA32 - dataSize = (imgWidth * imgHeight * 8)
krystalgamer
beginner
Posts: 31
Joined: Mon May 02, 2016 11:20 pm
Has thanked: 4 times
Been thanked: 18 times

Re: Get DDS file size

Post by krystalgamer »

Sorry for being so vague, i thought that there was an undocumented variable of DDS_FILE header the contained its size but now i understand it can be anywhere in the archive.
WRS wrote:
krystalgamer wrote:Analyzing the DDS_HEADER structure doesn't seem to help too.
why not? what does that structure contain? i have no idea what it looks like!

the dds version will help - different formats pack the texture data differently. it might be stored as another value somewhere. do you also have the width and height?
The texture i extracted is DXT3, its height and width is 64x64. I included the 0x00 at the end because at the time i had no ideia if they're required.
chrrox wrote:you have to do this for each mip
but here is what i use for the main mip.

Code: Select all

DXT1    - dataSize = (imgWidth * imgHeight * 4) // 8
DXT5    - dataSize = (imgWidth * imgHeight * 8) // 8
RGBA32 - dataSize = (imgWidth * imgHeight * 8)
Hmm any suggestion for DXT3? I uploaded the file i extracted.


I'll look more in the archive i've been so busy that i couldn't look more deeply into PCPACKs. I'll post an update ASAP.
chrrox
Moderator
Posts: 2602
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1411 times

Re: Get DDS file size

Post by chrrox »

Dxt3 and 5 are identical size only difference is how alpha channel is read
Post Reply