vcs.RunForFrameCount() checks for CPU KIL state

This commit is contained in:
JetSetIlly 2024-02-03 21:33:39 +00:00
parent 7a6d877096
commit 5b7a22ebb9
3 changed files with 11 additions and 1 deletions

View file

@ -110,6 +110,12 @@ func (vcs *VCS) RunForFrameCount(numFrames int, continueCheck func(frame int) (g
state := govern.Running
for frameNum != targetFrame && state != govern.Ending {
// check if CPU has been killed. emulation will run forever if we don't
// check for this
if vcs.CPU.Killed {
return nil
}
err := vcs.Step(nil)
if err != nil {
return err

View file

@ -15,4 +15,8 @@
// Package preview is used to emulate a ROM for a short period of time in order
// to gather information that would takes time to acquire.
//
// For example, it is used to determine the initial framing for the television
// on startup. Without a preview emulation the default framing will most often
// be wrong, resulting in a visible change in the image.
package preview

View file

@ -28,7 +28,7 @@ type Emulation struct {
vcs *hardware.VCS
}
// NewPreview is the preferred method of initialisation for the Preview type
// NewEmulation is the preferred method of initialisation for the Emulation type
func NewEmulation(prefs *preferences.Preferences) (*Emulation, error) {
em := &Emulation{}