games

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2025 License: GPL-3.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

View Source
const (
	CategoryArcade              = "Arcade"
	CategoryConsole             = "Console"
	CategoryComputer            = "Computer"
	CategoryHandheld            = "Handheld"
	CategoryOther               = "Other"
	ManufacturerEntex           = "Entex"
	ManufacturerEmerson         = "Emerson"
	ManufacturerMattel          = "Mattel"
	ManufacturerBally           = "Bally"
	ManufacturerAtari           = "Atari"
	ManufacturerColeco          = "Coleco"
	ManufacturerSega            = "Sega"
	ManufacturerNintendo        = "Nintendo"
	ManufacturerNEC             = "NEC"
	ManufacturerSNK             = "SNK"
	ManufacturerBandai          = "Bandai"
	ManufacturerVTech           = "VTech"
	ManufacturerCasio           = "Casio"
	ManufacturerWatara          = "Watara"
	ManufacturerMagnavox        = "Magnavox"
	ManufacturerFairchild       = "Fairchild"
	ManufacturerGCE             = "GCE"
	ManufacturerBitCorp         = "Bit Corporation"
	ManufacturerCommodore       = "Commodore"
	ManufacturerAmstrad         = "Amstrad"
	ManufacturerAcorn           = "Acorn"
	ManufacturerApple           = "Apple"
	ManufacturerBenesse         = "Benesse"
	ManufacturerSony            = "Sony"
	ManufacturerInterton        = "Interton"
	ManufacturerTandy           = "Tandy"
	ManufacturerIBM             = "IBM"
	ManufacturerApogee          = "Apogee"
	ManufacturerElektronika     = "Elektronika"
	ManufacturerCambridge       = "Cambridge"
	ManufacturerInteract        = "Interact"
	ManufacturerJupiter         = "Jupiter"
	ManufacturerVideoTechnology = "Video Technology"
	ManufacturerMicrosoft       = "Microsoft"
)

Variables

View Source
var CoreGroups = map[string][]System{
	"Atari7800": {Systems["Atari7800"], Systems["Atari2600"]},
	"Coleco":    {Systems["ColecoVision"], Systems["SG1000"]},
	"Gameboy":   {Systems["Gameboy"], Systems["GameboyColor"]},
	"NES":       {Systems["NES"], Systems["NESMusic"], Systems["FDS"]},
	"SMS": {Systems["MasterSystem"], Systems["GameGear"], System{
		Name: "SG-1000",
		Slots: []Slot{
			{
				Exts: []string{".sg"},
				Mgl: &MglParams{
					Delay:  1,
					Method: "f",
					Index:  1,
				},
			},
		},
	}},
	"SNES":   {Systems["SNES"], Systems["SNESMusic"]},
	"TGFX16": {Systems["TurboGrafx16"], Systems["SuperGrafx"]},
}

CoreGroups is a list of common MiSTer aliases that map back to a system. First in list takes precendence for simple attributes in case there's a conflict in the future.

View Source
var Systems = map[string]System{}/* 102 elements not displayed */

Functions

func FileExists

func FileExists(path string) bool

func FilterUniqueFilenames

func FilterUniqueFilenames(files []string) []string

func FindFile

func FindFile(path string) (string, error)

func GetAllFiles

func GetAllFiles(systemPaths map[string][]string, statusFn func(systemId string, path string)) ([][2]string, error)

func GetFiles

func GetFiles(systemId string, path string) ([]string, error)

GetFiles searches for all valid games in a given path and return a list of files. This function deep searches .zip files and handles symlinks at all levels.

func GetGamesFolders

func GetGamesFolders(cfg *config.UserConfig) []string

func GetPopulatedGamesFolders

func GetPopulatedGamesFolders(cfg *config.UserConfig, systems []System) map[string][]string

func MatchSystemFile

func MatchSystemFile(system System, path string) bool

MatchSystemFile returns true if a given file's extension is valid for a system.

func NewFileChecker

func NewFileChecker() *fileChecker

func RunSystemHook

func RunSystemHook(cfg *config.UserConfig, system System, path string) (string, error)

func SystemsWithRbf

func SystemsWithRbf() map[string]RbfInfo

SystemsWithRbf returns a map of all system IDs which have an existing rbf file.

Types

type MglParams

type MglParams struct {
	Delay  int
	Method string
	Index  int
}

func PathToMglDef

func PathToMglDef(system System, path string) (*MglParams, error)

type PathResult

type PathResult struct {
	System System
	Path   string
}

func GetActiveSystemPaths

func GetActiveSystemPaths(cfg *config.UserConfig, systems []System) []PathResult

GetActiveSystemPaths returns the active path for each system.

func GetAllSystemPaths

func GetAllSystemPaths(cfg *config.UserConfig) []PathResult

func GetSystemPaths

func GetSystemPaths(cfg *config.UserConfig, systems []System) []PathResult

GetSystemPaths returns all possible paths for each system.

type RbfInfo

type RbfInfo struct {
	Path      string // full path to RBF file
	Filename  string // base filename of RBF file
	ShortName string // base filename without date or extension
	MglName   string // relative path launch-able from MGL file
}

func ParseRbf

func ParseRbf(path string) RbfInfo

type Slot

type Slot struct {
	Label string
	Exts  []string
	Mgl   *MglParams
}

type System

type System struct {
	Id             string
	Name           string // US
	Category       string
	ReleaseDate    string // US
	Manufacturer   string
	Alias          []string
	SetName        string
	SetNameSameDir bool
	Folder         []string
	Rbf            string
	Slots          []Slot
}

func AllSystems

func AllSystems() []System

func BestSystemMatch

func BestSystemMatch(cfg *config.UserConfig, path string) (System, error)

func FolderToSystems

func FolderToSystems(cfg *config.UserConfig, path string) []System

FolderToSystems returns what systems a path could be for.

func GetGroup

func GetGroup(groupId string) (System, error)

func GetSystem

func GetSystem(id string) (*System, error)

GetSystem looks up an exact system definition by ID.

func LookupSystem

func LookupSystem(id string) (*System, error)

LookupSystem case-insensitively looks up system ID definition including aliases.

Jump to

Keyboard shortcuts

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