XACT XWB XSB XGS Audio: Difference between revisions
imported>Ikskoks |
imported>Ikskoks |
(No difference)
| |
Revision as of 22:29, 10 April 2022
XWB
- Format Type : Archive / Audio
- Endian Order : Little Endian
- Signature : WBND
Format Specifications
char {4} - Header (WBND)
uint32 {4} - Version (3)
uint32 {4} - Size Of Header 1 (40)
uint32 {4} - Size Of Header 2 (40)
uint32 {4} - Offset To Details Directory (80)
uint32 {4} - Length Of Details Directory
uint32 {4} - Offset To Filename Directory
uint32 {4} - Length Of Filename Directory
uint32 {4} - First File Offset (8192)
uint32 {4} - Unknown
uint16 {2} - Unknown (1)
uint16 {2} - Unknown (1)
uint32 {4} - Number Of Files
char {16} - Archive Filename (null) (without extension)
uint32 {4} - Length Of Each Details Entry (24)
uint32 {4} - Length Of Each Filename Entry (64)
uint32 {4} - Max padding size between each file (2048)
uint32 {4} - null
// for each file
- uint16 {2} - Unknown (0/2)
- uint16 {2} - Unknown (1)
- uint32 {4} - Unknown
- uint32 {4} - File Offset [+firstFileOffset]
- uint32 {4} - File Length
- uint64 {8} - null
// for each file
- char {64} - Filename (null) (without extension)
// for each file
- byte {X} - File Data
- byte {0-2047} - null Padding so the file length is a multiple of 2048 bytes)
Format Specifications #2
// ARCHIVE HEADER
- char {4} - Header (WBND)
- uint32 {4} - Version
// DIRECTORIES
// Strictly speaking you can seek past this section, it (always?) refers to 4 directories
- // DIR 1 - WAVE BANK INFO
- uint32 {4} - Offset
- uint32 {4} - Length
- // DIR 2 - FILE RECORDS
- uint32 {4} - Offset
- uint32 {4} - Length
- // DIR 3 - ALWAYS EMPTY?
- uint32 {4} - Offset
- uint32 {4} - Length
- // DIR 4 - FILE DATA
- uint32 {4} - Offset
- uint32 {4} - Length
// DIR 1 - WAVE BANK INFO
- uint32 {4} - Flags
- uint32 {4} - Number of files
- byte {16} - Wavebank name (Padded with 0's)
- uint32 {4} - Size of each file record (in dir 2)
- uint32 {4} - Size of each entry name block
- uint32 {4} - Offset of file data
- uint32 {4} - Always null?
// DIR 2 - FILE RECORDS
- // FOR EACH FILE
- uint16 {2} - Number of channels
- uint16 {2} - Format tag (0=normal pcm) (1=xbox adpcm)
- uint32 {4} - Magic value
- uint32 {4} - File offset (Relative to start of DIR 4)
- uint32 {4} - File size
- uint32 {4} - Loop region offset (not sure what this does)
- uint32 {4} - Loop region length (not sure what this does)
// DUMPING FILES
Read the file records then seek to 'Offset of file data'(section 3) + File Offset.
The files are wav's so you need to write a .wav header first and then copy the data
Extra Checks:
The number of channels can be wrong, sometimes its given as 0 or even 15 and sometimes it indicates a stereo file when its actually mono. The bottom line is - dont trust the 'number of channels' value. The correct number of channels can be worked out from the 'magic value', below is the code I use to do this:
function TPsychoAudioDumper.RepairXboxChannels(Format, MagicValue,
Channels: cardinal): integer;
var
Temp: integer;
begin
if format=0 then //Pcm
begin
Temp:=(MagicValue - 4) mod 32;
if Temp=0 then
Result:=1
else
Result:=2;
end
else
if format=1 then //Adpcm
begin
Temp:=(MagicValue - 5) mod 32;
if Temp=0 then
Result:=1
else
Result:=2;
end
else
Result:=1;
end;
Similarly, the samplerate is sometimes wrong, so to correct this:
function TPsychoAudioDumper.GetXboxSamplerate(Format, MagicValue,
Channels: cardinal): integer;
begin
if format=0 then //Pcm
begin
if Channels=1 then
begin
if MagicValue=2148894852 then //1 channel
result:=44100
else
if MagicValue=2148507652 then //1 channel
result:=32000
else
if MagicValue=2148189252 then //1 channel
result:=22050
else
if MagicValue=705604 then //1 channel
result:=22050
else
if MagicValue=352804 then //1 channel
result:=11025
else
if MagicValue=256004 then //1 channel
result:=8000
else
begin
result:=0;
if Assigned(FOnDebug) then
FOnDebug('Unknown magic value! = ' + inttostr(magicvalue));
end
end
else //2 channels
begin
if MagicValue=2148894856 then //2 channel
result:=44100
else
if MagicValue=2148507656 then //2 channel
result:=32000
else
if MagicValue=2148189256 then //2 channel
result:=22050
else
begin
result:=0;
if Assigned(FOnDebug) then
FOnDebug('Unknown magic value! = ' + inttostr(magicvalue));
end
end;
end
else
if format=1 then //Adpcm
begin
Result:=(MagicValue - (1 + (Channels * 4))) div 32;
end
else
Result:=0;
end;
Very rarely, the format tag is given as 2, this should be treated as format tag 0 - a normal pcm wave.
Notes and Comments
XWB files (Xbox Wavebanks) contain the audio data and are only used in the XBox version (and PC ports of XBOX games). XWB files are also used in many other XBox games, the specs here are only tested with Psychonauts though.
XWB files contain 2 types of audio:
- PCM - Standard Wave PCM
- Xbox ADPCM - As used by many Xbox games
The PCM audio can be played easily, to play the Xbox ADPCM however you either need to pass it through a decoder (there's one in Psychonauts Explorer) or install the Xbox ADPCM codec.
The Wavebank doesnt contain any file names. This is because these are stored in a seperate file - the SoundBank file (.xsb). See below for info on this.
XWB auidio files may occur along with XNB Archives.
XGS
- Format Type : Misc
- Endian Order : Little Endian
- Signature : XGSF
Format Specifications
//header 4 bytes (char) - Signature // "XGSF" // TODO
XSB
- Format Type : Misc
- Endian Order : Little Endian
- Signature : SDBK
Format Specifications
//header 4 bytes (char) - Signature // "SDBK" // TODO
Other Info
quickBMS Script
Not written yet.
Compatible Programs
- foobar2000 + vgmstream plugin
- Game Extractor
- Psychonauts Explorer
Other Games
These games use this file format
- Bleed (PC) (*.XWB / *.XGS / *.XSB)
- Full Spectrum Warrior *.xwb
- Ghost Recon 2 (XBox) *.xwb
- Powerdrome *.xwb
- Psychonauts *.xwb
- Return To Castle Wolfenstein: Tide Of War (XBox) *.xwb
- Star Trek Shattered Universe (XBox) *.xwb
- Sudeki *.xwb
- Unreal Championship 2: The Liandri Conflict (XBox) *.xwb