mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -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:
@ -22,6 +22,8 @@
|
||||
#include "Core/IOS/IOS.h"
|
||||
#include "Core/Movie.h"
|
||||
#include "Core/State.h"
|
||||
#include "Core/TitleDatabase.h"
|
||||
#include "Core/WiiUtils.h"
|
||||
#include "DiscIO/NANDImporter.h"
|
||||
#include "DolphinQt2/AboutDialog.h"
|
||||
#include "DolphinQt2/GameList/GameFile.h"
|
||||
@ -114,7 +116,7 @@ void MenuBar::AddToolsMenu()
|
||||
AddAction(tools_menu, QStringLiteral(""), this, [this] { emit BootWiiSystemMenu(); });
|
||||
m_import_backup = AddAction(gc_ipl, tr("Import BootMii NAND Backup..."), this,
|
||||
[this] { emit ImportNANDBackup(); });
|
||||
|
||||
m_check_nand = AddAction(tools_menu, tr("Check NAND..."), this, &MenuBar::CheckNAND);
|
||||
m_extract_certificates = AddAction(tools_menu, tr("Extract Certificates from NAND"), this,
|
||||
&MenuBar::NANDExtractCertificates);
|
||||
|
||||
@ -473,6 +475,7 @@ void MenuBar::UpdateToolsMenu(bool emulation_started)
|
||||
m_pal_ipl->setEnabled(!emulation_started &&
|
||||
File::Exists(SConfig::GetInstance().GetBootROMPath(EUR_DIR)));
|
||||
m_import_backup->setEnabled(!emulation_started);
|
||||
m_check_nand->setEnabled(!emulation_started);
|
||||
|
||||
if (!emulation_started)
|
||||
{
|
||||
@ -532,6 +535,51 @@ void MenuBar::ExportWiiSaves()
|
||||
CWiiSaveCrypted::ExportAllSaves();
|
||||
}
|
||||
|
||||
void MenuBar::CheckNAND()
|
||||
{
|
||||
IOS::HLE::Kernel ios;
|
||||
WiiUtils::NANDCheckResult result = WiiUtils::CheckNAND(ios);
|
||||
if (!result.bad)
|
||||
{
|
||||
QMessageBox::information(this, tr("NAND Check"), tr("No issues have been detected."));
|
||||
return;
|
||||
}
|
||||
|
||||
QString message = tr("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 += tr("\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() ?
|
||||
QStringLiteral("%1 (%2)")
|
||||
.arg(QString::fromStdString(name))
|
||||
.arg(title_id, 16, 16, QLatin1Char('0')) :
|
||||
QStringLiteral("%1").arg(title_id, 16, 16, QLatin1Char('0'));
|
||||
message += QStringLiteral("\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (QMessageBox::question(this, tr("NAND Check"), message) != QMessageBox::Yes)
|
||||
return;
|
||||
|
||||
if (WiiUtils::RepairNAND(ios))
|
||||
{
|
||||
QMessageBox::information(this, tr("NAND Check"), tr("The NAND has been repaired."));
|
||||
return;
|
||||
}
|
||||
|
||||
QMessageBox::critical(this, tr("NAND Check"),
|
||||
tr("The NAND could not be repaired. It is recommended to back up "
|
||||
"your current data and start over with a fresh NAND."));
|
||||
}
|
||||
|
||||
void MenuBar::NANDExtractCertificates()
|
||||
{
|
||||
if (DiscIO::NANDImporter().ExtractCertificates(File::GetUserPath(D_WIIROOT_IDX)))
|
||||
|
@ -113,6 +113,7 @@ private:
|
||||
void InstallWAD();
|
||||
void ImportWiiSave();
|
||||
void ExportWiiSaves();
|
||||
void CheckNAND();
|
||||
void NANDExtractCertificates();
|
||||
|
||||
void OnSelectionChanged(QSharedPointer<GameFile> game_file);
|
||||
@ -131,6 +132,7 @@ private:
|
||||
QAction* m_ntscu_ipl;
|
||||
QAction* m_pal_ipl;
|
||||
QAction* m_import_backup;
|
||||
QAction* m_check_nand;
|
||||
QAction* m_extract_certificates;
|
||||
|
||||
// Emulation
|
||||
|
Reference in New Issue
Block a user