Skip to content

c_api.h File Reference

An SDK for handling multiple different types of game hosting systems in one set of calls.

Summary

KindViewDescription
structRallyHereStatsBase
structRallyHereStatsBaseProvided
enumRallyHereLogLevel
typedefRallyHereLogLevel
typedefRallyHereLogCallbackLog callback function.
RH_EXPORT voidrallyhere_set_default_log_level(RallyHereLogLevel level)Sets the default log level for the SDK and any adapters created. This is only used if a log callback is not set.
typedefRallyHereGameInstanceAdapterPtrOpaque type and handle to a Rally Here Game Instance Adapter.
typedefRallyHereStringMapPtrOpaque type and handle to a Rally Here String Map.
typedefRallyHereOnAllocatedCallbackCallback to be sent when an allocation is received from the game host adapter.
RH_EXPORT voidrallyhere_allocator_set_alloc(void ()(unsigned int size) callback)Optional custom memory alloc override.
RH_EXPORT voidrallyhere_allocator_set_free(void(*)(void *) callback)Optional custom memory free override.
RH_EXPORT voidrallyhere_allocator_set_realloc(void ()(void *, unsigned int size) callback)Optional custom memory realloc override.
RH_EXPORT voidrallyhere_global_init()Initialize the Rally Here SDK.
RH_EXPORT voidrallyhere_global_cleanup()Cleanup the Rally Here SDK.

Logging

Logging levels that will passed to the optional log callback function

RallyHereLogLevel

EnumeratorInitializer
RH_LOG_LEVEL_ERROR
RH_LOG_LEVEL_INFO
RH_LOG_LEVEL_DEBUG
RH_LOG_LEVEL_TRACE

RallyHereLogLevel

typedef enum RallyHereLogLevel RallyHereLogLevel

RallyHereLogCallback

typedef void(* RallyHereLogCallback)(RallyHereLogLevel level, const char *message, size_t messagen, void *user_data)Log callback function.

rallyhere_set_default_log_level

RH_EXPORT void rallyhere_set_default_log_level(RallyHereLogLevel level)

Parameters

TypeName
RallyHereLogLevellevel

Description

Sets the default log level for the SDK and any adapters created. This is only used if a log callback is not set.

Opaque types

The API uses the pointer handles to represent internal objects.

RallyHereGameInstanceAdapterPtr

typedef RallyHereGameInstanceAdapter * RallyHereGameInstanceAdapterPtrOpaque type and handle to a Rally Here Game Instance Adapter.

RallyHereStringMapPtr

typedef RallyHereStringMap * RallyHereStringMapPtrOpaque type and handle to a Rally Here String Map.

State request and callbacks

RallyHereOnAllocatedCallback

typedef void(* RallyHereOnAllocatedCallback)(RallyHereStringMapPtr allocation_info, const RallyHereStatusCode &code, void *user_data)Callback to be sent when an allocation is received from the game host adapter.

The callback is responsible for freeing the allocation_info string map

Environment

rallyhere_allocator_set_alloc

RH_EXPORT void rallyhere_allocator_set_alloc(void ()(unsigned int size) callback)

Parameters

TypeName
void ()(unsigned int size)callback

Description

Optional custom memory alloc override.

If set, must be set at init time, before using any other APIs. If this is called, then rallyhere_allocator_set_free must also be called. If this is called, then rallyhere_allocator_set_free and rallyhere_allocator_set_realloc must also be called.

Parameters

callback : A function that takes a size in bytes of memory to allocate.

See also

rallyhere_allocator_set_free

See also

rallyhere_allocator_set_realloc

rallyhere_allocator_set_free

RH_EXPORT void rallyhere_allocator_set_free(void(*)(void *) callback)

Parameters

TypeName
void(*)(void *)callback

Description

Optional custom memory free override.

If set, must be set at init time, before using any other APIs.

Parameters

callback : An existing pointer p to free.

rallyhere_allocator_set_realloc

RH_EXPORT void rallyhere_allocator_set_realloc(void ()(void *, unsigned int size) callback)

Parameters

TypeName
void ()(void *, unsigned int size)callback

Description

Optional custom memory realloc override.

If set, must be set at init time, before using any other APIs.

Parameters

callback : A function taking an existing pointer and a new size. See the standard c realloc requirements for behavior.

Global

Bookend calls for using this SDK. Only the Environment methods may be called before or after these SDK calls.

rallyhere_global_init

RH_EXPORT void rallyhere_global_init()

Parameters

TypeName

Description

Initialize the Rally Here SDK.

Custom memory allocation must be made before this call, and no other SDK calls may be made until after this call.

rallyhere_global_cleanup

RH_EXPORT void rallyhere_global_cleanup()

Parameters

TypeName

Description

Cleanup the Rally Here SDK.

No other SDK calls may be made after this call.