RetroAchievements

This is the main class to interact with RetroAchievements.

Note

For a proper guide on how to use this integration, please refer to the dedicated integration guide.

Methods

Type

Name

bool

is_available

String

get_cheevos_dir

String

get_cheevos_hash_cache_path

Dictionary

build_auth

RetroAchievements.GameInfo

get_game_info

String

get_game_hash


static bool is_available ()

Indicates whether the RetroAchievements integration is enabled by the user. If this returns false, any usage of this API results in undefined behavior.

Warning

It is only safe to instantiate this class if this function returns true. Otherwise, the instance will remove itself and become null, which may cause crashes.

Note

This only refers to RetroHub’s configuration. The API itself may be unavailable for other reasons, such as the user not being logged in, or network issues.


static String get_cheevos_dir ()

Returns the path to the directory where RetroAchievements stores its data. Used internally by RetroHub.


static String get_cheevos_hash_cache_path ()

Returns the path to the file where RetroAchievements stores the known ROM hashes. Used internally by RetroHub.


Dictionary build_auth (bool reload_credentials = false)

Builds an authentication Dictionary, needed for any raw API calls. If reload_credentials is true, the credentials will be re-fetched from the user’s configuration.

Warning

You will only need to reload_credentials if using the RetroAchievements.Raw endpoints; if you’re only using the high-level API calls on this page, this is not needed.

Additionally, only reload_credentials when you known the credentials are invalid (e.g. receiving 401 HTTP response codes), as every force reload will cause file I/O to load user credentials.


Returns a RetroAchievements.GameInfo object for the given game. This object contains all achievement information for themes to use.

Note

This function is asynchronous; use await to wait for it’s completion.


String get_game_hash (RetroHubGameData data)

Returns the hash of the given game. This is used for identifying game files in RetroAchievements.

Note

RetroAchievements has it’s own hashing algorithms dependant on different game files. Check their documentation for more information.