mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 17:19:44 -06:00
Merge pull request #6096 from leoetlino/wii-fsck
Add a way to check the NAND for issues and fix them
This commit is contained in:
@ -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);
|
||||
|
@ -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,48 @@ void CFrame::OnImportBootMiiBackup(wxCommandEvent& WXUNUSED(event))
|
||||
UpdateLoadWiiMenuItem();
|
||||
}
|
||||
|
||||
void CFrame::OnCheckNAND(wxCommandEvent&)
|
||||
{
|
||||
IOS::HLE::Kernel ios;
|
||||
WiiUtils::NANDCheckResult result = WiiUtils::CheckNAND(ios);
|
||||
if (!result.bad)
|
||||
{
|
||||
wxMessageBox(_("No issues have been detected."), _("NAND Check"), wxOK | wxICON_INFORMATION);
|
||||
return;
|
||||
}
|
||||
|
||||
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())
|
||||
{
|
||||
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);
|
||||
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));
|
||||
|
@ -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,
|
||||
|
@ -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})
|
||||
|
Reference in New Issue
Block a user