fix wxw multibyte text issues in netplay. changes by bhaal.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4725 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-12-23 20:46:56 +00:00
parent 9eea60ca69
commit 62b6af3259
3 changed files with 13 additions and 13 deletions

View File

@ -36,7 +36,7 @@ void ClientSide::OnClientData(unsigned char data)
m_socket.Receive((char*)&buffer_size, 4, recv_size);
buffer = new char[buffer_size+1];
m_socket.Receive(buffer, buffer_size+1, recv_size);
Event->AppendText(wxString::Format(wxT("*Player : %s is now connected to Host...\n"), buffer));
Event->AppendText(wxString::FromAscii(StringFromFormat("*Player : %s is now connected to Host...\n", buffer).c_str()));
if (sent != 0x1F)
for (int i = 0; i < 4; i++)
@ -53,7 +53,7 @@ void ClientSide::OnClientData(unsigned char data)
buffer = new char[buffer_size+1];
m_socket.Receive(buffer, buffer_size+1, recv_size);
Event->AppendText(wxString::Format(wxT("*Player : %s left the game\n\n"), buffer));
Event->AppendText(wxString::FromAscii(StringFromFormat("*Player : %s left the game\n\n", buffer).c_str()));
m_numplayers--;
Event->SendEvent(HOST_PLAYERLEFT);
@ -99,7 +99,7 @@ void ClientSide::OnClientData(unsigned char data)
m_socket.Receive(buffer, buffer_size+1, recv_size);
m_selectedgame = std::string(buffer);
Event->AppendText(wxString::Format(wxT("*Host changed Game to : %s\n"), buffer));
Event->AppendText(wxString::FromAscii(StringFromFormat("*Host changed Game to : %s\n", buffer).c_str()));
// Tell the server if the game's been found
m_socket.Send((const char*)&data, 1);
@ -174,7 +174,7 @@ void ServerSide::OnServerData(int sock, unsigned char data)
// Read IP Address
m_client[sock].socket.Receive(buffer, 24, recv_size);
Event->AppendText(wxString::Format(wxT("> Your IP is : %s\n"), buffer));
Event->AppendText(wxString::FromAscii(StringFromFormat("> Your IP is : %s\n", buffer).c_str()));
break;
}
@ -219,8 +219,8 @@ void ServerSide::OnServerData(int sock, unsigned char data)
{
sent = 0x30;
wxString error_str = wxString::Format(
wxT("WARNING : Player %s does Not have this Game !\n"), m_client[sock].nick.c_str());
wxString error_str = wxString::FromAscii(
StringFromFormat("WARNING : Player %s does Not have this Game !\n", m_client[sock].nick.c_str()).c_str());
four_bytes = (int)error_str.size();
for (int i=0; i < 2; i++)

View File

@ -167,8 +167,8 @@ void *ServerSide::Entry()
m_numplayers--;
std::string player_left = m_client[socket_nb].nick;
Event->AppendText( wxString::Format(wxT("*Player : %s left the game.\n\n"),
player_left.c_str()) );
Event->AppendText( wxString::FromAscii(StringFromFormat("*Player : %s left the game.\n\n",
player_left.c_str()).c_str()) );
// We need to adjust the struct...
for (int j = socket_nb; j < m_numplayers; j++)
@ -412,8 +412,8 @@ void *ClientSide::Entry()
if (value == 0x16) // UDP connection successful
{
Event->AppendText(_("Connection successful !\n"));
Event->AppendText( wxString::Format( wxT("*Connection established to %s (%s)\n*Game is : %s\n "),
m_hostnick.c_str(), m_addr.c_str(), m_selectedgame.c_str()));
Event->AppendText( wxString::FromAscii( StringFromFormat("*Connection established to %s (%s)\n*Game is : %s\n",
m_hostnick.c_str(), m_addr.c_str(), m_selectedgame.c_str()).c_str()));
}
else
{

View File

@ -359,9 +359,9 @@ void NetPlay::UpdateNetWindow(bool update_infos, wxString infos)
SplitString(std::string(infos.mb_str()), "x", str_arr);
m_ConInfo_text->SetLabel
(wxString::Format(wxT(" Fps : %s | Ping : %s | Frame Delay : %s"),
(wxString::FromAscii(StringFromFormat(" Fps : %s | Ping : %s | Frame Delay : %s",
str_arr[0].c_str(), str_arr[1].c_str(),
str_arr[2].c_str()) );
str_arr[2].c_str()).c_str()) );
}
else
{
@ -468,7 +468,7 @@ void NetPlay::OnGUIEvent(wxCommandEvent& event)
{
value = 0x30;
// TODO : there seems to be a random bug here that i can't reproduce... looked like a loop bug :/
wxString chat_str = wxString::Format(wxT("> %s : %s\n"), wxString(m_nick.c_str(), wxConvUTF8).c_str() , m_Chat->GetValue().c_str() );
wxString chat_str = wxString::FromAscii(StringFromFormat("> %s : %s\n", m_nick.c_str(), m_Chat->GetValue().c_str()).c_str() );
int chat_size = (int)chat_str.size();
if(chat_size-m_nick.size()-6 > 0)
{