standalone

package
v2.23.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2026 License: GPL-3.0 Imports: 20 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package standalone holds the operating-system independent parts of the built-in standalone emulator launchers: argument builders, launcher target files and the Windows emulator table and install discovery.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func A7800Args

func A7800Args(ctx *Context) ([]string, error)

A7800Args loads a cartridge into the a7800 machine. A7800 runs from its own folder, so it finds the 7800 BIOS in its roms folder.

func BuildWindowsCommand

func BuildWindowsCommand(
	emu *WindowsEmulator,
	system *WindowsSystem,
	install WindowsInstall,
	path string,
	showConfig func(command *platforms.LaunchCommand) ([]byte, error),
) (*platforms.LaunchCommand, error)

BuildWindowsCommand builds the command line for launching path. For MAME builds, showConfig runs the command it is given and returns the output.

func CemuArgs

func CemuArgs(ctx *Context) ([]string, error)

CemuArgs launches a Wii U title.

func DiscoverWindows

func DiscoverWindows(env *WindowsEnv, emulators []WindowsEmulator) map[string]WindowsInstall

DiscoverWindows finds each emulator's executable. Emulators that are not found are left out of the result, which is keyed by emulator Name.

Discovery only lists known folders and their direct children, each once, so its cost does not grow with the size of the drives searched.

func FBNeoArgs

func FBNeoArgs(ctx *Context) ([]string, error)

FBNeoArgs launches a ROM set by name. FinalBurn Neo has no command line ROM path and only finds sets through the ROM folders in its own config, so the set's folder is added there first when it is missing.

func LauncherExtensions

func LauncherExtensions(system *WindowsSystem) []string

LauncherExtensions returns the system's explicit extensions, or the union of its folders' ES-DE extensions and its extra extensions.

func LauncherFolders

func LauncherFolders(system *WindowsSystem) []string

LauncherFolders returns the system's folders plus its Zaparoo system ID folder, without case-insensitive duplicates.

func MAMEArgs

func MAMEArgs(ctx *Context) ([]string, error)

MAMEArgs launches a MAME ROM set by name. The set's folder is put first in the rompath and the rompath MAME is configured with follows it, so BIOS, parent and CHD folders the user configured keep working. MAME strips the folder and extension from the set name itself, so only the name is passed.

func MAMEConfiguredROMPath

func MAMEConfiguredROMPath(showConfig []byte) string

MAMEConfiguredROMPath returns the rompath in MAME's -showconfig output, or MAME's default when it is not set. The value is returned as written: MAME expands environment variables and resolves relative entries against its own working directory.

func MAMEShowConfig

func MAMEShowConfig(command *platforms.LaunchCommand, prepare func(cmd *exec.Cmd)) ([]byte, error)

MAMEShowConfig runs command, which must be MAME with -showconfig, and returns what it prints: the settings MAME ends up with after reading every ini file on its inipath. Asking MAME is the only reliable way to find them, because builds and packages use different inipaths and defaults.

func NewWindowsLauncher

func NewWindowsLauncher(
	emu *WindowsEmulator,
	system *WindowsSystem,
	install WindowsInstall,
	prepare func(cmd *exec.Cmd),
) platforms.Launcher

NewWindowsLauncher builds the launcher for one emulator system.

func RPCS3Args

func RPCS3Args(ctx *Context) ([]string, error)

RPCS3Args launches a PS3 game, resolving a .ps3 target file first.

func ReadLauncherTarget

func ReadLauncherTarget(path, extension string) (string, error)

ReadLauncherTarget reads the one-line target stored in a small launcher file such as .ps3, .psvita or .scummvm.

func ScummVMArgs

func ScummVMArgs(ctx *Context) ([]string, error)

ScummVMArgs launches the game ID named by a .scummvm target file from the target file's folder.

func ScummVMTarget

func ScummVMTarget(path string) (string, error)

ScummVMTarget reads the game ID from a .scummvm target file. An empty file names the game by its file name, as Batocera and RetroBat lay them out.

func SetName

func SetName(path string, extensions ...string) (string, error)

SetName returns a ROM set name taken from an archive file name, for emulators that load sets by name from a ROM path.

func ShadPS4Args

func ShadPS4Args(ctx *Context) ([]string, error)

ShadPS4Args launches the game named by a .ps4 target file.

func ValidateMediaFile

func ValidateMediaFile(path string) error

ValidateMediaFile requires an absolute path to an existing regular file.

func Vita3KArgs

func Vita3KArgs(ctx *Context) ([]string, error)

