mister

package
v0.0.0-...-6f6a9a1 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: GPL-3.0 Imports: 25 Imported by: 3

Documentation

Index

Constants

View Source
const (
	KeyYpbpr                   = "ypbpr"
	KeyCompositeSync           = "composite_sync"
	KeyForcedScandoubler       = "forced_scandoubler"
	KeyVgaScaler               = "vga_scaler"
	KeyVgaSog                  = "vga_sog"
	KeyKeyrahMode              = "keyrah_mode"
	KeyResetCombo              = "reset_combo"
	KeyKeyMenuAsRgui           = "key_menu_as_rgui"
	KeyVideoMode               = "video_mode"
	KeyVideoModePal            = "video_mode_pal"
	KeyVideoModeNtsc           = "video_mode_ntsc"
	KeyVideoInfo               = "video_info"
	KeyVsyncAdjust             = "vsync_adjust"
	KeyHdmiAudio96k            = "hdmi_audio_96k"
	KeyDviMode                 = "dvi_mode"
	KeyHdmiLimited             = "hdmi_limited"
	KeyKbdNomouse              = "kbd_nomouse"
	KeyMouseThrottle           = "mouse_throttle"
	KeyBootscreen              = "bootscreen"
	KeyVscaleMode              = "vscale_mode"
	KeyVscaleBorder            = "vscale_border"
	KeyRbfHideDatecode         = "rbf_hide_datecode"
	KeyMenuPal                 = "menu_pal"
	KeyBootcore                = "bootcore"
	KeyBootcoreTimeout         = "bootcore_timeout"
	KeyFont                    = "font"
	KeyFbSize                  = "fb_size"
	KeyFbTerminal              = "fb_terminal"
	KeyOsdTimeout              = "osd_timeout"
	KeyDirectVideo             = "direct_video"
	KeyOsdRotate               = "osd_rotate"
	KeyGamepadDefaults         = "gamepad_defaults"
	KeyRecents                 = "recents"
	KeyControllerInfo          = "controller_info"
	KeyRefreshMin              = "refresh_min"
	KeyRefreshMax              = "refresh_max"
	KeyJammaVid                = "jamma_vid"
	KeyJammaPid                = "jamma_pid"
	KeySniperMode              = "sniper_mode"
	KeyBrowseExpand            = "browse_expand"
	KeySharedFolder            = "shared_folder"
	KeyNoMergeVid              = "no_merge_vid"
	KeyNoMergePid              = "no_merge_pid"
	KeyNoMergeVidpid           = "no_merge_vidpid"
	KeyCustomAspectRatio1      = "custom_aspect_ratio_1"
	KeyCustomAspectRatio2      = "custom_aspect_ratio_2"
	KeySpinnerVid              = "spinner_vid"
	KeySpinnerPid              = "spinner_pid"
	KeySpinnerAxis             = "spinner_axis"
	KeySpinnerThrottle         = "spinner_throttle"
	KeyAfilterDefault          = "afilter_default"
	KeyVfilterDefault          = "vfilter_default"
	KeyVfilterVerticalDefault  = "vfilter_vertical_default"
	KeyVfilterScanlinesDefault = "vfilter_scanlines_default"
	KeyShmaskDefault           = "shmask_default"
	KeyShmaskModeDefault       = "shmask_mode_default"
	KeyPresetDefault           = "preset_default"
	KeyLogFileEntry            = "log_file_entry"
	KeyBtAutoDisconnect        = "bt_auto_disconnect"
	KeyBtResetBeforePair       = "bt_reset_before_pair"
	KeyWaitmount               = "waitmount"
	KeyRumble                  = "rumble"
	KeyWheelForce              = "wheel_force"
	KeyWheelRange              = "wheel_range"
	KeyHdmiGameMode            = "hdmi_game_mode"
	KeyVrrMode                 = "vrr_mode"
	KeyVrrMinFramerate         = "vrr_min_framerate"
	KeyVrrMaxFramerate         = "vrr_max_framerate"
	KeyVrrVesaFramerate        = "vrr_vesa_framerate"
	KeyVideoOff                = "video_off"
	KeyPlayer1Controller       = "player_1_controller"
	KeyPlayer2Controller       = "player_2_controller"
	KeyPlayer3Controller       = "player_3_controller"
	KeyPlayer4Controller       = "player_4_controller"
	KeyPlayer5Controller       = "player_5_controller"
	KeyPlayer6Controller       = "player_6_controller"
	KeyDisableAutofire         = "disable_autofire"
	KeyVideoBrightness         = "video_brightness"
	KeyVideoContrast           = "video_contrast"
	KeyVideoSaturation         = "video_saturation"
	KeyVideoHue                = "video_hue"
	KeyVideoGainOffset         = "video_gain_offset"
	KeyHdr                     = "hdr"
	KeyHdrMaxNits              = "hdr_max_nits"
	KeyHdrAvgNits              = "hdr_avg_nits"
	KeyVgaMode                 = "vga_mode"
	KeyNtscMode                = "ntsc_mode"
	KeyControllerUniqueMapping = "controller_unique_mapping"
)
View Source
const (
	DefaultIniFilename = "MiSTer.ini"
	MainIniSection     = "MiSTer"
)
View Source
const (
	BackgroundModeNone      = 0
	BackgroundModeWallpaper = 2
	BackgroundModeHBars1    = 4
	BackgroundModeHBars2    = 6
	BackgroundModeVBars1    = 8
	BackgroundModeVBars2    = 10
	BackgroundModeSpectrum  = 12
	BackgroundModeBlack     = 14
)
View Source
const (
	DefaultHostname = "MiSTer"
	MdnsServiceName = "_mister-remote._tcp"
)
View Source
const (
	UBootMACParam    = "ethaddr"
	UBootKernelParam = "v"
)
View Source
const (
	VideoModeScaleFull    = "1"
	VideoModeScaleHalf    = "2"
	VideoModeScaleThird   = "3"
	VideoModeScaleQuarter = "4"
	VideoModeFormatRGB32  = "18888"
	VideoModeFormatRGB15  = "11555"
	VideoModeFormatRGB16  = "1565"
	VideoModeFormatBGR32  = "08888"
	VideoModeFormatBGR15  = "01555"
	VideoModeFormatBGR16  = "0565"
	VideoModeFormatIDX8   = "08"
	ResCountPath          = "/sys/module/MiSTer_fb/parameters/res_count"
)
View Source
const ShadowDelimiter = ","

