News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Super Mario Bros. 2 (USA, NES) small bugfix  (Read 3719 times)

Asaki

  • RHDN Patreon Supporter!
  • Full Member
  • *****
  • Posts: 169
    • View Profile
Super Mario Bros. 2 (USA, NES) small bugfix
« on: June 03, 2017, 11:53:34 pm »
I was so excited to find out from TCRF that there was a fix for the missing tile animation frame, that I fixed the POW block while I was at it. Then I found out that the SMB2 Improvement patch already fixed the animation, and more: http://www.romhacking.net/hacks/2600/

Well, it didn't fix the POW block (the letter "O" is misaligned in one frame), so I'm releasing it to whoever wants it. It's not a super important fix, but like the missing animation frames, it's just something that has bugged me since I was a kid.



Also, "just because", I graphically hacked Mario, Luigi, and Peach to have their eyes match how they look in the menu screens. I almost always play as Toad, so I never noticed how weird the whites of their eyes look, especially when they flicker. The "whites" are still being drawn, you just can't see them anymore, so if someone could ASM hack them out entirely (wink wink, nudge nudge), that might cut down on overall screen flicker a tiny bit.

Anyway, feel free to pick this apart and throw it into other hacks. If you just want the POW fix, I believe the two tiles are at 0x027410 and 0x027430. Here's the patch file, v0.99: https://www.mediafire.com/?xs650g7ze9zy1a3

Mix it with the Improvement patch linked above for best results.

Edit: Version 1.0 can be found here: http://www.romhacking.net/hacks/3847/
« Last Edit: February 01, 2018, 08:39:36 am by Asaki »

RadioTails

  • Sr. Member
  • ****
  • Posts: 338
  • Holding the Mega Drive controller
    • View Profile
Re: Super Mario Bros. 2 (USA, NES) small bugfix
« Reply #1 on: June 04, 2017, 12:53:23 pm »
I never noticed that before.  It could be worth mentioning it on The Cutting Room Floor.

I went and fixed it in the Pony Poki Panic hack I'm improving:


These are the values that you might be interested in:
- 01F2F0 = Mario’s Extra Tiles
- 01F2F1 = Peach’s Extra Tiles
- 01F2F2 = Toad’s Extra Tiles
- 01F2F3 = Luigi’s Extra Tiles

These are the values that tell the game which 8 x 16 tiles in Bank 1 to load behind the character sprites.  Toad just uses hex value "FB", which is basically a full transparent 8 x 16 tile.  Simple set Mario's, Luigi's and Peach's hex values to"FB", and the white values will no longer get displayed behind them.
Avatar by LazyNinjartist

FCandChill

  • Hero Member
  • *****
  • Posts: 529
    • View Profile
Re: Super Mario Bros. 2 (USA, NES) small bugfix
« Reply #2 on: June 04, 2017, 04:53:30 pm »
I never noticed that before.  It could be worth mentioning it on The Cutting Room Floor.

If that's TCRF worthy, then the graphical error with Mario's eye in SMB1 is too ... When Mario and Luigi jump, one pixel is absent in the eye which is present in the standing sprite.

Asaki

  • RHDN Patreon Supporter!
  • Full Member
  • *****
  • Posts: 169
    • View Profile
Re: Super Mario Bros. 2 (USA, NES) small bugfix
« Reply #3 on: June 04, 2017, 06:57:42 pm »
Simple set Mario's, Luigi's and Peach's hex values to"FB", and the white values will no longer get displayed behind them.

Loading in a blank tile would still count against the sprite limit, would it not?

FCandChill

  • Hero Member
  • *****
  • Posts: 529
    • View Profile
Re: Super Mario Bros. 2 (USA, NES) small bugfix
« Reply #4 on: June 04, 2017, 09:04:30 pm »
Loading in a blank tile would still count against the sprite limit, would it not?

Yes. Mr. Gimmick uses blank sprites for the intro cutscene so Yumetaro disappears when entering the portal ... just shows that SunSoft knew what it was doing! This is why the cutscene glitches when you disable the sprite limit.

SpiderDave

  • Jr. Member
  • **
  • Posts: 46
    • View Profile
    • spiderdave.com
Re: Super Mario Bros. 2 (USA, NES) small bugfix
« Reply #5 on: June 04, 2017, 10:30:38 pm »
This is awesome, I'm all about the small bugfixes.  I'll add a fix for this in SMB 2 Improvement.  Maybe I can hijack this thread for other small smb2 fixes?

