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 3cf0f5d9fd
commit 99987df459
3 changed files with 12 additions and 1 deletions

View File

@ -5,7 +5,8 @@ ConfigDisplayItem::ConfigDisplayItem(GeneralConfigInformation &info,
std::unique_ptr<WUPSConfigAPIBackend::WUPSConfig> config,
const bool isActive) : mConfig(std::move(config)),
mInfo(std::move(info)),
mIsActivePlugin(isActive) {
mIsActivePlugin(isActive),
mInitialIsActivePlugin(isActive) {
assert(mConfig);
}
@ -24,3 +25,7 @@ bool ConfigDisplayItem::isActivePlugin() const {
void ConfigDisplayItem::toggleIsActivePlugin() {
mIsActivePlugin = !mIsActivePlugin;
}
void ConfigDisplayItem::resetIsActivePlugin() {
mIsActivePlugin = mInitialIsActivePlugin;
}

View File

@ -24,8 +24,11 @@ public:
void toggleIsActivePlugin();
void resetIsActivePlugin();
private:
std::unique_ptr<WUPSConfigAPIBackend::WUPSConfig> mConfig;
GeneralConfigInformation mInfo;
bool mIsActivePlugin;
bool mInitialIsActivePlugin;
};

View File

@ -120,6 +120,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;