Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/components/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ bool Config::init(libretro::LoggerComponent* logger)
_backgroundInput = false;
_showSpeedIndicator = true;
_gameFocusCaptureMouse = false;
memset(&_updateDisplayCallback, 0, sizeof(_updateDisplayCallback));

reset();
return true;
Expand Down Expand Up @@ -326,6 +327,11 @@ void Config::setVariableDisplay(const struct retro_core_option_display* display)
_logger->info(TAG "Could not set visibility on unknown variable %s", display->key);
}

void Config::setUpdateDisplayCallback(const struct retro_core_options_update_display_callback* data)
{
memcpy(&_updateDisplayCallback, data, sizeof(_updateDisplayCallback));
}

bool Config::varUpdated()
{
bool updated = _updated;
Expand Down Expand Up @@ -906,6 +912,9 @@ void Config::showDialog(const std::string& coreName, Input& input)
_selections[var._key] = var._options[var._selected];
}
}

if (_updateDisplayCallback.callback)
_updateDisplayCallback.callback();
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/components/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Config: public libretro::ConfigComponent
virtual void setVariables(const struct retro_core_option_v2_definition* options, unsigned count,
const struct retro_core_option_v2_category* categories, unsigned category_count) override;
virtual void setVariableDisplay(const struct retro_core_option_display* display) override;
virtual void setUpdateDisplayCallback(const struct retro_core_options_update_display_callback* data) override;
virtual bool varUpdated() override;
virtual const char* getVariable(const char* variable) override;

Expand Down Expand Up @@ -147,6 +148,7 @@ class Config: public libretro::ConfigComponent
std::vector<Category> _categories;
std::vector<Variable> _variables;
std::unordered_map<std::string, std::string> _selections;
struct retro_core_options_update_display_callback _updateDisplayCallback;

bool _updated;
bool _fastForwarding;
Expand Down
1 change: 1 addition & 0 deletions src/libretro/Components.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ namespace libretro
virtual void setVariables(const struct retro_core_option_v2_definition* options, unsigned count,
const struct retro_core_option_v2_category* categories, unsigned category_count) = 0;
virtual void setVariableDisplay(const struct retro_core_option_display* display) = 0;
virtual void setUpdateDisplayCallback(const struct retro_core_options_update_display_callback* data) = 0;
virtual bool varUpdated() = 0;
virtual const char* getVariable(const char* variable) = 0;

Expand Down
23 changes: 19 additions & 4 deletions src/libretro/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ namespace
(void)display;
}

virtual void setUpdateDisplayCallback(const struct retro_core_options_update_display_callback* data) override
{
(void)data;
}

virtual bool varUpdated() override
{
return false;
Expand Down Expand Up @@ -1792,6 +1797,13 @@ bool libretro::Core::setCoreOptionsDisplay(const struct retro_core_option_displa
return true;
}

bool libretro::Core::setCoreOptionsUpdateDisplayCallback(const struct retro_core_options_update_display_callback* data)
{
_config->setUpdateDisplayCallback(data);
return true;
}


static bool clearAllWaitThreadsCallback(unsigned clear_threads, void* data)
{
return true;
Expand Down Expand Up @@ -2079,10 +2091,13 @@ bool libretro::Core::environmentCallback(unsigned cmd, void* data)
ret = getMicrophoneInterface((struct retro_microphone_interface*)data);
break;

/* RETRO_ENVIRONMENT_SET_CORE_OPTIONS_UPDATE_DISPLAY_CALLBACK cannot be supported because
* we don't update the variable values in real time. values are only updated when the config
* dialog is closed.
*/
case RETRO_ENVIRONMENT_SET_CORE_OPTIONS_UPDATE_DISPLAY_CALLBACK:
/* NOTE: we don't update the variable values in real time. values are only updated when the config
* dialog is closed. As such, the update display callback is only called after the dialog is closed
* and the updated visibility is only reflected the next time the user opens the dialog.
*/
ret = setCoreOptionsUpdateDisplayCallback((const struct retro_core_options_update_display_callback*)data);
break;

case RETRO_ENVIRONMENT_SET_SAVE_STATE_IN_BACKGROUND:
_logger->warn(TAG "Unimplemented env call: %s", "RETRO_ENVIRONMENT_SET_SAVE_STATE_IN_BACKGROUND");
Expand Down
1 change: 1 addition & 0 deletions src/libretro/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ namespace libretro
bool setCoreOptionsV2(const struct retro_core_options_v2* data);
bool setCoreOptionsV2Intl(const struct retro_core_options_v2_intl* data);
bool setCoreOptionsDisplay(const struct retro_core_option_display* data);
bool setCoreOptionsUpdateDisplayCallback(const struct retro_core_options_update_display_callback* data);
bool getPreferredHWRender(unsigned* data);
bool getMicrophoneInterface(struct retro_microphone_interface* data);

Expand Down
Loading