|
game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
|
#include <game_process.h>
Classes | |
| struct | ProcessSnapshot |
Public Types | |
| using | GameAccessCallback |
Public Member Functions | |
| std::chrono::seconds | getGameSessionDuration (const std::string &gameId) const |
| int | getLastExitCode (const std::string &gameId, int defaultCode=0) const |
| std::function< void(const std::string &)> | getOnGameStatsUpdated () const |
| std::function< void(GameProcess::NotificationType, const std::string &)> | getOnNotification () const |
| std::vector< std::string > | getRunningGameIds () const |
| const GameProcess * | getRunningProcess (const std::string &gameId) const |
| ProcessSnapshot | getRunningProcessSnapshot (const std::string &gameId) const |
| bool | isGameRunning (const std::string &gameId) const |
| bool | launchGame (const std::string &gameId, Game &game) |
| void | scanForRunningGames (const std::vector< Game * > &games, GameAccessCallback gameAccessCallback) |
| void | setOnGameStatsUpdated (std::function< void(const std::string &gameId)> callback) |
| void | setOnNotification (std::function< void(GameProcess::NotificationType, const std::string &)> callback) |
| bool | stopGame (const std::string &gameId, Game *game=nullptr, bool force=false) |
| void | update () |
Static Public Member Functions | |
| static GameProcessManager & | instance () |
Definition at line 389 of file game_process.h.
Definition at line 444 of file game_process.h.
| std::chrono::seconds GameProcessManager::getGameSessionDuration | ( | const std::string & | gameId | ) | const |
Definition at line 5027 of file game_process.cpp.
References PipeHandle::get().
Referenced by core::LaunchController::getSessionDuration().
| int GameProcessManager::getLastExitCode | ( | const std::string & | gameId, |
| int | defaultCode = 0 ) const |
Definition at line 5113 of file game_process.cpp.
Referenced by core::LaunchController::update().
| std::function< void(const std::string &)> GameProcessManager::getOnGameStatsUpdated | ( | ) | const |
Definition at line 4649 of file game_process.cpp.
Referenced by update().
| std::function< void(GameProcess::NotificationType, const std::string &)> GameProcessManager::getOnNotification | ( | ) | const |
Definition at line 4643 of file game_process.cpp.
| std::vector< std::string > GameProcessManager::getRunningGameIds | ( | ) | const |
Definition at line 5002 of file game_process.cpp.
Referenced by core::LaunchController::getAllRunningGames(), core::LaunchController::getRunningGameCount(), core::LaunchController::hasRunningGames(), and core::LaunchController::stopAllGames().
| const GameProcess * GameProcessManager::getRunningProcess | ( | const std::string & | gameId | ) | const |
Definition at line 4974 of file game_process.cpp.
Referenced by DetailsPanelManager::Impl::update(), and DetailsPanelManager::Impl::updateRunningInfo().
| GameProcessManager::ProcessSnapshot GameProcessManager::getRunningProcessSnapshot | ( | const std::string & | gameId | ) | const |
Definition at line 4986 of file game_process.cpp.
References GameProcessManager::ProcessSnapshot::found, GameProcess::getLastLaunchInfo(), GameProcess::getProcessId(), GameProcess::getTrackedProcessId(), GameProcess::getTrackedProcessName(), GameProcessManager::ProcessSnapshot::launchInfo, GameProcessManager::ProcessSnapshot::primaryPid, GameProcessManager::ProcessSnapshot::trackedPid, and GameProcessManager::ProcessSnapshot::trackedProcessName.
Referenced by core::LaunchController::getRunningGameInfo(), and core::LaunchController::update().
|
static |
Definition at line 4683 of file game_process.cpp.
References instance().
Referenced by MainWindow::MainWindow(), MainWindow::~MainWindow(), core::LaunchController::getAllRunningGames(), core::LaunchController::getGameState(), core::LaunchController::getRunningGameCount(), core::LaunchController::getRunningGameInfo(), core::LaunchController::getSessionDuration(), core::LaunchController::getTotalSessionPlayTime(), core::LaunchController::hasRunningGames(), instance(), core::LaunchController::isGameRunning(), core::LaunchController::killGame(), core::LaunchController::launchGame(), main(), ShortcutsController::registerPaletteCommands(), core::LaunchController::stopAllGames(), core::LaunchController::stopGame(), core::LaunchController::update(), DetailsPanelManager::Impl::update(), and DetailsPanelManager::Impl::updateRunningInfo().
| bool GameProcessManager::isGameRunning | ( | const std::string & | gameId | ) | const |
Definition at line 4952 of file game_process.cpp.
Referenced by core::LaunchController::isGameRunning(), launchGame(), and core::LaunchController::update().
| bool GameProcessManager::launchGame | ( | const std::string & | gameId, |
| Game & | game ) |
Definition at line 4693 of file game_process.cpp.
References GameRunnerConfig::arguments, GameRunnerConfig::environmentVariables, GameProcess::Error, Logger::error(), GameRunnerConfig::executablePath, ProcessExecutor::executeBackground(), Logger::info(), FrameMetricsService::instance(), GameSessionService::instance(), isGameRunning(), GameMetadata::isSteamGame, GameStatistics::lastEnvironmentVars, GameStatistics::lastLaunchCommand, GameStatistics::lastProtonVersion, Game::metadata, Game::name, GameSessionService::onGameStarted(), Proton, GameRunnerConfig::protonVersion, core::SettingsController::readUseSteamLaunchByDefaultFromDisk(), Game::runner, Game::runnerConfig, FrameMetricsService::startCollection(), Game::statistics, GameMetadata::steamAppId, ProcessResult::success, GameStatistics::timesLaunched, GameRunnerConfig::useSteamLaunch, and Logger::warn().
| void GameProcessManager::scanForRunningGames | ( | const std::vector< Game * > & | games, |
| GameAccessCallback | gameAccessCallback ) |
Definition at line 5748 of file game_process.cpp.
References Game::id, Logger::info(), GameMetadata::isSteamGame, Game::metadata, and GameMetadata::steamAppId.
Referenced by MainWindow::MainWindow(), and ShortcutsController::registerPaletteCommands().
| void GameProcessManager::setOnGameStatsUpdated | ( | std::function< void(const std::string &gameId)> | callback | ) |
Definition at line 4635 of file game_process.cpp.
Referenced by MainWindow::MainWindow(), and MainWindow::~MainWindow().
| void GameProcessManager::setOnNotification | ( | std::function< void(GameProcess::NotificationType, const std::string &)> | callback | ) |
Definition at line 4628 of file game_process.cpp.
Referenced by main().
| bool GameProcessManager::stopGame | ( | const std::string & | gameId, |
| Game * | game = nullptr, | ||
| bool | force = false ) |
Definition at line 4862 of file game_process.cpp.
References Logger::info(), GameSessionService::instance(), GameStatistics::lastPlayed, Game::name, GameSessionService::onGameStopped(), Game::statistics, GameStatistics::totalPlayTimeSeconds, and Logger::warn().
Referenced by core::LaunchController::killGame(), core::LaunchController::stopAllGames(), and core::LaunchController::stopGame().
| void GameProcessManager::update | ( | ) |
Definition at line 5820 of file game_process.cpp.
References Logger::debug(), getOnGameStatsUpdated(), Logger::info(), GameSessionService::instance(), GameStatistics::lastPlayed, Game::name, GameSessionService::onGameStopped(), Game::statistics, and GameStatistics::totalPlayTimeSeconds.
Referenced by core::LaunchController::update().