|
||||||
Views:
800,543 |
Sections: Documents
| Utilities
| ROM Hacks
| Games
| Translations
| Homebrew
| Fonts
| Community
Site: Main | Rules/FAQ | Discord | Memberlist | Latest posts | Stats | Ranks | Online users |
12-03-24 04:58 PM |
||||
Guest: Register | Login |
0 users currently in Hacking Discussion | 2 bots |
Main - Hacking Discussion - Super Mario Bros. Fixes (3) |
SMB2J-2Q |
| ||
Red Goomba Level: 9 Posts: 3/39 EXP: 2490 Next: 672 Since: 08-21-24 From: Oak Grove, OR Last post: 2 days Last view: 7 hours |
Continuing from where we left off in the old RHDN website, I present to you a thread that documents all the various code changes for SMB, SMB2J (or SMBLL) and ANNSMB.
Here's the old thread at RHDN that inspired this one here. https://www.romhacking.net/forum/index.php?topic=32473.0 And here are the two threads that inspired my original RHDN thread in the first place: https://forums.nesdev.org/viewtopic.php?t=11576&hilit=sram+mario (ShaneM's bugfixed SMB1 and SMB2J) https://tcrf.net/Super_Mario_Bros. (SMB entry at The Cutting Room Floor) In Super Mario All-Stars (SMAS) for the SNES, in the AreaPointer code there appears to be another new chunk of code related to blocking out invalid worlds.
~Ben (SMB2J-2Q) |
ShaneM |
| ||
Micro-Goomba Level: 6 Posts: 1/19 EXP: 847 Next: 60 Since: 08-21-24 Last post: 36 days Last view: 36 days |
Cool find, SMB2J-2Q!
Is that limited to SMB1 or The Lost Levels as well? I know the FDS SMB2J has a check for that under "CheckInvalidWorldNum:". On that version, it cannot be done after "FindAreaPointer:" because sm2data4.asm is loaded over that old code be it identical. |
SMB2J-2Q |
| ||
Red Goomba Level: 9 Posts: 4/39 EXP: 2490 Next: 672 Since: 08-21-24 From: Oak Grove, OR Last post: 2 days Last view: 7 hours |
Posted by ShaneM Hi Shane, Yes, this new code is in the SMAS remake of SMB2J (SMBLL) as well: https://github.com/Maseya/SMAS-Disassembly/blob/master/Assembly/SMB2J/code/b0E/_b0E.asm The area data code is also saved to the alternate AreaType address that stores the current BG palette and music ($BA). It is true about the separate data banks for the FDS original (and ANNSMB), so for SMAS the world number check has been revised to include up to World D. In addition, under 'GetAreaType' for SMBLL a check to see if the player is in world 8-4 or not has been added. Perhaps this last chunk of code might be why the music in World 8-4 doesn't reset during scene changes whenever the player enters a pipe?
~Ben |
Rexius55 |
| ||
Tektite Level: 11 Posts: 42/58 EXP: 4665 Next: 1320 Since: 08-14-24 From: Outset Island, The Great Sea Last post: 78 days Last view: 53 days |
Interesting look into the code, my apologies for thinkin' you were newer to the community. ____________________ I do requests (reverse-engineering, programming, music, spritework, writing, etc.). I'm always learnin'.
Status: Hands are full. I post wherever is on my Linktree. If you see my stuff anywhere else, it wasn't me. |
SMB2J-2Q |
| ||
Red Goomba Level: 9 Posts: 7/39 EXP: 2490 Next: 672 Since: 08-21-24 From: Oak Grove, OR Last post: 2 days Last view: 7 hours |
I wonder if the code change under 'NoDemote' in both SMB2J (SMBLL) and ANNSMB, which adds new checks for either power-up objects or Goombas (again), was meant to fix the "Koopa Troopa Factory" glitch in the first SMB that involved turning Goombas and Spinys into Koopa shells (either green or red) when hit by bricks above when the player was small?
~Ben (SMB2J-2Q) |
SMB2J-2Q |
| ||
Red Goomba Level: 9 Posts: 8/39 EXP: 2490 Next: 672 Since: 08-21-24 From: Oak Grove, OR Last post: 2 days Last view: 7 hours |
Hi Shane,
In Super Mario Bros. 3 there is a data table that lists all the sound effects to be played. It is explained in detail here (and explains why the "extended" 1-UP sound exists): I wish that we could do a similar sound effects data table check for SMB, SMB2J and ANNSMB, which would help prevent other sounds in the same three queues from overwriting each other. The reason I wish to come up with this data table like the one in SMB3 is so that I can redirect the old commands to it via a new JSR, instead of having to load for each specific routine the relevant queue first to check it for other sounds before loading the sound in question. The table in question looked like this:
~Ben |
SMB2J-2Q |
| |||||
Red Goomba Level: 9 Posts: 9/39 EXP: 2490 Next: 672 Since: 08-21-24 From: Oak Grove, OR Last post: 2 days Last view: 7 hours |
In SMB2J (SMBLL) there is a penalty for those who like to warp: do not allow world 9 to be activated unless the player completes all 8 worlds first.
In SMB 1 beating World 8 the first time around turns on the hard mode and world selection flags whether the player used warps or not; for those of you who wish to prevent speedrunners from gaining the hard mode too early, here is what you'd do:
~Ben (SMB2J-2Q) |
SMB2J-2Q |
| ||
Red Goomba Level: 9 Posts: 10/39 EXP: 2490 Next: 672 Since: 08-21-24 From: Oak Grove, OR Last post: 2 days Last view: 7 hours |
Posted by ShaneM Hi Shane, Time for a new hack question. In Super Mario All-Stars, in the x-4 levels, the Podoboo moves up higher than in the NES original but only up to the bottom edge of the status bar. May I ask you what I'd do to fix this, so that the Podoboo goes up high but only to the status bar's bottom edge? So far, I remember you re-coded this:
I also wanted to share this from SMAS:
UPDATE: SUCCESS! The Podoboos now rise up to the edge of the status bar before going back down, with the original unaltered attributes for MovePodoboo. In the NES SMB, both the Podoboo's Y position and high Y position were checked first and both set to $02 before the enemy interval timer was set to $01 via the LSR. But in SMAS this was changed so the Podoboo's Y position was explicitly checked first, now set to $d0 (208th pixel) before the high Y position and enemy interval timer were set, now both set to $01. Here's a screenshot of the result of this fix: ~Ben |
MegaFucker man |
|
ShaneM |
| ||
Micro-Goomba Level: 6 Posts: 2/19 EXP: 847 Next: 60 Since: 08-21-24 Last post: 36 days Last view: 36 days |
Posted by SMB2J-2Q Actually, that isn't true. SM2DATA3 does a check in the subroutine "BackToNormal" on which it is commented:
But that comment also isn't completely true. Whenever you complete a castle, one of the 8 bits in "CompletedWorlds" ($07FA) is set. (To make this comment correct just remove the word "backwards" from the cmp #$ff line of doppleganger's disassembly though that isn't really important.) This bit is determined in "SetupVictoryMode" subroutine in SM2MAIN:
The bits in the WorldBits table start with #%00000001 for world 1 and multiplies for each world in table values. So world 8 would set #%10000000. It is ORA'd to save the previous bits hence how "CompletedWorlds" would be #$FF if you complete all 8 worlds. But, the set bits remain set even after taking a warpzone. I'll put it in layman's terms for you: Say you complete worlds 1 and 2, at the start of world 3 "CompletedWorlds" would have bits #%00000011 set. Let's say you take the negative warp zone on 3-1 back to 1-1, those bits aren't reset. Now, let's say after taking the negative warp you take the warp on 1-2 back to world 3. Well, the bits remain set. So you would still get to world 9 while taking these warps because you completed the first two castles (assuming you complete castles 3-8). The same could be said if you complete up to the start of world 8 (#%01111111 set) and on 8-1 take the negative warp zone back to 5-1 and then on 5-2 warp ahead back to 8-1. Well, after completing 8-4 $07FA would still be set to #$FF, hence even taking a possible 4 warp zones (2 regular and 2 negative) you would still end up on world 9. Does that make sense? |
SMB2J-2Q |
| |||
Red Goomba Level: 9 Posts: 11/39 EXP: 2490 Next: 672 Since: 08-21-24 From: Oak Grove, OR Last post: 2 days Last view: 7 hours |
Posted by ShaneMPosted by SMB2J-2Q Hi Shane, I understand and thank you for the heads-up on these! BTW, I hope you enjoyed my latest SMAS discovery about the Podoboo. I also found this in SMAS:
Under SetStPos, after the player's sprite attributes are set up, X is then cleared and a JSR to BoundingBoxCore is performed. I wonder what this was supposed to do in SMAS? ~Ben |
SMB2J-2Q |
| ||
Red Goomba Level: 9 Posts: 12/39 EXP: 2490 Next: 672 Since: 08-21-24 From: Oak Grove, OR Last post: 2 days Last view: 7 hours |
Hi Shane,
Would you happen to know about why, under ClearVRLoop, SMAS removes the JSR to GetAreaMusic but also saves #$FF to the VRAM buffer?
And here's the SMAS version of the same code for reference:
~Ben (SMB2J-2Q) |
ShaneM |
| ||
Micro-Goomba Level: 6 Posts: 3/19 EXP: 847 Next: 60 Since: 08-21-24 Last post: 36 days Last view: 36 days |
Posted by SMB2J-2Q X is used as the offset for the player object, it is not "cleared" as in clearing a flag or bit but used as the offset for the player. I'll comment it more clearly for you:
This isn't a bugfix that needs to be ported to the NES/FDS. The display intermediate screen (lives screen) on the SNES SMB1 and TLL is set up differently, with a picture of the current level being displayed before the level starts. The player's bound box is set during this sequence on SNES but not NES/FDS because the routine isn't called during display intermediate on there. I NOP'd it on the SNES to see what would happen and it makes no difference. Perhaps this is quite possibly residual code as it may have been meant to be animated at one point including the player in the level intro picture. So not a bugfix or anything like that. -ShaneM EDIT: Also, the code you posted about castle timer awards has already been in my builds for the past year or so. You're mentioning really old code. I'd prefer you not guessing my code if you don't understand exactly what I did because it's creating false labels or comments to a disassembly that is private. Thanks. |
SMB2J-2Q |
| ||
Red Goomba Level: 9 Posts: 13/39 EXP: 2490 Next: 672 Since: 08-21-24 From: Oak Grove, OR Last post: 2 days Last view: 7 hours |
Posted by ShaneMPosted by SMB2J-2Q Shane, Thank you for the update; I will discard that then. This also makes me wonder what other residual code bits there are in the SMAS versions of SMB and SMBLL that can be safely removed w/o messing up the game (and I mean besides those code chunks we already know about in the respective NES and FDS originals)? For example, the continue world code from the NES original of SMB could be removed because the world save/continue feature is different in SMAS. I also edited my last post to remove the code in question you refer to in your last paragraph, and replaced it with something else to have you check out. ~Ben |
SMB2J-2Q |
| ||
Red Goomba Level: 9 Posts: 14/39 EXP: 2490 Next: 672 Since: 08-21-24 From: Oak Grove, OR Last post: 2 days Last view: 7 hours |
Hi Shane,
I remember having played SMAS and, at one time, in either SMB or SMBLL I remember defeating Bowser in one of the x-4 levels and the victory music strangely did not play (it was silent the whole time Mario walked over to Toad, until the timer counted down). The question is: what may cause the victory music to glitch out and not cue properly when you destroy Bowser? ~Ben (SMB2J-2Q) |
SMB2J-2Q |
| |||
Red Goomba Level: 9 Posts: 15/39 EXP: 2490 Next: 672 Since: 08-21-24 From: Oak Grove, OR Last post: 2 days Last view: 7 hours |
In SMAS, I also found another new flag for the AutoControlPlayer routine, which is at RAM 7E:0B7A. I wonder what it was supposed to have done, please?
This new flag is also checked in the ChkStart routine:
The routine just above it, PauseRoutine, is also modified to disallow pausing during the victory mode. What makes me curious is that there are two different RTS branches here. The first one, which occurs if the player has defeated Bowser, branches to the end of the main pause routine, but all the subsequent RTS branches point to the end of the start button check routine.
~Ben (SMB2J-2Q) |
ShaneM |
| ||
Micro-Goomba Level: 6 Posts: 5/19 EXP: 847 Next: 60 Since: 08-21-24 Last post: 36 days Last view: 36 days |
@SMB2J-2Q,
In a hex editor, did you try nopping all occurrences of “ AutoCtrlPlyrFlag” on a backup copy? What happened/what changes did you notice when you did? It looks like if the player is being autocontrolled it sets a flag to disable pausing in the check start routine and if you’re manually controlling the player it is cleared. I wouldn’t know exactly for what unless I test it. Edit: If I had to guess that’s what prevents pausing during flagpole slide or castle victory routine. A good way to test it is to NOP it and see if you can pause after touching flagpole, entry to 1-2 or castle victory. Let me know if my guess wasn’t right and I’ll figure it out when I get time if it isn’t. About the RTS thing, Nintendo is known to do branches to not necessarily the closest RTS. It really doesn’t matter which one except farther branching. If I understood what you’re saying correctly. |
SMB2J-2Q |
| ||
Red Goomba Level: 9 Posts: 16/39 EXP: 2490 Next: 672 Since: 08-21-24 From: Oak Grove, OR Last post: 2 days Last view: 7 hours |
Posted by ShaneM Shane, So far (when I NOP'ed the LDA instruction under 'ChkStart'), my test has failed, because it will not let me pause the game at all. ~Ben |
ShaneM |
| ||
Micro-Goomba Level: 6 Posts: 6/19 EXP: 847 Next: 60 Since: 08-21-24 Last post: 36 days Last view: 36 days |
Nop “lda #$01 and sta AutoCtrlPlyrFlag” in AutoControlPlayer and “stz AutoCtrlPlyrFlag” in PlayerControlRoutine and then nop” lda AutoCtrlPlyrFlag bne ExChkStart” in Chkstart. 5 different instructions in total. If not, I’ll get around to it when I can. Thanks. |
SMB2J-2Q |
| ||
Red Goomba Level: 9 Posts: 17/39 EXP: 2490 Next: 672 Since: 08-21-24 From: Oak Grove, OR Last post: 2 days Last view: 7 hours |
Posted by ShaneM Hi Shane, Please forgive me, but I actually got it to behave the old way by also NOP'ing the BNE after it, without having to do the other things you mention. Image 1 - end of level: Image 2 - pipe intro: When I ported the new AutoCtrlPlyrFlag to the NES, it does replicate what happens in SMAS by disallowing pause, except for when the player comes OUT of a pipe. I wonder what SMAS did to disallow pause while the player comes OUT of a pipe? This was the code added in to play the pipe sound coming out:
In SMAS, there is another new address $0E4E, but again since the disassembly I am using doesn't give labels to any of these RAM addresses yet, this is why I have difficulty pinpointing exactly what they do. ~Ben |
Main - Hacking Discussion - Super Mario Bros. Fixes (3) |
Acmlmboard v2.5.6+neo (2024-08-13) © 2005-2024 Acmlm, Emuz, NinCollin, et al. |
MySQL - queries: 122, rows: 492/500, time: 0.120 seconds. |