NetPlay: Fixed a problem with client game start code. Other minor fixes.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5427 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
b2e0dc2519
commit
533162b41f
|
@ -130,7 +130,7 @@ NetPlayClient::NetPlayClient(const std::string& address, const u16 port, const s
|
|||
sf::Packet rpac;
|
||||
// TODO: make this not hang
|
||||
m_socket.Receive(rpac);
|
||||
u8 error;
|
||||
MessageId error;
|
||||
rpac >> error;
|
||||
|
||||
// got error message
|
||||
|
@ -142,10 +142,13 @@ NetPlayClient::NetPlayClient(const std::string& address, const u16 port, const s
|
|||
PanicAlert("The server is full!");
|
||||
break;
|
||||
case CON_ERR_VERSION_MISMATCH :
|
||||
PanicAlert("The NetPlay versions are incompatible!");
|
||||
PanicAlert("The server and client's NetPlay versions are incompatible!");
|
||||
break;
|
||||
case CON_ERR_GAME_RUNNING :
|
||||
PanicAlert("The game is currently running!");
|
||||
PanicAlert("The server responded: the game is currently running!");
|
||||
break;
|
||||
default :
|
||||
PanicAlert("The server sent an unknown error message!");
|
||||
break;
|
||||
}
|
||||
m_socket.Close();
|
||||
|
@ -155,7 +158,7 @@ NetPlayClient::NetPlayClient(const std::string& address, const u16 port, const s
|
|||
rpac >> m_pid;
|
||||
|
||||
Player player;
|
||||
player.name = "Player";
|
||||
player.name = name;
|
||||
player.pid = m_pid;
|
||||
player.revision = NETPLAY_DOLPHIN_VER;
|
||||
|
||||
|
@ -270,7 +273,7 @@ unsigned int NetPlayServer::OnConnect(sf::SocketTCP& socket)
|
|||
std::map<sf::SocketTCP, Player>::const_iterator
|
||||
i,
|
||||
e = m_players.end();
|
||||
for (u8 p = 1; 0 == player.pid; ++p)
|
||||
for (PlayerId p = 1; 0 == player.pid; ++p)
|
||||
{
|
||||
for (i = m_players.begin(); ; ++i)
|
||||
{
|
||||
|
@ -401,7 +404,7 @@ void NetPlay::UpdateGUI()
|
|||
}
|
||||
}
|
||||
|
||||
void NetPlayServer::SendToClients(sf::Packet& packet, const u8 skip_pid)
|
||||
void NetPlayServer::SendToClients(sf::Packet& packet, const PlayerId skip_pid)
|
||||
{
|
||||
std::map<sf::SocketTCP, Player>::iterator
|
||||
i = m_players.begin(),
|
||||
|
@ -482,7 +485,7 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, sf::SocketTCP& socket)
|
|||
break;
|
||||
|
||||
default :
|
||||
//PanicAlert("Unknown message received with id : %d", mid);
|
||||
PanicAlert("Unknown message with id:%d received from player:%d Kicking player!", mid, player.pid);
|
||||
// unknown message, kick the client
|
||||
return 1;
|
||||
break;
|
||||
|
@ -590,8 +593,8 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
|
|||
case NP_MSG_START_GAME :
|
||||
{
|
||||
// kinda silly
|
||||
wxCommandEvent evt;
|
||||
m_dialog->OnStart(evt);
|
||||
wxCommandEvent evt(wxEVT_THREAD, 46);
|
||||
m_dialog->AddPendingEvent(evt);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -647,7 +650,7 @@ void NetPlayClient::GetPlayerList(std::string &list)
|
|||
|
||||
std::ostringstream ss;
|
||||
|
||||
std::map<u8, Player>::const_iterator
|
||||
std::map<PlayerId, Player>::const_iterator
|
||||
i = m_players.begin(),
|
||||
e = m_players.end();
|
||||
for ( ; i!=e; ++i)
|
||||
|
@ -756,7 +759,7 @@ bool NetPlayServer::GetNetPads(const u8 pad_nb, const SPADStatus* const pad_stat
|
|||
{
|
||||
m_crit.buffer.Leave();
|
||||
// wait for receiving thread to push some data
|
||||
Common::SleepCurrentThread(10);
|
||||
Common::SleepCurrentThread(1);
|
||||
m_crit.buffer.Enter();
|
||||
}
|
||||
*netvalues = m_pad_buffer[pad_nb].front();
|
||||
|
@ -810,7 +813,7 @@ bool NetPlayClient::GetNetPads(const u8 pad_nb, const SPADStatus* const pad_stat
|
|||
{
|
||||
m_crit.buffer.Leave();
|
||||
// wait for receiving thread to push some data
|
||||
Common::SleepCurrentThread(10);
|
||||
Common::SleepCurrentThread(1);
|
||||
m_crit.buffer.Enter();
|
||||
}
|
||||
*netvalues = m_pad_buffer[pad_nb].front();
|
||||
|
|
|
@ -145,7 +145,7 @@ private:
|
|||
std::string revision;
|
||||
};
|
||||
|
||||
void SendToClients(sf::Packet& packet, const u8 skip_pid = 0);
|
||||
void SendToClients(sf::Packet& packet, const PlayerId skip_pid = 0);
|
||||
unsigned int OnConnect(sf::SocketTCP& socket);
|
||||
unsigned int OnDisconnect(sf::SocketTCP& socket);
|
||||
unsigned int OnData(sf::Packet& packet, sf::SocketTCP& socket);
|
||||
|
@ -184,7 +184,7 @@ private:
|
|||
unsigned int OnData(sf::Packet& packet);
|
||||
|
||||
PlayerId m_pid;
|
||||
std::map<u8, Player> m_players;
|
||||
std::map<PlayerId, Player> m_players;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -67,8 +67,11 @@ NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* parent, const CGameListCtrl* const
|
|||
_connect_macro_(connect_btn, NetPlaySetupDiag::OnJoin, wxEVT_COMMAND_BUTTON_CLICKED, this);
|
||||
|
||||
wxStaticText* const alert_lbl = new wxStaticText(connect_tab, wxID_ANY
|
||||
, wxT("ALERT:\n\nNetPlay will currently only work properly when using the following settings:\n")
|
||||
wxT(" - Dual Core [OFF]\n - DSP LLE Plugin\n - DSPLLE on thread [OFF]\n - Manually set the exact number of controller that will be used to [Standard Controller]")
|
||||
, wxT("ALERT:\n\nNetPlay will currently only work properly when using the following settings:")
|
||||
wxT("\n - Dual Core [OFF]")
|
||||
wxT("\n - Audio Throttle [OFF] (if using DSP HLE)")
|
||||
wxT("\n - DSP LLE Plugin (may not be needed)\n - DSPLLE on thread [OFF]")
|
||||
wxT("\n - Manually set the exact number of controller that will be used to [Standard Controller]")
|
||||
wxT("\n\nAll players should try to use the same Dolphin version and settings.")
|
||||
wxT("\nDisable all memory cards or send them to all players before starting.")
|
||||
wxT("\nWiimote support has not been implemented.\nWii games will likely desync for other reasons as well.")
|
||||
|
@ -101,6 +104,8 @@ NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* parent, const CGameListCtrl* const
|
|||
_connect_macro_(host_btn, NetPlaySetupDiag::OnHost, wxEVT_COMMAND_BUTTON_CLICKED, this);
|
||||
|
||||
m_game_lbox = new wxListBox(host_tab, wxID_ANY);
|
||||
_connect_macro_(m_game_lbox, NetPlaySetupDiag::OnHost, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, this);
|
||||
|
||||
std::istringstream ss(game_list->GetGameNames());
|
||||
std::string game;
|
||||
while (std::getline(ss,game))
|
||||
|
@ -369,11 +374,18 @@ void NetPlayDiag::OnThread(wxCommandEvent& event)
|
|||
while (std::getline(ss, tmps))
|
||||
m_player_lbox->Append(wxString(tmps.c_str(), *wxConvCurrent));
|
||||
|
||||
// update selected game :/
|
||||
if (45 == event.GetId())
|
||||
switch (event.GetId())
|
||||
{
|
||||
case 45 :
|
||||
// update selected game :/
|
||||
m_selected_game.assign(event.GetString().mb_str());
|
||||
m_game_btn->SetLabel(event.GetString().Prepend(wxT(" Game : ")));
|
||||
break;
|
||||
case 46 :
|
||||
// client start game :/
|
||||
wxCommandEvent evt;
|
||||
OnStart(evt);
|
||||
break;
|
||||
}
|
||||
|
||||
// chat messages
|
||||
|
|
Loading…
Reference in New Issue