Right now the patcher only has one mode of operation. It triggers a countdown whenever the game writes SRAM and when the countdown ends whatever is in SRAM gets flushed to a reserved portion of ROM.
It may be worthwhile to have other options. For example.
Instead of patching write functions, patch branches to them. Then hooks can be selectively added with the assistance of a debugger, removing unnecessary flushes at inconvenient times. Or the patched write function could examine the return address to determine where it was called from and decide what to do.
Only trigger countdown if a key combo is held during the saving operation.
Instead of a countdown, use a key combo to decide when to flush.
Adventurously, it might even be possible to add save state or sleep support using a key combo.
Emulate larger save types such as FLASH1M on smaller physical save chips like 64KB SRAM by copying the matching bank into SRAM when needed..
Maybe don't even need SRAM at all and use a log of all writes, something like this
Right now the patcher only has one mode of operation. It triggers a countdown whenever the game writes SRAM and when the countdown ends whatever is in SRAM gets flushed to a reserved portion of ROM. It may be worthwhile to have other options. For example.
Instead of a countdown, use a key combo to decide when to flush.