From 07066836905eb86a882733c60934bf05a499b1bb Mon Sep 17 00:00:00 2001 From: ITotalJustice <47043333+ITotalJustice@users.noreply.github.com> Date: Sun, 14 Sep 2025 14:16:50 +0100 Subject: [PATCH] mui: rename misc to menus, change menu options order so that menus is at the top, improve some info boxes text. --- sphaira/include/app.hpp | 2 +- sphaira/include/ui/menus/main_menu.hpp | 2 +- sphaira/source/app.cpp | 8 +-- sphaira/source/ui/menus/main_menu.cpp | 97 +++++++++++++------------- 4 files changed, 56 insertions(+), 53 deletions(-) diff --git a/sphaira/include/app.hpp b/sphaira/include/app.hpp index 8a6dc88..72c2328 100644 --- a/sphaira/include/app.hpp +++ b/sphaira/include/app.hpp @@ -127,7 +127,7 @@ public: static void DisplayThemeOptions(bool left_side = true); // todo: static void DisplayNetworkOptions(bool left_side = true); - static void DisplayMiscOptions(bool left_side = true); + static void DisplayMenuOptions(bool left_side = true); static void DisplayAdvancedOptions(bool left_side = true); static void DisplayInstallOptions(bool left_side = true); static void DisplayDumpOptions(bool left_side = true); diff --git a/sphaira/include/ui/menus/main_menu.hpp b/sphaira/include/ui/menus/main_menu.hpp index 5b2038a..d709d39 100644 --- a/sphaira/include/ui/menus/main_menu.hpp +++ b/sphaira/include/ui/menus/main_menu.hpp @@ -42,7 +42,7 @@ struct MiscMenuEntry { } }; -auto GetMiscMenuEntries() -> std::span; +auto GetMenuMenuEntries() -> std::span; // this holds 2 menus and allows for switching between them struct MainMenu final : Widget { diff --git a/sphaira/source/app.cpp b/sphaira/source/app.cpp index 4332d70..417942e 100644 --- a/sphaira/source/app.cpp +++ b/sphaira/source/app.cpp @@ -1873,11 +1873,11 @@ void App::DisplayNetworkOptions(bool left_side) { } -void App::DisplayMiscOptions(bool left_side) { - auto options = std::make_unique("Misc Options"_i18n, left_side ? ui::Sidebar::Side::LEFT : ui::Sidebar::Side::RIGHT); +void App::DisplayMenuOptions(bool left_side) { + auto options = std::make_unique("Menus"_i18n, left_side ? ui::Sidebar::Side::LEFT : ui::Sidebar::Side::RIGHT); ON_SCOPE_EXIT(App::Push(std::move(options))); - for (auto& e : ui::menu::main::GetMiscMenuEntries()) { + for (auto& e : ui::menu::main::GetMenuMenuEntries()) { if (e.name == g_app->m_left_menu.Get()) { continue; } else if (e.name == g_app->m_right_menu.Get()) { @@ -1935,7 +1935,7 @@ void App::DisplayAdvancedOptions(bool left_side) { std::vector menu_names; ui::SidebarEntryArray::Items menu_items; - for (auto& e : ui::menu::main::GetMiscMenuEntries()) { + for (auto& e : ui::menu::main::GetMenuMenuEntries()) { if (!e.IsShortcut()) { continue; } diff --git a/sphaira/source/ui/menus/main_menu.cpp b/sphaira/source/ui/menus/main_menu.cpp index d397b16..c6ed5f4 100644 --- a/sphaira/source/ui/menus/main_menu.cpp +++ b/sphaira/source/ui/menus/main_menu.cpp @@ -50,58 +50,52 @@ auto MiscMenuFuncGenerator(u32 flags) { const MiscMenuEntry MISC_MENU_ENTRIES[] = { { .name = "Appstore", .title = "Appstore", .func = MiscMenuFuncGenerator, .flag = MiscMenuFlag_Shortcut, .info = - "Download and update apps.\n\n"\ + "Download and update apps.\n\n" "Internet connection required." }, { .name = "Games", .title = "Games", .func = MiscMenuFuncGenerator, .flag = MiscMenuFlag_Shortcut, .info = - "View all installed games. "\ + "View all installed games. " "In this menu you can launch, backup, create savedata and much more." }, { .name = "FileBrowser", .title = "FileBrowser", .func = MiscMenuFuncGenerator, .flag = MiscMenuFlag_Shortcut, .info = - "Browse files on you SD Card. "\ - "You can move, copy, delete, extract zip, create zip, upload and much more.\n\n"\ + "Browse files on you SD Card. " + "You can move, copy, delete, extract zip, create zip, upload and much more.\n\n" "A connected USB/HDD can be opened by mounting it in the advanced options." }, { .name = "Saves", .title = "Saves", .func = MiscMenuFuncGenerator, .flag = MiscMenuFlag_Shortcut, .info = - "View save data for each user. "\ - "You can backup and restore saves.\n\n"\ + "View save data for each user. " + "You can backup and restore saves.\n\n" "Experimental support for backing up system saves is possible." }, #if 0 { .name = "Themezer", .title = "Themezer", .func = MiscMenuFuncGenerator, .flag = MiscMenuFlag_Shortcut, .info = - "Download themes from themezer.net. "\ - "Themes are downloaded to /themes/sphaira\n"\ + "Download themes from themezer.net. " + "Themes are downloaded to /themes/sphaira\n" "To install the themes, NXThemesInstaller needs to be installed (can be downloaded via the AppStore)." }, #endif { .name = "GitHub", .title = "GitHub", .func = MiscMenuFuncGenerator, .flag = MiscMenuFlag_Shortcut, .info = - "Download releases directly from GitHub. "\ + "Download releases directly from GitHub. " "Custom entries can be added to /config/sphaira/github" }, #ifdef ENABLE_FTPSRV { .name = "FTP", .title = "FTP Install", .func = MiscMenuFuncGenerator, .flag = MiscMenuFlag_Install, .info = - "Install apps via FTP.\n\n"\ - "NOTE: This feature does not always work, use at your own risk. "\ - "If you encounter an issue, do not open an issue, it will not be fixed." }, + "Install apps via FTP." }, #endif // ENABLE_FTPSRV #ifdef ENABLE_LIBHAZE { .name = "MTP", .title = "MTP Install", .func = MiscMenuFuncGenerator, .flag = MiscMenuFlag_Install, .info = - "Install apps via MTP.\n\n"\ - "NOTE: This feature does not always work, use at your own risk. "\ - "If you encounter an issue, do not open an issue, it will not be fixed." }, + "Install apps via MTP." }, #endif // ENABLE_LIBHAZE { .name = "USB", .title = "USB Install", .func = MiscMenuFuncGenerator, .flag = MiscMenuFlag_Install, .info = - "Install apps via USB.\n\n"\ - "A USB client is required on PC, such as ns-usbloader and fluffy.\n\n"\ - "NOTE: This feature does not always work, use at your own risk. "\ - "If you encounter an issue, do not open an issue, it will not be fixed." }, + "Install apps via USB.\n\n" + "A USB client is required on PC." }, { .name = "GameCard", .title = "GameCard", .func = MiscMenuFuncGenerator, .flag = MiscMenuFlag_Shortcut, .info = - "View info on the inserted Game Card (GC). "\ - "You can backup and install the inserted GC. "\ - "To swap GC's, simply remove the old GC and insert the new one. "\ + "View info on the inserted Game Card (GC). " + "You can backup and install the inserted GC. " + "To swap GC's, simply remove the old GC and insert the new one. " "You do not need to exit the menu." }, { .name = "IRS", .title = "IRS (Infrared Joycon Camera)", .func = MiscMenuFuncGenerator, .flag = MiscMenuFlag_Shortcut, .info = @@ -172,7 +166,7 @@ auto InstallUpdate(ProgressBox* pbox, const std::string url, const std::string v auto CreateLeftSideMenu(std::string& name_out) -> std::unique_ptr { const auto name = App::GetApp()->m_left_menu.Get(); - for (auto& e : GetMiscMenuEntries()) { + for (auto& e : GetMenuMenuEntries()) { if (e.name == name) { name_out = name; return e.func(MenuFlag_Tab); @@ -197,7 +191,7 @@ auto CreateRightSideMenu(std::string_view left_name) -> std::unique_ptr std::unique_ptr std::span { +auto GetMenuMenuEntries() -> std::span { return MISC_MENU_ENTRIES; } @@ -280,7 +274,7 @@ MainMenu::MainMenu() { this->SetActions( std::make_pair(Button::START, Action{App::Exit}), - std::make_pair(Button::SELECT, Action{App::DisplayMiscOptions}), + std::make_pair(Button::SELECT, Action{App::DisplayMenuOptions}), std::make_pair(Button::Y, Action{"Menu"_i18n, [this](){ auto options = std::make_unique("Menu Options"_i18n, "v" APP_VERSION_HASH, Sidebar::Side::LEFT); ON_SCOPE_EXIT(App::Push(std::move(options))); @@ -302,9 +296,18 @@ MainMenu::MainMenu() { language_items.push_back("Vietnamese"_i18n); language_items.push_back("Ukrainian"_i18n); - options->Add("Theme"_i18n, [](){ - App::DisplayThemeOptions(); - }, "Customise the look of Sphaira by changing the theme"_i18n); + options->Add("Menus"_i18n, [](){ + App::DisplayMenuOptions(); + }, "Launch one of Sphaira's menus:\n" + "- Appstore\n" + "- Saves\n" + "- GitHub\n" + "- FTP Install\n" + "- MTP Install\n" + "- USB Install\n" + "- IRS (Infrared Joycon Camera)\n" + "- Web\n\n" + "You can change the left/right menu in the Advanced Options."_i18n); options->Add("Network"_i18n, [this](){ auto options = std::make_unique("Network Options"_i18n, Sidebar::Side::LEFT); @@ -330,47 +333,47 @@ MainMenu::MainMenu() { }); } - options->Add("Ftp"_i18n, App::GetFtpEnable(), [](bool& enable){ + options->Add("FTP"_i18n, App::GetFtpEnable(), [](bool& enable){ App::SetFtpEnable(enable); - }, "Enable FTP server to run in the background.\n\n"\ - "The default port is 5000 with no user/pass set. "\ + }, "Enable FTP server to run in the background.\n\n" + "The default port is 5000 with no user/pass set. " "You can change this behaviour in /config/ftpsrv/config.ini"_i18n); - options->Add("Mtp"_i18n, App::GetMtpEnable(), [](bool& enable){ + options->Add("MTP"_i18n, App::GetMtpEnable(), [](bool& enable){ App::SetMtpEnable(enable); }, "Enable MTP server to run in the background."_i18n); - options->Add("Nxlink"_i18n, App::GetNxlinkEnable(), [](bool& enable){ + options->Add("NXlink"_i18n, App::GetNxlinkEnable(), [](bool& enable){ App::SetNxlinkEnable(enable); - }, "Enable NXlink server to run in the background. "\ - "NXlink is used to send .nro's from PC to the switch\n\n"\ + }, "Enable NXlink server to run in the background. " + "NXlink is used to send .nro's from PC to the switch\n\n" "If you are not a developer, you can disable this option."_i18n); - options->Add("Hdd"_i18n, App::GetHddEnable(), [](bool& enable){ + options->Add("HDD"_i18n, App::GetHddEnable(), [](bool& enable){ App::SetHddEnable(enable); - }, "Enable mounting of connected USB/HDD devices. "\ + }, "Enable mounting of connected USB/HDD devices. " "Connected devices can be used in the FileBrowser, as well as a backup location when dumping games and saves."_i18n); - options->Add("Hdd write protect"_i18n, App::GetWriteProtect(), [](bool& enable){ + options->Add("HDD write protect"_i18n, App::GetWriteProtect(), [](bool& enable){ App::SetWriteProtect(enable); }, "Makes the connected HDD read-only."_i18n); - }, "Toggle FTP, MTP, HDD and NXlink\n\n" \ + }, "Toggle FTP, MTP, HDD and NXlink\n\n" "If Sphaira has a update available, you can download it from this menu"_i18n); + options->Add("Theme"_i18n, [](){ + App::DisplayThemeOptions(); + }, "Customise the look of Sphaira by changing the theme"_i18n); + options->Add("Language"_i18n, language_items, [](s64& index_out){ App::SetLanguage(index_out); }, (s64)App::GetLanguage(), "Change the language.\n\n" - "If your language isn't found, or translations are missing, please consider opening a PR at "\ + "If your language isn't found, or translations are missing, please consider opening a PR at " "github.com/ITotalJustice/sphaira"_i18n); - options->Add("Misc"_i18n, [](){ - App::DisplayMiscOptions(); - }, "View and launch one of Sphaira's menus"_i18n); - - options->Add("Advanced"_i18n, [](){ + options->Add("Advanced Options"_i18n, [](){ App::DisplayAdvancedOptions(); - }, "Change the advanced options. "\ + }, "Change the advanced options. " "Please view the info boxes to better understand each option."_i18n); }} ));