Vita3KArgs launches the title ID named by a .psvita target file.

func WinUAEArgs

func WinUAEArgs(ctx *Context) ([]string, error)

WinUAEArgs boots a floppy image in df0: without the configuration GUI.

func WindowsLaunchers

func WindowsLaunchers(
	emulators []WindowsEmulator,
	installs map[string]WindowsInstall,
	skip func(id string) bool,
	prepare func(cmd *exec.Cmd),
) []platforms.Launcher

WindowsLaunchers returns a launcher for every system of every discovered emulator, in table order, leaving out IDs for which skip returns true. prepare, if set, adjusts each command before it starts.

Types

type ArgsFunc

type ArgsFunc func(ctx *Context) ([]string, error)

ArgsFunc builds the emulator arguments for one launch.

func AltirraArgs

func AltirraArgs(machine string) ArgsFunc

AltirraArgs starts Altirra fullscreen in the given machine's default profile (5200 or xegs). Headerless cartridge images carry no mapper, so one is picked from the image size; otherwise Altirra stops to ask.

func Around

func Around(prefix []string, suffix ...string) ArgsFunc

Around passes prefix, the media path, then suffix.

func Batch

func Batch(prefix ...string) ArgsFunc

Batch passes prefix followed by the media path.

func DOSBoxArgs

func DOSBoxArgs(flags ...string) ArgsFunc

DOSBoxArgs runs a DOS program, or loads a .conf file whose autoexec starts the game.

func Joined

func Joined(flag string, prefix ...string) ArgsFunc

Joined passes prefix followed by flag and the media path as one argument, for emulators that only accept -flag=value.

type Context

type Context struct {
	// MAMEConfig returns MAME's -showconfig output, for launchers that read
	// MAME's own settings.
	MAMEConfig func() ([]byte, error)
	// Path is the absolute media path being launched.
	Path string
	// InstallDir is the folder holding the emulator executable, when known.
	InstallDir string
	// Exe is the emulator executable, when known.
	Exe string
}

Context is what an argument builder knows about one launch.

type UninstallEntry

type UninstallEntry struct {
	DisplayName     string
	InstallLocation string
	DisplayIcon     string
}

UninstallEntry is the part of a Windows Uninstall registry entry used to find an installed emulator.

type WindowsEmulator

type WindowsEmulator struct {
	Name string
	// Exes are executable file names, matched case-insensitively. A name
	// ending in "*" matches any executable starting with the text before it.
	Exes []string
	// DirHints are lower-case prefixes of folder names the emulator is
	// commonly extracted or installed to. The lower-cased Name is always one.
	DirHints []string
	// Scoop are the emulator's Scoop app names.
	Scoop   []string
	Systems []WindowsSystem
	// WorkDirInstall runs the emulator from its own folder, for emulators
	// that find their data and config relative to the working directory.
	WorkDirInstall bool
	// MAMEConfig tells the launcher to ask MAME for its configured rompath.
	MAMEConfig bool
}

WindowsEmulator is one standalone Windows emulator and the launchers it provides. Emulators are listed in priority order: when two launchers match the same file, the earlier one is the default.

func WindowsEmulators

func WindowsEmulators() []WindowsEmulator

WindowsEmulators returns the built-in Windows standalone emulators.

type WindowsEnv

type WindowsEnv struct {
	FS     afero.Fs
	Getenv func(key string) string
	// Configured returns the install_dir set for a launcher ID or an
	// emulator name, if any.
	Configured func(launcherID string) string
	// AppPath returns the registered App Paths location of an executable.
	AppPath          func(exe string) string
	UninstallEntries []UninstallEntry
	// FixedDrives are local fixed drive roots such as `C:\`.
	FixedDrives []string
	IndexRoots  []string
}

WindowsEnv is everything Windows discovery reads from the machine. Every field is optional, so tests can supply only what they exercise.

type WindowsInstall

type WindowsInstall struct {
	Exe    string
	Dir    string
	Source string
}

WindowsInstall is a discovered emulator executable.

type WindowsSystem

type WindowsSystem struct {
	Args     ArgsFunc
	ID       string
	SystemID string
	// Folders are the ROM folder names the launcher indexes. The Zaparoo
	// system ID folder is always added.
	Folders []string
	// Extensions replaces the extensions taken from the folders' ES-DE
	// definitions when set.
	Extensions []string
	// ExtraExtensions are added to the ES-DE extensions.
	ExtraExtensions []string
	NoScan          bool
}

WindowsSystem is one launcher an emulator provides for one system.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL