Gopher2600/rewind/deeppoke.go
JetSetIlly 8a8a306670 corrected rewind splicing point
rewind.String() now produces correct summary in all instances

rewind reset on frequency change (in addition to the existing rule about
number of states). timeline no longer reset on this type of rewind
reset.

adjust coordinates function uses the correct zero value for color
clocks. the error could be seen on STEP BACK FRAME when the execution
would stop near clock 0 rathre than clock -68

execution states are recorded and appended to the history every frame
regardless of the snapshot frequency schedule. they continue to be
trimmed in the usual way. on emulation halt meanwhile, the current
coordinates are recorded which is more flexible and allows for video
cycle granularity.
2021-11-18 10:29:33 +00:00

40 lines
1.2 KiB
Go

// This file is part of Gopher2600.
//
// Gopher2600 is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Gopher2600 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Gopher2600. If not, see <https://www.gnu.org/licenses/>.
package rewind
import "github.com/jetsetilly/gopher2600/curated"
type PokeHook func(res *State) error
// RunPoke will the run the VCS from one state to another state applying
// the supplied PokeHook to the from State
func (r *Rewind) RunPoke(from *State, to *State, poke PokeHook) error {
fromIdx := r.findFrameIndex(from.TV.GetCoords().Frame).nearestIdx
if poke != nil {
err := poke(r.entries[fromIdx])
if err != nil {
return err
}
}
err := r.setSplicePoint(fromIdx, to.TV.GetCoords())
if err != nil {
return curated.Errorf("rewind: %v", err)
}
return nil
}