diff --git a/include/mode/usb_install_mode.hpp b/include/mode/usb_install_mode.hpp index 3ec42ebb..38b5fc36 100644 --- a/include/mode/usb_install_mode.hpp +++ b/include/mode/usb_install_mode.hpp @@ -11,6 +11,7 @@ namespace tin::ui private: std::vector m_nspNames; FsStorageId m_destStorageId = FsStorageId_SdCard; + bool m_ignoreReqFirmVersion = false; public: USBInstallMode(); @@ -20,5 +21,6 @@ namespace tin::ui void OnSelected() override; void OnNSPSelected(); void OnDestinationSelected(); + void OnIgnoreReqFirmVersionSelected(); }; } \ No newline at end of file diff --git a/source/mode/usb_install_mode.cpp b/source/mode/usb_install_mode.cpp index 04bc58fe..f924f61d 100644 --- a/source/mode/usb_install_mode.cpp +++ b/source/mode/usb_install_mode.cpp @@ -166,7 +166,35 @@ namespace tin::ui m_destStorageId = FsStorageId_NandUser; } - auto view = std::make_unique(4); + auto view = std::make_unique(); + view->AddEntry("Ignore Required Firmware Version", tin::ui::ConsoleEntrySelectType::HEADING, nullptr); + view->AddEntry("", tin::ui::ConsoleEntrySelectType::NONE, nullptr); + view->AddEntry("No", tin::ui::ConsoleEntrySelectType::SELECT, std::bind(&USBInstallMode::OnIgnoreReqFirmVersionSelected, this)); + view->AddEntry("Yes", tin::ui::ConsoleEntrySelectType::SELECT, std::bind(&USBInstallMode::OnIgnoreReqFirmVersionSelected, this)); + manager.PushView(std::move(view)); + } + + void USBInstallMode::OnIgnoreReqFirmVersionSelected() + { + // Retrieve previous selection + tin::ui::ViewManager& manager = tin::ui::ViewManager::Instance(); + ConsoleOptionsView* prevView; + + if (!(prevView = dynamic_cast(manager.GetCurrentView()))) + { + throw std::runtime_error("Previous view must be a ConsoleOptionsView!"); + } + + auto optStr = prevView->GetSelectedOptionValue()->GetText(); + m_ignoreReqFirmVersion = false; + + if (optStr == "Yes") + { + m_ignoreReqFirmVersion = true; + } + + // Push a blank view ready for installation + auto view = std::make_unique(5); manager.PushView(std::move(view)); for (auto& nspName : m_nspNames) @@ -174,7 +202,7 @@ namespace tin::ui tin::install::nsp::USBNSP usbNSP(nspName); printf("Installing from %s\n", nspName.c_str()); - tin::install::nsp::RemoteNSPInstall install(m_destStorageId, false, &usbNSP); + tin::install::nsp::RemoteNSPInstall install(m_destStorageId, m_ignoreReqFirmVersion, &usbNSP); printf("Preparing install...\n"); install.Prepare();