NetPlay: Disable some UI elements when a game is running

because it makes dolphin crash, and it doesn’t make sense to change them
at runtime
This commit is contained in:
mathieui 2015-03-27 18:41:27 +01:00
parent a2c4abcae8
commit 666c06dce7
2 changed files with 17 additions and 5 deletions

View File

@ -546,9 +546,9 @@ NetPlayDiag::NetPlayDiag(wxWindow* const parent, const CGameListCtrl* const game
player_szr->Add(m_kick_btn, 0, wxEXPAND | wxTOP, 5); player_szr->Add(m_kick_btn, 0, wxEXPAND | wxTOP, 5);
m_kick_btn->Disable(); m_kick_btn->Disable();
wxButton* const player_config_btn = new wxButton(panel, wxID_ANY, _("Configure Pads")); m_player_config_btn = new wxButton(panel, wxID_ANY, _("Configure Pads"));
player_config_btn->Bind(wxEVT_BUTTON, &NetPlayDiag::OnConfigPads, this); m_player_config_btn->Bind(wxEVT_BUTTON, &NetPlayDiag::OnConfigPads, this);
player_szr->Add(player_config_btn, 0, wxEXPAND | wxTOP, 5); player_szr->Add(m_player_config_btn, 0, wxEXPAND | wxTOP, 5);
} }
wxBoxSizer* const mid_szr = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* const mid_szr = new wxBoxSizer(wxHORIZONTAL);
@ -691,8 +691,14 @@ void NetPlayDiag::OnMsgStartGame()
{ {
wxThreadEvent evt(wxEVT_THREAD, NP_GUI_EVT_START_GAME); wxThreadEvent evt(wxEVT_THREAD, NP_GUI_EVT_START_GAME);
GetEventHandler()->AddPendingEvent(evt); GetEventHandler()->AddPendingEvent(evt);
if (m_start_btn) if (m_is_hosting)
{
m_start_btn->Disable(); m_start_btn->Disable();
m_memcard_write->Disable();
m_game_btn->Disable();
m_player_config_btn->Disable();
}
m_record_chkbox->Disable(); m_record_chkbox->Disable();
} }
@ -700,8 +706,13 @@ void NetPlayDiag::OnMsgStopGame()
{ {
wxThreadEvent evt(wxEVT_THREAD, NP_GUI_EVT_STOP_GAME); wxThreadEvent evt(wxEVT_THREAD, NP_GUI_EVT_STOP_GAME);
GetEventHandler()->AddPendingEvent(evt); GetEventHandler()->AddPendingEvent(evt);
if (m_start_btn) if (m_is_hosting)
{
m_start_btn->Enable(); m_start_btn->Enable();
m_memcard_write->Enable();
m_game_btn->Enable();
m_player_config_btn->Enable();
}
m_record_chkbox->Enable(); m_record_chkbox->Enable();
} }

View File

@ -114,6 +114,7 @@ private:
wxCheckBox* m_record_chkbox; wxCheckBox* m_record_chkbox;
std::string m_selected_game; std::string m_selected_game;
wxButton* m_player_config_btn;
wxButton* m_game_btn; wxButton* m_game_btn;
wxButton* m_start_btn; wxButton* m_start_btn;
wxButton* m_kick_btn; wxButton* m_kick_btn;