Functions
mk_services_achievement_atfunction
mk_result mk_services_achievement_at(uint32_t index, mk_services_achievement *out_info)
Perform the services achievement at operation.
| Parameter | Type | Description |
|---|
index | uint32_t | Zero-based index. |
out_info | mk_services_achievement * | Receives the info. |
Returns MK_SUCCESS or an error result.
mk_services_achievement_clearfunction
mk_result mk_services_achievement_clear(const char *id)
Clear the services achievement.
| Parameter | Type | Description |
|---|
id | const char * | Value for ID. |
Returns MK_SUCCESS or an error result.
mk_services_achievement_countfunction
uint32_t mk_services_achievement_count(void)
Perform the services achievement count operation.
Returns The resulting value.
mk_services_achievement_getfunction
mk_result mk_services_achievement_get(const char *id, mk_services_achievement *out_info)
Get state from the services achievement.
| Parameter | Type | Description |
|---|
id | const char * | Value for ID. |
out_info | mk_services_achievement * | Receives the info. |
Returns MK_SUCCESS or an error result.
mk_services_achievement_initfunction
void mk_services_achievement_init(mk_services_achievement *info)
Initialize the services achievement.
| Parameter | Type | Description |
|---|
info | mk_services_achievement * | Value for info. |
mk_services_achievement_set_progressfunction
mk_result mk_services_achievement_set_progress(const char *id, uint32_t steps, uint32_t total_steps)
Set progress on the services achievement.
| Parameter | Type | Description |
|---|
id | const char * | Value for ID. |
steps | uint32_t | Value for steps. |
total_steps | uint32_t | Value for total steps. |
Returns MK_SUCCESS or an error result.
mk_services_achievement_unlockfunction
mk_result mk_services_achievement_unlock(const char *id)
Perform the services achievement unlock operation.
| Parameter | Type | Description |
|---|
id | const char * | Value for ID. |
Returns MK_SUCCESS or an error result.
mk_services_authfunction
mk_services_auth_state mk_services_auth(void)
Perform the services auth operation.
Returns The resulting value.
mk_services_auth_ticket_asyncfunction
mk_result mk_services_auth_ticket_async(const char *audience, mk_services_ticket_fn callback, void *user_data, mk_async_request_t *out_request)
Fetch a token your server can verify with the platform.
Maps to Steam GetAuthTicketForWebApi, Game Center identity verification, and Play requestServerSideAccess.
| Parameter | Type | Description |
|---|
audience | const char * | Value for audience. |
callback | mk_services_ticket_fn | Completion callback. |
user_data | void * | Caller-provided context. |
out_request | mk_async_request_t * | Receives the request. |
Returns MK_SUCCESS or an error result.
mk_services_backend_kindfunction
mk_services_backend mk_services_backend_kind(void)
The backend that actually started.
Returns The resulting value.
mk_services_backend_namefunction
const char * mk_services_backend_name(void)
Stable lowercase name: "steam", "game_center", "play_games", "web", "fake", "none", "disabled".
Returns A borrowed pointer, or NULL when unavailable.
mk_services_capabilitiesfunction
mk_services_capabilities_t mk_services_capabilities(void)
Perform the services capabilities operation.
Returns The resulting handle or value.
mk_services_cloud_delete_asyncfunction
mk_result mk_services_cloud_delete_async(const char *slot, mk_services_done_fn callback, void *user_data, mk_async_request_t *out_request)
Perform the services cloud delete async operation.
| Parameter | Type | Description |
|---|
slot | const char * | Value for slot. |
callback | mk_services_done_fn | Completion callback. |
user_data | void * | Caller-provided context. |
out_request | mk_async_request_t * | Receives the request. |
Returns MK_SUCCESS or an error result.
mk_services_cloud_list_asyncfunction
mk_result mk_services_cloud_list_async(mk_services_list_fn callback, void *user_data, mk_async_request_t *out_request)
Perform the services cloud list async operation.
| Parameter | Type | Description |
|---|
callback | mk_services_list_fn | Completion callback. |
user_data | void * | Caller-provided context. |
out_request | mk_async_request_t * | Receives the request. |
Returns MK_SUCCESS or an error result.
mk_services_cloud_quotafunction
mk_result mk_services_cloud_quota(uint64_t *out_used, uint64_t *out_total)
Perform the services cloud quota operation.
| Parameter | Type | Description |
|---|
out_used | uint64_t * | Receives the used. |
out_total | uint64_t * | Receives the total. |
Returns MK_SUCCESS or an error result.
mk_services_cloud_read_asyncfunction
mk_result mk_services_cloud_read_async(const char *slot, mk_services_read_fn callback, void *user_data, mk_async_request_t *out_request)
Read async for the services cloud.
| Parameter | Type | Description |
|---|
slot | const char * | Value for slot. |
callback | mk_services_read_fn | Completion callback. |
user_data | void * | Caller-provided context. |
out_request | mk_async_request_t * | Receives the request. |
Returns MK_SUCCESS or an error result.
mk_services_cloud_write_asyncfunction
mk_result mk_services_cloud_write_async(const char *slot, const mk_services_write_desc *desc, mk_services_done_fn callback, void *user_data, mk_async_request_t *out_request)
Write async for the services cloud.
| Parameter | Type | Description |
|---|
slot | const char * | Value for slot. |
desc | const mk_services_write_desc * | Configuration descriptor. |
callback | mk_services_done_fn | Completion callback. |
user_data | void * | Caller-provided context. |
out_request | mk_async_request_t * | Receives the request. |
Returns MK_SUCCESS or an error result.
mk_services_desc_initfunction
void mk_services_desc_init(mk_services_desc *desc)
Initialize the services desc.
| Parameter | Type | Description |
|---|
desc | mk_services_desc * | Configuration descriptor. |
mk_services_flush_asyncfunction
mk_result mk_services_flush_async(mk_services_done_fn callback, void *user_data, mk_async_request_t *out_request)
Commit locally-set achievements and stats to the platform.
Every backend needs a commit step (Steam StoreStats, Game Center report), so it is explicit rather than hidden behind each setter.
| Parameter | Type | Description |
|---|
callback | mk_services_done_fn | Completion callback. |
user_data | void * | Caller-provided context. |
out_request | mk_async_request_t * | Receives the request. |
Returns MK_SUCCESS or an error result.
mk_services_initfunction
mk_result mk_services_init(const mk_services_desc *desc)
Select and start a backend.
With MK_SERVICES_BACKEND_AUTO a failed probe falls back rather than failing, so a machine without Steam still initializes with the none backend. An explicit backend that cannot start returns MK_ERROR_UNSUPPORTED.
| Parameter | Type | Description |
|---|
desc | const mk_services_desc * | Configuration descriptor. |
Returns MK_SUCCESS or an error result.
mk_services_is_initializedfunction
bool mk_services_is_initialized(void)
Test whether the services is initialized.
Returns True when the condition holds.
mk_services_last_errorfunction
mk_services_error mk_services_last_error(void)
The most recent immediate (non-callback) failure.
Returns The resulting value.
mk_services_leaderboard_scores_asyncfunction
mk_result mk_services_leaderboard_scores_async(const mk_services_score_query *query, mk_services_scores_fn callback, void *user_data, mk_async_request_t *out_request)
Perform the services leaderboard scores async operation.
| Parameter | Type | Description |
|---|
query | const mk_services_score_query * | Value for query. |
callback | mk_services_scores_fn | Completion callback. |
user_data | void * | Caller-provided context. |
out_request | mk_async_request_t * | Receives the request. |
Returns MK_SUCCESS or an error result.
mk_services_leaderboard_submit_asyncfunction
mk_result mk_services_leaderboard_submit_async(const mk_services_submit_desc *desc, mk_services_submit_fn callback, void *user_data, mk_async_request_t *out_request)
Submit async for the services leaderboard.
| Parameter | Type | Description |
|---|
desc | const mk_services_submit_desc * | Configuration descriptor. |
callback | mk_services_submit_fn | Completion callback. |
user_data | void * | Caller-provided context. |
out_request | mk_async_request_t * | Receives the request. |
Returns MK_SUCCESS or an error result.
mk_services_playerfunction
mk_result mk_services_player(mk_services_player_info *out_info)
Perform the services player operation.
| Parameter | Type | Description |
|---|
out_info | mk_services_player_info * | Receives the info. |
Returns MK_SUCCESS or an error result.
mk_services_player_info_initfunction
void mk_services_player_info_init(mk_services_player_info *info)
Initialize the services player info.
| Parameter | Type | Description |
|---|
info | mk_services_player_info * | Value for info. |
mk_services_pollfunction
uint32_t mk_services_poll(void)
Deliver completed requests.
Called for you from the frame loop; call it directly in headless tools and tests. Returns the number of callbacks run.
Returns The resulting value.
mk_services_refresh_asyncfunction
mk_result mk_services_refresh_async(mk_services_done_fn callback, void *user_data, mk_async_request_t *out_request)
Re-read achievements and stats from the platform.
| Parameter | Type | Description |
|---|
callback | mk_services_done_fn | Completion callback. |
user_data | void * | Caller-provided context. |
out_request | mk_async_request_t * | Receives the request. |
Returns MK_SUCCESS or an error result.
mk_services_score_query_initfunction
void mk_services_score_query_init(mk_services_score_query *query)
Query init for the services score.
| Parameter | Type | Description |
|---|
query | mk_services_score_query * | Value for query. |
mk_services_show_uifunction
mk_result mk_services_show_ui(mk_services_ui view, const char *id)
Show a platform overlay.
| Parameter | Type | Description |
|---|
view | mk_services_ui | Value for view. |
id | const char * | Value for ID. |
Returns MK_SUCCESS or an error result.
mk_services_shutdownfunction
void mk_services_shutdown(void)
Perform the services shutdown operation.
mk_services_sign_infunction
mk_result mk_services_sign_in(void)
Ensure the player is signed in, presenting platform UI if the backend has it.
Returns MK_SUCCESS or an error result.
mk_services_sign_in_silentfunction
mk_result mk_services_sign_in_silent(void)
Sign in only if it needs no UI.
Returns MK_SUCCESS or an error result.
mk_services_sign_outfunction
mk_result mk_services_sign_out(void)
Perform the services sign out operation.
Returns MK_SUCCESS or an error result.
mk_services_stat_add_intfunction
mk_result mk_services_stat_add_int(const char *id, int64_t delta)
Add int for the services stat.
| Parameter | Type | Description |
|---|
id | const char * | Value for ID. |
delta | int64_t | Value for delta. |
Returns MK_SUCCESS or an error result.
mk_services_stat_get_floatfunction
mk_result mk_services_stat_get_float(const char *id, double *out_value)
Get float from the services stat.
| Parameter | Type | Description |
|---|
id | const char * | Value for ID. |
out_value | double * | Receives the value. |
Returns MK_SUCCESS or an error result.
mk_services_stat_get_intfunction
mk_result mk_services_stat_get_int(const char *id, int64_t *out_value)
Get int from the services stat.
| Parameter | Type | Description |
|---|
id | const char * | Value for ID. |
out_value | int64_t * | Receives the value. |
Returns MK_SUCCESS or an error result.
mk_services_stat_set_floatfunction
mk_result mk_services_stat_set_float(const char *id, double value)
Set float on the services stat.
| Parameter | Type | Description |
|---|
id | const char * | Value for ID. |
value | double | Value to use. |
Returns MK_SUCCESS or an error result.
mk_services_stat_set_intfunction
mk_result mk_services_stat_set_int(const char *id, int64_t value)
Set int on the services stat.
| Parameter | Type | Description |
|---|
id | const char * | Value for ID. |
value | int64_t | Value to use. |
Returns MK_SUCCESS or an error result.
mk_services_submit_desc_initfunction
void mk_services_submit_desc_init(mk_services_submit_desc *desc)
Submit desc init for the services.
| Parameter | Type | Description |
|---|
desc | mk_services_submit_desc * | Configuration descriptor. |
mk_services_write_desc_initfunction
void mk_services_write_desc_init(mk_services_write_desc *desc)
Write desc init for the services.
| Parameter | Type | Description |
|---|
desc | mk_services_write_desc * | Configuration descriptor. |
Typedefs
mk_services_achievementtypedef
typedef struct mk_services_achievement mk_services_achievement
Data for services achievement.
mk_services_auth_changed_fntypedef
typedef void(*) mk_services_auth_changed_fn(mk_services_auth_state state, void *user_data)
Sign-in state changed.
Invoked from mk_services_poll(). Not optional polish: Game Center can sign the player out mid-session.
mk_services_auth_statetypedef
typedef enum mk_services_auth_state mk_services_auth_state
Sign-in state.
Mirrors the audio capture-permission shape.
mk_services_backendtypedef
typedef enum mk_services_backend mk_services_backend
Which implementation is (or should be) running.
mk_services_capabilities_ttypedef
typedef uint64_t mk_services_capabilities_t
Bitmask returned by mk_services_capabilities().
mk_services_desctypedef
typedef struct mk_services_desc mk_services_desc
Data for services desc.
mk_services_done_fntypedef
typedef void(*) mk_services_done_fn(mk_async_request_t request, mk_result result, const mk_services_error *error, void *user_data)
Completion with no payload.
error is NULL on success.
mk_services_errortypedef
typedef struct mk_services_error mk_services_error
Detail carried alongside mk_result on every completion.
mk_services_error_codetypedef
typedef enum mk_services_error_code mk_services_error_code
Portable category for the most recent services failure.
mk_services_id_maptypedef
typedef struct mk_services_id_map mk_services_id_map
Maps an id the game uses to the id a store uses.
The same achievement is "ACH_WIN" on Steam, "grp.win" on Game Center, and an opaque string on Play. Supply the mapping once at init and use the logical id everywhere else. An id with no mapping is passed through unchanged.
mk_services_list_fntypedef
typedef void(*) mk_services_list_fn(mk_async_request_t request, mk_result result, const mk_services_error *error, const mk_services_slot *slots, uint32_t count, void *user_data)
Slot listing.
slots is valid for the duration of the callback only.
mk_services_player_infotypedef
typedef struct mk_services_player_info mk_services_player_info
Data for services player info.
mk_services_read_fntypedef
typedef void(*) mk_services_read_fn(mk_async_request_t request, mk_result result, const mk_services_error *error, const char *slot, const void *data, size_t size, void *user_data)
Slot contents.
data is valid for the duration of the callback only.
mk_services_scoretypedef
typedef struct mk_services_score mk_services_score
Data for services score.
mk_services_score_querytypedef
typedef struct mk_services_score_query mk_services_score_query
Data for services score query.
mk_services_score_scopetypedef
typedef enum mk_services_score_scope mk_services_score_scope
Values for services score scope.
mk_services_score_windowtypedef
typedef enum mk_services_score_window mk_services_score_window
Values for services score window.
mk_services_scores_fntypedef
typedef void(*) mk_services_scores_fn(mk_async_request_t request, mk_result result, const mk_services_error *error, const mk_services_score *scores, uint32_t count, void *user_data)
Score list.
scores is valid for the duration of the callback only.
mk_services_slottypedef
typedef struct mk_services_slot mk_services_slot
Data for services slot.
mk_services_submit_desctypedef
typedef struct mk_services_submit_desc mk_services_submit_desc
Data for services submit desc.
mk_services_submit_fntypedef
typedef void(*) mk_services_submit_fn(mk_async_request_t request, mk_result result, const mk_services_error *error, const mk_services_score *score, bool changed, void *user_data)
Submit result.
changed is false when a keep-best policy rejected the score.
mk_services_submit_policytypedef
typedef enum mk_services_submit_policy mk_services_submit_policy
Values for services submit policy.
mk_services_ticket_fntypedef
typedef void(*) mk_services_ticket_fn(mk_async_request_t request, mk_result result, const mk_services_error *error, const void *ticket, size_t size, void *user_data)
Completion for mk_services_auth_ticket_async().
Bytes are valid for the call only.
mk_services_uitypedef
typedef enum mk_services_ui mk_services_ui
Values for services UI.
mk_services_write_desctypedef
typedef struct mk_services_write_desc mk_services_write_desc
Data for services write desc.