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).
This commit is contained in:
Léo Lam
2017-10-08 18:31:42 +02:00
parent 2974c56e50
commit 239167245d
8 changed files with 164 additions and 2 deletions
+1
View File
@@ -348,6 +348,7 @@ private:
void OnInstallWAD(wxCommandEvent& event);
void OnUninstallWAD(wxCommandEvent& event);
void OnImportBootMiiBackup(wxCommandEvent& event);
void OnCheckNAND(wxCommandEvent& event);
void OnExtractCertificates(wxCommandEvent& event);
void OnPerformOnlineWiiUpdate(wxCommandEvent& event);
void OnPerformDiscWiiUpdate(wxCommandEvent& event);
+29
View File
@@ -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));
+1
View File
@@ -105,6 +105,7 @@ enum
IDM_LIST_INSTALL_WAD,
IDM_LIST_UNINSTALL_WAD,
IDM_IMPORT_NAND,
IDM_CHECK_NAND,
IDM_EXTRACT_CERTIFICATES,
IDM_PERFORM_ONLINE_UPDATE_CURRENT,
IDM_PERFORM_ONLINE_UPDATE_EUR,
+2 -1
View File
@@ -235,6 +235,7 @@ wxMenu* MainMenuBar::CreateToolsMenu() const
tools_menu->Append(IDM_MENU_INSTALL_WAD, _("Install WAD..."));
tools_menu->Append(IDM_LOAD_WII_MENU, dummy_string);
tools_menu->Append(IDM_IMPORT_NAND, _("Import BootMii NAND Backup..."));
tools_menu->Append(IDM_CHECK_NAND, _("Check NAND..."));
tools_menu->Append(IDM_EXTRACT_CERTIFICATES, _("Extract Certificates from NAND"));
auto* const online_update_menu = new wxMenu;
online_update_menu->Append(IDM_PERFORM_ONLINE_UPDATE_CURRENT, _("Current Region"));
@@ -582,7 +583,7 @@ void MainMenuBar::RefreshWiiToolsLabels() const
// inconsistent data.
const bool enable_wii_tools = !Core::IsRunning() || !SConfig::GetInstance().bWii;
for (const int index :
{IDM_MENU_INSTALL_WAD, IDM_EXPORT_ALL_SAVE, IDM_IMPORT_SAVE, IDM_IMPORT_NAND,
{IDM_MENU_INSTALL_WAD, IDM_EXPORT_ALL_SAVE, IDM_IMPORT_SAVE, IDM_IMPORT_NAND, IDM_CHECK_NAND,
IDM_EXTRACT_CERTIFICATES, IDM_LOAD_WII_MENU, IDM_PERFORM_ONLINE_UPDATE_CURRENT,
IDM_PERFORM_ONLINE_UPDATE_EUR, IDM_PERFORM_ONLINE_UPDATE_JPN, IDM_PERFORM_ONLINE_UPDATE_KOR,
IDM_PERFORM_ONLINE_UPDATE_USA})