livesplit-core
livesplit-core copied to clipboard
Figure out a design for resuming runs when restarting the application
At some point we want to have the ability to close LiveSplit and then resuming the run as if LiveSplit was never closed. We need to figure out a design of how we want to support this.
HI. I looked at this in a bit of detail and came up with a possible solution.
- Convert
Timervalues that areTimeStamps intoAtomicDateTime-
TimeStampis composed ofInstantwhich plays badly with accessing its contents and serializing - I also have a suspicion that
Instantis not consistent across reboots
-
- Serialize this new
TimerwithoutRunbut grabbing itsSegment::split_times- I was able to use
serde_jsonfor to accomplish this with an intermediate representation ofTimer
- I was able to use
- Deserialize
Timer(through this intermediate form) and replace its values- This might be bad if the
Timeris is not in the NotRunning state, but it may be ok
- This might be bad if the
If the Timer was Serialized on user actions (split, undo, skip, ...), I would imagine this would help in cases where livesplit would close unexpectedly (usually the computer rebooting).
There are a number of runners who do very long runs and have had a) their computers reboot or b) livesplit get into an inoperable state.
I have a working version of this from the current repo.