Netplay compiles on linux, please test

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3229 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2009-05-14 08:46:18 +00:00
parent d0653aa53a
commit 6f9a49b930
5 changed files with 25 additions and 19 deletions

View File

@ -253,7 +253,7 @@ else:
# sfml # sfml
env['HAVE_SFML'] = 0 env['HAVE_SFML'] = 0
if conf.CheckPKG('sfml') and conf.CheckCHeader("SFML/Audio.hpp"): if conf.CheckPKG('sfml-network') and conf.CheckCXXHeader("SFML/Network/Ftp.hpp"):
env['HAVE_SFML'] = 1; env['HAVE_SFML'] = 1;
#osx 64 specifics #osx 64 specifics

View File

@ -29,6 +29,11 @@ Core::GetWindowHandle().
*/ */
// FIXME: why doesn't it work on windows???
#ifndef _WIN32
#include "Common.h"
#endif
#if defined(HAVE_SFML) && HAVE_SFML || defined(_WIN32) #if defined(HAVE_SFML) && HAVE_SFML || defined(_WIN32)
#include "NetWindow.h" #include "NetWindow.h"
#endif #endif

View File

@ -62,7 +62,7 @@ ServerSide::ServerSide(NetPlay* netptr, sf::SocketTCP socket, int netmodel, std:
char ServerSide::GetSocket(sf::SocketTCP Socket) char ServerSide::GetSocket(sf::SocketTCP Socket)
{ {
for (char i=0; i < m_numplayers; i++) for (int i=0; i < m_numplayers; i++)
{ {
if(m_client[i].socket == Socket) if(m_client[i].socket == Socket)
return i; return i;
@ -119,7 +119,7 @@ void *ServerSide::Entry()
else else
{ {
unsigned char recv; unsigned char recv;
char socket_nb; int socket_nb;
size_t recv_size; size_t recv_size;
sf::Socket::Status recv_status; sf::Socket::Status recv_status;
@ -147,22 +147,22 @@ void *ServerSide::Entry()
player_left.c_str()) ); player_left.c_str()) );
// We need to adjust the struct... // We need to adjust the struct...
for (char i = socket_nb; i < m_numplayers; i++) for (int j = socket_nb; j < m_numplayers; j++)
{ {
m_client[i].socket = m_client[i+1].socket; m_client[j].socket = m_client[j+1].socket;
m_client[i].nick = m_client[i+1].nick; m_client[j].nick = m_client[j+1].nick;
m_client[i].ready = m_client[i+1].ready; m_client[j].ready = m_client[j+1].ready;
} }
// Send disconnected message to all // Send disconnected message to all
unsigned char send = 0x11; unsigned char send = 0x11;
unsigned int str_size = (int)player_left.size(); unsigned int str_size = (int)player_left.size();
for (int i=0; i < m_numplayers ; i++) for (int j=0; j < m_numplayers ; j++)
{ {
m_client[i].socket.Send((const char*)&send, 1); m_client[j].socket.Send((const char*)&send, 1);
m_client[i].socket.Send((const char*)&str_size, 4); m_client[j].socket.Send((const char*)&str_size, 4);
m_client[i].socket.Send(player_left.c_str(), (int)str_size + 1); m_client[j].socket.Send(player_left.c_str(), (int)str_size + 1);
} }
} }
else else

View File

@ -62,7 +62,7 @@ void NetPlay::OnJoin(wxCommandEvent& WXUNUSED(event))
// Create the client socket // Create the client socket
sf::SocketTCP sock_client; sf::SocketTCP sock_client;
if (sock_client.Connect(port, host.mb_str(), 1.5) == sf::Socket::Done) if (sock_client.Connect(port, (const char *)host.mb_str(), 1.5) == sf::Socket::Done)
{ {
m_sock_client = new ClientSide(this, sock_client, std::string(addr.mb_str()), m_nick); m_sock_client = new ClientSide(this, sock_client, std::string(addr.mb_str()), m_nick);
m_sock_client->Create(); m_sock_client->Create();
@ -303,14 +303,15 @@ void NetPlay::UpdateNetWindow(bool update_infos, wxString infos/*int fps, float
// String of the type : FPSxPINGxFRAME_DELAY // String of the type : FPSxPINGxFRAME_DELAY
SplitString(std::string(infos.mb_str()), "x", str_arr); SplitString(std::string(infos.mb_str()), "x", str_arr);
m_ConInfo_text->SetLabel( m_ConInfo_text->SetLabel
wxString::Format( " Fps : %s | Ping : %s | Frame Delay : %s", (wxString::Format(wxT(" Fps : %s | Ping : %s | Frame Delay : %s"),
str_arr[0].c_str(), str_arr[1].c_str(), str_arr[2].c_str() )); str_arr[0].c_str(), str_arr[1].c_str(),
str_arr[2].c_str()) );
} }
else else
{ {
m_critical.Enter(); m_critical.Enter();
m_Game_str->SetLabel(wxString::Format(" Game : %s", m_selectedGame.c_str())); m_Game_str->SetLabel(wxString::Format(wxT(" Game : %s"), m_selectedGame.c_str()));
m_critical.Leave(); m_critical.Leave();
} }
} }
@ -430,13 +431,13 @@ void NetPlay::OnGUIEvent(wxCommandEvent& event)
// Send Chat string // Send Chat string
m_sock_server->Write(i, (const char*)&chat_size, 4); m_sock_server->Write(i, (const char*)&chat_size, 4);
m_sock_server->Write(i, chat_str.c_str(), chat_size + 1); m_sock_server->Write(i, chat_str.mb_str(), chat_size + 1);
} }
} }
else { else {
m_sock_client->Write((const char*)&value, 1); m_sock_client->Write((const char*)&value, 1);
m_sock_client->Write((const char*)&chat_size, 4); m_sock_client->Write((const char*)&chat_size, 4);
m_sock_client->Write(chat_str.c_str(), chat_size + 1); m_sock_client->Write(chat_str.mb_str(), chat_size + 1);
} }
m_Chat->Clear(); m_Chat->Clear();

View File

@ -144,7 +144,7 @@ class NetPlay : public wxDialog
NetPlay(wxWindow* parent, std::string GamePath = "", std::string GameName = ""); NetPlay(wxWindow* parent, std::string GamePath = "", std::string GameName = "");
~NetPlay() {} ~NetPlay() {}
void UpdateNetWindow(bool update_infos, wxString="NULL"); void UpdateNetWindow(bool update_infos, wxString=wxT("NULL"));
void AppendText(const wxString text) { m_Logging->AppendText(text); } void AppendText(const wxString text) { m_Logging->AppendText(text); }
// Send and receive pads values // Send and receive pads values