Don't allow wiimote config while in Gamecube mode

Fixes crash when attempting to open emulated wiimote config in Gamecube mode
This commit is contained in:
Shawn Hoffman 2012-03-19 06:03:05 -07:00
parent 6091774ade
commit c3a537728f

View File

@ -1551,16 +1551,21 @@ void CFrame::UpdateGUI()
bool Initialized = Core::IsRunning(); bool Initialized = Core::IsRunning();
bool Running = Core::GetState() == Core::CORE_RUN; bool Running = Core::GetState() == Core::CORE_RUN;
bool Paused = Core::GetState() == Core::CORE_PAUSE; bool Paused = Core::GetState() == Core::CORE_PAUSE;
bool RunningWii = Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii;
bool RunningGamecube = Initialized && !SConfig::GetInstance().m_LocalCoreStartupParameter.bWii;
// Make sure that we have a toolbar // Make sure that we have a toolbar
if (m_ToolBar) if (m_ToolBar)
{ {
// Enable/disable the Config and Stop buttons // Enable/disable the Config and Stop buttons
m_ToolBar->EnableTool(wxID_OPEN, !Initialized); m_ToolBar->EnableTool(wxID_OPEN, !Initialized);
m_ToolBar->EnableTool(wxID_REFRESH, !Initialized); // Don't allow refresh when we don't show the list // Don't allow refresh when we don't show the list
m_ToolBar->EnableTool(wxID_REFRESH, !Initialized);
m_ToolBar->EnableTool(IDM_STOP, Running || Paused); m_ToolBar->EnableTool(IDM_STOP, Running || Paused);
m_ToolBar->EnableTool(IDM_TOGGLE_FULLSCREEN, Running || Paused); m_ToolBar->EnableTool(IDM_TOGGLE_FULLSCREEN, Running || Paused);
m_ToolBar->EnableTool(IDM_SCREENSHOT, Running || Paused); m_ToolBar->EnableTool(IDM_SCREENSHOT, Running || Paused);
// Don't allow wiimote config while in Gamecube mode
m_ToolBar->EnableTool(IDM_CONFIG_WIIMOTE_PLUGIN, !RunningGamecube);
} }
// File // File
@ -1590,15 +1595,12 @@ void CFrame::UpdateGUI()
if (DiscIO::CNANDContentManager::Access().GetNANDLoader(TITLEID_SYSMENU).IsValid()) if (DiscIO::CNANDContentManager::Access().GetNANDLoader(TITLEID_SYSMENU).IsValid())
GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable(!Initialized); GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable(!Initialized);
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)-> GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Enable(RunningWii);
Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii); GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)->Enable(RunningWii);
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)-> GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->Enable(RunningWii);
Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii); GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->Enable(RunningWii);
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)-> GetMenuBar()->FindItem(IDM_CONFIG_WIIMOTE_PLUGIN)->Enable(!RunningGamecube);
Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii); if (RunningWii)
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->
Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii);
if (Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
{ {
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Check(GetUsbPointer()-> GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Check(GetUsbPointer()->
AccessWiiMote(0x0100)->IsConnected()); AccessWiiMote(0x0100)->IsConnected());