Skip to content

rc_hash_init_custom_filereader

Jamiras edited this page Oct 25, 2020 · 4 revisions

Allows the caller to provide their own functionality for reading files.

Syntax

void rc_hash_init_custom_filereader(
    struct rc_hash_filereader* reader
);

Parameters

reader

Pointer to a rc_hash_filereader object containing function pointers for overloaded functions.

Can be NULL to reset back to the default filereader functions. (version 9.3+)


struct rc_hash_filereader
{
    rc_hash_filereader_open_file_handler      open;
    rc_hash_filereader_seek_handler           seek;
    rc_hash_filereader_tell_handler           tell;
    rc_hash_filereader_read_handler           read;
    rc_hash_filereader_close_file_handler     close;
};

open

Opens a file for reading (stream should be raw binary). Returns a handle to pass to the other functions.

seek

Updates the read pointer for the file to the specified location.

tell

Gets the current location of the read pointer.

read

Reads the specified number of bytes from the file starting at the read pointer. Returns the number of bytes read and advances the read pointer over the bytes that were read.

close

Closes the file.

Remarks

This is used to extend functional support for accessing files - usually from an archive.

The caller should zero out the structure before assigning its fields in case additional hooks are added in the future.

Minimum version: 9.0.0

See also

rc_hash_init_custom_cdreader

rc_hash_generate_from_file

rc_hash_iterate

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