set_core_options

Function set_core_options 

Source
pub unsafe fn set_core_options(
    callback: retro_environment_t,
    options: &[retro_core_option_definition],
) -> bool
Expand description

Allows an implementation to signal the environment which variables it might want to check for later using get_variable. This allows the frontend to present these variables to a user dynamically. This should only be called if get_core_options_version returns an API version of >= 1. This should be called instead of set_variables. This should be called the first time as early as possible (ideally in Core::on_set_environment). Afterwards it may be called again for the core to communicate updated options to the frontend, but the number of core options must not change from the number in the initial call.

‘data’ points to an array of retro_core_option_definition structs terminated by a { NULL, NULL, NULL, {{0}}, NULL } element. retro_core_option_definition::key should be namespaced to not collide with other implementations’ keys. e.g. A core called foo should use keys named as foo_option. retro_core_option_definition::desc should contain a human readable description of the key. retro_core_option_definition::info should contain any additional human readable information text that a typical user may need to understand the functionality of the option. retro_core_option_definition::values is an array of retro_core_option_value structs terminated by a { NULL, NULL } element.

retro_core_option_definition::values[index].value is an expected option value. retro_core_option_definition::values[index].label is a human readable label used when displaying the value on screen. If NULL, the value itself is used. retro_core_option_definition::default_value is the default core option setting. It must match one of the expected option values in the retro_core_option_definition::values array. If it does not, or the default value is NULL, the first entry in the retro_core_option_definition::values array is treated as the default.

The number of possible option values should be very limited, and must be less than RETRO_NUM_CORE_OPTION_VALUES_MAX. i.e. it should be feasible to cycle through options without a keyboard.

§Examples

{
    "foo_option",
    "Speed hack coprocessor X",
    "Provides increased performance at the expense of reduced accuracy",
    {
        { "false",    NULL },
        { "true",     NULL },
        { "unstable", "Turbo (Unstable)" },
        { NULL, NULL },
    },
    "false"
}

Only strings are operated on. The possible values will generally be displayed and stored as-is by the frontend.