Skip to content

rc_hash_initialize_iterator

Jamiras edited this page Jun 17, 2025 · 4 revisions

Initializes an iterator object for use with the rc_hash_iterate function.

Syntax

void rc_hash_initialize_iterator(
    rc_hash_iterator_t* iterator, 
    const char* path, 
    uint8_t* buffer, 
    size_t buffer_size
);

Parameters

iterator

Pointer to the rc_hash_iterator object to be initialized.

path

The path to the file to be hashed. If providing a buffer, this must still be set so the filename extension can be used to help select the appropriate hashing algorithm for the data.

buffer

Pointer to the data to be hashed (usually an in-memory copy of the game file). If NULL, the file specified by the path parameter will be used.

buffer_size

The number of bytes pointed to by the buffer parameter. Ignored if buffer is NULL.


rc_hash_iterator_t

typedef struct rc_hash_iterator {
  const uint8_t* buffer;
  size_t buffer_size;
  uint8_t consoles[12];
  int index;
  const char* path;

  rc_hash_callbacks_t callbacks;
} rc_hash_iterator_t;

The first five fields are used for iterating/generating hashes and should not be modified by the caller.

callbacks (Minimum version: 12.0.0)

A set of functions that can be provided for additional information about the hashing process. These should be set after initializing the iterator.


rc_hash_callbacks_t

typedef struct rc_hash_callbacks {
  rc_hash_message_callback verbose_message;
  rc_hash_message_callback error_message;

  rc_hash_filereader_t filereader;
  rc_hash_cdreader_t cdreader;
} rc_hash_callbacks_t;

verbose_message

Specifies a function to be called for detailed information about the hashing process.

error_message

Specifies a function to be called when an error occurs.

filereader

A set of functions for reading files (see rc_hash_init_custom_filereader).

cdreader

A set of functions for reading CD files (see rc_hash_init_custom_cdreader).

Remarks

If buffer is provided, path may be a filename (without an actual path). As rcheevos does not natively support compressed files, this could be the name of the file extracted from the archive, where buffer is the data extracted from the archive.

Minimum version: 9.0.0

See also

rc_hash_generate

rc_hash_iterate

rc_hash_destroy_iterator

rcheevos
rc_client

Integration guide

client

user

game

processing

additional data

rc_client_raintegration

Integration guide

rc_runtime
rhash
rapi

common

user

runtime

info

Clone this wiki locally