From 239167245dfea23f563429c30d07b3752dd83cad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Tue, 3 Oct 2017 16:45:59 +0200 Subject: Add a way to check the NAND for issues and fix them Old versions of Dolphin are so broken regarding NAND handling that we need this to repair common issues and avoid issues with titles like the System Menu or the Wii Shop. This isn't an exhaustive check, but this will catch most issues and offer to fix them automatically (if possible). --- Source/Core/DolphinWX/FrameTools.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'Source/Core/DolphinWX/FrameTools.cpp') diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index e8c7b4f487..cda03e9c6d 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -185,6 +185,7 @@ void CFrame::BindMenuBarEvents() Bind(wxEVT_MENU, &CFrame::OnInstallWAD, this, IDM_MENU_INSTALL_WAD); Bind(wxEVT_MENU, &CFrame::OnLoadWiiMenu, this, IDM_LOAD_WII_MENU); Bind(wxEVT_MENU, &CFrame::OnImportBootMiiBackup, this, IDM_IMPORT_NAND); + Bind(wxEVT_MENU, &CFrame::OnCheckNAND, this, IDM_CHECK_NAND); Bind(wxEVT_MENU, &CFrame::OnExtractCertificates, this, IDM_EXTRACT_CERTIFICATES); for (const int idm : {IDM_PERFORM_ONLINE_UPDATE_CURRENT, IDM_PERFORM_ONLINE_UPDATE_EUR, IDM_PERFORM_ONLINE_UPDATE_JPN, IDM_PERFORM_ONLINE_UPDATE_KOR, @@ -1308,6 +1309,34 @@ void CFrame::OnImportBootMiiBackup(wxCommandEvent& WXUNUSED(event)) UpdateLoadWiiMenuItem(); } +void CFrame::OnCheckNAND(wxCommandEvent&) +{ + IOS::HLE::Kernel ios; + if (WiiUtils::CheckNAND(ios)) + { + wxMessageBox(_("No issues have been detected."), _("NAND Check"), wxOK | wxICON_INFORMATION); + return; + } + + if (wxMessageBox("The emulated NAND is damaged. System titles such as the Wii Menu and " + "the Wii Shop Channel may not work correctly.\n\n" + "Do you want to try to repair the NAND?", + _("NAND Check"), wxYES_NO) != wxYES) + { + return; + } + + if (WiiUtils::RepairNAND(ios)) + { + wxMessageBox(_("The NAND has been repaired."), _("NAND Check"), wxOK | wxICON_INFORMATION); + return; + } + + wxMessageBox(_("The NAND could not be repaired. It is recommended to back up " + "your current data and start over with a fresh NAND."), + _("NAND Check"), wxOK | wxICON_ERROR); +} + void CFrame::OnExtractCertificates(wxCommandEvent& WXUNUSED(event)) { DiscIO::NANDImporter().ExtractCertificates(File::GetUserPath(D_WIIROOT_IDX)); -- cgit v1.2.3 From 02e17594b06151e652a1b51ce1018ce4747feecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Fri, 6 Oct 2017 21:45:28 +0200 Subject: WiiUtils: Attempt to fix the NAND more aggressively Change the repair logic to fix issues more aggressively by deleting bad titles. This is necessary because of a bug in Dolphin's WAD boot code. The UI code was updated to inform the user about titles that will be deleted if they continue a repair, before deleting anything. --- Source/Core/DolphinWX/FrameTools.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'Source/Core/DolphinWX/FrameTools.cpp') diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index cda03e9c6d..592f338cd2 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -1312,20 +1312,34 @@ void CFrame::OnImportBootMiiBackup(wxCommandEvent& WXUNUSED(event)) void CFrame::OnCheckNAND(wxCommandEvent&) { IOS::HLE::Kernel ios; - if (WiiUtils::CheckNAND(ios)) + WiiUtils::NANDCheckResult result = WiiUtils::CheckNAND(ios); + if (!result.bad) { wxMessageBox(_("No issues have been detected."), _("NAND Check"), wxOK | wxICON_INFORMATION); return; } - if (wxMessageBox("The emulated NAND is damaged. System titles such as the Wii Menu and " - "the Wii Shop Channel may not work correctly.\n\n" - "Do you want to try to repair the NAND?", - _("NAND Check"), wxYES_NO) != wxYES) + wxString message = _("The emulated NAND is damaged. System titles such as the Wii Menu and " + "the Wii Shop Channel may not work correctly.\n\n" + "Do you want to try to repair the NAND?"); + if (!result.titles_to_remove.empty()) { - return; + message += _("\n\nWARNING: Fixing this NAND requires the deletion of titles that have " + "incomplete data on the NAND, including all associated save data. " + "By continuing, the following title(s) will be removed:\n\n"); + Core::TitleDatabase title_db; + for (const u64 title_id : result.titles_to_remove) + { + const std::string name = title_db.GetTitleName(title_id); + message += !name.empty() ? StringFromFormat("%s (%016" PRIx64 ")", name.c_str(), title_id) : + StringFromFormat("%016" PRIx64, title_id); + message += "\n"; + } } + if (wxMessageBox(message, _("NAND Check"), wxYES_NO) != wxYES) + return; + if (WiiUtils::RepairNAND(ios)) { wxMessageBox(_("The NAND has been repaired."), _("NAND Check"), wxOK | wxICON_INFORMATION); -- cgit v1.2.3