Function rust_libretro::environment::set_controller_info
source · [−]pub unsafe fn set_controller_info(
callback: retro_environment_t,
data: &[retro_controller_info]
) -> boolExpand description
This environment call lets a libretro core tell the frontend
which controller subclasses are recognized in calls to
Core::on_set_controller_port_device.
Some emulators such as Super Nintendo support multiple lightgun types which must be specifically selected from. It is therefore sometimes necessary for a frontend to be able to tell the core about a special kind of input device which is not specifcally provided by the Libretro API.
In order for a frontend to understand the workings of those devices, they must be defined as a specialized subclass of the generic device types already defined in the libretro API.
The core must pass an array of const struct retro_controller_info which
is terminated with a blanked out struct.
Each element of the retro_controller_info struct corresponds to the
ascending port index that is passed to Core::on_set_controller_port_device
when that function is called to indicate to the core that the frontend has
changed the active device subclass.
SEE ALSO: Core::on_set_controller_port_device
The ascending input port indexes provided by the core in the struct are generally presented by frontends as ascending User # or Player #, such as Player 1, Player 2, Player 3, etc. Which device subclasses are supported can vary per input port.
The first inner element of each entry in the retro_controller_info array
is a retro_controller_description struct that specifies the names and
codes of all device subclasses that are available for the corresponding
User or Player, beginning with the generic Libretro device that the
subclasses are derived from. The second inner element of each entry is the
total number of subclasses that are listed in the retro_controller_description.
NOTE: Even if special device types are set in the libretro core, libretro should only poll input based on the base input device types.
