View Issue Details

IDProjectCategoryView StatusLast Update
0000359OpenMPTPlayback Compatibilitypublic2013-03-13 18:49
Reporterramiel Assigned To 
PrioritylowSeveritymajorReproducibilityalways
Status closedResolutionno change required 
Platformx86OSWindowsOS VersionXP
Summary0000359: [XM] Dxx saves xx in a wrong way if xx > $09
Description

I noticed that Dxx saves xx (in the actual file) wrong if > $09
It seems to make it hexadecimal twice in a row

e.g.
It saves D0F as $0D $15 (instead of $0F or decimal 15)
It saves D10 as $0D $16 (instead of $10 or decimal 16)

This can be tested by looking at the XM data in a hex editor, or opening the XM in Fast Tracker 2.

Steps To Reproduce

Create an XM file.
Write D10 as effect somewhere.
Look at the $16 in a hex editor or at the D16 in Fast Tracker 2.

Additional Information

This does not seem to apply to any other command.

Also, Dxx still works fine within MPT itself. It's only saved wrong.

TagsNo tags attached.
Has the bug occurred in previous versions?I'm actually using MPT 1.16.0203 but I asked a friend and he reproduced it in 1.18.03.00
Tested code revision (in case you know it)

Activities

ramiel

ramiel

2013-03-13 02:41

reporter   ~0001126

Sorry, I got some details wrong the first time around.

Saga Musix

Saga Musix

2013-03-13 12:17

administrator   ~0001127

Next time, please don't just look at bits and bytes, but also verify that the resulting playback is actually correct - because it is.
OpenMPT always displays pattern breaks in hexadecimal, but in some formats and trackers (like ScreamTracker S3M and FastTracker XM), they are stored and displayed in decimal format. OpenMPT converts between the displayed and internal formats. So D10 in OpenMPT jumps to row $10, and it saves it correctly - if you don't believe me, play your file in FastTracker and you will notice that it will jump to row 16 decimal, as intended.

ramiel

ramiel

2013-03-13 18:37

reporter   ~0001128

Yes but I just tested it again in FT2, it has a weird behaviour.
In FT2, D10 really jumps to row decimal 10 (or $0A), but D0F indeed jumps to row decimal 15 ($0F). Once saved, in the file there is $10 for the first case and $0F for the second. But see, in FT2, D15 jumps to row decimal 15 too, and it's saved as $15 (or decimal 22). In FT2, D15 and D0F jump to the same row.

Since I am writing an XM replaying code for a particular system I wonder how I should emulate that behaviour.

Saga Musix

Saga Musix

2013-03-13 18:44

administrator   ~0001129

That's because the calculation is as follows:

real_row = ((pattern_param >> 4) * 10) + (pattern_param & 0x0F);

As you can see, there are two several values that can be used to jump to row 15 (decimal): $15 ($1 10 + $5) and $0F ($0 10 + $F). Yes it is weird, but it really shouldn't be a problem to implement...

But again, that's not a problem in OpenMPT. OpenMPT stores the value as defined by FT2 in the file, and it will accept both possible encodings when importing XM files.

ramiel

ramiel

2013-03-13 18:47

reporter   ~0001130

Thank you very much, and sorry if I (re)opened this. I just tested that both D0F and D15 (as seen in FT2) appear as D0F in MPT, so I'll just implement it like you do.

Saga Musix

Saga Musix

2013-03-13 18:49

administrator   ~0001131

Alright. Good luck with your further implementations. Doing things exactly like FT2 is horribly painful. ;)

Issue History

Date Modified Username Field Change
2013-03-13 02:36 ramiel New Issue
2013-03-13 02:40 ramiel Description Updated
2013-03-13 02:40 ramiel Additional Information Updated
2013-03-13 02:41 ramiel Note Added: 0001126
2013-03-13 02:41 ramiel Summary Dxx saves xx in a wrong way if xx > $0F => Dxx saves xx in a wrong way if xx > $09
2013-03-13 02:43 ramiel Summary Dxx saves xx in a wrong way if xx > $09 => [XM] Dxx saves xx in a wrong way if xx > $09
2013-03-13 12:17 Saga Musix Note Added: 0001127
2013-03-13 12:17 Saga Musix Status new => closed
2013-03-13 12:17 Saga Musix Resolution open => no change required
2013-03-13 18:37 ramiel Note Added: 0001128
2013-03-13 18:37 ramiel Status closed => feedback
2013-03-13 18:37 ramiel Resolution no change required => reopened
2013-03-13 18:44 Saga Musix Note Added: 0001129
2013-03-13 18:44 Saga Musix Status feedback => closed
2013-03-13 18:44 Saga Musix Resolution reopened => no change required
2013-03-13 18:47 ramiel Note Added: 0001130
2013-03-13 18:47 ramiel Status closed => feedback
2013-03-13 18:47 ramiel Resolution no change required => reopened
2013-03-13 18:49 Saga Musix Note Added: 0001131
2013-03-13 18:49 Saga Musix Status feedback => closed
2013-03-13 18:49 Saga Musix Resolution reopened => no change required