imported>Mr.Mouse |
imported>Xz3J1f |
| Line 8: |
Line 8: |
|
| |
|
| <tt><b> | | <tt><b> |
| char {4} - Header <font color="purple">(WBND)</font> <br> | | char {4} |
| uint32 {4} - Version <font color="purple">(3)</font> <br>
| |
| uint32 {4} - Size Of Header 1 <font color="purple">(40)</font> <br>
| |
| uint32 {4} - Size Of Header 2 <font color="purple">(40)</font> <br>
| |
| uint32 {4} - Offset To Details Directory <font color="purple">(80)</font> <br>
| |
| uint32 {4} - Length Of Details Directory <br>
| |
| uint32 {4} - Offset To Filename Directory <br>
| |
| uint32 {4} - Length Of Filename Directory <br>
| |
| uint32 {4} - First File Offset <font color="purple">(8192)</font> <br>
| |
| uint32 {4} - <font color="red"> '' Unknown '' </font> <br>
| |
| uint16 {2} - <font color="red"> '' Unknown <font color="purple">(1)</font> '' </font> <br>
| |
| uint16 {2} - <font color="red"> '' Unknown <font color="purple">(1)</font> '' </font> <br>
| |
| uint32 {4} - Number Of Files <br>
| |
| char {16} - Archive Filename <font color="purple">(null)</font> <font color="purple">(without extension)</font> <br>
| |
| uint32 {4} - Length Of Each Details Entry <font color="purple">(24)</font> <br>
| |
| uint32 {4} - Length Of Each Filename Entry <font color="purple">(64)</font> <br>
| |
| uint32 {4} - Max padding size between each file <font color="purple">(2048)</font> <br>
| |
| uint32 {4} - null <br>
| |
| <br>
| |
| <font color="blue"> ''' // for each file ''' </font> <br>
| |
| : uint16 {2} - <font color="red"> '' Unknown <font color="purple">(0/2)</font> '' </font> <br>
| |
| : uint16 {2} - <font color="red"> '' Unknown <font color="purple">(1)</font> '' </font> <br>
| |
| : uint32 {4} - <font color="red"> '' Unknown '' </font> <br>
| |
| : uint32 {4} - File Offset <font color="darkgreen">[+firstFileOffset]</font> <br>
| |
| : uint32 {4} - File Length <br>
| |
| : uint64 {8} - null <br>
| |
| <br>
| |
| <font color="blue"> ''' // for each file ''' </font> <br>
| |
| : char {64} - Filename <font color="purple">(null)</font> <font color="purple">(without extension)</font> <br>
| |
| <br>
| |
| <font color="blue"> ''' // for each file ''' </font> <br>
| |
| : byte {X} - File Data <br>
| |
| : byte {0-2047} - null Padding so the file length is a multiple of 2048 bytes) <br>
| |
| <br>
| |
| </b></tt>
| |
| | |
| === Format Specifications #2 ===
| |
| <tt><b>
| |
| <font color="blue"> ''' // ARCHIVE HEADER ''' </font> <br>
| |
| : char {4} - Header <font color="purple">(WBND)</font> <br>
| |
| : uint32 {4} - Version <br>
| |
| <br>
| |
| <font color="blue"> ''' // DIRECTORIES ''' </font> <br>
| |
| <font color="blue"> ''' // Strictly speaking you can seek past this section, it (always?) refers to 4 directories ''' </font> <br>
| |
| : <font color="blue"> ''' // DIR 1 - WAVE BANK INFO ''' </font> <br>
| |
| : uint32 {4} - Offset <br>
| |
| : uint32 {4} - Length <br>
| |
| : <font color="blue"> ''' // DIR 2 - FILE RECORDS ''' </font> <br>
| |
| : uint32 {4} - Offset <br>
| |
| : uint32 {4} - Length <br>
| |
| : <font color="blue"> ''' // DIR 3 - ALWAYS EMPTY? ''' </font> <br>
| |
| : uint32 {4} - Offset <br>
| |
| : uint32 {4} - Length <br>
| |
| : <font color="blue"> ''' // DIR 4 - FILE DATA ''' </font> <br>
| |
| : uint32 {4} - Offset <br>
| |
| : uint32 {4} - Length <br>
| |
| <br>
| |
| | |
| <font color="blue"> ''' // DIR 1 - WAVE BANK INFO ''' </font> <br>
| |
| : uint32 {4} - Flags <br>
| |
| : uint32 {4} - Number of files <br>
| |
| : byte {16} - Wavebank name <font color="purple">(Padded with 0's)</font><br>
| |
| : uint32 {4} - Size of each file record (in dir 2) <br>
| |
| : uint32 {4} - Size of each entry name block <br>
| |
| : uint32 {4} - Offset of file data <br>
| |
| : uint32 {4} - Always null? <br>
| |
| <br>
| |
| | |
| <font color="blue"> ''' // DIR 2 - FILE RECORDS ''' </font> <br>
| |
| :<font color="blue"> ''' // FOR EACH FILE ''' </font> <br>
| |
| : uint16 {2} - Number of channels <br>
| |
| : uint16 {2} - Format tag <font color="purple">(0=normal pcm) (1=xbox adpcm)</font> <br>
| |
| : uint32 {4} - Magic value <br>
| |
| : uint32 {4} - File offset <font color="purple">(Relative to start of DIR 4)</font><br>
| |
| : uint32 {4} - File size <br>
| |
| : uint32 {4} - Loop region offset (not sure what this does) <br>
| |
| : uint32 {4} - Loop region length (not sure what this does) <br>
| |
| <br>
| |
| | |
| | |
| | |
| <font color="blue"> ''' // DUMPING FILES''' </font> <br>
| |
| Read the file records then seek to 'Offset of file data'(section 3) + File Offset.<br>
| |
| The files are wav's so you need to write a .wav header first and then copy the data<br>
| |
| <br>
| |
| | |
| Extra Checks:<br>
| |
| 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;
| |
| <br>
| |
| Similarly, the samplerate is sometimes wrong, so to correct this:<br>
| |
| | |
| 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;
| |
| <br>
| |
| Very rarely, the format tag is given as 2, this should be treated as format tag 0 - a normal pcm wave.<br>
| |
| <br>
| |
| </b></tt>
| |
| | |
| === Notes and Comments ===
| |
| | |
| XWB files (Xbox Wavebanks) contain the audio data and are only used in the XBox version. XWB files are also used in many other XBox games, the specs here are only tested with Psychonauts though.<br>
| |
| <br>
| |
| XWB files contain 2 types of audio:<br>
| |
| : PCM - Standard Wave PCM<br>
| |
| : Xbox ADPCM - As used by many Xbox games<br><br>
| |
| | |
| 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 [http://quick.mixnmojo.com/software.php#psychonautsexplorer Psychonauts Explorer]) or install the Xbox ADPCM codec.<br>
| |
| <br>
| |
| 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.<br>
| |
| <br>
| |
| | |
| === MultiEx BMS Script ===
| |
| | |
| Not written yet<br><br>
| |
| | |
| === Compatible Programs ===
| |
| | |
| * [[Game Extractor|Game Extractor]]<br>
| |
| * [http://quick.mixnmojo.com/software.php#psychonautsexplorer Psychonauts Explorer]<br>
| |
| | |
| === Other Games ===
| |
| | |
| These games use this file format<br>
| |
| * 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
| |