Documentation ¶
Index ¶
- Constants
- Variables
- func IsShortcut(id string) bool
- func Lookup(n *vdf.Node, x []string) (*vdf.Node, error)
- func ParseBinaryVdf(in []byte) (*vdf.Node, error)
- func ParseTextConfig(p string) (*vdf.Node, error)
- type AmbiguousNameError
- type BinaryVdf
- type BinaryVdfTable
- type CompatTool
- type CompatToolMappingVdf
- func (v *CompatToolMappingVdf) Add(appID, versionID string)
- func (v *CompatToolMappingVdf) GetCompatToolName(version string) string
- func (v *CompatToolMappingVdf) IsValid(version string) bool
- func (v *CompatToolMappingVdf) ReadCompatTools() (CompatTools, error)
- func (v *CompatToolMappingVdf) Update(id, version string) error
- type CompatTools
- func (c CompatTools) Add(id, name string)
- func (c CompatTools) AddGame(toolID string, game *Game) bool
- func (c CompatTools) GetDefault() *CompatTool
- func (c CompatTools) Includes(appID string) bool
- func (c CompatTools) IsValid(v string) bool
- func (c CompatTools) Merge(other *CompatTools) CompatTools
- func (c CompatTools) Sort() []string
- type DeckCompatibility
- type DeckCompatibilityCategory
- type Game
- type Games
- type KeyNotFoundError
- type LibraryConfigVdf
- type LocalConfigVdf
- type LoginUsersVdf
- type Steam
- func (s *Steam) GetAppIDAndName(idOrName string) (string, string, error)
- func (s *Steam) GetAppIDAndNames(idOrName string) [][]string
- func (s *Steam) GetCompatToolName(id string) (string, error)
- func (s *Steam) GetCompatdataPath(idOrName string) (string, string, error)
- func (s *Steam) GetCompatibilityToolsDir() string
- func (s *Steam) GetGame(id string, nameOnly ...bool) (*Game, error)
- func (s *Steam) GetGameData(id string) (*Game, bool, error)
- func (s *Steam) GetGameVersion(id string) *CompatTool
- func (s *Steam) GetInstalldir(id string) (string, error)
- func (s *Steam) GetName(id string) (string, error)
- func (s *Steam) GetNameFromAPI(id string) (string, error)
- func (s *Steam) GetShortcutName(id string) (string, error)
- func (s *Steam) IsRunning() (bool, error)
- func (s *Steam) NewCompatTools(data ...map[string][]string) (*CompatTools, error)
- func (s *Steam) ReadCompatTools() error
- func (s *Steam) SaveCache() error
- func (s *Steam) SearchCompatdataPath(id string) string
- type Vdf
Constants ¶
const InnerOffsetAppInfo = 10
InnerOffsetAppInfo sets byte count before appid match in appinfo
const InnerOffsetShortcuts = 1
InnerOffsetShortcuts sets byte count before appid match in shortcuts
Variables ¶
var DeckCompatibilityRegistry map[DeckCompatibilityCategory]string = map[DeckCompatibilityCategory]string{ DeckCompatibilityUnknown: "Unknown", DeckCompatibilityUnsupported: "Unsupported", DeckCompatibilityPlayable: "Playable", DeckCompatibilityVerified: "Verified", }
DeckCompatibilityRegistry translates DeckCompatibilityCategory values to human-readable strings
Functions ¶
func IsShortcut ¶ added in v1.6.0
IsShortcut returns whether app id is a shortcut
func ParseBinaryVdf ¶ added in v1.6.0
ParseBinaryVdf unmarshals `in` as binary VDF
Types ¶
type AmbiguousNameError ¶ added in v1.6.0
type AmbiguousNameError struct{}
AmbiguousNameError is returned if game search by app ID or name leads to several results
func (*AmbiguousNameError) Error ¶ added in v1.6.0
func (err *AmbiguousNameError) Error() string
Error returns description string
type BinaryVdf ¶ added in v1.6.0
BinaryVdf wraps info for binary VDF
func (*BinaryVdf) GetNextEntryStart ¶ added in v1.6.0
GetNextEntryStart returns the next offset to a binary VDF entry beginning where needle was found (starting at given offset)
type BinaryVdfTable ¶ added in v1.6.2
BinaryVdfTable is only used in debug mode to collect the count of duplicate parsing of binary VDF "snippets"
type CompatTool ¶ added in v1.6.0
type CompatTool struct { ID string `json:"id"` Name string `json:"name"` Games Games `json:"games"` IsDefault bool `json:"isDefault"` IsCustom bool `json:"isCustom"` }
CompatTool holds info about a compatibility tool (like human-readable name and a list of the games that are using it)
func (CompatTool) IsInstalled ¶ added in v1.6.0
func (t CompatTool) IsInstalled(s *Steam) bool
IsInstalled returns if a tool is installed
type CompatToolMappingVdf ¶ added in v1.6.0
type CompatToolMappingVdf struct {
Vdf
}
CompatToolMappingVdf represents parsed VDF config for CompatToolMapping
func (*CompatToolMappingVdf) Add ¶ added in v1.6.0
func (v *CompatToolMappingVdf) Add(appID, versionID string)
Add adds a new compatibility tool version mapping for a given app id
func (*CompatToolMappingVdf) GetCompatToolName ¶ added in v1.6.0
func (v *CompatToolMappingVdf) GetCompatToolName(version string) string
GetCompatToolName returns human-readable name for compatibility tool
func (*CompatToolMappingVdf) IsValid ¶ added in v1.6.0
func (v *CompatToolMappingVdf) IsValid(version string) bool
IsValid checks whether a version exists in the compatibility tools directory
func (*CompatToolMappingVdf) ReadCompatTools ¶ added in v1.6.0
func (v *CompatToolMappingVdf) ReadCompatTools() (CompatTools, error)
ReadCompatTools reads compatibility tool mappings from VDF config and returns a CompatTools map with existing entries
func (*CompatToolMappingVdf) Update ¶ added in v1.6.0
func (v *CompatToolMappingVdf) Update(id, version string) error
Update changes or adds a compatibility tool version mapping for a given app ID
type CompatTools ¶ added in v1.6.0
type CompatTools map[string]*CompatTool
CompatTools maps compatibility tool version IDs to CompatTool objects containing info like name and games.
func (CompatTools) Add ¶ added in v1.6.0
func (c CompatTools) Add(id, name string)
Add adds an entry to the CompatTools config (by tool id and (display) name)
func (CompatTools) AddGame ¶ added in v1.6.0
func (c CompatTools) AddGame(toolID string, game *Game) bool
AddGame adds a Game entry to an existing CompatTool entry
func (CompatTools) GetDefault ¶ added in v1.6.0
func (c CompatTools) GetDefault() *CompatTool
GetDefault returns the first entry from c that is a default compatibility tool
func (CompatTools) Includes ¶ added in v1.6.0
func (c CompatTools) Includes(appID string) bool
Includes returns whether a game is included in c
func (CompatTools) IsValid ¶ added in v1.6.0
func (c CompatTools) IsValid(v string) bool
IsValid checks whether a version ID (v) exists in the CompatTools config
func (CompatTools) Merge ¶ added in v1.6.0
func (c CompatTools) Merge(other *CompatTools) CompatTools
Merge adds all entries from other to c (without duplicates)
func (CompatTools) Sort ¶ added in v1.6.0
func (c CompatTools) Sort() []string
Sort returns slice of alphabetically sorted CompatTools IDs
type DeckCompatibility ¶ added in v1.6.0
type DeckCompatibility struct { Category DeckCompatibilityCategory `json:"category"` Tests []string `json:"tests"` }
DeckCompatibility holds deck compatibility info for a game
func GetDeckCompatibility ¶ added in v1.6.0
func GetDeckCompatibility(n *vdf.Node) *DeckCompatibility
GetDeckCompatibility reads deck compatibility data from VDF node n
func (DeckCompatibility) String ¶ added in v1.6.0
func (c DeckCompatibility) String() string
String returns string that represents deck compatibility status
type DeckCompatibilityCategory ¶ added in v1.6.0
type DeckCompatibilityCategory int
DeckCompatibilityCategory represents deck compatibility category
const ( // DeckCompatibilityUnknown represents unknown deck compatibility DeckCompatibilityUnknown DeckCompatibilityCategory = iota // DeckCompatibilityUnsupported represents unsupported deck compatibility DeckCompatibilityUnsupported // DeckCompatibilityPlayable represents playable deck compatibility DeckCompatibilityPlayable // DeckCompatibilityVerified represents verified deck compatibility DeckCompatibilityVerified )
func (DeckCompatibilityCategory) String ¶ added in v1.6.0
func (c DeckCompatibilityCategory) String() string
type Game ¶ added in v1.4.0
type Game struct { ID string `json:"appID"` Name string `json:"-"` IsInstalled bool `json:"isInstalled"` IsShortcut bool `json:"isShortcut"` DeckCompatibility DeckCompatibility `json:"deckCompatibility"` }
Game represents Steam game or shortcut
type Games ¶
Games maps game name to Game (app ID, install status)
func (Games) CountInstalled ¶ added in v1.6.0
CountInstalled returns count of installed games
func (Games) SortByDeckCompatibilityCategory ¶ added in v1.6.3
type KeyNotFoundError ¶ added in v1.4.0
type KeyNotFoundError struct {
Name string
}
KeyNotFoundError is returned if key in VDF is not found
func (*KeyNotFoundError) Error ¶ added in v1.4.0
func (e *KeyNotFoundError) Error() string
type LibraryConfigVdf ¶ added in v1.6.0
type LibraryConfigVdf struct {
Vdf
}
LibraryConfigVdf represents parsed VDF config for library config from libraryfolders.vdf
func (LibraryConfigVdf) GetLibraryPathByID ¶ added in v1.6.0
func (vdf LibraryConfigVdf) GetLibraryPathByID(id string) string
GetLibraryPathByID returns library path for app id
func (LibraryConfigVdf) GetLibraryPaths ¶ added in v1.6.1
func (vdf LibraryConfigVdf) GetLibraryPaths() []string
GetLibraryPaths returns array of Steam library paths
func (LibraryConfigVdf) IsInstalled ¶ added in v1.6.0
func (vdf LibraryConfigVdf) IsInstalled(id string) bool
IsInstalled returns whether app id is installed
type LocalConfigVdf ¶ added in v1.6.0
type LocalConfigVdf struct {
Vdf
}
LocalConfigVdf represents parsed VDF config for app config from localconfig.vdf
type LoginUsersVdf ¶ added in v1.6.0
type LoginUsersVdf struct {
Vdf
}
LoginUsersVdf represents parsed VDF config for app config from loginusers.vdf
func (*LoginUsersVdf) GetID64 ¶ added in v1.6.0
func (lu *LoginUsersVdf) GetID64(username string) string
GetID64 return steamID64 for given username
type Steam ¶
type Steam struct { AppidCache *cache.Cache VersionNameCache *cache.Cache AppInfo *BinaryVdf CompatToolMapping *CompatToolMappingVdf LibraryConfig *LibraryConfigVdf LocalConfig *LocalConfigVdf LoginUsers *LoginUsersVdf Shortcuts *BinaryVdf CompatTools CompatTools UID string Root string EnableViewedSteamPlay bool }
Steam struct wraps caches and exposes functions for Steam data retrieval
func (*Steam) GetAppIDAndName ¶ added in v1.6.0
GetAppIDAndName returns first found app ID and proper name for app ID or name search (from AppidCache cache)
func (*Steam) GetAppIDAndNames ¶ added in v1.6.0
GetAppIDAndNames returns app IDs and proper names for app ID or name search (from AppidCache cache)
func (*Steam) GetCompatToolName ¶ added in v1.4.0
GetCompatToolName returns human-readable name of compatibility tool, for example: "proton_63" -> "Proton 6.3-8"
func (*Steam) GetCompatdataPath ¶ added in v1.2.4
GetCompatdataPath returns compatdata path and game name for given game ID or name
func (*Steam) GetCompatibilityToolsDir ¶ added in v1.6.0
GetCompatibilityToolsDir returns compatibilitytools.d location
func (*Steam) GetGame ¶ added in v1.6.0
GetGame returns Game struct by app id If nameOnly is true, Game struct will only contain name
func (*Steam) GetGameData ¶ added in v1.4.0
GetGameData returns initialized Game struct by app ID TODO Rename/rewrite GetGameCached? How to handle non-cached data?
func (*Steam) GetGameVersion ¶ added in v1.4.0
func (s *Steam) GetGameVersion(id string) *CompatTool
GetGameVersion returns Version struct for a given game ID
func (*Steam) GetInstalldir ¶ added in v1.6.0
GetInstalldir returns installation directory of game by app ID
func (*Steam) GetNameFromAPI ¶ added in v1.6.0
GetNameFromAPI returns name of game by app id using the Steam API
func (*Steam) GetShortcutName ¶ added in v1.6.0
GetShortcutName returns name of shortcut by app id
func (*Steam) IsRunning ¶ added in v1.6.2
IsRunning returns whether a process is running that contains "steam" in its binary path. Always returns false if ran in Flatpak sandbox.
func (*Steam) NewCompatTools ¶ added in v1.6.0
func (s *Steam) NewCompatTools(data ...map[string][]string) (*CompatTools, error)
NewCompatTools returns new CompatTools struct (optionally initialized with data, which is a map from compatibility tool version IDs to slices of game IDs)
func (*Steam) ReadCompatTools ¶ added in v1.6.0
ReadCompatTools reads compatibility tool mappings from config, and sets s.CompatTools accordingly.
func (*Steam) SearchCompatdataPath ¶ added in v1.6.1
SearchCompatdataPath searches for compatdata path for given game id in all library paths