Magnetic Fields Packer pattern format?
Magnetic Fields Packer pattern format?
Hello,
I've been staring for a while at some hex dumps of Jeff Rourke's Crystal Dragon mfp patterns and, well, they're not making much sense to me (especially those 04040404 08080808 06060606 0000000 byte sequences). Has anyone (Asle?) taken some time to properly decode that, or does anyone have these modules (title and ingame) in some other, better known format for comparison?
I've been staring for a while at some hex dumps of Jeff Rourke's Crystal Dragon mfp patterns and, well, they're not making much sense to me (especially those 04040404 08080808 06060606 0000000 byte sequences). Has anyone (Asle?) taken some time to properly decode that, or does anyone have these modules (title and ingame) in some other, better known format for comparison?
Re: Magnetic Fields Packer pattern format?
Ok, I looked at it a bit more and figured out the general structure: number of patterns stored, the same value again (?), and then the offset of track data for each pattern four tracks per pattern. The 04040404 08080808 06060606 0000000 seems to be meaningless filler.
Code: Select all
00000170 00 0D 00 0D 00 10 ................
00000180 00 6C 00 00 00 94 00 EC 01 34 00 00 01 B4 00 EC .l.......4......
00000190 01 34 00 00 01 B4 00 EC 01 34 02 4C 01 B4 00 EC .4.......4.L....
000001A0 01 34 02 4C 01 B4 01 F4 01 34 02 4C 02 AC 01 F4 .4.L.....4.L....
000001B0 01 34 02 4C 02 AC 01 F4 03 3C 02 4C 02 AC 01 F4 .4.L.....<.L....
size = 13
0010 006c 0000 0094
00ec 0134 0000 01b4
00ec 0134 0000 01b4
00ec 0134 024c 01b4
00ec 0134 024c 01b4
Re: Magnetic Fields Packer pattern format?
No, it's not. It's meaningful track unpacking data. But still no idea on how exactly it works.
Code: Select all
01E6 - control data OFFSET 0000
04 04 04 04 08 08 08 08 06 06 06 06
01F2 - note
00 00 00 00 --- -- ---
01F6 - control data OFFSET 0010
04 08 0C 0C 10 14 18 1C 20 24 28 2C 30 30 30 30
1A 1C 1C 1C 1E 1C 1C 1C 20 1C 1C 1C 22 1C 1C 1C
24 1C 1C 1C 26 1C 1C 1C 28 1C 1C 1C 2A 1C 1C 2C
1C 1C 1C 1C
022A - note - 10
02 3A 1C 01 G 1 01 C01 00
00 00 00 00 --- -- --- 04
02 3A 1C 08 G 1 01 C08 08
02 3A 1C 11 G 1 01 C11 0c
02 3A 1C 18 G 1 01 C18 10
02 3A 1C 21 G 1 01 C21 14
02 3A 1C 28 G 1 01 C28 18
02 3A 1C 31 G 1 01 C31 1c
02 3A 1C 37 G 1 01 C37 20
00 00 0D 00 --- -- D00 24
0252 - control data OFFSET 006C
04 08 0C 0C 10 14 14 14 14 14 14 18 14 14 14 14
0E 10 10 10 10 10 10 10 10 10 12 10
026E - note - 3
00 00 0F 0A --- -- F0A
00 00 00 00 --- -- ---
01 7D 1C 20 D 2 01 C20
027A - control data OFFSET 0094
Re: Magnetic Fields Packer pattern format?
Hi,
Never looked at this format since there's a nice replayer.
Tell me if you come up with something.
Sylvain
Never looked at this format since there's a nice replayer.
Tell me if you come up with something.
Sylvain
Sylvain "Asle" Chipaux
Re: Magnetic Fields Packer pattern format?
Just wondering, here, but it looks a bit like Promizer 1.* . There seem to be a "reference table" which says what note data to play, and then describe said note.
so, 04 would mean use, here, the fourth note described after. Well, it looks more like the 4th byte.
Anyway, I'm sure you understand what I mean. Just take those 040404... as pointers on the note list that follows.
hum .. maybe I could do something to convert those. But, it's a two files case, so, it would be outside Prowiz.
Will keep updated if something comes up.
Sylvain
so, 04 would mean use, here, the fourth note described after. Well, it looks more like the 4th byte.
Anyway, I'm sure you understand what I mean. Just take those 040404... as pointers on the note list that follows.
hum .. maybe I could do something to convert those. But, it's a two files case, so, it would be outside Prowiz.
Will keep updated if something comes up.
Sylvain
Sylvain "Asle" Chipaux
Re: Magnetic Fields Packer pattern format?
I too suspect that the numbers in the "control data" are indexes to the events in protracker format located after this table. Most numbers (but not all!) are multiples of 4. The first four may have special meaning, since the values there don't appear elsewhere. There's also no hint on the size of the control data, so I suspect the first value with 0000 or 0001 in the lower four bits signals the start of note data.
This is the data of the first voice of the first pattern of mfp.crystaldragon title:
Compare it to the data of the first voice of the second pattern. There is a similarity in the numbers, but the exact logic isn't clear to me:
Having a M.K. version of this module would help a lot, but I didn't find any converted version.
This is the data of the first voice of the first pattern of mfp.crystaldragon title:
Code: Select all
026E - control data - size 0x24 OFFSET 0010
04 08 0C 10
14 18 1C 20
18 18 20 20
18 18 1C 1C
18 18 1C 20
12 14 14 14
16 14 14 14 14 14
18 14 14 14 14 14
0292 - notes
00 D6 BF 06 C 3 0B F06 14
00 00 00 00 --- -- --- 18
00 D6 B0 00 C 3 0B --- 1C
00 D6 C0 00 C 3 0C --- 20
Code: Select all
0336 - control data - size 0x1c OFFSET 00d8
04 08 0C 04
10 10 14 18
10 10 18 18
10 10 14 14
0E 10 10 10 10 10
12 10 10 10 10 10
0352 - notes
00 D6 B0 00 C 3 0B --- 10
00 00 00 00 --- -- --- 14
00 D6 C0 00 C 3 0C --- 18
Re: Magnetic Fields Packer pattern format?
Maybe it would seem wise to ask for help deciphering the replay:
http://wt.exotica.org.uk/files/sources/ ... Packer.lzx
I'm not good at all reading 68k, but somebody might be able to help.
Anyone ?
http://wt.exotica.org.uk/files/sources/ ... Packer.lzx
I'm not good at all reading 68k, but somebody might be able to help.
Anyone ?
Sylvain "Asle" Chipaux
Re: Magnetic Fields Packer pattern format?
Ok, I think I decoded it. It's a double-indirection system where a table points to another table that points to the note data. I still don't know what are the first four bytes. The following bytes are indexes to the second table. The second table starts when bit 1 is set, and ends when the low four bytes of the next byte are 0000 or 0001. I'm not 100% sure but it makes much more sense now. I'll write some code to convert it to see if it works.
Code: Select all
026E - control data - size 0x24 OFFSET 0010
04 08 0C 10
14 18 1C 20
18 18 20 20
18 18 1C 1C
18 18 1C 20
12 14 14 14 14 ; break, bit 1
16 14 14 14 18
14 14 18 14 1C
14 14 14 14 20
0292 - notes
00 D6 BF 06 C 3 0B F06 12
00 00 00 00 --- -- --- 14
00 D6 B0 00 C 3 0B --- 16
00 D6 C0 00 C 3 0C --- 18
Re: Magnetic Fields Packer pattern format?
Ok, I was wrong, it was not double indirection. It was triple indirection, and the first four bytes are also pointers. Clever system, but not obvious to reverse-engineer. To decode the pattern you can use the following C-like pseudocode:
Code: Select all
for (pattern = 0; pattern < num_patterns; pattern++) {
for (voice = 0; voice < 4; voice++) {
read buffer at pattern_address + pattern_table[pattern][voice];
for (row = k = 0; k < 4; k++) { /* iterate first indirection table */
for (x = 0; x < 4; x++) { /* iterate second indirection table */
for (y = 0; y < 4; y++) { /* iterate third indirection table */
note_event = buffer[buffer[buffer[buffer[k] + x] + y] * 2];
}
}
}
}
}
Re: Magnetic Fields Packer pattern format?
And it worked! Implemented in xmp using the triple indirection pattern decode, code at http://xmp.git.sourceforge.net/git/gitw ... mfp_load.c. I'll write a proper format description to document it.
Re: Magnetic Fields Packer pattern format?
The format description: http://xmp.git.sourceforge.net/git/gitw ... format.txt
Re: Magnetic Fields Packer pattern format?
Congratulations. This looks really impressive.
I get a headache trying to figure it out, but I guess that's the after effects of new year's eve
I'll give it a try once understood. Thanks for sharing !
Sylvain
I get a headache trying to figure it out, but I guess that's the after effects of new year's eve
I'll give it a try once understood. Thanks for sharing !
Sylvain
Sylvain "Asle" Chipaux