wiki.icculus.org
[ front page | index | search | recent changes | git repo | offline html ]

ControllerImage_AddData

Add data to the ControllerImage database.

Header File

Defined in <controllerimage.h>

Syntax

bool ControllerImage_AddData(const void *buf, size_t buflen);

Function Parameters

const void * buf a pointer to a buffer that holds database data.
size_t buflen the number of bytes to store in buffer.

Return Value

(bool) Returns true on success, false on error; call SDL_GetError() for details.

Remarks

The library needs a database of controller information to be useful. This data is external to the library and must be provided by the app. See the library's documentation on how to build the needed data file from the provided public domain assets.

This should be called successfully at least once before attempting to create a ControllerImage_Device, as doing so will fail without data.

It is legal to call this function multiple times. If data for the same gamepad is added twice, the newer call replaces a previous call's data. This allows an app to add a "standard" database with ControllerImage's dataset for wide converage, and override the most popular controllers with a second, custom dataset to match a game's style more closely.

This function takes the data from a memory buffer. It must be in the format that the make-controllerimage-data.c program produces. There are also equivalent functions to load from a filename or an SDL_IOStream.

Thread Safety

This function is not thread safe.

Version

This function is available since ControllerImage 1.0.0.

See Also


CategoryAPI, CategoryAPIFunction, CategoryControllerImage


[ edit | delete | history | feedback | raw ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.