Skip to content

Add enviroment callback to enable cores to notify the frontend that a core option value has changed #13079

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 7, 2021

Conversation

jdgleaver
Copy link
Contributor

Description

At present, changes to core option values are unidirectional: frontend -> core.

As requested by twinaphex, this PR adds a new RETRO_ENVIRONMENT_SET_VARIABLE callback which can be used by a core to transmit option value changes back to the frontend. Possible applications of this are:

  • To ensure that frontend and core are properly synchronised when core option values can be set via an internal core menu (e.g. this would allow options currently set by PrBoom's in-game menu to be added to the frontend core options interface)
  • To enable a core to force-set certain options when the user-set value of one option is incompatible with the current setting of another

The relevant API definition is as follows:

#define RETRO_ENVIRONMENT_SET_VARIABLE 70
                                           /* const struct retro_variable * --
                                            * Allows an implementation to notify the frontend
                                            * that a core option value has changed.
                                            *
                                            * retro_variable::key and retro_variable::value
                                            * must match strings that have been set previously
                                            * via one of the following:
                                            *
                                            * - RETRO_ENVIRONMENT_SET_VARIABLES
                                            * - RETRO_ENVIRONMENT_SET_CORE_OPTIONS
                                            * - RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL
                                            * - RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2
                                            * - RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL
                                            *
                                            * After changing a core option value via this
                                            * callback, RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE
                                            * will return true.
                                            *
                                            * If data is NULL, no changes will be registered
                                            * and the callback will return true; an
                                            * implementation may therefore pass NULL in order
                                            * to test whether the callback is supported.
                                            */

In addition, hash keys are now used to identify core option values to reduce overheads when performing lookups.

An example of the usage of this callback is provided here: libretro/gambatte-libretro#204

@inactive123 inactive123 merged commit 2e4d135 into libretro:master Oct 7, 2021
@jdgleaver jdgleaver deleted the api-set-core-option-value branch October 7, 2021 13:21
@i30817
Copy link
Contributor

i30817 commented Oct 7, 2021

Can this solve the problem of the first run of mupen64plus attempting to use rdp plugin = gliden64 for the parallel renderer in a vulkan machine @m4xw ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants