Tip: Switch palace switches normally disappear if you replay the level. However, if you insert them as direct Map16 and use the hex-edit at $00EEB2 in the ROM map, you can replay the level without a problem.
This code was made SA-1 compatible during moderation.
This code is functional and useful enough, and certainly worth hosting. If there's ever a v2.0, this code could be fleshed out with some extra bells and whistles such as options to change the activation buttons, to implement a cooldown on ON/OFF state switching, or to play a sound when state switching.
Tested with Asar 1.71, Lunar Magic 3.10, SA-1 1.32, Snes9x 1.59.2, UberASM Tool 1.4.