Skip to content

rc_client_begin_identify_and_load_game

Jamiras edited this page Mar 1, 2024 · 7 revisions

Starts loading an unidentified game.

Syntax

rc_client_async_handle_t* rc_client_begin_identify_and_load_game(
    rc_client_t* client,
    uint32_t console_id,
    const char* file_path,
    const uint8_t* data,
    size_t data_size,
    rc_client_callback_t callback,
    void* callback_userdata
);

Parameters

client

The rc_client_t to manage the game.

console_id

The unique identifier of the console associated to the game. Used to determine how to generate the game's hash. May be RC_CONSOLE_UNKNOWN to attempt to determine the console automatically.

file_path

Path to the file containing the game data.

If console_id is RC_CONSOLE_UNKNOWN, the file extension will be used to help determine how to generate the game's hash, even if data is provided.

For files extracted from a zip file into memory, it is recommended to append the extracted file to generate a virtual path (i.e. C:\games.zip#game.nes) so the correct extension will be found. When this occurs, data must be provided. The zip file itself will not be processed.

data

Pointer to pre-loaded data (file already loaded in memory - either directly or extracted from an archive). If NULL, the data will be read from file_path.

data_size

The number of bytes pointed to by data.

callback

Function to call when the game load 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 load game 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 The game could not be identified.
RC_LOGIN_REQUIRED A logged in user is required.
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 successful, rc_client_get_game_info will return information about the game.

If the game could not be identified, rc_client_get_game_info will return a dummy game object containing the hash that did not resolve. It's id will be 0.

Processing goes through rc_hash_generate_from_buffer or rc_hash_generate_from_file, so it supports providing custom filesystem hooks via rc_hash_init_custom_filereader and rc_hash_init_custom_cdreader.

Requires RC_CLIENT_SUPPORTS_HASH to be defined in 11.2+

Minimum version: 11.0.0

See also

rc_client_begin_change_media

rc_client_begin_load_game

rc_client_get_game_info

rc_client_unload_game

rc_hash_init_custom_cdreader

rc_hash_init_custom_filereader

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