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 { class ConfigDisplayItem {
public: 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); assert(mConfig);
} }
[[nodiscard]] const GeneralConfigInformation &getConfigInformation() const { [[nodiscard]] const GeneralConfigInformation &getConfigInformation() const {
@ -30,8 +30,13 @@ public:
mIsActivePlugin = !mIsActivePlugin; mIsActivePlugin = !mIsActivePlugin;
} }
void resetIsActivePlugin() {
mIsActivePlugin = mInitialIsActivePlugin;
}
private: private:
std::unique_ptr<WUPSConfigAPIBackend::WUPSConfig> mConfig; std::unique_ptr<WUPSConfigAPIBackend::WUPSConfig> mConfig;
GeneralConfigInformation mInfo; GeneralConfigInformation mInfo;
bool mIsActivePlugin; 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)) { } else if (input.data.buttons_d & (Input::eButtons::BUTTON_B | Input::eButtons::BUTTON_HOME)) {
if (mSetActivePluginsMode) { if (mSetActivePluginsMode) {
for (auto &cur : mConfigs) {
cur.resetIsActivePlugin();
}
mNeedRedraw = true; mNeedRedraw = true;
mSetActivePluginsMode = false; mSetActivePluginsMode = false;
return SUB_STATE_RUNNING; return SUB_STATE_RUNNING;