Isolated version of SMB3 from SMAS

Go down

Isolated version of SMB3 from SMAS Empty Isolated version of SMB3 from SMAS

Post by MemeMaster9000 Sat 11 May 2024 - 0:23

I'm aware of a hack of SMAS that implements MSU-1 support, but this ROM is a bit unique in the fact that it's the version of SMB3 found in standard SMAS... in it's own ROM. Saves and all.

I found it (along with it's disassembly) on GitHub, and trying to rack my brain on how to get it to work with the MSU's been a pain, mainly because the entire disassembly was done automatically with little to no labeling whatsoever Confused

So a hack using the ROM itself would be in order... something I'm not entirely sure how to do myself, so I'm making this request. I'll link the GitHub repository so you may build the ROM on your own, which instructions to do that can be found in the Readme under "Basic Usage".

Have a good day!

EDIT: Something I forgot to mention is that I'm more than willing to make the PCM files myself. It's the only thing that doesn't put my brain in a knot. Laughing
MemeMaster9000
MemeMaster9000
Bee
Bee

Since : 2024-04-27

Back to top Go down

Isolated version of SMB3 from SMAS Empty Re: Isolated version of SMB3 from SMAS

Post by Cubear Sat 11 May 2024 - 12:42

the most future proof method would probably be to convert the msu1 patch to fit into this file before building:

https://github.com/Yoshifanatic1/SMW-SMAS-SMASW-Disassembly/blob/main/SMB3/Custom/Asar_Patches_SMB3.asm

though i'm not entirely certain the method for going about this.
Cubear
Cubear

Isolated version of SMB3 from SMAS Image211

Since : 2021-11-17

https://www.patreon.com/Cubear

Back to top Go down

Isolated version of SMB3 from SMAS Empty Re: Isolated version of SMB3 from SMAS

Post by MemeMaster9000 Sat 11 May 2024 - 13:10

Not a terrible idea.

Assuming most of the code is similar to SMAS, theoretically all I'd need to do is change around some memory addresses.

I think the same approach could be taken for a post-assembly ROM patch.

Only issue is that I'm not entirely sure it would work, and if it would, I don't know where to find said memory addresses.

I'll try and look through the disassembly again later.
MemeMaster9000
MemeMaster9000
Bee
Bee

Since : 2024-04-27

Back to top Go down

Isolated version of SMB3 from SMAS Empty Re: Isolated version of SMB3 from SMAS

Post by Cubear Sat 11 May 2024 - 13:28

it's probably not too difficult to hack the output file as well, the ASM is fairly clearly labeled, and without even opening the game i can sort of tell that $1202 is likely a track number being sent by the game, so a breakpoint on WRAM $1202 in the output rom of this is likely to break at the same location as the patch would in the retail release.
Cubear
Cubear

Isolated version of SMB3 from SMAS Image211

Since : 2021-11-17

https://www.patreon.com/Cubear

Back to top Go down

Isolated version of SMB3 from SMAS Empty Re: Isolated version of SMB3 from SMAS

Post by MemeMaster9000 Sat 11 May 2024 - 14:44

I've tried everything now; the patch for the retail game simply won't work for whatever reason, despite addresses matching with the SMB3 ROM.

I'm not sure how to go about modifying the .asm patch myself, which seems like the only way to get it to work now.

I'll include the (mostly) unmodified pre-existing patch (that I had to fix because ASAR kept complaining about the JMP on line 444, it's now a JMP.w. That's all I changed.)
Code:
;Patch by Conn
; apply on Super Mario Allstars (USA) without header - no Super Mario World!

; header ; remove selicon before "header" if your rom has a header

; $16A0: track number
; $16A2: msu busy flag (01- track to be played, 02 - fade)
; $16A4: volume

lorom

;----------------title screen play tracks

;SMB1 title hook
org $039ec5
JSL SMB1titlehook
NOP

;Lost Levels title hook
org $0D9E4A
JSL LLevelstitlehook
NOP

;-----------------mute menu themes
;mute menu
org $009c2f
JSL mutemenu1
NOP

org $008A00
JSL mutemenu2
NOP
NOP

org $009cc4
JSL mutemenu3
NOP

org $008AEB
JSL mutemenu4
NOP
NOP

org $008Ab7
JSL menuresume

;----------------------PLAY TRACKS

;menu hook
org $0087CC
JML menu
NOP

;SMB1 and Lost Levels
org $0481AB
JML SMB1
NOP

;SMB2
org $11962C
JML SMB2
NOP

;SMB3
org $22E6Bf
JML SMB3
NOP

;smb3BuzzFix
org $20B235
JML buzzFix


org $1fecf0
menu:
LDA $0062
BEQ endMenu     ; no track change
LDA $2002
CMP #$53
BEQ $07
LDA $0062 ; no msu -> play spc
JML $0087D1  
LDA $0062
cmp #$80
BEQ fadeMenu
STZ $2006
CLC
ADC #$80   ;add new pcm index
STA $2004
STA $16A0 ; store track number
STZ $2005
LDA #$01
STA $16A2  ; store track change to msu busy
BRA $05
fadeMenu:
LDA #$02
STA $16A2  ;store fade to msu busy
STZ $0062
endMenu:
lda $16A2      ; is a track about to play?
BEQ $03
JSR checkMSU
LDA $0062
JML $008821

SMB1:
LDA $1602
BEQ endSMB1     ; no track change
LDA $2002
CMP #$53
BEQ $07
LDA $1602 ; no msu -> play spc
JML $0481B0  
LDA $1602
cmp #$80
BEQ fadeSMB1
CMP #$F0
BEQ stopSMB1
CMP #$F1
BEQ fadehalfSMB1
CMP #$F2
BEQ fadefullSMB1
CMP #$F3
BEQ fadeSMB1
STZ $2006
STA $2004
STA $16A0 ; store track number
STZ $2005
LDA #$01
STA $16A2  ; store track change to msu busy
BRA nofadeSMB1
fadeSMB1:
LDA #$02
STA $16A2  ;store fade to msu busy
bra nofadeSMB1
fadehalfSMB1:
LDA #$03
STA $16A2  ;store fade to msu busy
bra nofadeSMB1
fadefullSMB1:
LDA #$04
STA $16A2  ;store fade to msu busy
bra nofadeSMB1
stopSMB1:
STZ $2006
STZ $2007
nofadeSMB1:
STZ $1602
endSMB1:
lda $16A2      ; is a track about to play?
BEQ $03
JSR checkMSU
LDA $1602
JML $048226

SMB2:
LDA $1DE2
BEQ endSMB2     ; no track change
LDA $2002
CMP #$53
BEQ $07
LDA $1DE2 ; no msu -> play spc
JML $119631  
LDA $1DE2
cmp #$80
BEQ fadeSMB2
CMP #$F0
BEQ stopSMB2
CMP #$F1
BEQ fadehalfSMB2
CMP #$F2
BEQ fadefullSMB2
CMP #$F3
BEQ fadeSMB2
STZ $2006
CLC
ADC #$20   ;add new pcm index
STA $2004
STA $16A0 ; store track number
STZ $2005
LDA #$01
STA $16A2  ; store track change to msu busy
BRA nofadeSMB2
fadeSMB2:
LDA #$02
STA $16A2  ;store fade to msu busy
BRA nofadeSMB2
fadehalfSMB2:
LDA #$03
STA $16A2  ;store fade to msu busy
bra nofadeSMB2
fadefullSMB2:
LDA #$04
STA $16A2  ;store fade to msu busy
bra nofadeSMB2
stopSMB2:
STZ $2006
STZ $2007
nofadeSMB2:
STZ $1DE2
endSMB2:
lda $16A2      ; is a track about to play?
BEQ $03
JSR checkMSU
LDA $1DE2
JML $1196A7


SMB3:
LDA $1202
BNE $03     ; no track change
BRL endSMB3
LDA $2002
CMP #$53
BEQ $07
LDA $1202 ; no msu -> play spc
JML $22E6C4  
LDA $1202
STA $1206
cmp #$80
BEQ fadeSMB3
CMP #$F0
BEQ stopSMB3
CMP #$F1
BEQ fadehalfSMB3
CMP #$F2
BEQ fadefullSMB3
STZ $2006
CMP #$F3
BEQ fadeSMB3
PHA
LDA $1503
cmp #$00
BNE $06
PLA
CLC
ADC #$40   ;add new pcm index for Overworld
BRA $04
PLA
CLC
ADC #$60   ;add new pcm index for Level
cmp #$6e   ; did Bowser die?
BNE no6e
LDA #$01
STA $16A6 ; temporary to flag credits chime shall play
LDA #$6e
no6e:
cmp #$61
BNE no61
LDA $16A6
cmp #$01
BEQ $04
LDA #$61
BRA no61
LDA #$41
STZ $16A6
no61:
STA $2004
STA $16A0 ; store track number
STZ $2005
LDA #$01
STA $16A2  ; store track change to msu busy
BRA nofadeSMB3
fadeSMB3:
LDA #$02
STA $16A2  ;store fade to msu busy
BRA nofadeSMB3
fadehalfSMB3:
LDA #$03
STA $16A2  ;store fade to msu busy
bra nofadeSMB3
fadefullSMB3:
LDA #$04
STA $16A2  ;store fade to msu busy
bra nofadeSMB3
stopSMB3:
STZ $2006
STZ $2007
nofadeSMB3:
STZ $1202
endSMB3:
lda $16A2      ; is a track about to play?
BEQ $03
JSR checkMSU
LDA $1202
JML $22E73A



checkMSU:
cmp #$02
BEQ fade
cmp #$03
BEQ fadehalf
cmp #$04
BEQ fadefull
BIT $2000
BVS endCheck
PHX
LDA $16A0
TAX
LDA $1ff800,x ;load loop value
STA $2007  ; also wenn ein theme endlos looped dann mach hier eine 03 auf 2007
PLX
STZ $16A2
LDA #$FF
STA $2006
STA $16A4
endCheck:
RTS

fade:
LDA $16A4
dec
dec
STA $16A4
STA $2006
cmp #$05
bcc mute
RTS
mute:
STZ $2006
STZ $16A4
STZ $16A2
RTS

fadehalf:
LDA $16A4
dec
dec
dec
STA $16A4
STA $2006
cmp #$60
bcc mutehalf
RTS
mutehalf:
LDA #$60
STA $2006
STA $16A4
STZ $16A2
RTS

fadefull:
LDA $16A4
inc
inc
inc
STA $16A4
STA $2006
cmp #$F8
bcs full
RTS
full:
LDA #$FF
STA $2006
STA $16A4
STZ $16A2
RTS


SMB1titlehook:
LDA $2002
CMP #$53
BEQ $06
LDA #$14
STA $2142
RTL
LDA #$14
STZ $2006
STA $2004
STA $16A0 ; store track number
STZ $2005
LDA #$01
STA $16A2  ; store track change to msu busy
RTL

LLevelstitlehook:
LDA $2002
CMP #$53
BEQ $06
LDA #$15
STA $2142
RTL
LDA #$15
STZ $2006
STA $2004
STA $16A0 ; store track number
STZ $2005
LDA #$01
STA $16A2  ; store track change to msu busy
RTL


mutemenu1:
LDA #$11
STA $0060
LDA $2002
CMP #$53
BNE $03
STZ $2007
RTL

mutemenu2:
STZ $2140
STZ $2142
LDA $2002
CMP #$53
BNE $03
STZ $2007
RTL

mutemenu3:
LDA #$80
STA $2100
LDA $2002
CMP #$53
BNE $03
STZ $2007
RTL

mutemenu4:
STZ $420C
STZ $2140
LDA $2002
CMP #$53
BNE $03
STZ $2007
RTL

menuresume:
LDA $2002
CMP #$53
BEQ $05
LDA #$12
STA $60
RTL
LDA #$01
STA $62
RTL

buzzFix:
STZ $2006
JMP.w $008139

ORG $1ff800 ; loop table 03:loop, 01 non-loop
db $03,$03,$03,$03,$03,$03,$03,$03,$03,$01,$01,$01,$01,$03,$03,$03 ; themes 00-0f SMB1 and Lost Levels
db $03,$01,$01,$01,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03 ; themes 10-1f SMB1 and Lost Levels
db $03,$03,$03,$03,$03,$03,$03,$03,$03,$01,$01,$01,$01,$03,$03,$01 ; themes 20-2f SMB2
db $01,$01,$01,$01,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03 ; themes 30-3f SMB2
db $03,$03,$03,$03,$03,$03,$03,$01,$03,$03,$03,$03,$03,$03,$03,$03 ; themes 40-4f SMB3 Overworld
db $03,$01,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03 ; themes 50-4f SMB3 Overworld
db $03,$03,$03,$03,$03,$03,$03,$01,$03,$01,$01,$01,$01,$03,$01,$03 ; themes 60-6f SMB3 Level
db $03,$03,$03,$01,$03,$03,$03,$01,$01,$03,$03,$03,$03,$03,$03,$03 ; themes 70-7f SMB3 Level
db $03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03 ; themes 80-8f Menu
MemeMaster9000
MemeMaster9000
Bee
Bee

Since : 2024-04-27

Back to top Go down

Isolated version of SMB3 from SMAS Empty Re: Isolated version of SMB3 from SMAS

Post by Cubear Sat 11 May 2024 - 19:03

it is likely you'll need to convert it in the debugger of an emulator. i might suggest Mesen 2. once again, if you breakpoint WRAM reads on $1202 you are likely to find the hook in the modified rom.

finding the buzzfix looks quite a bit more difficult.
Cubear
Cubear

Isolated version of SMB3 from SMAS Image211

Since : 2021-11-17

https://www.patreon.com/Cubear

Back to top Go down

Isolated version of SMB3 from SMAS Empty Re: Isolated version of SMB3 from SMAS

Post by MemeMaster9000 Sat 11 May 2024 - 19:46

Isolated version of SMB3 from SMAS Screen10

Found this, but I'm not quite sure what I'm looking at.
MemeMaster9000
MemeMaster9000
Bee
Bee

Since : 2024-04-27

Back to top Go down

Isolated version of SMB3 from SMAS Empty Re: Isolated version of SMB3 from SMAS

Post by Cubear Sat 11 May 2024 - 19:49

looks to me like an incoming value, the code there is checking to make sure that ram is not zero.

if the number is not zero, it sends it to 2142 (spc700)

this is likely the play signal.

LDA $1202 (load value from 1202)
beq 02e73a (if 0, branch to this address. this likely skips some code.)

you should see if it gets tripped anywhere else in this rom before a track begins to play, or you could breakpoint the address of the hook in the retail rom ($22E6Bf) and compare it to the modified rom.  but i think you're right on top of the hook used for the SMB3 portion of the all stars hack.
Cubear
Cubear

Isolated version of SMB3 from SMAS Image211

Since : 2021-11-17

https://www.patreon.com/Cubear

Back to top Go down

Isolated version of SMB3 from SMAS Empty Re: Isolated version of SMB3 from SMAS

Post by MemeMaster9000 Sat 11 May 2024 - 20:35

Did some more digging.
Isolated version of SMB3 from SMAS Screen11
This line appears to check if $1202 to 15, the title screen music. If not, branch.

Isolated version of SMB3 from SMAS Screen12

This line does the same, however right before the world map shows up. It checks if $1202 is 02, which if it isn't, branch here:
Isolated version of SMB3 from SMAS Screen13

Am I onto something?
MemeMaster9000
MemeMaster9000
Bee
Bee

Since : 2024-04-27

Back to top Go down

Isolated version of SMB3 from SMAS Empty Re: Isolated version of SMB3 from SMAS

Post by Cubear Sat 11 May 2024 - 22:29

i couldn't tell without more context really. just play around and find out. try changing the value in ram (or in the accumulator) when it breaks, see if a different song plays, etc.

rom hacking is really a lot of "FAFO" but in a good way.
Cubear
Cubear

Isolated version of SMB3 from SMAS Image211

Since : 2021-11-17

https://www.patreon.com/Cubear

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum