core

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: GPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProfileVersion                 = "v1"
	ProfileArchiveDownloadTimeout  = 30 * time.Second
	ProfileArchiveDownloadMaxBytes = int64(64 << 20)
)

Variables

View Source
var ErrProfileLaunchBusy = errors.New("profile launch is already running")

Functions

func RoomKeyForCache added in v1.8.1

func RoomKeyForCache(room commonrest.RoomInfo, profileID uuid.UUID) string

Types

type App

type App struct {
	Version            string
	ConfigDir          string
	Rest               rest.Client
	ProfileManager     *profile.Manager
	EpicSessionManager *aumgr.EpicSessionManager
	EpicApi            *aumgr.EpicApi

	ActivityService *activity.ActivityService

	// Callbacks for state changes
	OnGameStarted      func(profileID uuid.UUID, pid int)
	OnGameExited       func(profileID uuid.UUID)
	OnLobbyInfoUpdated func(info *IPCLobbyInfo)
	// contains filtered or unexported fields
}

func New

func New(version string, restClient rest.Client, activityService *activity.ActivityService) (*App, error)

func (*App) AcquireProfileLaunchLock added in v1.5.3

func (a *App) AcquireProfileLaunchLock(profileID uuid.UUID) (*ProfileLaunchLock, error)

func (*App) ClearModCache

func (a *App) ClearModCache() error

func (*App) ClearRunningProfile added in v1.8.1

func (a *App) ClearRunningProfile(profileID uuid.UUID)

func (*App) CurrentBusyProfile added in v1.8.1

func (a *App) CurrentBusyProfile() (uuid.UUID, bool)

func (*App) CurrentRoomInfo added in v1.8.1

func (a *App) CurrentRoomInfo(info *IPCLobbyInfo) (commonrest.RoomInfo, bool)

func (*App) CurrentRunningProfile added in v1.8.1

func (a *App) CurrentRunningProfile() (profile.Profile, int, bool)

func (*App) CurrentRunningProfileAndPID added in v1.8.1

func (a *App) CurrentRunningProfileAndPID() (uuid.UUID, int)

func (*App) DetectGamePath

func (a *App) DetectGamePath() (string, error)

func (*App) DetectLauncherType

func (a *App) DetectLauncherType(path string) aumgr.LauncherType

func (*App) DownloadArchiveURLToTempFile added in v1.8.1

func (a *App) DownloadArchiveURLToTempFile(archiveURL string, progressListener progress.Progress) (string, error)

func (*App) ExecuteLaunch

func (a *App) ExecuteLaunch(gamePath string, dllDir string, joinInfo *LaunchJoinInfo, onStarted func(pid int) error) error

ExecuteLaunch launches the game and blocks until it exits.

func (*App) ExportProfile

func (a *App) ExportProfile(prof profile.Profile) (string, error)

func (*App) ExportProfileArchive added in v1.5.0

func (a *App) ExportProfileArchive(prof profile.Profile, iconPNG []byte) ([]byte, error)

func (*App) GetGameVersion added in v1.6.10

func (a *App) GetGameVersion(gamePath string) (string, error)

func (*App) GetLobbyInfo added in v1.8.1

func (a *App) GetLobbyInfo() *IPCLobbyInfo

func (*App) GetLobbyInfoByPID added in v1.6.0

func (a *App) GetLobbyInfoByPID(pid int) (*IPCLobbyInfo, error)

func (*App) GetSharedRoom added in v1.8.1

func (a *App) GetSharedRoom() SharedRoomLink

func (*App) HandleImportReader added in v1.8.1

func (a *App) HandleImportReader(reader io.Reader, extension string) (*profile.SharedProfile, []byte, error)

func (*App) HandleJoinGameDownload added in v1.8.1

func (a *App) HandleJoinGameDownload(sessionID string, serverBase string) (*profile.SharedProfile, []byte, *LaunchJoinInfo, error)

func (*App) HandleSharedProfile

func (a *App) HandleSharedProfile(uri string) (*profile.SharedProfile, error)

func (*App) HandleSharedProfileArchive added in v1.5.0

func (a *App) HandleSharedProfileArchive(reader io.ReaderAt, size int64) (*profile.SharedProfile, []byte, error)

func (*App) HandleSharedProfileArchiveFile added in v1.5.0

func (a *App) HandleSharedProfileArchiveFile(path string) (*profile.SharedProfile, []byte, error)

func (*App) HasDirectJoinFeature added in v1.8.1

func (a *App) HasDirectJoinFeature(versions []modmgr.ModVersion) bool

func (*App) HeartbeatRoomShareAsync added in v1.8.1

func (a *App) HeartbeatRoomShareAsync()

func (*App) ImportSharedProfile added in v1.8.1

func (a *App) ImportSharedProfile(shared *profile.SharedProfile, iconPNG []byte) (*profile.Profile, error)

func (*App) InvalidateCachedRoomShareAsync added in v1.8.1

func (a *App) InvalidateCachedRoomShareAsync()

func (*App) IsAnyProfileBusy added in v1.8.1

func (a *App) IsAnyProfileBusy() bool

func (*App) IsCurrentRunningProcess added in v1.8.1

func (a *App) IsCurrentRunningProcess(profileID uuid.UUID, pid int) bool

func (*App) IsDirectJoinEnabledForRunningProfile added in v1.8.1

func (a *App) IsDirectJoinEnabledForRunningProfile() bool

func (*App) IsLobbyInfoAvailable added in v1.6.0

func (a *App) IsLobbyInfoAvailable() bool

func (*App) IsProfileBusy added in v1.8.1

func (a *App) IsProfileBusy(profileID uuid.UUID) bool

func (*App) IsProfileRunning added in v1.8.1

func (a *App) IsProfileRunning(profileID uuid.UUID) bool

func (*App) IsRoomShareGenerating added in v1.8.1

func (a *App) IsRoomShareGenerating() bool

func (*App) LoadRunningProfilesFromLocks added in v1.6.2

func (a *App) LoadRunningProfilesFromLocks() ([]RunningProfileInfo, error)

LoadRunningProfilesFromLocks scans the profile lock directory and returns information about profiles that are currently running (have valid lock files with active processes).

func (*App) OnGameExitedInternal added in v1.8.1

func (a *App) OnGameExitedInternal(profileID uuid.UUID)

func (*App) OnGameStartedInternal added in v1.8.1

func (a *App) OnGameStartedInternal(profileID uuid.UUID, pid int)

func (*App) ParseJoinGameURI added in v1.6.0

func (a *App) ParseJoinGameURI(uri string) (*JoinGameLink, error)

func (*App) PrepareLaunch

func (a *App) PrepareLaunch(gamePath string, profileID uuid.UUID) (string, func() error, error)

PrepareLaunch prepares the game for launch by preparing the profile directory.

func (*App) ResolveDependencies

func (a *App) ResolveDependencies(initialMods []modmgr.ModVersion) ([]modmgr.ModVersion, error)

func (*App) ResolveProfileDependencies

func (a *App) ResolveProfileDependencies(profileID uuid.UUID) ([]modmgr.ModVersion, error)

ResolveProfileDependencies resolves all required dependencies for the given profile.

func (*App) SendLobbyJoinByPID added in v1.6.0

func (a *App) SendLobbyJoinByPID(pid int, joinInfo LaunchJoinInfo) <-chan error

func (*App) SetLaunchingProfile added in v1.8.1

func (a *App) SetLaunchingProfile(profileID uuid.UUID, launching bool)

func (*App) SetRoomShareGenerating added in v1.8.1

func (a *App) SetRoomShareGenerating(generating bool)

func (*App) SetRunningDirectJoin added in v1.8.1

func (a *App) SetRunningDirectJoin(enabled bool)

func (*App) SetRunningPlayStartedAt added in v1.8.1

func (a *App) SetRunningPlayStartedAt(startedAt time.Time)

func (*App) SetRunningProfile added in v1.8.1

func (a *App) SetRunningProfile(profileID uuid.UUID)

func (*App) SetSharedRoom added in v1.8.1

func (a *App) SetSharedRoom(link SharedRoomLink)

func (*App) StartActivityPolling added in v1.8.1

func (a *App) StartActivityPolling(ctx context.Context)

func (*App) StartLobbyInfoPolling added in v1.6.0

func (a *App) StartLobbyInfoPolling(pid int, interval time.Duration, onInfo func(*IPCLobbyInfo), onError func(error)) func()

func (*App) StartLobbyPolling added in v1.8.1

func (a *App) StartLobbyPolling(pid int)

func (*App) StopLobbyPolling added in v1.8.1

func (a *App) StopLobbyPolling()

func (*App) SyncProfile

func (a *App) SyncProfile(profileID uuid.UUID, binaryType aumgr.BinaryType, gameVersion string, progressListener progress.Progress) error

SyncProfile forces a re-sync of the profile directory by clearing it and re-installing mods.

func (*App) WatchRestoredRunningProfile added in v1.8.1

func (a *App) WatchRestoredRunningProfile(profileID uuid.UUID, pid int, startedAt time.Time, pollInterval time.Duration, onExited func())

type IPCLobbyInfo added in v1.6.0

type IPCLobbyInfo struct {
	HasClient      bool   `json:"HasClient"`
	IsConnected    bool   `json:"IsConnected"`
	GameState      string `json:"GameState"`
	LobbyCode      string `json:"LobbyCode"`
	ServerIP       string `json:"ServerIp"`
	ServerPort     int    `json:"ServerPort"`
	IsHost         *bool  `json:"IsHost"`
	IsInGame       *bool  `json:"IsInGame"`
	MatchMakerIp   string `json:"MatchMakerIp"`
	MatchMakerPort int    `json:"MatchMakerPort"`

	JoinedPlayers int `json:"JoinedPlayers"`
	MaxPlayers    int `json:"MaxPlayers"`
}

func (*IPCLobbyInfo) String added in v1.6.10

func (i *IPCLobbyInfo) String() string
type JoinGameLink struct {
	SessionID  string
	ServerBase string
	Error      string
}

type LaunchJoinInfo added in v1.6.0

type LaunchJoinInfo struct {
	LobbyCode      string
	ServerIP       string
	ServerPort     uint16
	MatchMakerIp   string
	MatchMakerPort uint16
}

type ProfileLaunchLock added in v1.5.3

type ProfileLaunchLock struct {
	// contains filtered or unexported fields
}

func (*ProfileLaunchLock) Release added in v1.5.3

func (l *ProfileLaunchLock) Release() error

func (*ProfileLaunchLock) SetGamePID added in v1.5.3

func (l *ProfileLaunchLock) SetGamePID(gamePID int, startedAt time.Time, directJoinEnabled bool) error

type RunningProfileInfo added in v1.6.2

type RunningProfileInfo struct {
	ProfileID         uuid.UUID
	GamePID           int
	DirectJoinEnabled bool
	PlayStartedAt     time.Time
}
type SharedRoomLink struct {
	RoomKey   string
	URL       string
	SessionID string
	HostKey   string
	ExpiresAt time.Time
	InFlight  bool
}

Jump to

Keyboard shortcuts

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