vgmrips / vgmplay-legacy

VGM file command-line player and Winamp plugin.
http://vgmrips.net
224 stars 54 forks source link

Phantasy Star II SSG-EG or whatever issue #48

Closed westonlast closed 5 years ago

westonlast commented 5 years ago

The SSG-EG stuff is used heavily in Phantasy Star II, especially at the title screen. This sounds wrong in "in_vgm." At least, I think it does, because I'm not able to find a hardware recording. This is how I think it's supposed to sound:

https://www.youtube.com/watch?v=24JW1lxW-2U (Correct)

This is more like how "in_vgm" sounds:

https://www.youtube.com/watch?v=zi2RuDRTIWI (Incorrect)

Notice the weird oscillations in the second video when the background pad changes? Is this an issue with the imperfection of the VGM logging format, is something wrong with "nuked," or is the second video really how it sounded on hardware?

ValleyBell commented 5 years ago

Here is a video from the "Phantasy Star Collection" CD that was released in 1993. https://www.youtube.com/watch?v=aDYlnt-nGac&t=14m7s

The recording is from real hardware, so it confirms that in_vgm is correct.

westonlast commented 5 years ago

That's the Japanese version, though. Notice the loud percussion. The English version is the one I'm concerned about, which has quiet percussion.

I just checked in Genesis Plus GX with the English Phantasy Star II ROM: This oscillation artifact isn't there, with both the MAME and nuked sound cores.

superctr commented 5 years ago

The Japanese version of Phantasy Star 2 does also not have that effect when played with an emulator. Afaik the drums should be the only difference between the two anyway, I don't think the melodic instruments changed.

superctr commented 5 years ago

Ok, did some checking and it appears to be the SSG-EG indeed. 0xFF is written to the channel 4 SSG-EG register for some reason. Probably this only happens because the game forgets to clear the register when playing the song through the sound test (Ustvestia).

ValleyBell commented 5 years ago

Interesting fact: The VGM rip of the Japanese version doesn't have the bug. (The SSG-EG register 0x190 is initialized with value 0 as it should be.)

The sound driver used by PS2 wasn't built with SSG-EG support in mind and neither songs nor SFX use explicitly it. That it somehow accessed that register is probably a bug caused by some calculation overflow.

EDIT: I had a look at the sound driver disassembly and I'm pretty sure the bug gets triggered by playing any sound effect that uses the FM 5 channel. In that case it will write to the value 0xFF to registers 0x81, 0x86, 0x8B and 0x90. (It was supposed to write to 0x81, 0x85, 0x89, 0x8D.)

westonlast commented 5 years ago

Very interesting, thank you. Do you have a relatively quick and easy way to scan the Phantasy Star II VGMs and always set the SSG-EG to zero?

superctr commented 5 years ago

The easy way would be to unpack the vgz files, open a hex editor and replace '53 90 FF' with '53 90 00' in all files.

westonlast commented 5 years ago

I've updated the Phantasy Star II (English) set: https://mega.nz/#!TcwSxKjb!eEmjs0C422KrhYtxWQwLeDycQhynTTcwFkEfKXWDqh8