To restore the ellipses on the select screen for lives display (so it's like the pause screen):
(add 0x10 to addresses to account for iNES header)
copy 0x10 bytes at 0x2ef90 to 0x2bf90

Another one I'd like to fix is a lot more complex; When you do a charge jump it resets controller input, so if you're holding something it throws it.  I thought maybe this was by design, but looking at the asm i think it's actually just a side effect of the way they coded it or a bug.
My NES Tool: Davepatcher My SMB2 Hack WIP: Join Lamross in Hell

Asaki

  • RHDN Patreon Supporter!
  • Full Member
  • *****
  • Posts: 169
    • View Profile
Re: Super Mario Bros. 2 (USA, NES) small bugfix
« Reply #6 on: June 05, 2017, 08:03:21 am »
Mr. Gimmick uses blank sprites for the intro cutscene so Yumetaro disappears when entering the portal ... just shows that SunSoft knew what it was doing!

That's awesome, I'm going to have to load it up and pay attention.

I'll add a fix for this in SMB 2 Improvement.

Yes please. I thought about PMing you, but I'm pretty lazy.

*makes lame attempt at joke about tingling Spidey-senses*

Maybe I can hijack this thread for other small smb2 fixes?

I am fine with this.

BTW, why did you make the "PRESS START BUTTON" change?

When you do a charge jump it resets controller input, so if you're holding something it throws it.

I always figured that was intentional, too. Sounds like one of those fun controversial bugfixes where people will complain because it changes gameplay too much =)

Like that weird Lakitu bug in the first game. Well...maybe not that bad.

SpiderDave

  • Jr. Member
  • **
  • Posts: 46
    • View Profile
    • spiderdave.com
Re: Super Mario Bros. 2 (USA, NES) small bugfix
« Reply #7 on: June 05, 2017, 06:13:37 pm »
I changed "Press Start Button" because I feel like it sounds a bit more modern; It's already implied that "start" is a button.  This updates it to the wording on the SMAS versions of the game.  Just to be clear the change is from "PUSH START BUTTON" to "PUSH START" (It never said "PRESS").

You can test that the charge jump clears all controller input--pause the game and unpause, but keep holding start when you unpause.  Then, with start still held down do a charge jump.  It will pause, even though you never let go and re-pressed start.  Lots of games have this input clearing issue; a while back I posed a fix for it in Megaman 1 (which clears input when you collect an energy item, dropping you in a pit if you were in mid-air collecting it).  Mario 1 allows you to manually change input when it should be frozen when you get a mushroom (this allows you to release and re-press jump on a mushroom to do an extra jump off the mushroom).

EDIT: To prevent the tiles for the eyes from being used, use this:

(add 0x10 for header)
0x1f39d: ea ea ea
« Last Edit: June 05, 2017, 09:46:00 pm by SpiderDave »
My NES Tool: Davepatcher My SMB2 Hack WIP: Join Lamross in Hell

Asaki

  • RHDN Patreon Supporter!
  • Full Member
  • *****
  • Posts: 169
    • View Profile
Re: Super Mario Bros. 2 (USA, NES) small bugfix
« Reply #8 on: June 07, 2017, 08:25:18 am »
EDIT: To prevent the tiles for the eyes from being used, use this:

(add 0x10 for header)
0x1f39d: ea ea ea

Awesome, thanks, I'll try it out.

It works! I just checked, and it does cut down the flicker a notch. I'll have to release this proper later.
« Last Edit: June 07, 2017, 08:32:37 am by Asaki »

SpiderDave

  • Jr. Member
  • **
  • Posts: 46
    • View Profile
    • spiderdave.com
Re: Super Mario Bros. 2 (USA, NES) small bugfix
« Reply #9 on: June 07, 2017, 06:19:05 pm »
I fixed the issue where you do a charge jump holding an item, it now only resets left/right/down input.  Here's an updated SMB2 Improvement with that, fixed POW, and ellipsis if anyone wants to grab it or test.  There are sooooooo many more bugs ;).

SMB2 Improvement 2017.07.06 test build.zip

BTW, I don't like losing the white part of the eyes, personally.  I'd like to add the white of the eyes to the select screen and ducking frames (at least for the Princess).
My NES Tool: Davepatcher My SMB2 Hack WIP: Join Lamross in Hell

RadioTails

  • Sr. Member
  • ****
  • Posts: 338
  • Holding the Mega Drive controller
    • View Profile
Re: Super Mario Bros. 2 (USA, NES) small bugfix
« Reply #10 on: June 08, 2017, 03:15:38 am »
If it’s not too trouble, could you explain the code you changed for the charge jump holding (unless it’s really long code, then I’ll forgive you :P)?  Useful for people who want to use it in their hacks.  I can use IPS Peeker to figure it out however.

In the prototype of Super Mario Bros. 2, the white eyes didn’t exists.  I can see why they added them.  Adding them to the Player Select / Ending Scene would be cool.  Since the tiles don’t move position, you could just modify the background tiles.  Although adding them as extra sprites may give a better result.

