Xbox XWB ADPCM music replacement Unreal Champ. Liandri Con.

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
tommik
Posts: 2
Joined: Thu Mar 09, 2017 12:10 pm

Xbox XWB ADPCM music replacement Unreal Champ. Liandri Con.

Post by tommik »

Hello people,

I need advice on Xbox XWB music replacement in Unreal Championship Liandri Conflict. So far I have gone this far:

• using ToWav (c) Xplorer 2k6-2k9 I am able to convert music files like M_Abydos.xwb into standard 16 bit 44 kHz stereo WAVE files and playback them in Gold Wave - probably only suitable to listen and see how long the music is (in seconds)
• using Xbox ADPCM Codec v1.0_2 installed in Windows 10 32 bit I am able to encode my own Xbox ADPCM WAVE file from Gold Wave - note: the codec does not allow anything higher than 4 bits and unxwb reports M_Abydos.xwb as 8 bits: 6969344 ADP 44100 2 8 00000000.wav plus it won't playback in Gold Wave at all - what is going on here?
• using HxD hex editor I am able to manipulate with the existing XWB files in terms of injecting my own encoded Xbox ADPCM stream plus play around with some values... - note: Xact Tool seems useless since there is no support for this kind of Xbox audio stuff (only Xbox 360)

And here is where I get stuck. The problem is I don't know which value(s) to set so that the playback loops and plays the whole stream. I can use existent values from original XWB files, but then it means the playback will chop off and start again not following my own stream length. Unfortunately the description of XBOX XWB3 (if that's the one Unreal uses) is missing important parts for me:

http://wiki.xentax.com/index.php/XBOX_XWB3

After inspecting several Unreal XWB music files I have found out that there are 2 regions changing for every different XWB:

offset 24 blocks 24-27 - this should be stream(?) length? - HEX values match those DEC values reported by unxwb - I can change this value and my own stream will then play longer than the original one but it won't loop since there is something else that has to be addressed

Image

I think it might be the value that is not documented in XWB3 wiki, and I am talking about offset 50, 52, 54 - according to wiki it should be 2, 2, 4 bytes - but who knows. Anyway the value - if it is 2 bytes - at offset 52 is crucial. Changing that on the original XWB means it won't loop anymore. So it has to do with looping and I can't figure this out.

Image


To summarize: I know where to insert my own ADPCM stream (offset HEX 800), I know that changing 4 bytes at offset HEX 24 addresses length, but I have no clue how to set it to loop and playback the whole stream.

Note: not sure if the original Unreal XWB files contain 8-bit ADPCM streams but my own 4-bit stereo 44 kHz encoded streams from Gold Wave playback just fine on real Xbox. Xbox ADPCM codec I use does not allow anything higher that 4 bits.

Note 2: offset 2048 bytes from the end of the file is always that "length" value at offset 24.

Thank you very much for your time!


edit: This is from the Avaris.xap file that is present in the Sounds directory of the game but I have no clue how to associate the values with the actual XWB file:

Wave Bank
{
Name = M_Abydos;
Bank File = M_Abydos.xwb;
Alignment = 2048;
Streaming = 1;
Compact = 1;
Bank Last Modified Low = 2750680392;
Bank Last Modified High = 29699242;
Header Last Modified Low = 0;
Header Last Modified High = 0;

Entry
{
Name = Abydos;
File = ..\Music\Abydos.wav;
ADPCM Filter = 1;
Format Tag = 0;
Channels = 2;
Sampling Rate = 44100;
Bits Per Sample = 1;
Play Region Offset = 44;
Play Region Length = 24774404;
Loop Region Offset = 0;
Loop Region Length = 0;
File Type = 0;
Last Modified Low = 709325271;
Last Modified High = 29669464;
}
}
tommik
Posts: 2
Joined: Thu Mar 09, 2017 12:10 pm

Re: Xbox XWB ADPCM music replacement Unreal Champ. Liandri Con.

Post by tommik »

Solved. Used the original Xact - works like a charm.