VTFX file format: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (moved Vtfx to VTFX file format: Consistent title format)
mNo edit summary
Line 1: Line 1:
{{stub}}
{{stub}}
{{cleanup}}
{{cleanup}}
VTFX is a file format used by Valve to store textures on the Xbox 360.
'''VTFX''' is a file format used by Valve to store textures on the Xbox 360.
It has a modified header from normal VTF files.
It has a modified header from normal VTF files.
Conversion to VTF or another usable format is difficult but not impossible.
Conversion to VTF or another usable format is difficult but not impossible.
Line 7: Line 7:
VTFX files are Big-Endian.
VTFX files are Big-Endian.


== VTFX file format==
== VTFX header ==
 
=== VTFX header ===
<source lang="cpp">
<source lang="cpp">
typedef struct tagVTFXHEADER   
typedef struct tagVTFXHEADER   
Line 36: Line 34:
</source>
</source>


=== ResourceEntryInfo Info ===
== ResourceEntryInfo Info ==


<source lang="cpp">
<source lang="cpp">

Revision as of 22:36, 15 April 2011

Stub

This article or section is a stub. You can help by expanding it.

Broom icon.png
This article or section needs to be cleaned up to conform to a higher standard of quality.
For help, see the VDC Editing Help and Wikipedia cleanup process. Also, remember to check for any notes left by the tagger at this article's talk page.

VTFX is a file format used by Valve to store textures on the Xbox 360. It has a modified header from normal VTF files. Conversion to VTF or another usable format is difficult but not impossible. Compression seems to be varied depending on what game the VTFX is for (eg. some may not have compression) VTFX files are Big-Endian.

VTFX header

typedef struct tagVTFXHEADER  
{
	char fileTypeString[4];         // VTFX.
	int version[2]; 		// version[0].version[1].
	int headerSize;
	unsigned int	flags;
	unsigned short	width;					// actual width of data in file.
	unsigned short	height;					// actual height of data in file.
	unsigned short	depth;					// actual depth of data in file.
	unsigned short	numFrames;
	unsigned short	preloadDataSize;		// exact size of preload data (may extend into image!).
	unsigned char	mipSkipCount;			// used to resconstruct mapping dimensions.
	unsigned char	numResources;
	Vector			reflectivity;			// Resides on 16 byte boundary!.
	float			bumpScale;
	ImageFormat		imageFormat;
	unsigned char	lowResImageSample[4];
	unsigned int	compressedSize;

	// *** followed by *** ResourceEntryInfo resources[0];
} VTFXHEADER;
#define VTF_X360_MAJOR_VERSION	0x0360
#define VTF_X360_MINOR_VERSION	8

ResourceEntryInfo Info

VTF_LEGACY_RSRC_LOW_RES_IMAGE	= MK_VTF_RSRC_ID( 0x01, 0, 0 ),	// Low-res image data
VTF_LEGACY_RSRC_IMAGE		= MK_VTF_RSRC_ID( 0x30, 0, 0 ),	// Image data
VTF_RSRC_SHEET                  = MK_VTF_RSRC_ID( 0x10, 0, 0 ),	// Sheet data
RSRCF_HAS_NO_DATA_CHUNK	        = MK_VTF_RSRCF( 0x02 ),	// Resource doesn't have a corresponding data chunk
RSRCF_MASK			= MK_VTF_RSRCF( 0xFF )	// Mask for all the flags
#define VTF_RSRC_TEXTURE_CRC ( MK_VTF_RSRC_ID( 'C','R','C' ) ) //CRC Checksum?
#define VTF_RSRC_TEXTURE_SETTINGS_EX ( MK_VTF_RSRC_ID( 'T','S','0' ) ) //TextureSettingsEx_t
#define VTF_RSRC_TEXTURE_LOD_SETTINGS ( MK_VTF_RSRC_ID( 'L','O','D' ) ) //TextureLODControlSettings_t

struct ResourceEntryInfo
{
	union
	{ 
		unsigned int	eType;		// Use MK_VTF_??? macros to be endian compliant with the type
		unsigned char	chTypeBytes[4];
	};
	unsigned int		resData;	// Resource data or offset from the beginning of the file
};