Luigi Auriemma

www.aluigi.org
 FAQ •  Search •  Register •  Login 
It is currently 18 Dec 2009 05:21

All times are UTC [ DST ]




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: XMA
PostPosted: 12 Jul 2009 17:29 

Joined: 12 Jul 2009 17:07
Posts: 4
Is anyone working on reversing this WMA Pro based Xbox 360 codec?

This Russian tool successfully decodes XMA files (and XMA files inside FSB containers), however it doesn't support Multichannel files:
http://www.ctpax-x.ru/index.php?goto=fi ... 24&lang=en

Interesting document with some general info:
https://devel.nuclex.org/external/svn/d ... xma2defs.h

XMA encoder .dll file from FMOD:
http://www.mediafire.com/?znwyy24z3mu

Decrypted FSB samples from GH:WT containing Multichannel XMA files (not supported by ToWAV):
http://www.mediafire.com/?zyzzm1mt1mv


Top
 Profile  
 
 Post subject: Re: XMA
PostPosted: 12 Jul 2009 22:22 

Joined: 13 Aug 2007 21:44
Posts: 2845
Location: http://aluigi.org
personally no.
the only thing I verified some months ago (only for curiosity) was that towav uses an official Microsoft library which looks very similar to wmapro.
that's all I know about this thing.


Top
 Profile  
 
 Post subject: Re: XMA
PostPosted: 16 Jul 2009 11:15 

Joined: 12 Jul 2009 17:07
Posts: 4
Ok, thanks!


Top
 Profile  
 
 Post subject: Re: XMA
PostPosted: 19 Jul 2009 17:10 

Joined: 19 Jul 2009 17:06
Posts: 4
Hey Fred, How did you decrypt the .xen format? How did you uncover the algorithm behind that?

nvm, i found the key. Is the .xma file in the .fsb encrypted somehow?


Top
 Profile  
 
 Post subject: Re: XMA
PostPosted: 24 Jul 2009 08:33 

Joined: 12 Jul 2009 17:07
Posts: 4
No, the XMA files are not encrypted, they're (headerless) multichannel XMA files, so they need to be decoded as such. As you can read here, the data is interleaved:
https://devel.nuclex.org/external/svn/d ... xma2defs.h

Quote:
// MULTICHANNEL AUDIO: the XMA decoder can only decode raw XMA data into either
// mono or stereo PCM data. In order to encode a 6-channel file (say), the file
// must be deinterleaved into 3 stereo streams that are encoded independently,
// producing 3 encoded XMA data streams. Then the packets in these 3 streams
// are interleaved to produce a single XMA2 file, and some information is added
// to the file so that the original 6-channel audio can be reconstructed at
// decode time. This works using the concept of an XMA stream (see above).
//
// The frames for all the streams in an XMA file are interleaved in an arbitrary
// order. To locate a frame that belongs to a given stream in a given XMA block,
// you must examine the first few packets in the block. Here (and only here) the
// packets are guaranteed to be presented in stream order, so that all frames
// beginning in packet 0 belong to stream 0 (the first stereo pair), etc.
//
// (This means that when decoding multi-stream XMA files, only entire XMA blocks
// should be submitted to the decoder; otherwise it cannot know which frames
// belong to which stream.)
//
// Once you have one frame that belongs to a given stream, you can find the next
// one by looking at the frame's 'NextFrameOffsetBits' value (which is stored in
// its first 15 bits; see XMAFRAME below). The GetXmaFrameBitPosition function
// uses this technique.


ToWAV apparently doesn't work with multichannel files but if you stick a regular XMA header to it ( http://www.mediafire.com/?gitfmumgotj ), you can pass it through ToWAV ( http://www.ctpax-x.ru/index.php?goto=fi ... 24&lang=en ) and you'll actually hear some frames of the interleaved audio.


Top
 Profile  
 
 Post subject: Re: XMA
PostPosted: 26 Jul 2009 07:19 

