Allow non-SIDEVICE_GC_CONTROLLER controllers in netplay again.

This commit is contained in:
Rachel Bryk 2013-07-19 22:58:33 -04:00
parent e4767aec55
commit 96219df4fd
5 changed files with 9 additions and 18 deletions

View File

@ -263,7 +263,7 @@ void Init()
if (Movie::IsRecordingInput() || Movie::IsPlayingInput()) if (Movie::IsRecordingInput() || Movie::IsPlayingInput())
AddDevice(Movie::IsUsingPad(i) ? (Movie::IsUsingBongo(i) ? SIDEVICE_GC_TARUKONGA : SIDEVICE_GC_CONTROLLER) : SIDEVICE_NONE, i); AddDevice(Movie::IsUsingPad(i) ? (Movie::IsUsingBongo(i) ? SIDEVICE_GC_TARUKONGA : SIDEVICE_GC_CONTROLLER) : SIDEVICE_NONE, i);
else if (NetPlay::GetNetPlayPtr()) else if (NetPlay::GetNetPlayPtr())
AddDevice(NetPlay::IsUsingPad(i) ? SIDEVICE_GC_CONTROLLER : SIDEVICE_NONE, i); AddDevice((SIDevices) g_NetPlaySettings.m_Controllers[i], i);
else else
AddDevice(SConfig::GetInstance().m_SIDevice[i], i); AddDevice(SConfig::GetInstance().m_SIDevice[i], i);
} }

View File

@ -289,13 +289,9 @@ void NetPlay::GetNetSettings()
g_NetPlaySettings.m_CPUthread = instance.m_LocalCoreStartupParameter.bCPUThread; g_NetPlaySettings.m_CPUthread = instance.m_LocalCoreStartupParameter.bCPUThread;
g_NetPlaySettings.m_DSPHLE = instance.m_LocalCoreStartupParameter.bDSPHLE; g_NetPlaySettings.m_DSPHLE = instance.m_LocalCoreStartupParameter.bDSPHLE;
g_NetPlaySettings.m_DSPEnableJIT = instance.m_EnableJIT; g_NetPlaySettings.m_DSPEnableJIT = instance.m_EnableJIT;
for (int i = 0; i < 4; ++i)
{ for (unsigned int i = 0; i < 4; ++i)
if (SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_CONTROLLER) g_NetPlaySettings.m_Controllers[i] = SConfig::GetInstance().m_SIDevice[i];
g_NetPlaySettings.m_Controllers |= (1 << i);
if (g_wiimote_sources[i] != WIIMOTE_SRC_NONE)
g_NetPlaySettings.m_Controllers |= (1 << (i + 4));
}
} }
// stuff hacked into dolphin // stuff hacked into dolphin
@ -408,8 +404,3 @@ NetPlay* NetPlay::GetNetPlayPtr()
{ {
return netplay_ptr; return netplay_ptr;
} }
bool NetPlay::IsUsingPad(int pad)
{
return ((g_NetPlaySettings.m_Controllers & (1 << pad)) != 0);
}

View File

@ -36,7 +36,7 @@ struct NetSettings
bool m_CPUthread; bool m_CPUthread;
bool m_DSPHLE; bool m_DSPHLE;
bool m_DSPEnableJIT; bool m_DSPEnableJIT;
u8 m_Controllers; u8 m_Controllers[4];
}; };
extern NetSettings g_NetPlaySettings; extern NetSettings g_NetPlaySettings;
@ -129,7 +129,6 @@ public:
u8 GetPadNum(u8 numPAD); u8 GetPadNum(u8 numPAD);
static NetPlay* GetNetPlayPtr(); static NetPlay* GetNetPlayPtr();
static bool IsUsingPad(int pad);
protected: protected:
//void GetBufferedPad(const u8 pad_nb, NetPad* const netvalues); //void GetBufferedPad(const u8 pad_nb, NetPad* const netvalues);

View File

@ -196,7 +196,8 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
packet >> g_NetPlaySettings.m_CPUthread; packet >> g_NetPlaySettings.m_CPUthread;
packet >> g_NetPlaySettings.m_DSPEnableJIT; packet >> g_NetPlaySettings.m_DSPEnableJIT;
packet >> g_NetPlaySettings.m_DSPHLE; packet >> g_NetPlaySettings.m_DSPHLE;
packet >> g_NetPlaySettings.m_Controllers; for (unsigned int i = 0; i < 4; ++i)
packet >> g_NetPlaySettings.m_Controllers[i];
} }
m_dialog->OnMsgStartGame(); m_dialog->OnMsgStartGame();

View File

@ -607,8 +607,8 @@ bool NetPlayServer::StartGame(const std::string &path)
spac << g_NetPlaySettings.m_CPUthread; spac << g_NetPlaySettings.m_CPUthread;
spac << g_NetPlaySettings.m_DSPEnableJIT; spac << g_NetPlaySettings.m_DSPEnableJIT;
spac << g_NetPlaySettings.m_DSPHLE; spac << g_NetPlaySettings.m_DSPHLE;
spac << g_NetPlaySettings.m_Controllers; for (unsigned int i = 0; i < 4; ++i)
spac << g_NetPlaySettings.m_Controllers[i];
std::lock_guard<std::recursive_mutex> lkp(m_crit.players); std::lock_guard<std::recursive_mutex> lkp(m_crit.players);
std::lock_guard<std::recursive_mutex> lks(m_crit.send); std::lock_guard<std::recursive_mutex> lks(m_crit.send);