squid-man / MegaMan2Randomizer2

Mega Man 2 Randomizer
8 stars 4 forks source link

Fix mm2ft crash on C2 tracks with non-max priority #167

Closed TheRealQuantam closed 5 months ago

TheRealQuantam commented 5 months ago

Fix the bug where C2 tracks with priority < 0xf cause mm2ft to crash.

This is caused by the order of operations in mm2ft when playing a C2 track:

  1. Switch to the bank the C2 track is in, and store that as the current C2 bank
  2. Call Mm2PlaySound
  3. Mm2PlaySound checks the track priority and if >= the currently playing track plays it

This works fine for most C2 tracks, which use the priority 0xf (C1 tracks use the priority system, but it's rare in C2), but Duck Tales and 1 MM hack music use other priorities. There is no trivial way to make mm2ft detect whether Mm2PlaySound started the track or not, but MM2R can trivially force the priority of all tracks to 0xf.