Reset active state in config menu when active selection is aborted (by pressing B or home)

This commit is contained in:
Maschell 2024-08-04 18:02:58 +02:00
parent 01778ecb51
commit ef1296c8dd
2 changed files with 9 additions and 1 deletions

View File

@ -12,7 +12,7 @@ struct GeneralConfigInformation {
class ConfigDisplayItem {
public:
ConfigDisplayItem(GeneralConfigInformation &info, std::unique_ptr<WUPSConfigAPIBackend::WUPSConfig> config, bool isActive) : mConfig(std::move(config)), mInfo(std::move(info)), mIsActivePlugin(isActive) {
ConfigDisplayItem(GeneralConfigInformation &info, std::unique_ptr<WUPSConfigAPIBackend::WUPSConfig> config, bool isActive) : mConfig(std::move(config)), mInfo(std::move(info)), mIsActivePlugin(isActive), mInitialIsActivePlugin(isActive) {
assert(mConfig);
}
[[nodiscard]] const GeneralConfigInformation &getConfigInformation() const {
@ -30,8 +30,13 @@ public:
mIsActivePlugin = !mIsActivePlugin;
}
void resetIsActivePlugin() {
mIsActivePlugin = mInitialIsActivePlugin;
}
private:
std::unique_ptr<WUPSConfigAPIBackend::WUPSConfig> mConfig;
GeneralConfigInformation mInfo;
bool mIsActivePlugin;
bool mInitialIsActivePlugin;
};

View File

@ -131,6 +131,9 @@ ConfigSubState ConfigRenderer::UpdateStateMain(const Input &input) {
}
} else if (input.data.buttons_d & (Input::eButtons::BUTTON_B | Input::eButtons::BUTTON_HOME)) {
if (mSetActivePluginsMode) {
for (auto &cur : mConfigs) {
cur.resetIsActivePlugin();
}
mNeedRedraw = true;
mSetActivePluginsMode = false;
return SUB_STATE_RUNNING;