This patch prevents the game from crashing when grabbing a powerup while in an invalid powerup state or grabbing an invalid powerup like a chargin chuck. Normally, the game would crash, require a reset, and potentially erase or corrupt save files. This patch removes the danger of losing save data, and immediately resets. All existing behavior for valid states is intact.
Theoretically, this patch should not be necessary in a well designed hack. But if the possibility of powerup incrementation exists, this is a safety measure.
This patch is likely incompatible with any patch that modifies the number of valid mario states or powerup items.
Future plans include the option to simply reset the level.
Rejected due to faulty execution.
This patch breaks the powerup collection system on install, causing severe glitches and potential crashes. The patch seems to be replacing code for a hijack at $01C538, but the actual hijack employed is $01C53F; critical code is thus not executed, and garbage data is generated in its place.
Moreover, the patch checks for a powerup reward index (for the table at $01C524) of $15 or above in order to detect potentially crash-generating powerup states. The maximum valid index for this table is $13, thereby creating a gap if an index of exactly $14 happens to be calculated.
Finally, I personally don't see much application for this patch in its current intended scope. Assuming the usage of RAM address $19 isn't customized in any other way, the only way to achieve an invalid powerup state (that I'm aware of) is by way of a glitch; in that case, a full game reset seems like a rather harsh measure as opposed to, say, forcing the powerup state to Big Mario and allowing the game to proceed. If address $19 is modified, say for custom powerups, then exceptions for invalid $19 states would best be handled by the custom powerup patch itself, making this patch unneeded in that case as well.
Please always test the completely-final version of any patch on a clean ROM prior to submission, and kindly bear the above points in mind if planning a re-submission.