Language…
6 users online: DanMario24YT, JPhanto,  K.T.B., Majink12, Maw, Rhubarb44230 - Guests: 228 - Bots: 353
Users: 64,795 (2,378 active)
Latest user: mathew

P-balloon timer fix 2.0 by GreenHammerBro

File Name: P-balloon timer fix 2.0
Submitted: 08 October 2017 - 21:47:03 PM by GreenHammerBro
Obsoletes: P-balloon timer fix
Authors: GreenHammerBro
Tool: Asar
Requires Free Space: Yes
Bug Fix: Yes
Featured: No
Description: Fixes a bug where the p-balloon timer does not freeze when $9D is set (such as L and R scrolling).

EDIT:
-You can now cancel balloon at any time by pressing a button (A by default)
-Fixes a bug that only exist via ASM methods that clears the timer (to #$00); the countdown decrements the timer BEFORE checking if its zero, making it possible to decrement it to #$FF and refilling the timer.
-Fixes additional bug (can be turned off if you want to) that Mario retains his state (spinjump, air flag, etc) prior grabbing it.

See patch's comments for more fixes.
The problem with DontLosePBalloon.asm was that, depending on the value of !RetainType, it would either restore original code or install a hijack to allow the P-Balloon to be retained after an animation. Patching it with !RetainType = 1 after already having patched it with !RetainType = 0 would leak freespace.

Originally posted by Submission Notes
you can now repatch "DontLosePBalloon.asm" without issues.

The purpose of this update is to clean the used up freespace if the steps mentioned below are taken. This doesn't work because of line 19, which checks for a JSL opcode ($22) at $019FBE. The patch's hijack (line 17), however, uses a JML opcode ($5C), so the condition is never true and consequently, the freespace block is never cleaned, which is the only thing the update is meant to fix. This can be proven with Lunar Magic's scanning feature (File -> Scan ROM) - both the current version and this update leak freespace if DontLosePBalloon.asm is reapplied with a changed !RetainType.

Line 19 also uses a single equals sign (rather than two equals signs) to check for equality. This is, as mentioned in Asar's manual.txt, a deprecated feature which could be removed in a future version.