Skip to content

GB_set_user_data and GB_get_user_data

Lior Halphon edited this page Nov 30, 2024 · 2 revisions

Definition

void GB_set_user_data(GB_gameboy_t *gb, void *data);

void *GB_get_user_data(GB_gameboy_t *gb);

In gb.h

Description

GB_set_user_data can associate an arbitrary pointer with an emulator instance, and GB_get_user_data can read the associated pointer back. They can be used by a frontend that can handle multiple emulator instances to associate an emulator instance with its frontend data (For example, a window object that displays the screen of the instance) and read it back when getting callbacks.

Thread Safety

GB_set_user_data and GB_get_user_data are thread-safe and can be called from any thread and context.

Clone this wiki locally