From bf7fdcfdac1999df6486d149b7fd4c21ce064e87 Mon Sep 17 00:00:00 2001 From: hap Date: Sun, 18 Feb 2024 14:51:46 +0100 Subject: cheatopt: move global cheat enable to the bottom --- src/frontend/mame/ui/cheatopt.cpp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/frontend/mame/ui/cheatopt.cpp b/src/frontend/mame/ui/cheatopt.cpp index 4338061f1ca..dbc05700908 100644 --- a/src/frontend/mame/ui/cheatopt.cpp +++ b/src/frontend/mame/ui/cheatopt.cpp @@ -130,17 +130,14 @@ void menu_cheat::menu_activated() void menu_cheat::populate() { - // iterate over cheats - std::string text; - std::string subtext; - - // add global enable toggle - item_append_on_off(_("Cheat Engine"), mame_machine_manager::instance()->cheat().enabled(), 0, (void *)ITEMREF_CHEATS_ENABLE); - item_append(menu_item_type::SEPARATOR); + const bool empty = mame_machine_manager::instance()->cheat().entries().empty(); - // add cheats - if (!mame_machine_manager::instance()->cheat().entries().empty()) + // iterate over cheats + if (!empty) { + std::string text; + std::string subtext; + for (auto &curcheat : mame_machine_manager::instance()->cheat().entries()) { uint32_t flags; @@ -150,17 +147,23 @@ void menu_cheat::populate() else item_append(text, subtext, flags, curcheat.get()); } - - item_append(menu_item_type::SEPARATOR); - - // add a reset all option - item_append(_("Reset All"), 0, (void *)ITEMREF_CHEATS_RESET_ALL); } else { // indicate that none were found item_append(_("[no cheats found]"), FLAG_DISABLE, nullptr); + } + + item_append(menu_item_type::SEPARATOR); + + if (!empty) + { + // add global enable toggle + item_append_on_off(_("Enable Cheats"), mame_machine_manager::instance()->cheat().enabled(), 0, (void *)ITEMREF_CHEATS_ENABLE); item_append(menu_item_type::SEPARATOR); + + // add a reset all option + item_append(_("Reset All"), 0, (void *)ITEMREF_CHEATS_RESET_ALL); } // add a reload all cheats option -- cgit v1.2.3