From 6f9a49b9307c2209d5a549e03096154821781df7 Mon Sep 17 00:00:00 2001 From: nakeee Date: Thu, 14 May 2009 08:46:18 +0000 Subject: [PATCH] Netplay compiles on linux, please test git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3229 8ced0084-cf51-0410-be5f-012b33b47a6e --- SConstruct | 2 +- Source/Core/DolphinWX/Src/FrameTools.cpp | 5 +++++ Source/Core/DolphinWX/Src/NetSockets.cpp | 20 ++++++++++---------- Source/Core/DolphinWX/Src/NetWindow.cpp | 15 ++++++++------- Source/Core/DolphinWX/Src/NetWindow.h | 2 +- 5 files changed, 25 insertions(+), 19 deletions(-) diff --git a/SConstruct b/SConstruct index 5437167761..9f11e80032 100644 --- a/SConstruct +++ b/SConstruct @@ -253,7 +253,7 @@ else: # sfml 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; #osx 64 specifics diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index c5be1af05f..cb8c2f49ec 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -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) #include "NetWindow.h" #endif diff --git a/Source/Core/DolphinWX/Src/NetSockets.cpp b/Source/Core/DolphinWX/Src/NetSockets.cpp index 5cc1ddd38c..c7c2c2610b 100644 --- a/Source/Core/DolphinWX/Src/NetSockets.cpp +++ b/Source/Core/DolphinWX/Src/NetSockets.cpp @@ -62,7 +62,7 @@ ServerSide::ServerSide(NetPlay* netptr, sf::SocketTCP socket, int netmodel, std: 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) return i; @@ -119,7 +119,7 @@ void *ServerSide::Entry() else { unsigned char recv; - char socket_nb; + int socket_nb; size_t recv_size; sf::Socket::Status recv_status; @@ -147,22 +147,22 @@ void *ServerSide::Entry() player_left.c_str()) ); // 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[i].nick = m_client[i+1].nick; - m_client[i].ready = m_client[i+1].ready; + m_client[j].socket = m_client[j+1].socket; + m_client[j].nick = m_client[j+1].nick; + m_client[j].ready = m_client[j+1].ready; } // Send disconnected message to all unsigned char send = 0x11; 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[i].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((const char*)&send, 1); + m_client[j].socket.Send((const char*)&str_size, 4); + m_client[j].socket.Send(player_left.c_str(), (int)str_size + 1); } } else diff --git a/Source/Core/DolphinWX/Src/NetWindow.cpp b/Source/Core/DolphinWX/Src/NetWindow.cpp index bc1315fc14..d49440f41c 100644 --- a/Source/Core/DolphinWX/Src/NetWindow.cpp +++ b/Source/Core/DolphinWX/Src/NetWindow.cpp @@ -62,7 +62,7 @@ void NetPlay::OnJoin(wxCommandEvent& WXUNUSED(event)) // Create the client socket 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->Create(); @@ -303,14 +303,15 @@ void NetPlay::UpdateNetWindow(bool update_infos, wxString infos/*int fps, float // String of the type : FPSxPINGxFRAME_DELAY SplitString(std::string(infos.mb_str()), "x", str_arr); - m_ConInfo_text->SetLabel( - wxString::Format( " Fps : %s | Ping : %s | Frame Delay : %s", - str_arr[0].c_str(), str_arr[1].c_str(), str_arr[2].c_str() )); + m_ConInfo_text->SetLabel + (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()) ); } else { 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(); } } @@ -430,13 +431,13 @@ void NetPlay::OnGUIEvent(wxCommandEvent& event) // Send Chat string 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 { m_sock_client->Write((const char*)&value, 1); 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(); diff --git a/Source/Core/DolphinWX/Src/NetWindow.h b/Source/Core/DolphinWX/Src/NetWindow.h index baf99b06d3..f3ef8cb668 100644 --- a/Source/Core/DolphinWX/Src/NetWindow.h +++ b/Source/Core/DolphinWX/Src/NetWindow.h @@ -144,7 +144,7 @@ class NetPlay : public wxDialog NetPlay(wxWindow* parent, std::string GamePath = "", std::string GameName = ""); ~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); } // Send and receive pads values