Skip to content

rc_client_begin_change_media_from_hash

Jamiras edited this page Jul 24, 2024 · 1 revision

Switches the loaded media for the active game.

Syntax

rc_client_async_handle_t* rc_client_begin_change_media(
    rc_client_t* client,
    const char* hash,
    rc_client_callback_t callback,
    void* callback_userdata
);

Parameters

client

The rc_client_t to manage the game.

hash

The RetroAchievements hash that identifies the media being loaded.

callback

Function to call when the media change process completes.

callback_userdata

Additional information to pass to the callback function.

Returns

Pointer to an rc_client_async_handle_t that can be passed to rc_client_abort_async to cancel the change media request. The rc_client_async_handle_t is invalid after callback has been called.


rc_client_callback_t

void (*rc_client_callback_t)(
    int result,
    const char* error_message,
    rc_client_t* client
);

result

RC_OK on success, or an error code indicating the failure.

result problem
RC_OK Game was successfully loaded.
RC_NO_GAME_LOADED An active game is required.
RC_HARDCORE_DISABLED The new media could not be identified, so hardcore was disabled.
RC_ABORTED The process was canceled before it finished (rc_client_unload_game was called, or another game started loading).
RC_INVALID_STATE Generic failure. See error_message for details.
RC_INVALID_JSON Server response could not be processed.
RC_MISSING_VALUE Server response was not complete.
RC_API_FAILURE Error occurred on the server. See error_message for details.

error_message

NULL on success, or a message related to a non-successful result.

client

The rc_client_t that was handling the load game attempt.

Remarks

If a hash cannot be generated for the new media, it is assumed to not be able to affect the loaded game (i.e. an audio CD for a rhythm game). If the hash does resolve to a known hash, it will be allowed as either a valid media for the loaded game, or something that won't affect the loaded game. If the hash does not resolve to a known hash, hardcore will be disabled and RC_HARDCORE_DISABLED will be passed to the callback.

Minimum version: 11.2.0

See also

rc_client_begin_change_media

rc_client_begin_identify_and_load_game

rc_client_begin_load_game

rc_client_unload_game

rcheevos

rc_client

Integration guide

client

user

game

processing

rc_client_raintegration

Integration guide

rc_runtime

rhash

rapi

common

user

runtime

info

Clone this wiki locally