diff --git a/sphaira/include/app.hpp b/sphaira/include/app.hpp index 8a8c654..df15b97 100644 --- a/sphaira/include/app.hpp +++ b/sphaira/include/app.hpp @@ -63,6 +63,7 @@ class App { static auto GetNxlinkEnable() -> bool; static auto GetLogEnable() -> bool; static auto GetReplaceHbmenuEnable() -> bool; + static auto GetInstallEnable() -> bool; static auto GetInstallSdEnable() -> bool; static auto GetInstallPrompt() -> bool; static auto GetThemeShuffleEnable() -> bool; @@ -72,7 +73,9 @@ class App { static void SetNxlinkEnable(bool enable); static void SetLogEnable(bool enable); static void SetReplaceHbmenuEnable(bool enable); + static void SetInstallEnable(bool enable); static void SetInstallSdEnable(bool enable); + static void SetInstallPrompt(bool enable); static void SetThemeShuffleEnable(bool enable); static void SetThemeMusicEnable(bool enable); static void SetLanguage(long index); @@ -139,6 +142,7 @@ class App { option::OptionBool m_nxlink_enabled{INI_SECTION, "nxlink_enabled", true}; option::OptionBool m_log_enabled{INI_SECTION, "log_enabled", false}; option::OptionBool m_replace_hbmenu{INI_SECTION, "replace_hbmenu", false}; + option::OptionBool m_install{INI_SECTION, "install", false}; option::OptionBool m_install_sd{INI_SECTION, "install_sd", true}; option::OptionLong m_install_prompt{INI_SECTION, "install_prompt", true}; option::OptionBool m_theme_shuffle{INI_SECTION, "theme_shuffle", false}; diff --git a/sphaira/source/app.cpp b/sphaira/source/app.cpp index 65c2b02..578de27 100644 --- a/sphaira/source/app.cpp +++ b/sphaira/source/app.cpp @@ -363,6 +363,10 @@ auto App::GetReplaceHbmenuEnable() -> bool { return g_app->m_replace_hbmenu.Get(); } +auto App::GetInstallEnable() -> bool { + return g_app->m_install.Get(); +} + auto App::GetInstallSdEnable() -> bool { return g_app->m_install_sd.Get(); } @@ -409,10 +413,18 @@ void App::SetReplaceHbmenuEnable(bool enable) { g_app->m_replace_hbmenu.Set(enable); } +void App::SetInstallEnable(bool enable) { + g_app->m_install.Set(enable); +} + void App::SetInstallSdEnable(bool enable) { g_app->m_install_sd.Set(enable); } +void App::SetInstallPrompt(bool enable) { + g_app->m_install_prompt.Set(enable); +} + void App::SetThemeShuffleEnable(bool enable) { g_app->m_theme_shuffle.Set(enable); } diff --git a/sphaira/source/ui/menus/filebrowser.cpp b/sphaira/source/ui/menus/filebrowser.cpp index b6c694f..004e4d0 100644 --- a/sphaira/source/ui/menus/filebrowser.cpp +++ b/sphaira/source/ui/menus/filebrowser.cpp @@ -608,7 +608,7 @@ Menu::Menu(const std::vector& nro_entries) : MenuBase{"FileBrowser"_i1 } if (m_entries_current.size()) { - if (HasTypeInSelectedEntries(FsDirEntryType_File) && !m_selected_count && (GetEntry().GetExtension() == "nro" || !FindFileAssocFor().empty())) { + if (App::GetInstallEnable() && HasTypeInSelectedEntries(FsDirEntryType_File) && !m_selected_count && (GetEntry().GetExtension() == "nro" || !FindFileAssocFor().empty())) { options->Add(std::make_shared("Install Forwarder"_i18n, [this](){; if (App::GetInstallPrompt()) { App::Push(std::make_shared( diff --git a/sphaira/source/ui/menus/homebrew.cpp b/sphaira/source/ui/menus/homebrew.cpp index e7e90fb..0fb5e10 100644 --- a/sphaira/source/ui/menus/homebrew.cpp +++ b/sphaira/source/ui/menus/homebrew.cpp @@ -126,20 +126,22 @@ Menu::Menu() : MenuBase{"Homebrew"_i18n} { )); }, true)); - options->Add(std::make_shared("Install Forwarder"_i18n, [this](){ - if (App::GetInstallPrompt()) { - App::Push(std::make_shared( - "WARNING: Installing forwarders will lead to a ban!"_i18n, - "Back"_i18n, "Install"_i18n, 0, [this](auto op_index){ - if (op_index && *op_index) { - InstallHomebrew(); + if (App::GetInstallEnable()) { + options->Add(std::make_shared("Install Forwarder"_i18n, [this](){ + if (App::GetInstallPrompt()) { + App::Push(std::make_shared( + "WARNING: Installing forwarders will lead to a ban!"_i18n, + "Back"_i18n, "Install"_i18n, 0, [this](auto op_index){ + if (op_index && *op_index) { + InstallHomebrew(); + } } - } - )); - } else { - InstallHomebrew(); - } - }, true)); + )); + } else { + InstallHomebrew(); + } + }, true)); + } } }}) ); diff --git a/sphaira/source/ui/menus/main_menu.cpp b/sphaira/source/ui/menus/main_menu.cpp index 98dba55..1e1192b 100644 --- a/sphaira/source/ui/menus/main_menu.cpp +++ b/sphaira/source/ui/menus/main_menu.cpp @@ -204,7 +204,6 @@ MainMenu::MainMenu() { SidebarEntryArray::Items language_items; language_items.push_back("Auto"_i18n); - language_items.push_back("English"_i18n); language_items.push_back("Japanese"_i18n); language_items.push_back("French"_i18n); @@ -266,17 +265,10 @@ MainMenu::MainMenu() { } })); - options->Add(std::make_shared("Language"_i18n, language_items, [this, language_items](std::size_t& index_out){ + options->Add(std::make_shared("Language"_i18n, language_items, [this](std::size_t& index_out){ App::SetLanguage(index_out); }, (std::size_t)App::GetLanguage())); - options->Add(std::make_shared("Logging"_i18n, App::GetLogEnable(), [this](bool& enable){ - App::SetLogEnable(enable); - }, "Enabled"_i18n, "Disabled"_i18n)); - options->Add(std::make_shared("Replace hbmenu on exit"_i18n, App::GetReplaceHbmenuEnable(), [this](bool& enable){ - App::SetReplaceHbmenuEnable(enable); - }, "Enabled"_i18n, "Disabled"_i18n)); - options->Add(std::make_shared("Misc"_i18n, [this](){ auto options = std::make_shared("Misc Options"_i18n, Sidebar::Side::LEFT); ON_SCOPE_EXIT(App::Push(options)); @@ -284,12 +276,45 @@ MainMenu::MainMenu() { options->Add(std::make_shared("Themezer"_i18n, [](){ App::Push(std::make_shared()); })); + options->Add(std::make_shared("Irs"_i18n, [](){ App::Push(std::make_shared()); })); - options->Add(std::make_shared("Web"_i18n, [](){ - WebShow("https://lite.duckduckgo.com/lite"); - })); + + if (App::IsApplication()) { + options->Add(std::make_shared("Web"_i18n, [](){ + WebShow("https://lite.duckduckgo.com/lite"); + })); + } + })); + + options->Add(std::make_shared("Advanced"_i18n, [this](){ + auto options = std::make_shared("Advanced Options"_i18n, Sidebar::Side::LEFT); + ON_SCOPE_EXIT(App::Push(options)); + + SidebarEntryArray::Items install_items; + install_items.push_back("System memory"_i18n); + install_items.push_back("microSD card"_i18n); + + options->Add(std::make_shared("Logging"_i18n, App::GetLogEnable(), [this](bool& enable){ + App::SetLogEnable(enable); + }, "Enabled"_i18n, "Disabled"_i18n)); + + options->Add(std::make_shared("Replace hbmenu on exit"_i18n, App::GetReplaceHbmenuEnable(), [this](bool& enable){ + App::SetReplaceHbmenuEnable(enable); + }, "Enabled"_i18n, "Disabled"_i18n)); + + options->Add(std::make_shared("Install forwarders"_i18n, App::GetInstallEnable(), [this](bool& enable){ + App::SetInstallEnable(enable); + }, "Enabled"_i18n, "Disabled"_i18n)); + + options->Add(std::make_shared("Install location"_i18n, install_items, [this](std::size_t& index_out){ + App::SetInstallSdEnable(index_out); + }, (std::size_t)App::GetInstallSdEnable())); + + options->Add(std::make_shared("Show install warning"_i18n, App::GetInstallPrompt(), [this](bool& enable){ + App::SetInstallPrompt(enable); + }, "Enabled"_i18n, "Disabled"_i18n)); })); }}) );