game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
ProtonDBService Class Reference

Service for fetching game compatibility data from ProtonDB. More...

#include <protondb_service.h>

Public Types

using GameInfoCallback = std::function<void(const ProtonDBGameInfo&)>
using SearchCallback = std::function<void(const std::vector<ProtonDBSearchResult>&)>

Static Public Member Functions

static void clearCache ()
 Clear cached data.
static ProtonDBGameInfo findGameByName (const std::string &gameName)
 Find game info by name (searches for matching game, returns full info).
static void findGameByNameAsync (const std::string &gameName, const GameInfoCallback &callback)
 Find game info by name asynchronously.
static ProtonDBGameInfo getGameInfo (int steamAppId)
 Get game info by Steam App ID.
static void getGameInfoAsync (int steamAppId, const GameInfoCallback &callback)
 Get game info asynchronously.
static LutrisGameInfo getLutrisInfo (int steamAppId)
 Get Lutris game info and installers.
static void getLutrisInfoAsync (int steamAppId, const std::function< void(const LutrisGameInfo &)> &callback)
 Get Lutris info asynchronously.
static LutrisGameInfo getLutrisInfoBySlug (const std::string &gameSlug)
 Get Lutris info by game slug.
static SteamAppInfo getSteamAppInfo (int steamAppId)
 Get Steam store information (native Linux, genres, DRM, etc.).
static void getSteamAppInfoAsync (int steamAppId, const std::function< void(const SteamAppInfo &)> &callback)
 Get Steam app info asynchronously.
static SteamDeckInfo getSteamDeckInfo (int steamAppId)
 Get Steam Deck compatibility status from Valve's testing.
static void getSteamDeckInfoAsync (int steamAppId, const std::function< void(const SteamDeckInfo &)> &callback)
 Get Steam Deck compatibility asynchronously.
static std::string getTier (int steamAppId)
 Get compatibility tier for a game (quick lookup).
static void getTierColor (const std::string &tier, float &r, float &g, float &b, float &a)
 Get tier color for UI display (RGBA).
static std::string getTierDescription (const std::string &tier)
 Get human-readable tier description.
static std::vector< ProtonDBSearchResult > searchByName (const std::string &gameName, int maxResults=10)
 Search for games by name.
static void searchByNameAsync (const std::string &gameName, const SearchCallback &callback, int maxResults=10)
 Search for games by name asynchronously.

Detailed Description

Service for fetching game compatibility data from ProtonDB.

Provides methods to look up game compatibility information and extract recommended settings from user reports.

Usage Example

// Look up by Steam App ID
auto info = ProtonDBService::getGameInfo(292030); // Witcher 3
if (info.found) {
Logger::info("Tier: {}, Score: {}", info.tier, info.score);
// Apply tweaks...
}
// Async lookup
if (info.found) {
// Update UI with results
}
});
static void info(const std::string &message, Args &&... args)
Log info message (general information).
Definition logger.h:108
static ProtonDBGameInfo getGameInfo(int steamAppId)
Get game info by Steam App ID.
static void getGameInfoAsync(int steamAppId, const GameInfoCallback &callback)
Get game info asynchronously.
Complete ProtonDB information for a game.

Definition at line 259 of file protondb_service.h.

Member Typedef Documentation

◆ GameInfoCallback

using ProtonDBService::GameInfoCallback = std::function<void(const ProtonDBGameInfo&)>

Definition at line 296 of file protondb_service.h.

◆ SearchCallback

using ProtonDBService::SearchCallback = std::function<void(const std::vector<ProtonDBSearchResult>&)>

Definition at line 297 of file protondb_service.h.

Member Function Documentation

◆ clearCache()

void ProtonDBService::clearCache ( )
static

Clear cached data.

Clears any cached API responses to force fresh lookups.

Definition at line 951 of file protondb_service.cpp.

References Logger::info().

◆ findGameByName()

ProtonDBGameInfo ProtonDBService::findGameByName ( const std::string & gameName)
static

Find game info by name (searches for matching game, returns full info).

Parameters
gameNameName of the game to search for
Returns
ProtonDBGameInfo with compatibility data if found

This method searches for the game by name, finds the best match, and returns full compatibility information including tweaks. Useful when you don't know the Steam App ID.

Definition at line 759 of file protondb_service.cpp.

References ProtonDBGameInfo::errorMessage, getGameInfo(), Logger::info(), searchByName(), and Logger::warn().

Referenced by findGameByNameAsync().

◆ findGameByNameAsync()

void ProtonDBService::findGameByNameAsync ( const std::string & gameName,
const GameInfoCallback & callback )
static

Find game info by name asynchronously.

Parameters
gameNameName of the game to search for
callbackFunction to call with results

Definition at line 866 of file protondb_service.cpp.

References findGameByName().

◆ getGameInfo()

ProtonDBGameInfo ProtonDBService::getGameInfo ( int steamAppId)
static

Get game info by Steam App ID.

Parameters
steamAppIdSteam App ID to look up
Returns
ProtonDBGameInfo with compatibility data and recommendations

Makes HTTP requests to ProtonDB APIs. May block for several seconds. For UI updates, prefer getGameInfoAsync().

Definition at line 585 of file protondb_service.cpp.

References Logger::debug(), ProtonDBGameInfo::errorMessage, ProtonDBGameInfo::found, Logger::info(), ProtonDBGameInfo::tweaks, and Logger::warn().

Referenced by findGameByName(), getGameInfoAsync(), and getTier().

◆ getGameInfoAsync()

void ProtonDBService::getGameInfoAsync ( int steamAppId,
const GameInfoCallback & callback )
static

Get game info asynchronously.

Parameters
steamAppIdSteam App ID to look up
callbackFunction to call with results (called from background thread)

Returns immediately. Callback is invoked when data is available. Callback may be invoked from a different thread.

Definition at line 728 of file protondb_service.cpp.

References getGameInfo().

◆ getLutrisInfo()

LutrisGameInfo ProtonDBService::getLutrisInfo ( int steamAppId)
static

Get Lutris game info and installers.

Parameters
steamAppIdSteam App ID to search for
Returns
LutrisGameInfo with available install scripts

Fetches community-tested installation scripts from Lutris database. These contain working configurations for many games.

Definition at line 1237 of file protondb_service.cpp.

References LutrisInstaller::battleye, Logger::debug(), LutrisInstaller::dllOverrides, LutrisInstaller::eac, LutrisInstaller::environmentVariables, LutrisGameInfo::found, LutrisInstaller::found, Logger::info(), LutrisGameInfo::installers, LutrisGameInfo::name, LutrisInstaller::name, LutrisInstaller::runner, LutrisGameInfo::slug, LutrisInstaller::slug, LutrisGameInfo::steamId, LutrisInstaller::version, Logger::warn(), and LutrisInstaller::wineVersion.

Referenced by getLutrisInfoAsync(), and getLutrisInfoBySlug().

◆ getLutrisInfoAsync()

void ProtonDBService::getLutrisInfoAsync ( int steamAppId,
const std::function< void(const LutrisGameInfo &)> & callback )
static

Get Lutris info asynchronously.

Definition at line 1451 of file protondb_service.cpp.

References getLutrisInfo().

◆ getLutrisInfoBySlug()

LutrisGameInfo ProtonDBService::getLutrisInfoBySlug ( const std::string & gameSlug)
static

Get Lutris info by game slug.

Parameters
gameSlugLutris game slug (e.g., "counter-strike-2")

Definition at line 1412 of file protondb_service.cpp.

References Logger::debug(), LutrisGameInfo::found, getLutrisInfo(), LutrisGameInfo::gogId, LutrisGameInfo::installers, LutrisGameInfo::name, LutrisGameInfo::slug, and LutrisGameInfo::steamId.

◆ getSteamAppInfo()

SteamAppInfo ProtonDBService::getSteamAppInfo ( int steamAppId)
static

Get Steam store information (native Linux, genres, DRM, etc.).

Parameters
steamAppIdSteam App ID
Returns
SteamAppInfo with store metadata

Checks if game has native Linux support, controller support, genres, etc. Essential for determining if Proton is even needed.

Definition at line 1102 of file protondb_service.cpp.

