From da2114fa6a571c1880edea45ed79a7c95ac7fa7e Mon Sep 17 00:00:00 2001 From: Frederik Walk Date: Wed, 13 Nov 2024 21:46:57 +0100 Subject: [PATCH] Fix menu buttons for toggle options --- src/utils/Menu.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/utils/Menu.cpp b/src/utils/Menu.cpp index 569057d..0da1ff3 100644 --- a/src/utils/Menu.cpp +++ b/src/utils/Menu.cpp @@ -395,6 +395,8 @@ void Menu::update(const InputState::Controller &controller_state) { switch (descriptor_it->second.type) { case Descriptor::Type::Value: case Descriptor::Type::Toggle: + current_state.selected_value = !current_state.selected_value; + performAction(descriptor_it->second.items.at(0).second, current_state.selected_value); break; case Descriptor::Type::Selection: if (current_state.selected_value == 0) { @@ -419,6 +421,8 @@ void Menu::update(const InputState::Controller &controller_state) { switch (descriptor_it->second.type) { case Descriptor::Type::Value: case Descriptor::Type::Toggle: + current_state.selected_value = !current_state.selected_value; + performAction(descriptor_it->second.items.at(0).second, current_state.selected_value); break; case Descriptor::Type::Selection: if (current_state.selected_value == descriptor_it->second.items.size() - 1) { @@ -448,9 +452,6 @@ void Menu::update(const InputState::Controller &controller_state) { } break; case Descriptor::Type::Toggle: - current_state.selected_value = !current_state.selected_value; - performAction(descriptor_it->second.items.at(0).second, current_state.selected_value); - break; case Descriptor::Type::Selection: case Descriptor::Type::Menu: case Descriptor::Type::RebootInfo: @@ -465,9 +466,6 @@ void Menu::update(const InputState::Controller &controller_state) { } break; case Descriptor::Type::Toggle: - current_state.selected_value = !current_state.selected_value; - performAction(descriptor_it->second.items.at(0).second, current_state.selected_value); - break; case Descriptor::Type::Selection: case Descriptor::Type::Menu: case Descriptor::Type::RebootInfo: