besteon / Ironmon-Tracker

A Lua script for the Bizhawk/mGBA emulator compatible with Pokemon Fire Red, Leaf Green, Ruby, Sapphire, and Emerald that tracks relevant data for the IronMon challenge.
MIT License
123 stars 44 forks source link

Allowing the Tracker to autoflush saveRAM #317

Closed UTDZac closed 1 year ago

UTDZac commented 1 year ago

Since Bizhawk doesn't always flush the saveRAM, this is an attempt to make that happen more reliably.

This solution uses a simple hack of checking the GAME_STATS for a change in quantity on the stat "game saves". This change occurs the moment the user presses the "Save the game" button, and NOT when the save actually completes. As a result, I added a short 10 second delay before telling Bizhawk to flush the save. It's not perfect, but its a simple addition that likely helps save some runs (pun intended).

Let me know if you can think of a slightly better way to do this.