References SteamAppInfo::controllerSupport, Logger::debug(), SteamAppInfo::developer, SteamAppInfo::drmNotice, SteamAppInfo::found, SteamAppInfo::genres, SteamAppInfo::hasCloudSaves, SteamAppInfo::hasMultiplayer, Logger::info(), SteamAppInfo::name, SteamAppInfo::publisher, SteamAppInfo::steamAppId, SteamAppInfo::supportsLinux, SteamAppInfo::supportsMac, SteamAppInfo::supportsWindows, and Logger::warn().

Referenced by getSteamAppInfoAsync().

◆ getSteamAppInfoAsync()

void ProtonDBService::getSteamAppInfoAsync ( int steamAppId,
const std::function< void(const SteamAppInfo &)> & callback )
static

Get Steam app info asynchronously.

Definition at line 1217 of file protondb_service.cpp.

References getSteamAppInfo().

◆ getSteamDeckInfo()

SteamDeckInfo ProtonDBService::getSteamDeckInfo ( int steamAppId)
static

Get Steam Deck compatibility status from Valve's testing.

Parameters
steamAppIdSteam App ID
Returns
SteamDeckInfo with verification status and notes

Uses Steam's official Deck compatibility API. Results indicate whether Valve has tested and verified the game for Steam Deck.

Definition at line 972 of file protondb_service.cpp.

References SteamDeckInfo::compatibility, SteamDeckInfo::compatibilityString, SteamDeckInfo::controllerSupport, Logger::debug(), SteamDeckInfo::found, Logger::info(), SteamDeckInfo::nativeResolution, Playable, SteamDeckInfo::protonCompatible, Unknown, Unsupported, Verified, and Logger::warn().

Referenced by getSteamDeckInfoAsync().

◆ getSteamDeckInfoAsync()

void ProtonDBService::getSteamDeckInfoAsync ( int steamAppId,
const std::function< void(const SteamDeckInfo &)> & callback )
static

Get Steam Deck compatibility asynchronously.

Definition at line 1082 of file protondb_service.cpp.

References getSteamDeckInfo().

◆ getTier()

std::string ProtonDBService::getTier ( int steamAppId)
static

Get compatibility tier for a game (quick lookup).

Parameters
steamAppIdSteam App ID
Returns
Tier string ("platinum", "gold", etc.) or empty if not found

Definition at line 689 of file protondb_service.cpp.

References getGameInfo(), and ProtonDBGameInfo::tier.

◆ getTierColor()

void ProtonDBService::getTierColor ( const std::string & tier,
float & r,
float & g,
float & b,
float & a )
static

Get tier color for UI display (RGBA).

Parameters
tierTier string (e.g., "platinum", "gold", "silver", "bronze", "borked").
[out]rRed channel in [0.0, 1.0].
[out]gGreen channel in [0.0, 1.0].
[out]bBlue channel in [0.0, 1.0].
[out]aAlpha channel in [0.0, 1.0].

Definition at line 903 of file protondb_service.cpp.

◆ getTierDescription()

std::string ProtonDBService::getTierDescription ( const std::string & tier)
static

Get human-readable tier description.

Parameters
tierTier string (e.g., "platinum")
Returns
Description (e.g., "Works perfectly out of the box")

Definition at line 886 of file protondb_service.cpp.

◆ searchByName()

std::vector< ProtonDBSearchResult > ProtonDBService::searchByName ( const std::string & gameName,
int maxResults = 10 )
static

Search for games by name.

Parameters
gameNameName to search for (partial match supported)
maxResultsMaximum results to return
Returns
Vector of search results

Definition at line 642 of file protondb_service.cpp.

References Logger::info(), and Logger::warn().

Referenced by findGameByName(), and searchByNameAsync().

◆ searchByNameAsync()

void ProtonDBService::searchByNameAsync ( const std::string & gameName,
const SearchCallback & callback,
int maxResults = 10 )
static

Search for games by name asynchronously.

Parameters
gameNameName to search for
callbackFunction to call with results
maxResultsMaximum results to return

Definition at line 743 of file protondb_service.cpp.

References searchByName().


The documentation for this class was generated from the following files: