main environment label is now "main" rather than the empty string

this means that main emulation must be explicitely named but this is
good because it means there is no ambiguity if a support emulation is
not named
This commit is contained in:
JetSetIlly 2024-02-09 17:24:20 +00:00
parent 4d7ec9f109
commit d1482c139a
7 changed files with 10 additions and 8 deletions

View file

@ -38,6 +38,7 @@ import (
"github.com/jetsetilly/gopher2600/debugger/terminal"
"github.com/jetsetilly/gopher2600/debugger/terminal/commandline"
"github.com/jetsetilly/gopher2600/disassembly"
"github.com/jetsetilly/gopher2600/environment"
"github.com/jetsetilly/gopher2600/gui"
"github.com/jetsetilly/gopher2600/hardware"
"github.com/jetsetilly/gopher2600/hardware/cpu/execution"
@ -361,6 +362,7 @@ func NewDebugger(opts CommandLineOptions, create CreateUserInterface) (*Debugger
if err != nil {
return nil, fmt.Errorf("debugger: %w", err)
}
dbg.vcs.Env.Label = environment.MainEmulation
// create userinput/controllers handler
dbg.controllers = userinput.NewControllers(dbg.vcs.Input)

View file

@ -86,7 +86,7 @@ func (env *Environment) Normalise() {
}
// MainEmulation is the label used for the main emulation
const MainEmulation = Label("")
const MainEmulation = Label("main")
// IsEmulation checks the emulation label and returns true if it matches
func (env *Environment) IsEmulation(label Label) bool {

View file

@ -106,7 +106,7 @@ func (c *Cache) Update(vcs *hardware.VCS, rewind *rewind.Rewind, dbg *debugger.D
TIA: vcs.TIA.Snapshot(),
},
env: &environment.Environment{
Label: "gui",
Label: "cache",
Prefs: vcs.Env.Prefs,
// no television required for gui purposes
},

View file

@ -19,6 +19,7 @@ import (
"fmt"
"github.com/jetsetilly/gopher2600/cartridgeloader"
"github.com/jetsetilly/gopher2600/environment"
"github.com/jetsetilly/gopher2600/hardware"
"github.com/jetsetilly/gopher2600/hardware/preferences"
"github.com/jetsetilly/gopher2600/hardware/television"
@ -44,6 +45,7 @@ func NewEmulation(prefs *preferences.Preferences) (*Emulation, error) {
if err != nil {
return nil, fmt.Errorf("preview: %w", err)
}
em.vcs.Env.Label = environment.Label("preview")
return em, nil
}

View file

@ -25,6 +25,7 @@ import (
"github.com/jetsetilly/gopher2600/cartridgeloader"
"github.com/jetsetilly/gopher2600/debugger/govern"
"github.com/jetsetilly/gopher2600/environment"
"github.com/jetsetilly/gopher2600/hardware"
"github.com/jetsetilly/gopher2600/hardware/memory/cartridge/mapper"
"github.com/jetsetilly/gopher2600/hardware/memory/cartridge/supercharger"
@ -96,7 +97,7 @@ func NewAnim(prefs *preferences.Preferences) (*Anim, error) {
if err != nil {
return nil, fmt.Errorf("thumbnailer: %w", err)
}
thmb.vcs.Env.Label = thumbnailerEnv
thmb.vcs.Env.Label = environment.Label("thumbnail_anim")
thmb.img = image.NewRGBA(image.Rect(0, 0, specification.ClksScanline, specification.AbsoluteMaxScanlines))
thmb.Reset()

View file

@ -24,6 +24,7 @@ import (
"github.com/jetsetilly/gopher2600/coprocessor"
"github.com/jetsetilly/gopher2600/debugger/govern"
"github.com/jetsetilly/gopher2600/environment"
"github.com/jetsetilly/gopher2600/hardware"
"github.com/jetsetilly/gopher2600/hardware/preferences"
"github.com/jetsetilly/gopher2600/hardware/television"
@ -78,7 +79,7 @@ func NewImage(prefs *preferences.Preferences) (*Image, error) {
if err != nil {
return nil, fmt.Errorf("thumbnailer: %w", err)
}
thmb.vcs.Env.Label = thumbnailerEnv
thmb.vcs.Env.Label = environment.Label("thumbnail")
thmb.img = image.NewRGBA(image.Rect(0, 0, specification.ClksScanline, specification.AbsoluteMaxScanlines))
thmb.Reset()

View file

@ -15,11 +15,7 @@
package thumbnailer
import "github.com/jetsetilly/gopher2600/environment"
// UndefinedNumFrames indicates the that the thumbnailing emulation should run
// until it is explicitely stopped with the EndCreation() function (or
// implicitely with a second call to Create())
const UndefinedNumFrames = -1
const thumbnailerEnv = environment.Label("thumbnailer")