Variables

View Source
var Mdns = &MdnsService{
	Active:  false,
	Clients: []MdnsClient{},
}

ShadowedIniKeys are keys which can be defined multiple times in an .ini file

View Source
var ValidIniKeys = []string{
	KeyYpbpr,
	KeyCompositeSync,
	KeyForcedScandoubler,
	KeyVgaScaler,
	KeyVgaSog,
	KeyKeyrahMode,
	KeyResetCombo,
	KeyKeyMenuAsRgui,
	KeyVideoMode,
	KeyVideoModePal,
	KeyVideoModeNtsc,
	KeyVideoInfo,
	KeyVsyncAdjust,
	KeyHdmiAudio96k,
	KeyDviMode,
	KeyHdmiLimited,
	KeyKbdNomouse,
	KeyMouseThrottle,
	KeyBootscreen,
	KeyVscaleMode,
	KeyVscaleBorder,
	KeyRbfHideDatecode,
	KeyMenuPal,
	KeyBootcore,
	KeyBootcoreTimeout,
	KeyFont,
	KeyFbSize,
	KeyFbTerminal,
	KeyOsdTimeout,
	KeyDirectVideo,
	KeyOsdRotate,
	KeyGamepadDefaults,
	KeyRecents,
	KeyControllerInfo,
	KeyRefreshMin,
	KeyRefreshMax,
	KeyJammaVid,
	KeyJammaPid,
	KeySniperMode,
	KeyBrowseExpand,
	KeyLogo,
	KeySharedFolder,
	KeyNoMergeVid,
	KeyNoMergePid,
	KeyNoMergeVidpid,
	KeyCustomAspectRatio1,
	KeyCustomAspectRatio2,
	KeySpinnerVid,
	KeySpinnerPid,
	KeySpinnerAxis,
	KeySpinnerThrottle,
	KeyAfilterDefault,
	KeyVfilterDefault,
	KeyVfilterVerticalDefault,
	KeyVfilterScanlinesDefault,
	KeyShmaskDefault,
	KeyShmaskModeDefault,
	KeyPresetDefault,
	KeyLogFileEntry,
	KeyBtAutoDisconnect,
	KeyBtResetBeforePair,
	KeyWaitmount,
	KeyRumble,
	KeyWheelForce,
	KeyWheelRange,
	KeyHdmiGameMode,
	KeyVrrMode,
	KeyVrrMinFramerate,
	KeyVrrMaxFramerate,
	KeyVrrVesaFramerate,
	KeyVideoOff,
	KeyPlayer1Controller,
	KeyPlayer2Controller,
	KeyPlayer3Controller,
	KeyPlayer4Controller,
	KeyPlayer5Controller,
	KeyPlayer6Controller,
	KeyDisableAutofire,
	KeyVideoBrightness,
	KeyVideoContrast,
	KeyVideoSaturation,
	KeyVideoHue,
	KeyVideoGainOffset,
	KeyHdr,
	KeyHdrMaxNits,
	KeyHdrAvgNits,
	KeyVgaMode,
	KeyNtscMode,
	KeyControllerUniqueMapping,
}

Functions

func ActiveGameEnabled

func ActiveGameEnabled() bool

func CopyAndFixSSHKeys

func CopyAndFixSSHKeys(reverse bool) error

CopyAndFixSSHKeys copies the authorized_keys file from the linux folder to root home and fixes all permissions.

func CreateLauncher

func CreateLauncher(cfg *config.UserConfig, system *games.System, gameFile string, folder string, name string) (string, error)

func DeleteLauncher

func DeleteLauncher(path string) error

func EnableFastUsbPoll

func EnableFastUsbPoll() error

func FixRootSSHPerms

func FixRootSSHPerms() error

func GenerateMgl

func GenerateMgl(cfg *config.UserConfig, system *games.System, path string, override string) (string, error)

func GetActiveCoreName

func GetActiveCoreName() (string, error)

func GetActiveGame

func GetActiveGame() (string, error)

func GetActiveIni

func GetActiveIni() (int, error)

func GetConfiguredMacAddress

func GetConfiguredMacAddress() (string, error)

GetConfiguredMacAddress returns the ethernet MAC address configured in the u-boot.txt file, if available.

func GetLastUpdateTime

func GetLastUpdateTime() (time.Time, error)

func GetLauncherFilename

func GetLauncherFilename(system *games.System, folder string, name string) string

func GetMenuFolders

func GetMenuFolders(root string) []string

Search for directories in root that start with "_".

func GetMounts

func GetMounts(cfg *config.UserConfig) ([]string, error)

func GetRbfs

func GetRbfs(root string) []string

Do a shallow search of RBF files in root and return list of relative paths.

func GetUsbHidQuirks

func GetUsbHidQuirks() ([]string, error)

func IsFastUsbPollActive

func IsFastUsbPollActive() (bool, error)

func IsMenuRunning

func IsMenuRunning() bool

func IsScriptRunning

func IsScriptRunning() bool

func KillActiveScript

func KillActiveScript() error

func LaunchCore

func LaunchCore(cfg *config.UserConfig, system games.System) error

LaunchCore Launch a core given a possibly partial path, as per MGL files.

func LaunchGame

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

func LaunchGenericFile

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

LaunchGenericFile Given a generic file path, launch it using the correct method, if possible.

func LaunchMenu

func LaunchMenu() error

func LaunchRandomGame

func LaunchRandomGame(cfg *config.UserConfig, systems []games.System) error

func LaunchShortCore

func LaunchShortCore(path string) error

LaunchShortCore attempts to launch a core with a short path, as per what's allowed in an MGL file.

func LaunchToken

func LaunchToken(cfg *config.UserConfig, manual bool, kbd input.Keyboard, text string) error

func MatchRbf

func MatchRbf(rbfs []string, match string) string

Find an RBF in a list of all RBFs and return a value suitable for MGL.

func OpenConsole

func OpenConsole(kbd input.Keyboard) error

func ReadUBootParams

func ReadUBootParams() (map[string]string, error)

func RecentsOptionEnabled

func RecentsOptionEnabled() (bool, error)

func RelaunchIfInMenu

func RelaunchIfInMenu() error

func ResolvePath

func ResolvePath(path string) string

Convert a launchable path to an absolute path.

func RunScript

func RunScript(kbd input.Keyboard, path string) error

func ScriptCanLaunch

func ScriptCanLaunch() bool

func SetActiveGame

func SetActiveGame(path string) error

func SetActiveIni

func SetActiveIni(ini int, relaunchCore bool) error

func SetMenuBackgroundMode

func SetMenuBackgroundMode(mode int) error

func SetVideoMode

func SetVideoMode(width int, height int) error

func TryPickRandomGame

func TryPickRandomGame(system *games.System, folder string) (string, error)

TryPickRandomGame recursively searches through given folder for a valid game file for that system.

func TrySetupArcadeCoresLink(path string) error

func TryStartMdns

func TryStartMdns(logger *service.Logger, appVersion string) func() error

TryStartMdns will attempt to start the mDNS service, retrying multiple times if it fails. This is because a script may be run at boot time before the network is available.

func UpdateConfiguredMacAddress

func UpdateConfiguredMacAddress(newMacAddress string) error

UpdateConfiguredMacAddress updates the ethernet MAC address configured in the u-boot.txt file. Setting a new one if it doesn't exist, or updating the existing one. Any existing u-boot.txt arguments are preserved.

func UpdateHostname

func UpdateHostname(newHostname string, writeProc bool) error

UpdateHostname updates all hostname related files with the new hostname and refreshes it in kernel memory.

func UpdateUsbHidQuirks

func UpdateUsbHidQuirks(quirks []string) error

func WriteUBootParams

func WriteUBootParams(params map[string]string) error

Types

type DiskUsage

type DiskUsage struct {
	Total uint64
	Free  uint64
	Used  uint64
}

func GetDiskUsage

func GetDiskUsage(path string) (DiskUsage, error)

