JD2022-TU1/main/extern/UplaySDK/include/Uplay/UplayGameTokenInterface.h

48 lines
1.7 KiB
C++

#pragma once
// This is the interface for the Denuvo wrapper
// These defines always point to the most recent version of the interface and data.
// That way the loader dll will use the latest version correctly.
#define CURRENT_UPlayDenuvoUserData UPlayDenuvoUserDataV1
#define CURRENT_IGameTokenInterface IGameTokenInterfaceV1
#define CURRENT_IGameTokenInterfaceVersion 1
enum GameTokenState
{
GameTokenState_Unavailable = 0,
GameTokenState_Available,
GameTokenState_Pending,
GameTokenState_Abort, // Unrecoverable state, application shall exit.
};
// When planning to change this interface then make a copy, increase the version number and point the #defines to the new number.
struct CURRENT_UPlayDenuvoUserData
{
size_t myGameId;
};
class CURRENT_IGameTokenInterface
{
public:
// Tells us the state of the GameToken.
virtual GameTokenState GetState() const = 0;
// In case of failure we can use this to query the failure reason.
// The API will handle all failures (and exit), thus this will never be called
virtual int GetResult() const = 0;
// Async or blocking, this shall set the state to PENDING, while that is case we must wait for the token to be ready.
virtual bool QueryToken(
const void *requestToken,
size_t requestTokenSize) = 0;
// Invalidates the current GameToken, this might be in the case of a hardware change, calling this
// should reset the state to UNAVAILABLE and purge the existing GameToken.
// A new GameToken must be obtained from the server via queryToken.
virtual void InvalidateToken() = 0;
// Returns the buffer to the GameToken and its size, returns nullptr if not available.
virtual const void* GetToken(
size_t* pSizeRes) const = 0;
};