Documentation
¶
Overview ¶
Package launch provides the shared, restart-time CLI options for the gomeboy binaries (desktop, web, and agent).
Options are registered on a flag.FlagSet and parsed into a validated Options value. The binaries translate Options into core (internal/gameboy) or public (pkg/gomeboy) options, run the emulator behind a run(args) error boundary, and let main log the final error and exit non-zero.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
Register registers the core shared options on fs: -rom, -boot, -model, -printer, -cheats, -log-level, and -pprof.
func RegisterDriver ¶
RegisterDriver registers the -driver option with the given default.
func RegisterSaves ¶
RegisterSaves registers the persistence options on fs: -save-dir and -no-saves. Binaries that historically persist saves (desktop, web) register them; diskless binaries (agent) do not.
func StartPProf ¶
StartPProf serves net/http/pprof on addr in a background goroutine and returns a stop function that closes the listener. An empty addr disables profiling. A bind failure is returned so the caller can exit with a contextual error; a later serve failure is reported through logger instead of being discarded.
Types ¶
type Options ¶
type Options struct {
ROM string // path to the ROM to load
BootROM string // path to a boot ROM (.gbr)
Model gomeboy.Model // hardware model (ModelAuto keeps inference)
Printer bool // attach the Game Boy Printer
Cheats string // explicit cheats file path
SaveDir string // directory for .sav / .state files ("" = working directory)
NoSaves bool // disable save file I/O entirely
LogLevel log.Level // log severity
Driver string // display driver name
PProfAddr string // pprof listen address ("" = disabled)
}
Options holds the shared CLI options. Every field is a restart-time setting: changing one requires re-running the binary.
func Parse ¶
Parse parses args with fs and returns the validated launch options. fs must already carry the registered launch options (Register, RegisterSaves, RegisterDriver) and may also carry display driver options.
func (*Options) CheatsPath ¶
CheatsPath returns the cheats file the desktop and web binaries load: the explicit -cheats path if given, otherwise the historical <romname>.cheats in the working directory when a ROM is set.
func (*Options) CoreOptions ¶
CoreOptions translates these options into internal gameboy options for the desktop and web binaries, which drive internal/gameboy directly. The historical defaults are preserved: cheats come from <romname>.cheats and saves live in the working directory unless disabled or redirected.
func (*Options) PublicOptions ¶
PublicOptions translates these options into pkg/gomeboy options for the agent binary. The agent stays diskless: no save directory is passed and cheats are only loaded from an explicit -cheats path.