This patch rewrites the game's save file handling by using DMA for saving and loading, leading to the most efficient handling. As a bonus, it also frees up the 141 bytes of RAM at $7E:1F49.
NOTE: You must apply this patch after you use Lunar Magic to modify any of the level's level flags on the overworld -- LM doesn't take into account the fact that $1F49 is never being used anymore.
Read the readme for information on including an address to be saved to SRAM/BWRAM.
This version now allows addresses to have default values.
The BWRAM is included because due to the nature of the sa-1 rom, SRAM doesn't exist, so use that instead of SRAM on a sa-1 rom, not SRAM.
Update: Fixed for compatibility with Lunar Magic v2.53.
Fixed a bug init would happen after intro level's load, leading to weird issues with initialized RAMs. Example: if you remove the code that takes care of initializing manually the life counter and try to do that with bwram's default values, you will see your life counter suddenly jump from 1 to the right value. And many other issues of the same variation.
I also brought the load routine to the same hijack, so now the game chooses whether to init or load, instead of trying to do both. In v1.2, I had added a lock so that wouldn't happen, I removed it in this version. Both routines are running at the same hijack sram_plus uses now.
Fixed a bug it would restore a piece of code from the original game on top of a LM hijack (message sprite fix (shift+f8)) that would send you to the wrong OW submap.
Fixed a bug the patch would load a save even if there was no save to be loaded (values would be loaded with FF or whatever else was in the tables).
Fixed a bug the patch would write garbage to address+1, according to the tables, so dl $4013C7 : dw $0001 would write to 4013C7 and 4013C8.