snes9xgit / snes9x

Snes9x - Portable Super Nintendo Entertainment System (TM) emulator
http://www.snes9x.com
Other
2.67k stars 461 forks source link

MSU-1 support does not seem to support "Resume" functionality. #249

Closed Dizzy611 closed 7 years ago

Dizzy611 commented 7 years ago

Higan v097+, bsnes-plus v073+3, and SD2SNES all support the ability to pause a track and resume it later on the MSU-1. The FF6 hack, Dancing Mad, requires this in order to not restart area songs constantly. From my testing of said hack using the windows build of snes9x with msu support obtained from the rhdn thread, snes9x does not seem to support this feature. If I'm wrong, then it's not properly claiming to support it (involves the revision number, which should claim to be "2")

Not complaining, just wanted to bring this to your attention as I wasn't able to find it as an open issue.

The following external issue is linked for reference with my first discovery thereof. Feel free to remove if you think it inappropriate. https://github.com/Insidious611/DancingMadFF6/issues/27

qwertymodo commented 7 years ago

It definitely supports it. I'd have to see your code to know exactly what's going on. Does your code work properly on higan/bsnes+/SD2SNES? Also, try re-downloading it now, you might have downloaded an out-of-date version:

https://dl.qwertymodo.com/snes9x.zip

and there were a few bugs early on:

https://github.com/snes9xgit/snes9x/commit/07ce784c1b13e1fd6935e50169671b8c21249f21 https://github.com/snes9xgit/snes9x/commit/781124189c55a4d36c9f02d09844c7cff6377000

Dizzy611 commented 7 years ago

It does work properly on higan and bsnes+. I'm told it works properly on SD2SNES, but because I can't afford one I can't confirm that firsthand. I'll try re-downloading from that link to confirm the issue.

Dizzy611 commented 7 years ago

The issue is still present in the linked binary.

For reference, here is the code in DancingMadFF6 that is supposed to trigger the resume support:

(From line 383+ in the following file: https://github.com/Insidious611/DancingMadFF6/blob/master/patch/ff3msu.asm)

BattleTheme:
    lda MSUStatus   ; Are we on Revision 2 or greater? If so, we have Resume support. Handle this specially.
    and #%00000111
    cmp #$02
    bcs ResumeSupportBT
    jml SpecialHandlingBack ; If not, do our normal stuff.
ResumeSupportBT:
    lda #MSUControl_Pause ; Pause the current track.
    sta MSUControl
    jml SpecialHandlingBack

Constants used: MSUStatus = $2000 MSUControl = $2007 MSUControl_Pause = %00000100

qwertymodo commented 7 years ago

Wow... it looks like I never actually initialize the version number in the status register. Do me a favor and try commenting out the version check there, just as a test. I'll bet it will work. I'll try to get a fix pushed on our end.

Dizzy611 commented 7 years ago

Confirmed, resume support for Dancing Mad is now working with the following modified code:

BattleTheme:
    ; lda MSUStatus   ; Are we on Revision 2 or greater? If so, we have Resume support. Handle this specially.
    ; and #%00000111
    ; cmp #$02
    ; bcs ResumeSupportBT
    jmp ResumeSupportBT ; temporary test for snes9x support.
    jml SpecialHandlingBack ; If not, do our normal stuff.
ResumeSupportBT:
    lda #MSUControl_Pause ; Pause the current track.
    sta MSUControl
    jml SpecialHandlingBack
qwertymodo commented 7 years ago

Ok, I'll get that fixed.

qwertymodo commented 7 years ago

New version posted at the same URL. Give that a try and if it works I'll go ahead and push the change.

Dizzy611 commented 7 years ago

Yep. It now works with my original code.

qwertymodo commented 7 years ago

Fixed in fc224c0df751e935ac5161e13b5f9be603953de7