One bug in the game is where you get more than 99 lives / 9 coins, it uses the hex format.  So 100 lives = 9A, 101 lives = 9B, 10 coins = 0A, 11 Coins = 0B etc.  I suspect they did that so they only had to use 2 tiles instead of 3.  Could be an easy fix.

Not really a bug, but I find it strange how Clawgrip and Triclyde Palette Sets were changed to Sprite Palette Set 1, instead of sticking to Sprite Palette 3 and just changing the values.  The value to change this for Clawgrip is known, but not Triclyde.  Need to do some debugging.  Looking at the RAM values, I need to locate a hex value 09 (made a topic asking for help on the issue: http://www.romhacking.net/forum/index.php?topic=24124.0).
Avatar by LazyNinjartist

SpiderDave

  • Jr. Member
  • **
  • Posts: 46
    • View Profile
    • spiderdave.com
Re: Super Mario Bros. 2 (USA, NES) small bugfix
« Reply #11 on: June 08, 2017, 03:39:39 am »
(add 0x10 for iNES header)

// 00:8cc1
// This usually clears controller input when you do a charge jump
// Change it to point to new subroutine below instead
// (originally it has a90085f7)
// 20 db95 jump to subroutine at $95db
// ea (no operation, since we don't need this byte now)
put 0cbf 20 db95 ea

//00:95db
// New subroutine to only clear left/right/down when doing a charge jump
// a9f8 Load accumulator with #$f8
// 25f7 AND what's in $00f7 (controller input) with accumulator (#$f8)
// 85f7 store accumulator back in $00f7
// a900 load accumulator with #$00 (code below the original spot needs it)
// 60 return from subroutine
put 15db a9f8 25f7 85f7 a900 60
My NES Tool: Davepatcher My SMB2 Hack WIP: Join Lamross in Hell

Asaki

  • RHDN Patreon Supporter!
  • Full Member
  • *****
  • Posts: 169
    • View Profile
Re: Super Mario Bros. 2 (USA, NES) small bugfix
« Reply #12 on: June 08, 2017, 07:37:06 am »
I fixed the issue where you do a charge jump holding an item, it now only resets left/right/down input.

You know, I was testing the game yesterday, and I couldn't get the bug to trigger in Nestopia or Nesticle in either revision of the ROM. I didn't have time to try any other emus or hardware.

BTW, I don't like losing the white part of the eyes, personally.

Sure, I wasn't expecting you to add it to your patch. It was just something I made for myself, and I figured I'd release it.

Heck, I'm surprised anybody downloaded my NoMap patch for Super Metroid, I don't even use it myself.

zacmario

  • Jr. Member
  • **
  • Posts: 79
    • View Profile
Re: Super Mario Bros. 2 (USA, NES) small bugfix
« Reply #13 on: June 08, 2017, 09:08:34 am »
I changed "Press Start Button" because I feel like it sounds a bit more modern; It's already implied that "start" is a button.  This updates it to the wording on the SMAS versions of the game.  Just to be clear the change is from "PUSH START BUTTON" to "PUSH START" (It never said "PRESS").

You can test that the charge jump clears all controller input--pause the game and unpause, but keep holding start when you unpause.  Then, with start still held down do a charge jump.  It will pause, even though you never let go and re-pressed start.  Lots of games have this input clearing issue; a while back I posed a fix for it in Megaman 1 (which clears input when you collect an energy item, dropping you in a pit if you were in mid-air collecting it).  Mario 1 allows you to manually change input when it should be frozen when you get a mushroom (this allows you to release and re-press jump on a mushroom to do an extra jump off the mushroom).

EDIT: To prevent the tiles for the eyes from being used, use this:

(add 0x10 for header)
0x1f39d: ea ea ea

So is this why in smb 1 when collecting a mushroom while over a pit you lose speed and plummet to death?

SpiderDave

  • Jr. Member
  • **
  • Posts: 46
    • View Profile
    • spiderdave.com
Re: Super Mario Bros. 2 (USA, NES) small bugfix
« Reply #14 on: June 08, 2017, 05:22:09 pm »
I didn't describe the issue properly, it only makes you throw it if you hold down b, which you commonly would if you like to always run fast.  Since the input is reset it counts it as a new button press, making you throw the item.
My NES Tool: Davepatcher My SMB2 Hack WIP: Join Lamross in Hell

Asaki

  • RHDN Patreon Supporter!
  • Full Member
  • *****
  • Posts: 169
    • View Profile
Re: Super Mario Bros. 2 (USA, NES) small bugfix
« Reply #15 on: February 01, 2018, 08:38:24 am »
I finally submitted this patch to the site. It's the same patch from above, but with SpiderDave's addendum from Reply #7 added in (and a proper readme file).

http://www.romhacking.net/hacks/3847/