Remove any wx-specific code from Core.
Move NetPlay code from DolphinWX to Core. Even NetPlay with nowx should be possible now if anyone felt like implementing a CLI for it ;) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7119 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
dbd381755b
commit
42908c5b2e
|
@ -10,6 +10,9 @@ set(SRCS Src/ActionReplay.cpp
|
|||
Src/GeckoCodeConfig.cpp
|
||||
Src/GeckoCode.cpp
|
||||
Src/MemTools.cpp
|
||||
Src/NetPlay.cpp
|
||||
Src/NetPlayClient.cpp
|
||||
Src/NetPlayServer.cpp
|
||||
Src/OnFrame.cpp
|
||||
Src/PatchEngine.cpp
|
||||
Src/State.cpp
|
||||
|
|
|
@ -1885,6 +1885,26 @@
|
|||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="NetPlay"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Src\NetPlay.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\NetPlay.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\NetPlayClient.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\NetPlayServer.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\CMakeLists.txt"
|
||||
>
|
||||
|
|
|
@ -326,6 +326,9 @@
|
|||
<ClCompile Include="Src\IPC_HLE\WII_IPC_HLE_Device_usb_kbd.cpp" />
|
||||
<ClCompile Include="Src\IPC_HLE\WII_IPC_HLE_WiiMote.cpp" />
|
||||
<ClCompile Include="Src\MemTools.cpp" />
|
||||
<ClCompile Include="Src\NetPlay.cpp" />
|
||||
<ClCompile Include="Src\NetPlayClient.cpp" />
|
||||
<ClCompile Include="Src\NetPlayServer.cpp" />
|
||||
<ClCompile Include="Src\OnFrame.cpp" />
|
||||
<ClCompile Include="Src\PatchEngine.cpp" />
|
||||
<ClCompile Include="Src\DSPEmulator.cpp" />
|
||||
|
@ -516,6 +519,7 @@
|
|||
<ClInclude Include="Src\IPC_HLE\WII_IPC_HLE_Device_usb_kbd.h" />
|
||||
<ClInclude Include="Src\IPC_HLE\WII_IPC_HLE_WiiMote.h" />
|
||||
<ClInclude Include="Src\MemTools.h" />
|
||||
<ClInclude Include="Src\NetPlay.h" />
|
||||
<ClInclude Include="Src\OnFrame.h" />
|
||||
<ClInclude Include="Src\PatchEngine.h" />
|
||||
<ClInclude Include="Src\DSPEmulator.h" />
|
||||
|
|
|
@ -525,6 +525,15 @@
|
|||
<ClCompile Include="Src\HW\Wiimote.cpp">
|
||||
<Filter>HW %28Flipper/Hollywood%29\Wiimote</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Src\NetPlay.cpp">
|
||||
<Filter>NetPlay</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Src\NetPlayServer.cpp">
|
||||
<Filter>NetPlay</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Src\NetPlayClient.cpp">
|
||||
<Filter>NetPlay</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Src\ConfigManager.h" />
|
||||
|
@ -977,6 +986,9 @@
|
|||
<Filter>PowerPC</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Src\DolLoader.h" />
|
||||
<ClInclude Include="Src\NetPlay.h">
|
||||
<Filter>NetPlay</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="CMakeLists.txt" />
|
||||
|
@ -1109,5 +1121,8 @@
|
|||
<Filter Include="HW %28Flipper/Hollywood%29\Wiimote\Real">
|
||||
<UniqueIdentifier>{1c21a3e1-b791-4a23-b0d5-ed2b2c34007f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="NetPlay">
|
||||
<UniqueIdentifier>{231ceb02-1122-402a-87a8-094a9ed768c2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -90,16 +90,12 @@ u32 DSPHost_CodeLoaded(const u8 *ptr, int size)
|
|||
// Always add the ROM.
|
||||
DSPSymbols::AutoDisassembly(0x8000, 0x9000);
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
Host_RefreshDSPDebuggerWindow();
|
||||
#endif
|
||||
DSPHost_UpdateDebugger();
|
||||
|
||||
return ector_crc;
|
||||
}
|
||||
|
||||
void DSPHost_UpdateDebugger()
|
||||
{
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
Host_RefreshDSPDebuggerWindow();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -100,14 +100,6 @@ void DSPLLE::dsp_thread(DSPLLE *lpParameter)
|
|||
}
|
||||
}
|
||||
|
||||
void DSPLLE::DSP_DebugBreak()
|
||||
{
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
// if (m_DebuggerFrame)
|
||||
// m_DebuggerFrame->DebugBreak();
|
||||
#endif
|
||||
}
|
||||
|
||||
void DSPLLE::Initialize(void *hWnd, bool bWii, bool bDSPThread)
|
||||
{
|
||||
m_hWnd = hWnd;
|
||||
|
@ -148,9 +140,7 @@ void DSPLLE::Initialize(void *hWnd, bool bWii, bool bDSPThread)
|
|||
if (m_bDSPThread)
|
||||
m_hDSPThread = std::thread(dsp_thread, this);
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
Host_RefreshDSPDebuggerWindow();
|
||||
#endif
|
||||
}
|
||||
|
||||
void DSPLLE::DSP_StopSoundStream()
|
||||
|
|
|
@ -43,7 +43,6 @@ public:
|
|||
virtual void DSP_Update(int cycles);
|
||||
virtual void DSP_StopSoundStream();
|
||||
virtual void DSP_ClearAudioBuffer(bool mute);
|
||||
void DSP_DebugBreak();
|
||||
|
||||
private:
|
||||
static void dsp_thread(DSPLLE* lpParameter);
|
||||
|
|
|
@ -343,10 +343,8 @@ u32 CEXIIPL::GetGCTime()
|
|||
u64 ltime = 0;
|
||||
const u32 cJanuary2000 = 0x386D4380; // Seconds between 1.1.1970 and 1.1.2000
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
// hack in some netplay stuff
|
||||
ltime = NetPlay_GetGCTime();
|
||||
#endif
|
||||
if (Frame::IsRecordingInput() || Frame::IsPlayingInput())
|
||||
ltime = 1234567890; // TODO: Should you be able to set a custom time in movies?
|
||||
else if (0 == ltime)
|
||||
|
|
|
@ -129,7 +129,6 @@ bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
|
|||
|
||||
Pad::GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
u32 netValues[2];
|
||||
if (NetPlay_GetInput(ISIDevice::m_iDeviceNumber, PadStatus, netValues))
|
||||
{
|
||||
|
@ -137,7 +136,6 @@ bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
|
|||
_Low = netValues[1]; // last 4 bytes
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
Frame::SetPolledDevice();
|
||||
|
||||
|
@ -257,12 +255,8 @@ void CSIDevice_GCController::SendCommand(u32 _Cmd, u8 _Poll)
|
|||
unsigned int uType = command.Parameter1; // 0 = stop, 1 = rumble, 2 = stop hard
|
||||
unsigned int uStrength = command.Parameter2;
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
// get the correct pad number that should rumble locally when using netplay
|
||||
const u8 numPAD = NetPlay_GetPadNum(ISIDevice::m_iDeviceNumber);
|
||||
#else
|
||||
const u8 numPAD = 0;
|
||||
#endif
|
||||
|
||||
if (numPAD < 4)
|
||||
Pad::Rumble(numPAD, uType, uStrength);
|
||||
|
|
|
@ -502,10 +502,7 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
|
|||
{
|
||||
if (m_WiiMotes[i].IsConnected() && m_WiimoteUpdate_Freq == 15 / (i + 1))
|
||||
{
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
NetPlay_WiimoteUpdate(i);
|
||||
#endif
|
||||
Wiimote::Update(i);
|
||||
//return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -253,11 +253,7 @@ void CWII_IPC_HLE_WiiMote::ExecuteL2capCmd(u8* _pData, u32 _Size)
|
|||
_dbg_assert_msg_(WII_IPC_WIIMOTE, DoesChannelExist(pHeader->dcid), "L2CAP: SendACLPacket to unknown channel %i", pHeader->dcid);
|
||||
CChannelMap::iterator itr= m_Channel.find(pHeader->dcid);
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
const int number = NetPlay_GetWiimoteNum(m_ConnectionHandle & 0xFF);
|
||||
#else
|
||||
const int number = 0;
|
||||
#endif
|
||||
|
||||
if (itr != m_Channel.end())
|
||||
{
|
||||
|
@ -854,10 +850,8 @@ void CWII_IPC_HLE_WiiMote::SendCommandToACL(u8 _Ident, u8 _Code, u8 _CommandLeng
|
|||
|
||||
void CWII_IPC_HLE_WiiMote::ReceiveL2capData(u16 scid, const void* _pData, u32 _Size)
|
||||
{
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
if (NetPlay_WiimoteInput(m_ConnectionHandle & 0xFF, scid, _pData, _Size))
|
||||
return;
|
||||
#endif
|
||||
|
||||
// Allocate DataFrame
|
||||
u8 DataFrame[1024];
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "NetPlay.h"
|
||||
#include "NetWindow.h"
|
||||
|
||||
// for wiimote
|
||||
#include "IPC_HLE/WII_IPC_HLE_Device_usb.h"
|
||||
|
@ -25,22 +24,17 @@
|
|||
#include "HW/SI_DeviceGCController.h"
|
||||
// for gctime
|
||||
#include "HW/EXI_DeviceIPL.h"
|
||||
// to start/stop game
|
||||
#include "Frame.h"
|
||||
// for wiimote/ OSD messages
|
||||
#include "Core.h"
|
||||
|
||||
Common::CriticalSection crit_netplay_ptr;
|
||||
static NetPlay* netplay_ptr = NULL;
|
||||
extern CFrame* main_frame;
|
||||
|
||||
#define RPT_SIZE_HACK (1 << 16)
|
||||
|
||||
DEFINE_EVENT_TYPE(wxEVT_THREAD)
|
||||
|
||||
// called from ---GUI--- thread
|
||||
NetPlay::NetPlay()
|
||||
: m_is_running(false), m_do_loop(true)
|
||||
NetPlay::NetPlay(NetPlayUI* dialog)
|
||||
: m_dialog(dialog), m_is_running(false), m_do_loop(true)
|
||||
{
|
||||
m_target_buffer_size = 20;
|
||||
ClearBuffers();
|
||||
|
@ -74,27 +68,6 @@ NetPlay::Player::Player()
|
|||
memset(pad_map, -1, sizeof(pad_map));
|
||||
}
|
||||
|
||||
// called from ---NETPLAY--- thread
|
||||
void NetPlay::UpdateGUI()
|
||||
{
|
||||
if (m_dialog)
|
||||
{
|
||||
wxCommandEvent evt(wxEVT_THREAD, 1);
|
||||
m_dialog->GetEventHandler()->AddPendingEvent(evt);
|
||||
}
|
||||
}
|
||||
|
||||
// called from ---NETPLAY--- thread
|
||||
void NetPlay::AppendChatGUI(const std::string& msg)
|
||||
{
|
||||
if (m_dialog)
|
||||
{
|
||||
m_dialog->chat_msgs.Push(msg);
|
||||
// silly
|
||||
UpdateGUI();
|
||||
}
|
||||
}
|
||||
|
||||
// called from ---GUI--- thread
|
||||
std::string NetPlay::Player::ToString() const
|
||||
{
|
||||
|
@ -256,7 +229,7 @@ bool NetPlay::StartGame(const std::string &path)
|
|||
return false;
|
||||
}
|
||||
|
||||
AppendChatGUI(" -- STARTING GAME -- ");
|
||||
m_dialog->AppendChat(" -- STARTING GAME -- ");
|
||||
|
||||
m_is_running = true;
|
||||
NetPlay_Enable(this);
|
||||
|
@ -264,7 +237,7 @@ bool NetPlay::StartGame(const std::string &path)
|
|||
ClearBuffers();
|
||||
|
||||
// boot game
|
||||
::main_frame->BootGame(path);
|
||||
m_dialog->BootGame(path);
|
||||
|
||||
// temporary
|
||||
NetWiimote nw;
|
||||
|
@ -286,13 +259,13 @@ bool NetPlay::StopGame()
|
|||
return false;
|
||||
}
|
||||
|
||||
AppendChatGUI(" -- STOPPING GAME -- ");
|
||||
m_dialog->AppendChat(" -- STOPPING GAME -- ");
|
||||
|
||||
m_is_running = false;
|
||||
NetPlay_Disable();
|
||||
|
||||
// stop game
|
||||
::main_frame->DoStop();
|
||||
m_dialog->StopGame();
|
||||
|
||||
return true;
|
||||
}
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
#include "FifoQueue.h"
|
||||
|
||||
class NetPlayDiag;
|
||||
|
||||
class NetPad
|
||||
{
|
||||
public:
|
||||
|
@ -90,10 +88,24 @@ private:
|
|||
Common::CriticalSection& m_crit;
|
||||
};
|
||||
|
||||
class NetPlayUI
|
||||
{
|
||||
public:
|
||||
virtual void BootGame(const std::string& filename) = 0;
|
||||
virtual void StopGame() = 0;
|
||||
|
||||
virtual void Update() = 0;
|
||||
virtual void AppendChat(const std::string& msg) = 0;
|
||||
|
||||
virtual void OnMsgChangeGame(const std::string& filename) = 0;
|
||||
virtual void OnMsgStartGame() = 0;
|
||||
virtual void OnMsgStopGame() = 0;
|
||||
};
|
||||
|
||||
class NetPlay
|
||||
{
|
||||
public:
|
||||
NetPlay();
|
||||
NetPlay(NetPlayUI* _dialog);
|
||||
virtual ~NetPlay();
|
||||
//virtual void ThreadFunc() = 0;
|
||||
|
||||
|
@ -117,8 +129,6 @@ public:
|
|||
protected:
|
||||
//void GetBufferedPad(const u8 pad_nb, NetPad* const netvalues);
|
||||
void ClearBuffers();
|
||||
void UpdateGUI();
|
||||
void AppendChatGUI(const std::string& msg);
|
||||
virtual void SendPadState(const PadMapping local_nb, const NetPad& np) = 0;
|
||||
|
||||
struct
|
||||
|
@ -145,7 +155,7 @@ protected:
|
|||
|
||||
NetWiimote m_wiimote_input[4];
|
||||
|
||||
NetPlayDiag* m_dialog;
|
||||
NetPlayUI* m_dialog;
|
||||
sf::SocketTCP m_socket;
|
||||
std::thread m_thread;
|
||||
sf::Selector<sf::SocketTCP> m_selector;
|
||||
|
@ -172,7 +182,7 @@ class NetPlayServer : public NetPlay
|
|||
public:
|
||||
void ThreadFunc();
|
||||
|
||||
NetPlayServer(const u16 port, const std::string& name, NetPlayDiag* const npd = NULL, const std::string& game = "");
|
||||
NetPlayServer(const u16 port, const std::string& name, NetPlayUI* dialog, const std::string& game = "");
|
||||
~NetPlayServer();
|
||||
|
||||
void GetPlayerList(std::string& list, std::vector<int>& pid_list);
|
||||
|
@ -221,7 +231,7 @@ class NetPlayClient : public NetPlay
|
|||
public:
|
||||
void ThreadFunc();
|
||||
|
||||
NetPlayClient(const std::string& address, const u16 port, const std::string& name, NetPlayDiag* const npd = NULL);
|
||||
NetPlayClient(const std::string& address, const u16 port, NetPlayUI* dialog, const std::string& name);
|
||||
~NetPlayClient();
|
||||
|
||||
void GetPlayerList(std::string& list, std::vector<int>& pid_list);
|
|
@ -1,5 +1,4 @@
|
|||
#include "NetPlay.h"
|
||||
#include "NetWindow.h"
|
||||
|
||||
// called from ---GUI--- thread
|
||||
NetPlayClient::~NetPlayClient()
|
||||
|
@ -12,9 +11,8 @@ NetPlayClient::~NetPlayClient()
|
|||
}
|
||||
|
||||
// called from ---GUI--- thread
|
||||
NetPlayClient::NetPlayClient(const std::string& address, const u16 port, const std::string& name, NetPlayDiag* const npd)
|
||||
NetPlayClient::NetPlayClient(const std::string& address, const u16 port, NetPlayUI* dialog, const std::string& name) : NetPlay(dialog)
|
||||
{
|
||||
m_dialog = npd;
|
||||
is_connected = false;
|
||||
|
||||
// why is false successful? documentation says true is
|
||||
|
@ -66,7 +64,7 @@ NetPlayClient::NetPlayClient(const std::string& address, const u16 port, const s
|
|||
m_players[m_pid] = player;
|
||||
m_local_player = &m_players[m_pid];
|
||||
|
||||
UpdateGUI();
|
||||
m_dialog->Update();
|
||||
|
||||
//PanicAlertT("Connection successful: assigned player id: %d", m_pid);
|
||||
is_connected = true;
|
||||
|
@ -99,7 +97,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
|
|||
m_players[player.pid] = player;
|
||||
m_crit.players.Leave();
|
||||
|
||||
UpdateGUI();
|
||||
m_dialog->Update();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -112,7 +110,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
|
|||
m_players.erase(m_players.find(pid));
|
||||
m_crit.players.Leave();
|
||||
|
||||
UpdateGUI();
|
||||
m_dialog->Update();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -130,7 +128,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
|
|||
std::ostringstream ss;
|
||||
ss << player.name << '[' << (char)(pid+'0') << "]: " << msg;
|
||||
|
||||
AppendChatGUI(ss.str());
|
||||
m_dialog->AppendChat(ss.str());
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -146,7 +144,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
|
|||
packet >> player.pad_map[i];
|
||||
m_crit.players.Leave();
|
||||
|
||||
UpdateGUI();
|
||||
m_dialog->Update();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -179,10 +177,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
|
|||
m_crit.game.Leave();
|
||||
|
||||
// update gui
|
||||
wxCommandEvent evt(wxEVT_THREAD, NP_GUI_EVT_CHANGE_GAME);
|
||||
// TODO: using a wxString in AddPendingEvent from another thread is unsafe i guess?
|
||||
evt.SetString(wxString(m_selected_game.c_str(), *wxConvCurrent));
|
||||
m_dialog->GetEventHandler()->AddPendingEvent(evt);
|
||||
m_dialog->OnMsgChangeGame(m_selected_game);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -192,15 +187,13 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
|
|||
packet >> m_current_game;
|
||||
m_crit.game.Leave();
|
||||
|
||||
wxCommandEvent evt(wxEVT_THREAD, NP_GUI_EVT_START_GAME);
|
||||
m_dialog->GetEventHandler()->AddPendingEvent(evt);
|
||||
m_dialog->OnMsgStartGame();
|
||||
}
|
||||
break;
|
||||
|
||||
case NP_MSG_STOP_GAME :
|
||||
{
|
||||
wxCommandEvent evt(wxEVT_THREAD, NP_GUI_EVT_STOP_GAME);
|
||||
m_dialog->GetEventHandler()->AddPendingEvent(evt);
|
||||
m_dialog->OnMsgStopGame();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -254,7 +247,7 @@ void NetPlayClient::ThreadFunc()
|
|||
default :
|
||||
m_is_running = false;
|
||||
NetPlay_Disable();
|
||||
AppendChatGUI("< LOST CONNECTION TO SERVER >");
|
||||
m_dialog->AppendChat("< LOST CONNECTION TO SERVER >");
|
||||
PanicAlertT("Lost connection to server!");
|
||||
m_do_loop = false;
|
||||
break;
|
|
@ -1,5 +1,4 @@
|
|||
#include "NetPlay.h"
|
||||
#include "NetWindow.h"
|
||||
|
||||
// called from ---GUI--- thread
|
||||
NetPlayServer::~NetPlayServer()
|
||||
|
@ -12,9 +11,8 @@ NetPlayServer::~NetPlayServer()
|
|||
}
|
||||
|
||||
// called from ---GUI--- thread
|
||||
NetPlayServer::NetPlayServer(const u16 port, const std::string& name, NetPlayDiag* const npd, const std::string& game)
|
||||
NetPlayServer::NetPlayServer(const u16 port, const std::string& name, NetPlayUI* dialog, const std::string& game) : NetPlay(dialog)
|
||||
{
|
||||
m_dialog = npd;
|
||||
m_selected_game = game;
|
||||
|
||||
m_update_pings = true;
|
||||
|
@ -35,7 +33,7 @@ NetPlayServer::NetPlayServer(const u16 port, const std::string& name, NetPlayDia
|
|||
m_local_player = &m_players[m_socket];
|
||||
//PanicAlertT("Listening");
|
||||
|
||||
UpdateGUI();
|
||||
m_dialog->Update();
|
||||
|
||||
is_connected = true;
|
||||
|
||||
|
@ -246,7 +244,7 @@ unsigned int NetPlayServer::OnConnect(sf::SocketTCP& socket)
|
|||
// add client to selector/ used for receiving
|
||||
m_selector.Add(socket);
|
||||
|
||||
UpdateGUI();
|
||||
m_dialog->Update();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -281,7 +279,7 @@ unsigned int NetPlayServer::OnDisconnect(sf::SocketTCP& socket)
|
|||
CritLocker send_lock(m_crit.send); // lock send
|
||||
SendToClients(spac);
|
||||
|
||||
UpdateGUI();
|
||||
m_dialog->Update();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -345,7 +343,7 @@ bool NetPlayServer::SetPadMapping(const int pid, const int map[])
|
|||
CritLocker send_lock(m_crit.send); // lock send
|
||||
UpdatePadMapping(); // sync pad mappings with everyone
|
||||
|
||||
UpdateGUI();
|
||||
m_dialog->Update();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -439,7 +437,7 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, sf::SocketTCP& socket)
|
|||
std::ostringstream ss;
|
||||
ss << player.name << '[' << (char)(player.pid+'0') << "]: " << msg;
|
||||
|
||||
AppendChatGUI(ss.str());
|
||||
m_dialog->AppendChat(ss.str());
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -489,7 +487,7 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, sf::SocketTCP& socket)
|
|||
//PanicAlertT("good pong");
|
||||
player.ping = ping;
|
||||
}
|
||||
UpdateGUI();
|
||||
m_dialog->Update();
|
||||
}
|
||||
break;
|
||||
|
|
@ -12,6 +12,9 @@ files = [
|
|||
"CoreParameter.cpp",
|
||||
"CoreRerecording.cpp",
|
||||
"CoreTiming.cpp",
|
||||
"NetPlay.cpp",
|
||||
"NetPlayClient.cpp",
|
||||
"NetPlayServer.cpp",
|
||||
"OnFrame.cpp",
|
||||
"MemTools.cpp",
|
||||
"PatchEngine.cpp",
|
||||
|
|
|
@ -34,9 +34,6 @@ if(wxWidgets_FOUND)
|
|||
Src/Main.cpp
|
||||
Src/MemcardManager.cpp
|
||||
Src/MemoryCards/GCMemcard.cpp
|
||||
Src/NetPlay.cpp
|
||||
Src/NetPlayClient.cpp
|
||||
Src/NetPlayServer.cpp
|
||||
Src/NetWindow.cpp
|
||||
Src/PatchAddEdit.cpp
|
||||
Src/PHackSettings.cpp
|
||||
|
|
|
@ -242,9 +242,6 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
|
|||
<ClCompile Include="Src\MemcardManager.cpp" />
|
||||
<ClCompile Include="Src\MemoryCards\GCMemcard.cpp" />
|
||||
<ClCompile Include="Src\MemoryCards\WiiSaveCrypted.cpp" />
|
||||
<ClCompile Include="Src\NetPlay.cpp" />
|
||||
<ClCompile Include="Src\NetPlayClient.cpp" />
|
||||
<ClCompile Include="Src\NetPlayServer.cpp" />
|
||||
<ClCompile Include="Src\NetWindow.cpp" />
|
||||
<ClCompile Include="Src\PatchAddEdit.cpp" />
|
||||
<ClCompile Include="Src\PHackSettings.cpp" />
|
||||
|
@ -281,7 +278,6 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
|
|||
<ClInclude Include="Src\MemcardManager.h" />
|
||||
<ClInclude Include="Src\MemoryCards\GCMemcard.h" />
|
||||
<ClInclude Include="Src\MemoryCards\WiiSaveCrypted.h" />
|
||||
<ClInclude Include="Src\NetPlay.h" />
|
||||
<ClInclude Include="Src\NetWindow.h" />
|
||||
<ClInclude Include="Src\PatchAddEdit.h" />
|
||||
<ClInclude Include="Src\PHackSettings.h" />
|
||||
|
|
|
@ -943,22 +943,6 @@
|
|||
<Filter
|
||||
Name="NetPlay"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Src\NetPlay.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\NetPlay.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\NetPlayClient.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\NetPlayServer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\NetWindow.cpp"
|
||||
>
|
||||
|
|
|
@ -48,7 +48,8 @@
|
|||
bool rendererHasFocus = true;
|
||||
bool running = true;
|
||||
|
||||
void Host_NotifyMapLoaded(){}
|
||||
void Host_NotifyMapLoaded() {}
|
||||
void Host_RefreshDSPDebuggerWindow() {}
|
||||
|
||||
void Host_ShowJitResults(unsigned int address){}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "NetPlay.h"
|
||||
#include "NetWindow.h"
|
||||
#include "Frame.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
|
@ -27,11 +28,13 @@
|
|||
|
||||
#define NETPLAY_TITLEBAR "Dolphin NetPlay"
|
||||
|
||||
DEFINE_EVENT_TYPE(wxEVT_THREAD)
|
||||
BEGIN_EVENT_TABLE(NetPlayDiag, wxFrame)
|
||||
EVT_COMMAND(wxID_ANY, wxEVT_THREAD, NetPlayDiag::OnThread)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
static NetPlay* netplay_ptr = NULL;
|
||||
extern CFrame* main_frame;
|
||||
|
||||
NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl* const game_list)
|
||||
: wxFrame(parent, wxID_ANY, wxT(NETPLAY_TITLEBAR), wxDefaultPosition, wxDefaultSize)
|
||||
|
@ -218,7 +221,7 @@ void NetPlaySetupDiag::OnJoin(wxCommandEvent&)
|
|||
unsigned long port = 0;
|
||||
m_connect_port_text->GetValue().ToULong(&port);
|
||||
::netplay_ptr = new NetPlayClient(std::string(m_connect_ip_text->GetValue().mb_str())
|
||||
, (u16)port, std::string(m_nickname_text->GetValue().mb_str()), npd);
|
||||
, (u16)port, npd, std::string(m_nickname_text->GetValue().mb_str()));
|
||||
if (::netplay_ptr->is_connected)
|
||||
{
|
||||
//NetPlayServerDiag* const npsd =
|
||||
|
@ -381,6 +384,50 @@ void NetPlayDiag::OnStop(wxCommandEvent&)
|
|||
::netplay_ptr->StopGame();
|
||||
}
|
||||
|
||||
void NetPlayDiag::BootGame(const std::string& filename)
|
||||
{
|
||||
main_frame->BootGame(filename);
|
||||
}
|
||||
|
||||
void NetPlayDiag::StopGame()
|
||||
{
|
||||
main_frame->DoStop();
|
||||
}
|
||||
|
||||
// NetPlayUI methods called from ---NETPLAY--- thread
|
||||
void NetPlayDiag::Update()
|
||||
{
|
||||
wxCommandEvent evt(wxEVT_THREAD, 1);
|
||||
GetEventHandler()->AddPendingEvent(evt);
|
||||
}
|
||||
|
||||
void NetPlayDiag::AppendChat(const std::string& msg)
|
||||
{
|
||||
chat_msgs.Push(msg);
|
||||
// silly
|
||||
Update();
|
||||
}
|
||||
|
||||
void NetPlayDiag::OnMsgChangeGame(const std::string& filename)
|
||||
{
|
||||
wxCommandEvent evt(wxEVT_THREAD, NP_GUI_EVT_CHANGE_GAME);
|
||||
// TODO: using a wxString in AddPendingEvent from another thread is unsafe i guess?
|
||||
evt.SetString(wxString(filename.c_str(), *wxConvCurrent));
|
||||
GetEventHandler()->AddPendingEvent(evt);
|
||||
}
|
||||
|
||||
void NetPlayDiag::OnMsgStartGame()
|
||||
{
|
||||
wxCommandEvent evt(wxEVT_THREAD, NP_GUI_EVT_START_GAME);
|
||||
GetEventHandler()->AddPendingEvent(evt);
|
||||
}
|
||||
|
||||
void NetPlayDiag::OnMsgStopGame()
|
||||
{
|
||||
wxCommandEvent evt(wxEVT_THREAD, NP_GUI_EVT_STOP_GAME);
|
||||
GetEventHandler()->AddPendingEvent(evt);
|
||||
}
|
||||
|
||||
void NetPlayDiag::OnPadBuffHelp(wxCommandEvent&)
|
||||
{
|
||||
const u64 time = ((NetPlayServer*)::netplay_ptr)->CalculateMinimumBufferTime();
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
|
||||
#include "FifoQueue.h"
|
||||
|
||||
#include "NetPlay.h"
|
||||
|
||||
enum
|
||||
{
|
||||
NP_GUI_EVT_CHANGE_GAME = 45,
|
||||
|
@ -62,7 +64,7 @@ private:
|
|||
const CGameListCtrl* const m_game_list;
|
||||
};
|
||||
|
||||
class NetPlayDiag : public wxFrame
|
||||
class NetPlayDiag : public wxFrame, public NetPlayUI
|
||||
{
|
||||
public:
|
||||
NetPlayDiag(wxWindow* const parent, const CGameListCtrl* const game_list
|
||||
|
@ -74,6 +76,17 @@ public:
|
|||
void OnStart(wxCommandEvent& event);
|
||||
void OnStop(wxCommandEvent& event);
|
||||
|
||||
// implementation of NetPlayUI methods
|
||||
void BootGame(const std::string& filename);
|
||||
void StopGame();
|
||||
|
||||
void Update();
|
||||
void AppendChat(const std::string& msg);
|
||||
|
||||
void OnMsgChangeGame(const std::string& filename);
|
||||
void OnMsgStartGame();
|
||||
void OnMsgStopGame();
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
|
|
|
@ -33,9 +33,6 @@ else:
|
|||
'MemcardManager.cpp',
|
||||
'MemoryCards/GCMemcard.cpp',
|
||||
'MemoryCards/WiiSaveCrypted.cpp',
|
||||
'NetPlay.cpp',
|
||||
'NetPlayClient.cpp',
|
||||
'NetPlayServer.cpp',
|
||||
'NetWindow.cpp',
|
||||
'UDPConfigDiag.cpp',
|
||||
'WiimoteConfigDiag.cpp',
|
||||
|
|
Loading…
Reference in New Issue