229 lines
6 KiB
C
229 lines
6 KiB
C
#ifndef UMP_H
|
|
#define UMP_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#define UMP_VERSION_MAJOR 1 // Max value 255
|
|
#define UMP_VERSION_MINOR 0 // Max value 65535
|
|
#define UMP_VERSION_MICRO 0 // Max value 255
|
|
#define UMP_VERSION ((UMP_VERSION_MAJOR << 24) | (UMP_VERSION_MINOR << 8) | UMP_VERSION_MICRO)
|
|
#define UMP_VERSION_STRING #UMP_VERSION_MAJOR "." #UMP_VERSION_MINOR "." #UMP_VERSION_MICRO
|
|
|
|
#if defined(_MSC_VER)
|
|
# define UMP_API_DECL_EXPORT __declspec(dllexport)
|
|
# define UMP_API_DECL_IMPORT __declspec(dllimport)
|
|
# define UMP_CALL __stdcall
|
|
#elif defined(__clang__) || defined(__GNUC__)
|
|
# define UMP_API_DECL_EXPORT __attribute__((visibility("default")))
|
|
# define UMP_API_DECL_IMPORT __attribute__((visibility("default")))
|
|
# define UMP_CALL
|
|
#else
|
|
# define UMP_API_DECL_EXPORT
|
|
# define UMP_API_DECL_IMPORT
|
|
# define UMP_CALL
|
|
#endif
|
|
|
|
#if defined(UMP_API_BUILD_LIB)
|
|
# define UMP_API UMP_API_DECL_EXPORT
|
|
#else
|
|
# define UMP_API UMP_API_DECL_IMPORT
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
#pragma pack(push, 8)
|
|
|
|
typedef enum
|
|
{
|
|
UMP_Result_Ok = 0,
|
|
UMP_Result_InvalidArgs = -1,
|
|
UMP_Result_UninitializedSubsystem = -2,
|
|
UMP_Result_CommunicationError = -3,
|
|
UMP_Result_MemoryError = -4,
|
|
UMP_Result_NotFound = -5,
|
|
UMP_Result_InternalError = -6,
|
|
UMP_Result_NotImplemented = -7,
|
|
UMP_Result_Canceled = -8,
|
|
UMP_Result_AuthenticationFailed = -9,
|
|
UMP_Result_Unavailable = -10
|
|
} UMP_Result;
|
|
|
|
struct UMP_Context;
|
|
|
|
typedef enum
|
|
{
|
|
UMP_ContextSubsystem_None = 0,
|
|
UMP_ContextSubsystem_User = 1 << 0
|
|
}
|
|
UMP_ContextSubsystem;
|
|
|
|
typedef struct UMP_ContextSettings
|
|
{
|
|
uint64_t subsystems;
|
|
}
|
|
UMP_ContextSettings;
|
|
|
|
typedef enum
|
|
{
|
|
UMP_EventType_None = 0,
|
|
UMP_EventType_OverlayShown = 10000,
|
|
UMP_EventType_OverlayHidden = 10001,
|
|
UMP_EventType_OverlayInputSourceChanged = 10002
|
|
}
|
|
UMP_EventType;
|
|
|
|
typedef enum
|
|
{
|
|
UMP_OverlaySection_None = 0,
|
|
UMP_OverlaySection_Club = 1,
|
|
UMP_OverlaySection_ClubRewards = 2,
|
|
UMP_OverlaySection_ClubChallenges = 3
|
|
}
|
|
UMP_OverlaySection;
|
|
|
|
typedef enum
|
|
{
|
|
UMP_OverlayInputSource_None = 0,
|
|
UMP_OverlayInputSource_KeyboardMouse = 1,
|
|
UMP_OverlayInputSource_GamepadGeneric = 2,
|
|
UMP_OverlayInputSource_GamepadNintendo = 3,
|
|
UMP_OverlayInputSource_GamepadPlayStation = 4,
|
|
UMP_OverlayInputSource_GamepadStadia = 5,
|
|
}
|
|
UMP_OverlayInputSource;
|
|
|
|
typedef struct UMP_EventData_OverlayVisibilityChanged
|
|
{
|
|
uint8_t visible;
|
|
}
|
|
UMP_EventData_OverlayVisibilityChanged;
|
|
|
|
typedef struct UMP_EventData_OverlayInputSourceChanged
|
|
{
|
|
uint32_t inputSource;
|
|
}
|
|
UMP_EventData_OverlayInputSourceChanged;
|
|
|
|
typedef union UMP_EventData
|
|
{
|
|
struct UMP_EventData_OverlayVisibilityChanged overlayVisibilityChanged;
|
|
struct UMP_EventData_OverlayInputSourceChanged overlayInputSourceChanged;
|
|
}
|
|
UMP_EventData;
|
|
|
|
typedef struct UMP_Event
|
|
{
|
|
uint32_t type;
|
|
union UMP_EventData data;
|
|
}
|
|
UMP_Event;
|
|
|
|
typedef enum
|
|
{
|
|
UMP_Environment_None = 0,
|
|
UMP_Environment_Prod = 1,
|
|
UMP_Environment_Uat = 2,
|
|
UMP_Environment_Dev = 3,
|
|
UMP_Environment_Cert2 = 4
|
|
}
|
|
UMP_Environment;
|
|
|
|
typedef struct UMP_UserAuthenticateInfo
|
|
{
|
|
int32_t size;
|
|
const char* userTicketUtf8;
|
|
const char* platformTypeUtf8;
|
|
int32_t environment;
|
|
const char* localeUtf8;
|
|
const char* sessionIdUtf8;
|
|
uint8_t isAccountLinked;
|
|
const char* spaceIdUtf8;
|
|
} UMP_UserAuthenticateInfo;
|
|
|
|
typedef struct UMP_SessionInitInfo
|
|
{
|
|
int32_t size;
|
|
const char* sessionIdUtf8;
|
|
const char* spaceIdUtf8;
|
|
const char* userTicketUtf8;
|
|
int32_t environment;
|
|
} UMP_SessionInitInfo;
|
|
|
|
typedef struct UMP_VirtualKeyboardSettings
|
|
{
|
|
int32_t size;
|
|
const char* initStrUtf8;
|
|
} UMP_VirtualKeyboardSettings;
|
|
|
|
typedef void(UMP_CALL *UMP_Callback)(int32_t inResult, void* inData);
|
|
typedef void(UMP_CALL *UMP_EventHandler)(UMP_Event* inEvent, void* inData);
|
|
|
|
#pragma pack(pop)
|
|
|
|
UMP_API int32_t UMP_CALL UMP_Init(
|
|
const char* inApplicationId);
|
|
UMP_API void UMP_CALL UMP_Uninit();
|
|
|
|
UMP_API const char* UMP_CALL UMP_ErrorToString(
|
|
int32_t inError);
|
|
|
|
UMP_API struct UMP_Context* UMP_CALL UMP_ContextCreate(
|
|
uint32_t inVersion,
|
|
UMP_ContextSettings* inOptSettings);
|
|
UMP_API int32_t UMP_CALL UMP_ContextFree(
|
|
struct UMP_Context* inContext);
|
|
|
|
UMP_API int32_t UMP_CALL UMP_Update(
|
|
struct UMP_Context* inContext);
|
|
UMP_API int32_t UMP_CALL UMP_Cancel(
|
|
struct UMP_Context* inContext,
|
|
int32_t inHandle);
|
|
|
|
UMP_API int32_t UMP_CALL UMP_EventNextPeek(
|
|
struct UMP_Context* inContext,
|
|
UMP_Event* outEvent);
|
|
UMP_API int32_t UMP_CALL UMP_EventNextPoll(
|
|
struct UMP_Context* inContext,
|
|
UMP_Event* outEvent);
|
|
UMP_API int32_t UMP_CALL UMP_EventRegisterHandler(
|
|
struct UMP_Context* inContext,
|
|
int32_t inType,
|
|
UMP_EventHandler inHandler,
|
|
void* inOptHandlerData);
|
|
|
|
UMP_API int32_t UMP_CALL UMP_UserAuthenticate(
|
|
struct UMP_Context* inContext,
|
|
UMP_UserAuthenticateInfo* inInfo,
|
|
UMP_Callback inCallback,
|
|
void* inOptCallbackData);
|
|
|
|
UMP_API int32_t UMP_CALL UMP_OverlayShow(
|
|
struct UMP_Context* inContext,
|
|
uint32_t inSection,
|
|
const char* inOptSectionArg,
|
|
UMP_Callback inOptCallback,
|
|
void* inOptCallbackData);
|
|
|
|
UMP_API int32_t UMP_CALL UMP_SessionInit(
|
|
struct UMP_Context* inContext,
|
|
UMP_SessionInitInfo* inSessionInfo,
|
|
UMP_Callback inCallback,
|
|
void* inOptCallbackData);
|
|
|
|
UMP_API int32_t UMP_CALL UMP_VirtualKeyboardInput(
|
|
struct UMP_Context* inContext,
|
|
UMP_VirtualKeyboardSettings* inOptKeyboardSettings,
|
|
char** outInputUtf8,
|
|
UMP_Callback inCallback,
|
|
void* inCallbackData);
|
|
|
|
UMP_API int32_t UMP_CALL UMP_VirtualKeyboardInputFree(
|
|
struct UMP_Context* inContext,
|
|
char* inInputUtf8);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // UMP_H
|