type DownloaderIni

type DownloaderIni struct {
	IniFile *ini.File
	Dbs     map[string]string
}

func LoadDownloaderIni

func LoadDownloaderIni() (*DownloaderIni, error)

func (*DownloaderIni) AddDb

func (d *DownloaderIni) AddDb(name, url string) error

func (*DownloaderIni) HasDb

func (d *DownloaderIni) HasDb(name string) bool

func (*DownloaderIni) RemoveDb

func (d *DownloaderIni) RemoveDb(name string) error

func (*DownloaderIni) Save

func (d *DownloaderIni) Save() error

type MGL

type MGL struct {
	XMLName xml.Name `xml:"mistergamedescription"`
	Rbf     string   `xml:"rbf"`
	SetName string   `xml:"setname"`
	File    MGLFile  `xml:"file"`
}

func ReadMgl

func ReadMgl(path string) (MGL, error)

type MGLFile

type MGLFile struct {
	XMLName xml.Name `xml:"file"`
	Delay   int      `xml:"delay,attr"`
	Type    string   `xml:"type,attr"`
	Index   int      `xml:"index,attr"`
	Path    string   `xml:"path,attr"`
}

type MdnsClient

type MdnsClient struct {
	Hostname string
	Version  string
	IP       string
}

type MdnsService

type MdnsService struct {
	Active  bool
	Clients []MdnsClient
	// contains filtered or unexported fields
}

func (*MdnsService) AddClient

func (s *MdnsService) AddClient(client MdnsClient)

func (*MdnsService) ClearClients

func (s *MdnsService) ClearClients()

func (*MdnsService) GetClients

func (s *MdnsService) GetClients() []MdnsClient

func (*MdnsService) IsActive

func (s *MdnsService) IsActive() bool

func (*MdnsService) SetActive

func (s *MdnsService) SetActive(active bool)
type MenuConfig struct {
	BackgroundMode int
}

func ReadMenuConfig

func ReadMenuConfig() (MenuConfig, error)

type MisterIni

type MisterIni struct {
	Id          int       `json:"id"`
	DisplayName string    `json:"displayName"`
	Filename    string    `json:"filename"`
	Path        string    `json:"path"`
	File        *ini.File `json:"-"`
}

func GetActiveMisterIni

func GetActiveMisterIni() (MisterIni, error)

func GetAllMisterIni

func GetAllMisterIni() ([]MisterIni, error)

func GetAllWithDefaultMisterIni

func GetAllWithDefaultMisterIni() ([]MisterIni, error)

GetAllWithDefaultMisterIni returns all ini files, setting up a default one if none exist.

func GetInisWithout

func GetInisWithout(key string, value string) ([]MisterIni, error)

func GetMisterIni

func GetMisterIni(id int) (MisterIni, error)

func (*MisterIni) AddKey

func (mi *MisterIni) AddKey(key string, value string) error

AddKey sets a key to a value whether it exists or not and appends to any shadowed values.

func (*MisterIni) GetKey

func (mi *MisterIni) GetKey(key string) (string, error)

func (*MisterIni) IsShadowedKey

func (mi *MisterIni) IsShadowedKey(key string) bool

func (*MisterIni) IsValidKey

func (mi *MisterIni) IsValidKey(key string) bool

func (*MisterIni) Load

func (mi *MisterIni) Load() error

func (*MisterIni) RemoveKey

func (mi *MisterIni) RemoveKey(key string) error

RemoveKey removes a key from the ini file.

func (*MisterIni) Save

func (mi *MisterIni) Save() error

func (*MisterIni) SetKey

func (mi *MisterIni) SetKey(key string, value string) error

SetKey a key to an absolute value, or delete it if value is empty. Supports shadowed keys delimited with a comma.

type RecentEntry

type RecentEntry struct {
	Directory string
	Name      string
	Label     string
}

func ReadRecent

func ReadRecent(path string) ([]RecentEntry, error)

type Script

type Script struct {
	Name     string `json:"name"`
	Filename string `json:"filename"`
	Path     string `json:"path"`
}

func GetAllScripts

func GetAllScripts() ([]Script, error)

type Startup

type Startup struct {
	Entries []StartupEntry
}

func (*Startup) Add

func (s *Startup) Add(name string, cmd string) error

func (*Startup) AddService

func (s *Startup) AddService(name string) error

func (*Startup) Enable

func (s *Startup) Enable(name string) error

func (*Startup) Exists

func (s *Startup) Exists(name string) bool

func (*Startup) Load

func (s *Startup) Load() error

func (*Startup) Remove

func (s *Startup) Remove(name string) error

func (*Startup) Save

func (s *Startup) Save() error

type StartupEntry

type StartupEntry struct {
	Name    string
	Enabled bool
	Cmds    []string
}

Jump to

Keyboard shortcuts

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