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;
|
sf::Packet rpac;
|
||||||
// TODO: make this not hang
|
// TODO: make this not hang
|
||||||
m_socket.Receive(rpac);
|
m_socket.Receive(rpac);
|
||||||
u8 error;
|
MessageId error;
|
||||||
rpac >> error;
|
rpac >> error;
|
||||||
|
|
||||||
// got error message
|
// got error message
|
||||||
|
@ -142,10 +142,13 @@ NetPlayClient::NetPlayClient(const std::string& address, const u16 port, const s
|
||||||
PanicAlert("The server is full!");
|
PanicAlert("The server is full!");
|
||||||
break;
|
break;
|
||||||
case CON_ERR_VERSION_MISMATCH :
|
case CON_ERR_VERSION_MISMATCH :
|
||||||
PanicAlert("The NetPlay versions are incompatible!");
|
PanicAlert("The server and client's NetPlay versions are incompatible!");
|
||||||
break;
|
break;
|
||||||
case CON_ERR_GAME_RUNNING :
|
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;
|
break;
|
||||||
}
|
}
|
||||||
m_socket.Close();
|
m_socket.Close();
|
||||||
|
@ -155,7 +158,7 @@ NetPlayClient::NetPlayClient(const std::string& address, const u16 port, const s
|
||||||
rpac >> m_pid;
|
rpac >> m_pid;
|
||||||
|
|
||||||
Player player;
|
Player player;
|
||||||
player.name = "Player";
|
player.name = name;
|
||||||
player.pid = m_pid;
|
player.pid = m_pid;
|
||||||
player.revision = NETPLAY_DOLPHIN_VER;
|
player.revision = NETPLAY_DOLPHIN_VER;
|
||||||
|
|
||||||
|
@ -270,7 +273,7 @@ unsigned int NetPlayServer::OnConnect(sf::SocketTCP& socket)
|
||||||
std::map<sf::SocketTCP, Player>::const_iterator
|
std::map<sf::SocketTCP, Player>::const_iterator
|
||||||
i,
|
i,
|
||||||
e = m_players.end();
|
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)
|
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
|
std::map<sf::SocketTCP, Player>::iterator
|
||||||
i = m_players.begin(),
|
i = m_players.begin(),
|
||||||
|
@ -482,7 +485,7 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, sf::SocketTCP& socket)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
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
|
// unknown message, kick the client
|
||||||
return 1;
|
return 1;
|
||||||
break;
|
break;
|
||||||
|
@ -590,8 +593,8 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
|
||||||
case NP_MSG_START_GAME :
|
case NP_MSG_START_GAME :
|
||||||
{
|
{
|
||||||
// kinda silly
|
// kinda silly
|
||||||
wxCommandEvent evt;
|
wxCommandEvent evt(wxEVT_THREAD, 46);
|
||||||
m_dialog->OnStart(evt);
|
m_dialog->AddPendingEvent(evt);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -647,7 +650,7 @@ void NetPlayClient::GetPlayerList(std::string &list)
|
||||||
|
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
|
|
||||||
std::map<u8, Player>::const_iterator
|
std::map<PlayerId, Player>::const_iterator
|
||||||
i = m_players.begin(),
|
i = m_players.begin(),
|
||||||
e = m_players.end();
|
e = m_players.end();
|
||||||
for ( ; i!=e; ++i)
|
for ( ; i!=e; ++i)
|
||||||
|
@ -756,7 +759,7 @@ bool NetPlayServer::GetNetPads(const u8 pad_nb, const SPADStatus* const pad_stat
|
||||||
{
|
{
|
||||||
m_crit.buffer.Leave();
|
m_crit.buffer.Leave();
|
||||||
// wait for receiving thread to push some data
|
// wait for receiving thread to push some data
|
||||||
Common::SleepCurrentThread(10);
|
Common::SleepCurrentThread(1);
|
||||||
m_crit.buffer.Enter();
|
m_crit.buffer.Enter();
|
||||||
}
|
}
|
||||||
*netvalues = m_pad_buffer[pad_nb].front();
|
*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();
|
m_crit.buffer.Leave();
|
||||||
// wait for receiving thread to push some data
|
// wait for receiving thread to push some data
|
||||||
Common::SleepCurrentThread(10);
|
Common::SleepCurrentThread(1);
|
||||||
m_crit.buffer.Enter();
|
m_crit.buffer.Enter();
|
||||||
}
|
}
|
||||||
*netvalues = m_pad_buffer[pad_nb].front();
|
*netvalues = m_pad_buffer[pad_nb].front();
|
||||||
|
|
|
@ -145,7 +145,7 @@ private:
|
||||||
std::string revision;
|
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 OnConnect(sf::SocketTCP& socket);
|
||||||
unsigned int OnDisconnect(sf::SocketTCP& socket);
|
unsigned int OnDisconnect(sf::SocketTCP& socket);
|
||||||
unsigned int OnData(sf::Packet& packet, sf::SocketTCP& socket);
|
unsigned int OnData(sf::Packet& packet, sf::SocketTCP& socket);
|
||||||
|
@ -184,7 +184,7 @@ private:
|
||||||
unsigned int OnData(sf::Packet& packet);
|
unsigned int OnData(sf::Packet& packet);
|
||||||
|
|
||||||
PlayerId m_pid;
|
PlayerId m_pid;
|
||||||
std::map<u8, Player> m_players;
|
std::map<PlayerId, Player> m_players;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -67,8 +67,11 @@ NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* parent, const CGameListCtrl* const
|
||||||
_connect_macro_(connect_btn, NetPlaySetupDiag::OnJoin, wxEVT_COMMAND_BUTTON_CLICKED, this);
|
_connect_macro_(connect_btn, NetPlaySetupDiag::OnJoin, wxEVT_COMMAND_BUTTON_CLICKED, this);
|
||||||
|
|
||||||
wxStaticText* const alert_lbl = new wxStaticText(connect_tab, wxID_ANY
|
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("ALERT:\n\nNetPlay will currently only work properly when using the following settings:")
|
||||||
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("\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("\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("\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.")
|
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);
|
_connect_macro_(host_btn, NetPlaySetupDiag::OnHost, wxEVT_COMMAND_BUTTON_CLICKED, this);
|
||||||
|
|
||||||
m_game_lbox = new wxListBox(host_tab, wxID_ANY);
|
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::istringstream ss(game_list->GetGameNames());
|
||||||
std::string game;
|
std::string game;
|
||||||
while (std::getline(ss,game))
|
while (std::getline(ss,game))
|
||||||
|
@ -369,11 +374,18 @@ void NetPlayDiag::OnThread(wxCommandEvent& event)
|
||||||
while (std::getline(ss, tmps))
|
while (std::getline(ss, tmps))
|
||||||
m_player_lbox->Append(wxString(tmps.c_str(), *wxConvCurrent));
|
m_player_lbox->Append(wxString(tmps.c_str(), *wxConvCurrent));
|
||||||
|
|
||||||
// update selected game :/
|
switch (event.GetId())
|
||||||
if (45 == event.GetId())
|
|
||||||
{
|
{
|
||||||
|
case 45 :
|
||||||
|
// update selected game :/
|
||||||
m_selected_game.assign(event.GetString().mb_str());
|
m_selected_game.assign(event.GetString().mb_str());
|
||||||
m_game_btn->SetLabel(event.GetString().Prepend(wxT(" Game : ")));
|
m_game_btn->SetLabel(event.GetString().Prepend(wxT(" Game : ")));
|
||||||
|
break;
|
||||||
|
case 46 :
|
||||||
|
// client start game :/
|
||||||
|
wxCommandEvent evt;
|
||||||
|
OnStart(evt);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// chat messages
|
// chat messages
|
||||||
|
|
Loading…
Reference in New Issue