[Cleanup] WX: Remove usage of NANDContentManager
Also clean up the way the system menu label is updated. We don't want to access the NAND while emulation is running, and especially not that many times per second on an unpredictable timing.
This commit is contained in:
parent
ff6b3eb9ac
commit
c03aa78c8f
|
@ -501,7 +501,6 @@ void CFrame::BindEvents()
|
||||||
Bind(DOLPHIN_EVT_RELOAD_THEME_BITMAPS, &CFrame::OnReloadThemeBitmaps, this);
|
Bind(DOLPHIN_EVT_RELOAD_THEME_BITMAPS, &CFrame::OnReloadThemeBitmaps, this);
|
||||||
Bind(DOLPHIN_EVT_REFRESH_GAMELIST, &CFrame::OnRefreshGameList, this);
|
Bind(DOLPHIN_EVT_REFRESH_GAMELIST, &CFrame::OnRefreshGameList, this);
|
||||||
Bind(DOLPHIN_EVT_RESCAN_GAMELIST, &CFrame::OnRescanGameList, this);
|
Bind(DOLPHIN_EVT_RESCAN_GAMELIST, &CFrame::OnRescanGameList, this);
|
||||||
Bind(DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM, &CFrame::OnUpdateLoadWiiMenuItem, this);
|
|
||||||
Bind(DOLPHIN_EVT_BOOT_SOFTWARE, &CFrame::OnPlay, this);
|
Bind(DOLPHIN_EVT_BOOT_SOFTWARE, &CFrame::OnPlay, this);
|
||||||
Bind(DOLPHIN_EVT_STOP_SOFTWARE, &CFrame::OnStop, this);
|
Bind(DOLPHIN_EVT_STOP_SOFTWARE, &CFrame::OnStop, this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,9 +275,6 @@ private:
|
||||||
|
|
||||||
void OnUpdateInterpreterMenuItem(wxUpdateUIEvent& event);
|
void OnUpdateInterpreterMenuItem(wxUpdateUIEvent& event);
|
||||||
|
|
||||||
void OnUpdateLoadWiiMenuItem(wxCommandEvent&);
|
|
||||||
void UpdateLoadWiiMenuItem() const;
|
|
||||||
|
|
||||||
void OnOpen(wxCommandEvent& event); // File menu
|
void OnOpen(wxCommandEvent& event); // File menu
|
||||||
void OnRefresh(wxCommandEvent& event);
|
void OnRefresh(wxCommandEvent& event);
|
||||||
void OnBootDrive(wxCommandEvent& event);
|
void OnBootDrive(wxCommandEvent& event);
|
||||||
|
|
|
@ -652,6 +652,7 @@ void CFrame::StartGame(std::unique_ptr<BootParameters> boot)
|
||||||
if (m_is_game_loading)
|
if (m_is_game_loading)
|
||||||
return;
|
return;
|
||||||
m_is_game_loading = true;
|
m_is_game_loading = true;
|
||||||
|
wxPostEvent(GetMenuBar(), wxCommandEvent{DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM});
|
||||||
|
|
||||||
GetToolBar()->EnableTool(IDM_PLAY, false);
|
GetToolBar()->EnableTool(IDM_PLAY, false);
|
||||||
GetMenuBar()->FindItem(IDM_PLAY)->Enable(false);
|
GetMenuBar()->FindItem(IDM_PLAY)->Enable(false);
|
||||||
|
@ -925,6 +926,7 @@ void CFrame::OnStopped()
|
||||||
m_confirm_stop = false;
|
m_confirm_stop = false;
|
||||||
m_is_game_loading = false;
|
m_is_game_loading = false;
|
||||||
m_tried_graceful_shutdown = false;
|
m_tried_graceful_shutdown = false;
|
||||||
|
wxPostEvent(GetMenuBar(), wxCommandEvent{DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM});
|
||||||
|
|
||||||
UninhibitScreensaver();
|
UninhibitScreensaver();
|
||||||
|
|
||||||
|
@ -1131,11 +1133,6 @@ void CFrame::OnUpdateInterpreterMenuItem(wxUpdateUIEvent& event)
|
||||||
event.Check(SConfig::GetInstance().iCPUCore == PowerPC::CORE_INTERPRETER);
|
event.Check(SConfig::GetInstance().iCPUCore == PowerPC::CORE_INTERPRETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFrame::OnUpdateLoadWiiMenuItem(wxCommandEvent& WXUNUSED(event))
|
|
||||||
{
|
|
||||||
UpdateLoadWiiMenuItem();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CFrame::ClearStatusBar()
|
void CFrame::ClearStatusBar()
|
||||||
{
|
{
|
||||||
if (this->GetStatusBar()->IsEnabled())
|
if (this->GetStatusBar()->IsEnabled())
|
||||||
|
@ -1260,7 +1257,7 @@ void CFrame::OnInstallWAD(wxCommandEvent& event)
|
||||||
wxPD_REMAINING_TIME | wxPD_SMOOTH);
|
wxPD_REMAINING_TIME | wxPD_SMOOTH);
|
||||||
|
|
||||||
if (WiiUtils::InstallWAD(fileName))
|
if (WiiUtils::InstallWAD(fileName))
|
||||||
UpdateLoadWiiMenuItem();
|
wxPostEvent(GetMenuBar(), wxCommandEvent{DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM});
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFrame::OnUninstallWAD(wxCommandEvent&)
|
void CFrame::OnUninstallWAD(wxCommandEvent&)
|
||||||
|
@ -1284,7 +1281,7 @@ void CFrame::OnUninstallWAD(wxCommandEvent&)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (title_id == Titles::SYSTEM_MENU)
|
if (title_id == Titles::SYSTEM_MENU)
|
||||||
UpdateLoadWiiMenuItem();
|
wxPostEvent(GetMenuBar(), wxCommandEvent{DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM});
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFrame::OnImportBootMiiBackup(wxCommandEvent& WXUNUSED(event))
|
void CFrame::OnImportBootMiiBackup(wxCommandEvent& WXUNUSED(event))
|
||||||
|
@ -1306,7 +1303,7 @@ void CFrame::OnImportBootMiiBackup(wxCommandEvent& WXUNUSED(event))
|
||||||
wxProgressDialog dialog(_("Importing NAND backup"), _("Working..."), 100, this,
|
wxProgressDialog dialog(_("Importing NAND backup"), _("Working..."), 100, this,
|
||||||
wxPD_APP_MODAL | wxPD_ELAPSED_TIME | wxPD_SMOOTH);
|
wxPD_APP_MODAL | wxPD_ELAPSED_TIME | wxPD_SMOOTH);
|
||||||
DiscIO::NANDImporter().ImportNANDBin(file_name, [&dialog] { dialog.Pulse(); });
|
DiscIO::NANDImporter().ImportNANDBin(file_name, [&dialog] { dialog.Pulse(); });
|
||||||
UpdateLoadWiiMenuItem();
|
wxPostEvent(GetMenuBar(), wxCommandEvent{DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM});
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFrame::OnCheckNAND(wxCommandEvent&)
|
void CFrame::OnCheckNAND(wxCommandEvent&)
|
||||||
|
@ -1462,7 +1459,7 @@ void CFrame::OnPerformOnlineWiiUpdate(wxCommandEvent& event)
|
||||||
|
|
||||||
const WiiUtils::UpdateResult result = ShowUpdateProgress(this, WiiUtils::DoOnlineUpdate, region);
|
const WiiUtils::UpdateResult result = ShowUpdateProgress(this, WiiUtils::DoOnlineUpdate, region);
|
||||||
ShowUpdateResult(result);
|
ShowUpdateResult(result);
|
||||||
UpdateLoadWiiMenuItem();
|
wxPostEvent(GetMenuBar(), wxCommandEvent{DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM});
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFrame::OnPerformDiscWiiUpdate(wxCommandEvent&)
|
void CFrame::OnPerformDiscWiiUpdate(wxCommandEvent&)
|
||||||
|
@ -1475,12 +1472,7 @@ void CFrame::OnPerformDiscWiiUpdate(wxCommandEvent&)
|
||||||
|
|
||||||
const WiiUtils::UpdateResult result = ShowUpdateProgress(this, WiiUtils::DoDiscUpdate, file_name);
|
const WiiUtils::UpdateResult result = ShowUpdateProgress(this, WiiUtils::DoDiscUpdate, file_name);
|
||||||
ShowUpdateResult(result);
|
ShowUpdateResult(result);
|
||||||
UpdateLoadWiiMenuItem();
|
wxPostEvent(GetMenuBar(), wxCommandEvent{DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM});
|
||||||
}
|
|
||||||
|
|
||||||
void CFrame::UpdateLoadWiiMenuItem() const
|
|
||||||
{
|
|
||||||
GetMenuBar()->Refresh(true, nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFrame::OnFifoPlayer(wxCommandEvent& WXUNUSED(event))
|
void CFrame::OnFifoPlayer(wxCommandEvent& WXUNUSED(event))
|
||||||
|
|
|
@ -11,10 +11,12 @@
|
||||||
#include "Core/CommonTitles.h"
|
#include "Core/CommonTitles.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
|
#include "Core/IOS/ES/ES.h"
|
||||||
|
#include "Core/IOS/ES/Formats.h"
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
#include "Core/State.h"
|
#include "Core/State.h"
|
||||||
#include "DiscIO/Enums.h"
|
#include "DiscIO/Enums.h"
|
||||||
#include "DiscIO/NANDContentLoader.h"
|
#include "DolphinWX/Frame.h"
|
||||||
#include "DolphinWX/Globals.h"
|
#include "DolphinWX/Globals.h"
|
||||||
#include "DolphinWX/WxUtils.h"
|
#include "DolphinWX/WxUtils.h"
|
||||||
|
|
||||||
|
@ -30,6 +32,7 @@ MainMenuBar::MainMenuBar(MenuType type, long style) : wxMenuBar{style}, m_type{t
|
||||||
{
|
{
|
||||||
BindEvents();
|
BindEvents();
|
||||||
AddMenus();
|
AddMenus();
|
||||||
|
RefreshWiiSystemMenuLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainMenuBar::Refresh(bool erase_background, const wxRect* rect)
|
void MainMenuBar::Refresh(bool erase_background, const wxRect* rect)
|
||||||
|
@ -62,6 +65,7 @@ void MainMenuBar::AddMenus()
|
||||||
void MainMenuBar::BindEvents()
|
void MainMenuBar::BindEvents()
|
||||||
{
|
{
|
||||||
Bind(EVT_POPULATE_PERSPECTIVES_MENU, &MainMenuBar::OnPopulatePerspectivesMenu, this);
|
Bind(EVT_POPULATE_PERSPECTIVES_MENU, &MainMenuBar::OnPopulatePerspectivesMenu, this);
|
||||||
|
Bind(DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM, &MainMenuBar::OnUpdateWiiMenuTool, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMenu* MainMenuBar::CreateFileMenu() const
|
wxMenu* MainMenuBar::CreateFileMenu() const
|
||||||
|
@ -582,16 +586,11 @@ void MainMenuBar::RefreshWiiToolsLabels() const
|
||||||
// result in the emulated software being confused, or even worse, exported saves having
|
// result in the emulated software being confused, or even worse, exported saves having
|
||||||
// inconsistent data.
|
// inconsistent data.
|
||||||
const bool enable_wii_tools = !Core::IsRunning() || !SConfig::GetInstance().bWii;
|
const bool enable_wii_tools = !Core::IsRunning() || !SConfig::GetInstance().bWii;
|
||||||
for (const int index :
|
for (const int index : {IDM_MENU_INSTALL_WAD, IDM_EXPORT_ALL_SAVE, IDM_IMPORT_SAVE,
|
||||||
{IDM_MENU_INSTALL_WAD, IDM_EXPORT_ALL_SAVE, IDM_IMPORT_SAVE, IDM_IMPORT_NAND, IDM_CHECK_NAND,
|
IDM_IMPORT_NAND, IDM_CHECK_NAND, IDM_EXTRACT_CERTIFICATES})
|
||||||
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})
|
|
||||||
{
|
{
|
||||||
FindItem(index)->Enable(enable_wii_tools);
|
FindItem(index)->Enable(enable_wii_tools);
|
||||||
}
|
}
|
||||||
if (enable_wii_tools)
|
|
||||||
RefreshWiiSystemMenuLabel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainMenuBar::EnableUpdateMenu(UpdateMenuMode mode) const
|
void MainMenuBar::EnableUpdateMenu(UpdateMenuMode mode) const
|
||||||
|
@ -608,12 +607,23 @@ void MainMenuBar::RefreshWiiSystemMenuLabel() const
|
||||||
{
|
{
|
||||||
auto* const item = FindItem(IDM_LOAD_WII_MENU);
|
auto* const item = FindItem(IDM_LOAD_WII_MENU);
|
||||||
|
|
||||||
const auto& sys_menu_loader = DiscIO::NANDContentManager::Access().GetNANDLoader(
|
if (Core::IsRunning())
|
||||||
Titles::SYSTEM_MENU, Common::FROM_CONFIGURED_ROOT);
|
|
||||||
|
|
||||||
if (sys_menu_loader.IsValid())
|
|
||||||
{
|
{
|
||||||
const u16 version_number = sys_menu_loader.GetTMD().GetTitleVersion();
|
item->Enable(false);
|
||||||
|
for (const int idm : {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})
|
||||||
|
{
|
||||||
|
FindItem(idm)->Enable(false);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IOS::HLE::Kernel ios;
|
||||||
|
const IOS::ES::TMDReader sys_menu_tmd = ios.GetES()->FindInstalledTMD(Titles::SYSTEM_MENU);
|
||||||
|
if (sys_menu_tmd.IsValid())
|
||||||
|
{
|
||||||
|
const u16 version_number = sys_menu_tmd.GetTitleVersion();
|
||||||
const wxString version_string = StrToWxStr(DiscIO::GetSysMenuVersionString(version_number));
|
const wxString version_string = StrToWxStr(DiscIO::GetSysMenuVersionString(version_number));
|
||||||
item->Enable();
|
item->Enable();
|
||||||
item->SetItemLabel(wxString::Format(_("Load Wii System Menu %s"), version_string));
|
item->SetItemLabel(wxString::Format(_("Load Wii System Menu %s"), version_string));
|
||||||
|
@ -627,6 +637,11 @@ void MainMenuBar::RefreshWiiSystemMenuLabel() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainMenuBar::OnUpdateWiiMenuTool(wxCommandEvent&)
|
||||||
|
{
|
||||||
|
RefreshWiiSystemMenuLabel();
|
||||||
|
}
|
||||||
|
|
||||||
void MainMenuBar::ClearSavedPerspectivesMenu() const
|
void MainMenuBar::ClearSavedPerspectivesMenu() const
|
||||||
{
|
{
|
||||||
while (m_saved_perspectives_menu->GetMenuItemCount() != 0)
|
while (m_saved_perspectives_menu->GetMenuItemCount() != 0)
|
||||||
|
|
|
@ -42,6 +42,7 @@ private:
|
||||||
wxMenu* CreateHelpMenu() const;
|
wxMenu* CreateHelpMenu() const;
|
||||||
|
|
||||||
void OnPopulatePerspectivesMenu(PopulatePerspectivesEvent&);
|
void OnPopulatePerspectivesMenu(PopulatePerspectivesEvent&);
|
||||||
|
void OnUpdateWiiMenuTool(wxCommandEvent&);
|
||||||
|
|
||||||
void RefreshMenuLabels() const;
|
void RefreshMenuLabels() const;
|
||||||
void RefreshPlayMenuLabel() const;
|
void RefreshPlayMenuLabel() const;
|
||||||
|
|
Loading…
Reference in New Issue