Joined: 19 Jul 2009 17:06
Posts: 4
The multi channel mp3 files in ghwt pc are sequentially interleaved. Kindof sucks that the xma streams aren't.

Is each frame supposed to have a 15 bit value for the size?, like the first 15 bits correspond to the size of the frame. The document also states that the 'nextFrameOffsetBits value is stored in the first 15 bits of the frame (see page 2, like halfway down.) So I don't know which one to believe.


Top
 Profile  
 
 Post subject: Re: XMA
PostPosted: 16 Aug 2009 19:55 

Joined: 16 Aug 2009 19:24
Posts: 19
Location: Austin, TX
I'd taken a look at toWav and came to the same conclusion as aluigi, it seems that a wmapro decoder (codec id 0x162, probably MS's due to the error codes) is set up with decode flags 0x10D6, but I never got much further than that. Here's the relevant disassembly:
http://hcs64.com/files/xma_setup.txt
The wma3dec stuff for ffmpeg doesn't support those flags yet. I wonder if it might be possible to take the header this thing builds and use it in an ordinary wmapro decoder, but I didn't get to trying it.

For those interested in the overall packet layout, I had put together a little XMA stream parser:
http://hcs64.com/files/xma_parse01.zip
All this does is parse to see if it works, though. It doesn't look for other streams, but if there is another stream and you start the decoding after the first packet you should have it.

Sorry for resurrecting this month-old thread, but someone just pointed it out to me today and I thought you folks might be interested to see what little progress I'd made.


Top
 Profile  
 
 Post subject: Re: XMA
PostPosted: 19 Sep 2009 19:03 

Joined: 13 Aug 2007 21:44
Posts: 2845
Location: http://aluigi.org
the libraries for decoding the xma files are contained in the xbox development kit sdk


Top
 Profile  
 
 Post subject: Re: XMA
PostPosted: 28 Sep 2009 02:27 

Joined: 12 Jul 2009 17:07
Posts: 4
aluigi wrote:
the libraries for decoding the xma files are contained in the xbox development kit sdk

Great, but are they documented/usable? I still haven't taken a look at the SDK.


Top
 Profile  
 
 Post subject: Re: XMA
PostPosted: 28 Sep 2009 09:36 

Joined: 13 Aug 2007 21:44
Posts: 2845
Location: http://aluigi.org
there is a small documentation about the XMA* APIs, the only thing missing seems the library but that's all I know


Top
 Profile  
 
 Post subject: Re: XMA
PostPosted: 03 Oct 2009 18:32 

Joined: 13 Sep 2009 17:33
Posts: 6
bnw from the scorehero forums updated his guitar hero tools and it includes xma extract which seperates the multichannel xma's works very good :).


Top
 Profile  
 
 Post subject: Re: XMA
PostPosted: 03 Oct 2009 18:45 

Joined: 13 Aug 2007 21:44
Posts: 2845
Location: http://aluigi.org
uhmmm are you sure you are not talking about mp3extract?
(it's a quick search I did with google so maybe I'm wrong, I don't know that forum or guitar hero or anything else related)


Top
 Profile  
 
 Post subject: Re: XMA
PostPosted: 04 Oct 2009 06:45 

Joined: 19 Jul 2009 17:06
Posts: 4
yeah, xmaextract extracts the streams, but no dice for decoding =(.

I took a look at the white papers in the sdk, but none of them reveal much about the encoding/decoding process.


Top
 Profile  
 
 Post subject: Re: XMA
PostPosted: 21 Oct 2009 19:25 

Joined: 18 Oct 2009 19:42
Posts: 7
bnw33 wrote:
yeah, xmaextract extracts the streams, but no dice for decoding =(.

I took a look at the white papers in the sdk, but none of them reveal much about the encoding/decoding process.


bnw33, Could you please tell me how to run/use your xmaextract. I need to seperate some multichannel xma's.

Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for: