PDA

View Full Version : JJ2 Music Restart points (Thread for coders)


Jojo
Mar 8, 2010, 10:26 AM
Hi there,
first for those who don't know me, I happened to play JJ2 years ago (and still play it occasionaly) and since then, I was captivated by its great music. I also happen to be a developer of OpenMPT (ModPlug).
I have listened to many game rips and pre-releases of JJ2 music, but they're all not satisfying. That's one reason why I started coding my own J2B loader for OpenMPT. A few months have passed since I finished it, and it's pretty good, all tracks sound correct in it. However, one thing that's still missing (also in the foo_dumb implementation, if anyone was going to point that out) are the loop (restart) points: f.e. order.j2b does not restart from the beginning, but from order 4 or something like that. But the last pattern does not have a pattern jump command.
So, I have not actively followed the latest JJ2 hacks or whatever you're doing with this nice game, but I heard that the audio system has been exchanged or something, and I wonder if anyone has got their hands on the original code (apparently not) or disassembly to find out where those loop points are stored? The J2B format does not seem to have such a header field, so I guess the loop points are hardcoded into the executable.
Does anybody have any information on this?

Oh, and feel free to move this post if it doesn't fit - I hesitated to post it in the coder forum as it's not really jj2 related.

Greets,
-Jojo

DoubleGJ
Mar 9, 2010, 05:25 AM
I would be hesistant of saying the commands are hardcoded. As you may or may not know, there is an official (albeit quite primitive) program for making custom .j2b's out of other module formats, so this would be very impractical. Although, I'm not sure if any of the custom .j2b's I know loops to a middle pattern...

Jojo
Mar 9, 2010, 06:25 AM
Well, the tracks for JJ2 were all composed in IT and S3M format, which don't have restart points. So I would suppose that the MOD2J2B tool would not have written loop points, either...

Puffie40
Mar 9, 2010, 06:59 AM
In plus (http://www.jazz2online.com/jcf/showthread.php?t=17567) the sound engine was "Augmented" (or redone?) to handle MP3's and today's more "complex" Modules.

order.j2b loops at position 4? That's news to me... It always looped right back to the start for me in-game. Are you sure you are not overlooking position jumps?

Unless you are talking about how the music restarts when you die. That I think is a bug in the sound engine. It seems to always restart the music at position one, and It's noticeable when you are playing a module with "Action" positions like Neve.s3m

Jojo
Mar 9, 2010, 07:02 AM
Puffie40, I'm using JJ2:TSF and I never hear the first pattern of order.j2b again after it has been played one time. That's also the case with some ingame music, but I don't know which tracks are affected right now.

DoubleGJ
Mar 9, 2010, 08:37 AM
Unless you are talking about how the music restarts when you die. That I think is a bug in the sound engine. It seems to always restart the music at position one, and It's noticeable when you are playing a module with "Action" positions like Neve.s3m
I am fairly sure it's intended, just so the music stops when you die and yet it remains "fluent". It is done so-so, though.

Grytolle
Mar 10, 2010, 08:41 AM
The code has been altered so that the internal stop/start/repeat functions aren't called. Instead bass.dll(?) is called accordingly

j2b is still handled by the normal music engine though, unless blur has changed that recently

Jojo
Mar 10, 2010, 08:46 AM
Yeah, it would be strange if j2b would be played by something else than the internal routines, since BASS can't play j2b files anyway! :D

Jojo
Jun 21, 2010, 07:51 AM
I just sent two XMs though mod2j2b, the only difference being the restart point. And the result was the same. So that would imply that there is indeed no restart point setting in the j2b specs. And that implies that the restart points must be hardcoded... :\

blurredd
Jun 21, 2010, 11:42 AM
I'm sure that order.j2b always starts from the beginning, so JJ2 definitely does not using hardcoded restart positions for that track, and I doubt it would for any other track. The track, however, does replay nearly all of the same patterns before starting from the beginning again.

From what I can tell, xm files created with different restart positions create different j2b files through MOD2J2B so there is a chance that the relevant data is stored in the j2b file. JJ2's Galaxy Music System doesn't appear to support restart positions whether for mod tracks or j2b files, so you wouldn't be able to find out through JJ2 if j2b files store restart positions.

Jojo
Jun 21, 2010, 02:01 PM
Hmm, I just checked again, letting OpenMPT run in the background playing order.j2b synced to JJ2... apparently my old recording was incomplete, which lead me to the conlusion that it must be looped. After playing the whole thing, it indeed seems to be returning to order 0!

From what I can tell, xm files created with different restart positions create different j2b files through MOD2J2BWell, I just created identical files (but with different restart points), and they all resulted in the j2b file. But since there seems to be no restart point indeed, that would explain why.