94 lines
4.3 KiB
C++
94 lines
4.3 KiB
C++
////////////////////////////////////////////////////////////////////////////////
|
|
// (c) Copyright, Ubisoft Entertainment Inc. || Created by Harbour //
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
#pragma once
|
|
#include "ubiservices/core/configs/config.h"
|
|
#include "ubiservices/core/configs/gameConfig.h"
|
|
#include "ubiservices/core/configs/systemConfig.h"
|
|
#if !defined(US_UNITY3D)
|
|
#include <ealmem.h>
|
|
#include <eallog.h>
|
|
#endif
|
|
|
|
// #if defined(DOXYGEN)
|
|
// #define US_NS ubiservices
|
|
// #define namespace US_NS { namespace US_NS {
|
|
// #define } }
|
|
// #define US_NS_USING using namespace US_NS;
|
|
// #endif
|
|
|
|
/// @cond PREVENTS_DOXYGEN_WARNING
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// These functions must be called in the proper sequence to initialize and
|
|
// shutdown the SDK. Here is the proper sequence:
|
|
//
|
|
// US_NS::initializeSdk(); // Initializes memory
|
|
//
|
|
// // Apply configuration
|
|
// const US_NS::GameConfig config("111122223333-4444-5555-6666-77778888", "myGame_CL123456");
|
|
// const US_NS::ConfigureResult result = US_NS::configureSdk(config);
|
|
// assert(result == US_NS::ConfigureResult::Success);
|
|
//
|
|
// // Game loop...
|
|
//
|
|
// // On game exit, shutdown UbiServices SDK and wait for completion
|
|
// while(US_NS::uninitializeSdk() == UninitializeResult::InProgress)
|
|
// {
|
|
// sleep(20);
|
|
// }
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
struct eal_log_dll_interface;
|
|
struct eal_mem_dll_interface;
|
|
/// @endcond
|
|
|
|
namespace US_NS {;
|
|
|
|
/// @addindex ConfigureResult
|
|
/// Defines the \c US_NS::configureSdk result codes.
|
|
enum class ConfigureResult
|
|
{
|
|
Success,
|
|
ApplicationIdNotValid, //!< The \c ApplicationId does not respect the GUID format.
|
|
ApplicationBuildIdNotValid, //!< The \c ApplicationBuildId contains one or more of the following characters: <>*%&:\?
|
|
EnvironmentNotValid, //!< The specified environment does not match any known environment
|
|
FirstPartyModulesNotLoaded, //!< PS4 only: The modules needed for UbiServices have not been loaded.
|
|
UbisoftGameSkuIsEmpty, //!< The Ubisoft Game SKU is empty and it should not. Game SKU is mandatory.
|
|
ApplicationFirstPartyProductIdIsEmpty, //!< The Application First Party Product ID is empty and should not. Product ID is mandatory
|
|
FirstPartyJsonHasNotBeenInitialized, //!< PsApi only: The game is responsible to initialize the sce::Json. Return an error if it was not done.
|
|
};
|
|
|
|
/// Initializes the modules required by the SDK (e.g.: EAL, JSON)
|
|
/// @param logInterface The EAL interface log module. If null, the SDK uses a default interface.
|
|
/// @param memInterface The EAL interface memory module. If null, the SDK uses a default interface.
|
|
/// @note If you build the SDK has a DLL, make sure you have the US_DLL compiler definition/flag.
|
|
/// @warning If you are calling the SDK from a shared module (DLL) that doesn't
|
|
/// link against EAL, you must provide the interfaces. You also need to make sure
|
|
/// that your shared module has the required EAL_IMPORT_DLL compiler definition/flag.
|
|
inline void initializeSdk(const eal_log_dll_interface* logInterface = nullptr, const eal_mem_dll_interface* memInterface = nullptr);
|
|
|
|
/// Initializes the UbiServices SDK and memory.
|
|
/// @note This function MUST be called prior to using any of the UbiServices features.
|
|
/// This call must match with a call to \c US_NS::uninitializeSdk to prevent memory leaks.
|
|
ConfigureResult US_DLL_API configureSdk(const GameConfig& gameConfig, const SystemConfig& systemConfig = SystemConfig());
|
|
|
|
/// @addindex UninitializeResult
|
|
enum class UninitializeResult
|
|
{
|
|
Complete,
|
|
InProgress
|
|
};
|
|
|
|
/// Steps through the uninitializing request and completes the process.
|
|
/// @return \c UninitializeResult::Complete once the process is completed.
|
|
/// @note This call invalidates all the instantiated facades, canceling
|
|
/// all remaining calls and freeing memory.
|
|
/// @warning There should be no more call to any function/method from the SDK after
|
|
/// calling this function besides \c initializeSdk
|
|
/// @warning All objects from the SDK shall also be destroyed prior to calling this method
|
|
/// including the objects passed in to \c US_NS::configureSdk
|
|
UninitializeResult US_DLL_API uninitializeSdk();
|
|
|
|
};
|
|
|
|
#include "ubiservices/ubiservices.inl"
|