set_variables

Function set_variables 

Source
pub unsafe fn set_variables(
    callback: retro_environment_t,
    variables: &[retro_variable],
) -> 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 be called the first time as early as possible (ideally in Core::on_set_environment). Afterward 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.

The passed array of retro_variable structs must be terminated by a

retro_variable {
    key:   0 as *const libc::c_char,
    value: 0 as *const libc::c_char,
}

element. retro_variable::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_variable::value should contain a human readable description of the key as well as a | delimited list of expected values.

The number of possible options should be very limited, i.e. it should be feasible to cycle through options without a keyboard.

First entry should be treated as a default.

§Examples

retro_variable {
    key:   b"foo_option" as *const u8 as *const libc::c_char,
    value: b"Speed hack coprocessor X; false|true" as *const u8 as *const libc::c_char,
}

Text before the first ; is a description. This ; must be followed by a space, and followed by a list of possible values split up with |.

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