Pause sound effect in SMB2J ending

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Pause sound effect in SMB2J ending
by on (#138574)
(In reply to this post by ShaneM)

You are correct, The pause SFX is available, but the music is frozen/corrupt. Something like this happened when I tried to do a revamp of SMB2j's ending music to work in SMB1 (NES version) in case I wanted to work on it, so the only one I used to fix this is a comparsion-and-reconstruction of it using Beneficii's old disassembly as the base for the alternate music engine

It's a (dis)assembly error, I think, and I know it's not your fault.

EDIT: Check the Victory Music Header loading routines, If they are unmodified, that's where it might've gone wrong, not 100% sure though, maybe it's more than that...

Also there needs to be two more bytes at the end of the VictoryMusEnvData as another fix (the last two were shared as the first two bytes of WaveformHeaderOffsets in the original disk)
Re: SMB1 + SMB2J SRAM Plus (FDS hack)
by on (#138580)
Hamtaro126 wrote:
You are correct, The pause SFX is availible, but the Music is frozen/corrupt, Something like this happened when I tried to do a revamp of SMB2j's ending music to work in SMB1 (NES version) in case I wanted to work on it, so the only one I used to fix this is a comparsion-and-reconstruction of it using Beneficii's old disassembly as the base for the alternate music engine

It's a (dis)assembly error, I think, and I know it's not your fault.

EDIT: Check the Victory Music Header loading routines, If they are unmodified, that's where it might've gone wrong, not 100% sure though, maybe it's more than that...

Also there needs to be two more bytes at the end of the VictoryMusEnvData as another fix (the last two were shared as the first two bytes of WaveformHeaderOffsets in the original disk)


Nintendo intentionally coded it to mute pause sfx. Look at this in sm2data3.asm

Code:
AlternateSoundEngine:
    lda GamePauseStatus     ;check to see if game is paused
    beq RunAltSoundRoutines ;branch to play sfx and music if not
    lda #$80
    sta FDSSND_VOLUMECTRL   ;otherwise, silence everything
    lsr
    sta SND_MASTERCTRL_REG
    rts


doppleganger's source does indeed assemble back into SMB2J. That is not the issue.

It intentionally loads an alternate sound routine engine for victory mode and the lda #%10000000 (lda #$80) silences it.
Code:
;sm2main.asm
;music constants
Silence               = %10000000


I just found it unnecessary and made it jump to SoundEngine in sm2main.asm if the Z flag is not set. --ShaneM

EDIT: Just do what I did and paste all the SMB1 levels over loopy's NES SMB2J source, if you want SMB1 with SMB2J features. Or, you can just download my FDS version in where I do that, princess scene included. Anyway, I promised you a free copy of the SMB1 promo if you test it like I want you to in the PM.

EDIT2: I don't understand what you mean about the "VictoryMusEnvData". How do you know two bytes are missing?
Re: SMB1 + SMB2J SRAM Plus (FDS hack)
by on (#138582)
It is the version of the Envelope data used by the Victory music in the game, Right at line 339 in doppelganger's original SMB2j disassembly...

My bad, It is one, not two bytes, Sorry!

Code:
;Quote from Beneficii's disassembly (replaced some terms for consistency):
;
;Note that first byte of WaveformHeaderOffsets is loaded first from VictoryMusEnvData
;should keep that address more or less the same. (retarded, I know)
;you can probably just get away with adding an extra byte to the data
;if it's a problem!

VictoryMusEnvData:
    .db $97, $98, $9a, $9b, $9b, $9a, $9a, $99 ;Nintendo's Code
    .db $99, $98, $98, $97, $97, $96, $96, $95
;Fix: Fixes a minor detail about the Envelope
    .db $02


It is the only minor nitpick worth fixing if needed...
Re: SMB1 + SMB2J SRAM Plus (FDS hack)
by on (#138585)
Hamtaro126 wrote:
It is the version of the Envelope data used by the Victory music in the game, Right at line 339 in doppelganger's original SMB2j disassembly...

My bad, It is one, not two bytes, Sorry!

Code:
;Quote from Beneficii's disassembly (replaced some terms for consistency):
;
;Note that first byte of WaveformHeaderOffsets is loaded first from VictoryMusEnvData
;should keep that address more or less the same. (retarded, I know)
;you can probably just get away with adding an extra byte to the data
;if it's a problem!

VictoryMusEnvData:
    .db $97, $98, $9a, $9b, $9b, $9a, $9a, $99 ;Nintendo's Code
    .db $99, $98, $98, $97, $97, $96, $96, $95
;Fix: Fixes a minor detail about the Envelope
    .db $02


It is the only minor nitpick worth fixing if needed...


Line 339 of what? Which .asm file are you referring to??? If you mean sm2data3.asm then at that line it's got a CMP for something irrelevant; if you mean sm2main.asm then that too is irrelevant. So again, what do you mean?

I have a copy of Beneficii's disassembly but you've basically interpreted his note as a whole which has nothing really to do with what you mean (as far as I can see):

Code:
;note that first byte of PCMDataHeader is loaded first from SquRegisterData
;should keep that address more or less the same (retarded I know)
;you can probably just get away with adding an extra byte to the data
;if it's a problem

;(note that first byte of PDH is the last byte of SquRegisterData)


It's saying that if you edit the "SquRegisterData:" to add the $95 back at the end since the first byte of PDH makes use of it. So add a $95 at the end if you edit the music data.

Code:
SquRegisterData:
   .byte $97, $98, $9a, $9b, $9b, $9a, $9a, $99, $99, $98, $98, $97
   .byte $97, $96, $96, $95 ;ShaneM note, last byte made use of by PDH


So again, why did you choose to add a $02 after "VictoryMusEnvData:" ("SquRegisterData:") and why a $02? Why are you using an unlabeled copy of SMB2J source when you have access to doppleganger's fully labeled SMB2J source???
Re: SMB1 + SMB2J SRAM Plus (FDS hack)
by on (#138655)
I guess it was my choice, I only used the music part of beneficii's disassembly even before Doppelganger's version!

Explanation: $02 was the byte that was shared in between those data segments according to the listings of the original SMB2j disassembly build, even if Doppel did not mention it being shared!

Leaving it as-is would be OK, I guess...

EDIT: What I mean is it's in Doppel's original version of the SM2DATA3 portion of the SMB2j disassembly, Where the ending coding resided, so yeah...