Sonic Mega Collection audio patch for Nintendont

Discussion in 'Wii - Hacking' started by SuperrSonic, Jul 15, 2017.

  1. SuperrSonic
    OP

    SuperrSonic GBAtemp Advanced Fan

    Member
    658
    216
    Dec 9, 2011


    Issue starts at 6:15

    As you can see in the video SMC has audio latency and distortion when played in nintendont or devolution.
    Despite being reported for both projects nothing ever came to be. Can't imagine why.

    Patches:

    NTSC-U

    Audio Patch (SS)
    202AA2F9 000005BE
    042AA2F9 00000B7B
    E0000000 00000000

    PAL (60Hz mode only)

    Audio Patch (SS)
    202C8619 000005BE
    042C8619 00000B7B
    E0000000 00000000

    NTSC-J

    Audio Patch (SS)
    202ABD11 000005BE
    042ABD11 00000B7B
    E0000000 00000000

    About the issue:
    Starting any of the games will slowly, gradually cause the audio to lag behind the game, when it gets to around 6 minutes distortion starts to kick in for about 20 seconds, after that it resyncs, but the next time it will distort sooner indefinitely. The workaround until now was to bring up the pause menu and resume before the lag is noticeable, this forces the a/v to sync until you exit and start another game.

    About the patch:
    I always thought it was because of the hw speed difference, but apparently this isn't the case. If you start MIOS without BC, the game plays normally albeit with broken audio and no memory card reading but the audio never lags behind the video.

    Anyway, because of that I started to experiment and since I don't have a usb gecko for doing so, I used Dolphin to dump memory and started the hunt.
    Finding the relevant stuff was surprisingly easy, finding the actual value to fix the issue was a bit long and tedious.
    [​IMG]
    At address 0x2AA2FA is the value that the code changes and acts like a timer, it's volatile, it starts as 0x5BE the moment you start a game, then it changes to 10 different values per frame and loops. What I found is that patching the first value to something else automatically changes the rest, so that's what I did. I increased it and doing that reduced the distortion so I kept at it and now 0xB7B is the farthest I could go before the distortion happens 2 minutes in instead of 6.

    The next value you see in the image is 0x44E8, this is the first value that shows up when you load a game, it's always 0x44E8. It seems to affect audio speed, the fact that it's 0x52B0 in 50Hz mode in the PAL version seems to back this. The next value you see in the image 0x5BE, also volatile, might be related to video, constantly patching it to 0x5BE slows down the video when you call the pause menu and resume, otherwise it just makes the audio lag happen sooner.
    The 0xAC44 value might be the emulated sample rate, changing it doesn't do anything that I could tell.

    Issues worth mentioning:
    While this works well to avoid the latency and distorted audio the patch doesn't actually fix it 100%, the game still performs differently from GC mode in that there's a very faint jump in the audio at 6 minutes. In any case I tested the entirety of Sonic 2 without actually noticing this small "audio skip", so it's not so bad. I tested the NTSC-U version, and only changed the addresses for the other versions but it should still work the same.

    I recommend using my mod of nintendont, because it removes the memory card delay the official version enforces.
     
    MartyDreamy and cvskid like this.
  2. cvskid

    cvskid GBAtemp Addict

    Member
    2,159
    774
    Apr 13, 2014
    United States
    Does using the actual gc disc of sonic mega collection give the same audio issues?
     
  3. SuperrSonic
    OP

    SuperrSonic GBAtemp Advanced Fan

    Member
    658
    216
    Dec 9, 2011
    Disc+nintendont gives the same exact issue.
     
    cvskid likes this.