Add state rewinding support.

Built on top of ordinary save states by saving the state to a ring
buffer each frame.