302 lines
10 KiB
C
302 lines
10 KiB
C
/**
|
|
* @mainpage Uplay PC API
|
|
*
|
|
* The Uplay PC API gives developers access to the following functionality of Uplay PC
|
|
* client:
|
|
*
|
|
* \li Friends
|
|
* \li Party
|
|
* \li Overlay
|
|
* \li Game session information
|
|
* \li Avatar images
|
|
* \li Achievements
|
|
* \li Save games
|
|
* \li User credentials
|
|
*
|
|
* The API is provided as C++ DLL (dynamic link library) and corresponding header and
|
|
* library files, and all API functions have extensive documentation comments.
|
|
*
|
|
* The developer links their game executable with a loader DLL that act as a proxy to
|
|
* the actual API implementation provided by the Uplay PC client installation. This
|
|
* way the game will always use an up-to-date version of the API implementation that
|
|
* matches in version with the Uplay PC client.
|
|
*
|
|
* The API implementation works by communicating with the running Uplay PC client
|
|
* process through a named pipe. This is different from other APIs which implement
|
|
* their services in the linked library itself, and means that the Uplay PC client
|
|
* process must be running in the background for the API to work.
|
|
*/
|
|
|
|
/**
|
|
* @file Uplay.h Uplay Main API
|
|
* @brief Main header file for the Uplay PC API.
|
|
*
|
|
* This file should be included in files that needs to use the Uplay PC API.
|
|
*/
|
|
#ifndef UPLAY_H
|
|
#define UPLAY_H
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif
|
|
|
|
#ifndef UPLAY_API
|
|
#ifdef _WIN32
|
|
#if defined EXPORTING_DLL
|
|
#define UPLAY_API __declspec(dllexport)
|
|
#elif defined IMPORTING_DLL
|
|
#define UPLAY_API __declspec(dllimport)
|
|
#else
|
|
#define UPLAY_API
|
|
#endif
|
|
#endif // _Win32
|
|
|
|
#ifdef __APPLE__
|
|
#define UPLAY_API __attribute__((visibility("default")))
|
|
#define __cdecl
|
|
#endif // __APPLE__
|
|
#endif // UPLAY_API
|
|
|
|
#include "Uplay/UplayAchievements.h"
|
|
#include "Uplay/UplayAvatar.h"
|
|
#include "Uplay/UplayChat.h"
|
|
#include "Uplay/UplayFriends.h"
|
|
#include "Uplay/UplayEvent.h"
|
|
#include "Uplay/UplayInstaller.h"
|
|
#include "Uplay/UplayMetadata.h"
|
|
#include "Uplay/UplayOverlay.h"
|
|
#include "Uplay/UplayParty.h"
|
|
#include "Uplay/UplaySaveGame.h"
|
|
#include "Uplay/UplayUser.h"
|
|
#include "Uplay/UplayWin.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif // __cplusplus
|
|
|
|
/************************************************************************************//**
|
|
* @defgroup main Main
|
|
* @brief Main functions
|
|
*
|
|
* @{
|
|
*/
|
|
|
|
/************************************************************************************//**
|
|
* @enum UPLAY_StartResult
|
|
* @brief UPLAY_Start result values.
|
|
*/
|
|
enum UPLAY_StartResult
|
|
{
|
|
/** Uplay start operation was successful */
|
|
UPLAY_StartResult_Ok,
|
|
/** Uplay start operation failed */
|
|
UPLAY_StartResult_Failed,
|
|
/** Uplay platform will be started, game process should quit now */
|
|
UPLAY_StartResult_ExitProcessRequired,
|
|
/** Uplay platform could not be found, something is wrong with the installation */
|
|
UPLAY_StartResult_InstallationError,
|
|
/** Game should notify user that desktop interaction is required in order to proceed. Game process should quit afterwards*/
|
|
UPLAY_StartResult_DesktopInteractionRequired,
|
|
};
|
|
|
|
/************************************************************************************//**
|
|
* @enum UPLAY_StartFlags
|
|
* @brief Flag values determining the game launch behavior (used in ::UPLAY_Start)
|
|
*/
|
|
enum UPLAY_StartFlags
|
|
{
|
|
/** No special flags */
|
|
UPLAY_StartFlags_None = 0x0,
|
|
/** Tells Uplay PC to restart on UAT environment if it's already running on PROD, ignored if UPLAY_StartFlags_Dev is not used */
|
|
UPLAY_StartFlags_DevUAT = 0x2,
|
|
/** Starts in Dev mode, game is never restarted by Uplay in Dev mode. Make sure it's used only during development process, this flag should not be used in production */
|
|
UPLAY_StartFlags_Dev = 0x4,
|
|
/**
|
|
*@note More flags can be added in future versions of the API.
|
|
*/
|
|
};
|
|
|
|
/************************************************************************************//**
|
|
* @enum UPLAY_LanguageCountryCode
|
|
* @brief Supported Language Country Code values (used in ::UPLAY_SetLanguage)
|
|
*/
|
|
enum UPLAY_LanguageCountryCode
|
|
{
|
|
/** Czech (as spoken in Czech Republic) */
|
|
UPLAY_LanguageCountryCode_csCZ = 0,
|
|
/** Danish (as spoken in Denmark) */
|
|
UPLAY_LanguageCountryCode_daDK,
|
|
/** German (as spoken in Germany) */
|
|
UPLAY_LanguageCountryCode_deDE,
|
|
/** English (as spoken in Canada) */
|
|
UPLAY_LanguageCountryCode_enCA,
|
|
/** English (as spoken in United States) */
|
|
UPLAY_LanguageCountryCode_enUS,
|
|
/** Spanish (as spoken in Spain) */
|
|
UPLAY_LanguageCountryCode_esES,
|
|
/** Finnish (as spoken in Finland) */
|
|
UPLAY_LanguageCountryCode_fiFI,
|
|
/** French (as spoken in France) */
|
|
UPLAY_LanguageCountryCode_frFR,
|
|
/** Hungarian (as spoken in Hungary) */
|
|
UPLAY_LanguageCountryCode_huHU,
|
|
/** Italian (as spoken in Italy) */
|
|
UPLAY_LanguageCountryCode_itIT,
|
|
/** Japanese (as spoken in Japan) */
|
|
UPLAY_LanguageCountryCode_jaJP,
|
|
/** Korean (as spoken in Korea) */
|
|
UPLAY_LanguageCountryCode_koKO,
|
|
/** Norwegian (as spoken in Norway) */
|
|
UPLAY_LanguageCountryCode_nbNO,
|
|
/** Dutch (as spoken in Netherlands) */
|
|
UPLAY_LanguageCountryCode_nlNL,
|
|
/** Polish (as spoken in Poland) */
|
|
UPLAY_LanguageCountryCode_plPL,
|
|
/** Portuguese (as spoken in Brazil) */
|
|
UPLAY_LanguageCountryCode_ptBR,
|
|
/** Portuguese (as spoken in Portugal) */
|
|
UPLAY_LanguageCountryCode_ptPT,
|
|
/** Russian (as spoken in Russia) */
|
|
UPLAY_LanguageCountryCode_ruRU,
|
|
/** Swedish (as spoken in Sweden) */
|
|
UPLAY_LanguageCountryCode_svSE,
|
|
/** Chinese (as spoken in China) */
|
|
UPLAY_LanguageCountryCode_zhCN,
|
|
/** Chinese (as spoken in Taiwan) */
|
|
UPLAY_LanguageCountryCode_zhTW,
|
|
/** Spanish (as spoken in Mexico) */
|
|
UPLAY_LanguageCountryCode_esMX,
|
|
/**
|
|
*@note More languages can be added in future versions of the API.
|
|
*/
|
|
};
|
|
|
|
/************************************************************************************//**
|
|
* @fn int UPLAY_Start(UPLAY_uint32, UPLAY_uint32)
|
|
* @brief Starts the Uplay platform if not running
|
|
*
|
|
* @param aUplayId
|
|
* Id of the game running
|
|
* @param aFlags
|
|
* Bitmask with flags from ::UPLAY_StartFlags
|
|
*
|
|
* @returns The following ::UPLAY_StartResult values can be returned:
|
|
*
|
|
* Result | Description
|
|
* ---------------------------------------------|------------
|
|
* UPLAY_StartResult_Ok | Startup was successful.
|
|
* UPLAY_StartResult_Failed | Error occur during the startup. UPLAY_GetLastError can be used for detailed description.
|
|
* UPLAY_StartResult_ExitProcessRequired | No connection to the Uplay platform could be made. The caller has to exit its process as the API does not work without the platform running. The caller process will be restarted by the platform once it is running.
|
|
* UPLAY_StartResult_InstallationError | Something is wrong with the UplayPC installation.
|
|
* UPLAY_StartResult_DesktopInteractionRequired | User interaction with UplayPC platform is needed.
|
|
*/
|
|
int
|
|
UPLAY_API UPLAY_Start(
|
|
UPLAY_uint32 aUplayId,
|
|
UPLAY_uint32 aFlags);
|
|
|
|
/************************************************************************************//**
|
|
* @fn UPLAY_uint8 UPLAY_GetNextEvent(UPLAY_Event*)
|
|
* @brief Get next pending event
|
|
*
|
|
* Shall be called upon successful call to ::UPLAY_Update repeatedly to receive all pending events.
|
|
*
|
|
* @param aEvent
|
|
* Gets updated with the new event
|
|
*
|
|
* @returns \c Zero if there are no more events
|
|
*/
|
|
UPLAY_uint8
|
|
UPLAY_API UPLAY_GetNextEvent(
|
|
struct UPLAY_Event* aEvent);
|
|
|
|
/************************************************************************************//**
|
|
* @fn int UPLAY_PeekNextEvent(UPLAY_Event*)
|
|
* @brief Peek next pending event
|
|
*
|
|
* Will not remove any event. To remove events, use UPLAY_GetNextEvent.
|
|
*
|
|
* @param aEvent
|
|
* Gets updated with the next event
|
|
*
|
|
* @returns \c Zero if there are no more events
|
|
*/
|
|
int
|
|
UPLAY_API UPLAY_PeekNextEvent(
|
|
struct UPLAY_Event* aEvent);
|
|
|
|
/************************************************************************************//**
|
|
* @fn int UPLAY_Update
|
|
* @brief Check for overlapped results
|
|
*
|
|
* Shall be used to query overlapped operation results and events from launcher.
|
|
*
|
|
* @returns Non-zero on success
|
|
*
|
|
* @note Game shall call this API repeatedly. One call at a time is enough to gather
|
|
* all pending updates. Game should do something else like wait or yield CPU
|
|
* before calling this API again. Overlapped operation result retrieval
|
|
* depends on game calling this API.
|
|
*/
|
|
int
|
|
UPLAY_API UPLAY_Update();
|
|
|
|
/************************************************************************************//**
|
|
* @fn int UPLAY_SetLanguage(UPLAY_uint32)
|
|
* @brief Set Uplay API language, which is used for all API calls that support localized data.
|
|
* Game shall set Uplay API language on game start and update it every time
|
|
* the language is changed in the game's settings. Uplay API language is used in calls like
|
|
* UPLAY_WIN_GetActions, UPLAY_WIN_GetRewards and UPLAY_ACH_GetAchievements.
|
|
*
|
|
* @param aLanguageCountryCode
|
|
* Language Country Code from ::UPLAY_LanguageCountryCode
|
|
*
|
|
* @returns Non-zero on success. Zero if Language Country Code is not supported.
|
|
*
|
|
* @note Overlapped calls in progress while calling this method will not affect overlapped results.
|
|
* If no call to set language is done, the language of Uplay client will be used.
|
|
* If an invalid language code is used, language will not change.
|
|
*/
|
|
int
|
|
UPLAY_API UPLAY_SetLanguage(
|
|
UPLAY_uint32 aLanguageCountryCode);
|
|
|
|
/************************************************************************************//**
|
|
* @fn int UPLAY_GetLastError(char aOutErrorString[512])
|
|
* @brief Get last error description
|
|
*
|
|
* Get an error string describing the last occurred error.
|
|
*
|
|
* @param aOutErrorString
|
|
* Output buffer for error string.
|
|
*
|
|
* @returns Non-zero on success
|
|
*
|
|
* @note Should only be called after API functions specifically requiring its usage.
|
|
*/
|
|
int
|
|
UPLAY_API UPLAY_GetLastError(
|
|
char aOutErrorString[512]);
|
|
|
|
/************************************************************************************//**
|
|
* @fn int UPLAY_Quit()
|
|
* @brief Closes the Uplay connection
|
|
*
|
|
* Shall be called to end using Uplay API.
|
|
*
|
|
* @returns Non-zero on success
|
|
*
|
|
* @note No API usage is allowed after calling this function.
|
|
*/
|
|
int
|
|
UPLAY_API UPLAY_Quit();
|
|
|
|
/** @} */
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif // __cplusplus
|
|
|
|
#endif // UPLAY_H
|
|
|