nba-emu / NanoBoyAdvance

A cycle-accurate Nintendo Game Boy Advance emulator.
GNU General Public License v3.0
955 stars 53 forks source link

Rework the scheduler to allow for proper (de)serialization of events #279

Closed fleroviux closed 1 year ago

fleroviux commented 1 year ago

Previously we were not able to save and restore scheduler events when saving/loading a save state. So instead we opted to try recreate all events from other state when loading save states. This worked somewhat fine in most cases but isn't ideal and doesn't scale well to scheduling more fine grained/nuanced events such as 'operation Y happens with 1 cycle delay after operation X'.

This PR allows us to finally (de)serialize all events by tagging them with an event class/type instead of storing the raw callbacks.