Gyuszi999 wrote:
Ok, thank you for your help, but I have a final question...
For now, I understand the procedure: -finding out block size, data offsets
-parsing
-rebuild header (with the one you said)
-decode with Towav
The file I've sent is decoded now,it works, I think.
But when I try to decode the next file...
First, I'm trying to find out the first offset: I open file with HEX editor, and I search "data"; the address after the closing "00" byte should be the first offset, but the parser doesn't work with that offset (maybe the block size is fidderent??)
So, please tell me the algorythm of finding out these numbers
I've read all the things you wrote, but it's still not clear for me :S
Thank you for your answer, and sorry for being such slow xD
I think these questions are important enough to be posted here!
Regarding the offset: the data starts four bytes after 'data' (which contain the size of the encoded stream)
Regarding the block size and the other offsets (anyone please correct me if I'm wrong here and I'll change the post): Well, first you'll have to find out which type of XMA file it is. To simplify the procedure, you may delete the header and save the file under another name. The end of each block normally consists of placeholders (FF bytes), the next block starts at an even offset (0x__0). The block size is the difference of the start of the succeeding and the current block. That's also the offset plus for the parser command.
For example:
data starts at 0x600 = start of first block
second block starts at 0xE00 => first block has size 0x800
third block starts at 0x1E00 => second block has size 0x1000
fourth block starts at 0x2E00 => third block has size 0x1000
fifth block starts at 0x3600 => fourth block has size 0x800 = size of first block
Now if the cycle repeats here (i.e. the following block sizes are again 0x1000, 0x1000, 0x800 and so on) the block size is the size of one complete cycle: 0x800 + 0x1000 + 0x1000 = 0x2800 (you may also consider to read this post:
post8740.html#p8740. It's a bit technical but shows a simple algorithm which you can use in parts for a manual analysis). If you don't know how many channels the stream has, check out the next block (fifth). In the above example it could have a length of 0x800, so the cycle would be 800:1000:1000:800 and thus the block size would be 3000. Correct me if I' wrong: If the chunk size is always 800, the block size is 8000 (for the command line: leave out the "-b" option).
Parsing the example from above would mean the following commands for 6 channels:
xma_test example.xma -o 600 -b 2800 -r example_ch1.xma
xma_test example.xma -o E00 -b 2800 -r example_ch2.xma
xma_test example.xma -o 1E00 -b 2800 -r example_ch3.xma
or for 8 channels
xma_test example.xma -o 600 -b 3000 -r example_ch1.xma
xma_test example.xma -o E00 -b 3000 -r example_ch2.xma
xma_test example.xma -o 1E00 -b 3000 -r example_ch3.xma
xma_test example.xma -o 2E00 -b 3000 -r example_ch3.xma
respectively. Hope I could help. =)