XWV: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Created page with 'Still being researched... <code> DWORD id = 1482118688 "XWV" + $20 DWORD magic1 = 4 DWORD magic2 = 48 DWORD magic3 = (known values 156, 172, 192) increases with file size DW…')
 
(this file format proprietary-ness kinda makes it hard to reverse engineer, but atleast so far i found a tool that allow users to convert it back to wav.)
 
(23 intermediate revisions by 6 users not shown)
Line 1: Line 1:
Still being researched...
{{stub}}


<code>
'''XWV''' is the proprietary sound format used by Valve's {{360|4}} games. It is similar to the [[WAV]] format and uses the big-endian byte order. The format is defined in the [[SDK]] in {{path|public\xwvfile|h|icon=custom|customico=Cpp-16px.png}}.
DWORD id = 1482118688 "XWV" + $20


DWORD magic1 = 4
To convert some XMV file to WAV, you can use [https://vgmstream.org/ vgmstream].


DWORD magic2 = 48
== Header ==


DWORD magic3 = (known values 156, 172, 192) increases with file size
<source lang="cpp">
#define XWV_ID (('X'<<24)|('W'<<16)|('V'<<8)|(' '<<0))
#define XWV_VERSION 4


DWORD magic4 = 2048
enum xwvSampleRate_t
{
XWV_RATE_11025 = 0,
XWV_RATE_22050 = 1,
XWV_RATE_44100 = 2,
};


DWORD magic5 = (known values 71680, 90,112) very similar to file size! (within a kilo or two)
enum xwvFormat_t
{
XWV_FORMAT_PCM = 0,
XWV_FORMAT_XMA = 1,
XWV_FORMAT_ADPCM = 2,
};


DWORD magic6 = (kv 268288, 204288, 243200) increases with file size
// generated in big-endian
struct xwvHeader_t
{
unsigned int id;
unsigned int version;
unsigned int headerSize; // header only
unsigned int staticDataSize; // follows header
unsigned int dataOffset; // start of samples, possibly sector aligned
unsigned int dataSize; // length of samples in bytes
unsigned int numDecodedSamples; // for duration calcs
int loopStart; // -1 = no loop, offset of loop in samples
unsigned short loopBlock; // the xma block where the loop starts
unsigned short numLeadingSamples; // number of leading samples in the loop block to discard
unsigned short numTrailingSamples; // number of trailing samples at the final block to discard
unsigned short vdatSize; // follows seek table
byte format;
byte bitsPerSample;
byte sampleRate;
byte channels;
byte quality;
byte bHasSeekTable; // indicates presence, follows header
byte padding[2]; // created as 0
};
</source>


DWORD magic7 = -1
[[Category:Audio formats]]
 
DWORD magic8 = 0
 
DWORD magic9 = 16</code>

Latest revision as of 04:32, 1 April 2024

Stub

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

XWV is the proprietary sound format used by Valve's Xbox 360 Xbox 360 games. It is similar to the WAV format and uses the big-endian byte order. The format is defined in the SDK in Custom Iconpublic\xwvfile.h.

To convert some XMV file to WAV, you can use vgmstream.

Header

#define XWV_ID		(('X'<<24)|('W'<<16)|('V'<<8)|(' '<<0))
#define XWV_VERSION 4

enum xwvSampleRate_t
{
	XWV_RATE_11025 = 0,
	XWV_RATE_22050 = 1,
	XWV_RATE_44100 = 2,
};

enum xwvFormat_t
{
	XWV_FORMAT_PCM = 0,
	XWV_FORMAT_XMA = 1,
	XWV_FORMAT_ADPCM = 2,
};

// generated in big-endian
struct xwvHeader_t
{
	unsigned int	id;
	unsigned int	version;
	unsigned int	headerSize;		// header only
	unsigned int	staticDataSize;		// follows header
	unsigned int	dataOffset;		// start of samples, possibly sector aligned
	unsigned int	dataSize;		// length of samples in bytes
	unsigned int	numDecodedSamples;	// for duration calcs
	int		loopStart;		// -1 = no loop, offset of loop in samples
	unsigned short	loopBlock;		// the xma block where the loop starts 
	unsigned short	numLeadingSamples;	// number of leading samples in the loop block to discard
	unsigned short	numTrailingSamples;	// number of trailing samples at the final block to discard
	unsigned short	vdatSize;		// follows seek table
	byte		format;
	byte		bitsPerSample;
	byte		sampleRate;
	byte		channels;
	byte		quality;
	byte		bHasSeekTable;		// indicates presence, follows header
	byte		padding[2];		// created as 0
};