WX: Disable a few menu items when a Wii title is running

Unsafe and keeping them enabled would allow inaccurate behaviour that
can break games.
This commit is contained in:
Léo Lam 2017-03-29 15:47:04 +02:00
parent 4c0a392698
commit d8089a457f
3 changed files with 34 additions and 4 deletions

View File

@ -984,8 +984,17 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
}
if (platform == DiscIO::Platform::WII_DISC || platform == DiscIO::Platform::WII_WAD)
{
auto* const open_save_folder_item =
popupMenu.Append(IDM_OPEN_SAVE_FOLDER, _("Open Wii &save folder"));
auto* const export_save_item =
popupMenu.Append(IDM_EXPORT_SAVE, _("Export Wii save (Experimental)"));
// We should not allow the user to mess with the save folder or export saves while
// emulation is running, because this could result in the exported save being in
// an inconsistent state; the emulated software can do *anything* to its data directory,
// and we definitely do not want the user to touch anything in there if it's running.
for (auto* menu_item : {open_save_folder_item, export_save_item})
menu_item->Enable(!Core::IsRunning() || !SConfig::GetInstance().bWii);
}
popupMenu.Append(IDM_OPEN_CONTAINING_FOLDER, _("Open &containing folder"));
@ -1011,7 +1020,12 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
}
if (platform == DiscIO::Platform::WII_WAD)
{
auto* const install_wad_item =
popupMenu.Append(IDM_LIST_INSTALL_WAD, _("Install to Wii Menu"));
// This should not be allowed while emulation is running, just like the Install WAD option.
install_wad_item->Enable(!Core::IsRunning() || !SConfig::GetInstance().bWii);
}
popupMenu.Append(IDM_START_NETPLAY, _("Host with Netplay"));

View File

@ -514,7 +514,7 @@ void MainMenuBar::RefreshMenuLabels() const
{
RefreshPlayMenuLabel();
RefreshSaveStateMenuLabels();
RefreshWiiSystemMenuLabel();
RefreshWiiToolsLabels();
}
void MainMenuBar::RefreshPlayMenuLabel() const
@ -545,6 +545,21 @@ void MainMenuBar::RefreshSaveStateMenuLabels() const
}
}
void MainMenuBar::RefreshWiiToolsLabels() const
{
RefreshWiiSystemMenuLabel();
// The Install WAD option should not be enabled while emulation is running, because
// having unexpected title changes can confuse emulated software; and of course, this is
// not possible on a real Wii and won't be if we have IOS LLE (or simply more accurate IOS HLE).
//
// For similar reasons, it should not be possible to export or import saves, because this can
// result in the emulated software being confused, or even worse, exported saves having
// inconsistent data.
for (const int index : {IDM_MENU_INSTALL_WAD, IDM_EXPORT_ALL_SAVE, IDM_IMPORT_SAVE})
FindItem(index)->Enable(!Core::IsRunning() || !SConfig::GetInstance().bWii);
}
void MainMenuBar::RefreshWiiSystemMenuLabel() const
{
auto* const item = FindItem(IDM_LOAD_WII_MENU);

View File

@ -46,6 +46,7 @@ private:
void RefreshMenuLabels() const;
void RefreshPlayMenuLabel() const;
void RefreshSaveStateMenuLabels() const;
void RefreshWiiToolsLabels() const;
void RefreshWiiSystemMenuLabel() const;
void ClearSavedPerspectivesMenu() const;