Sync some important settings with server during netplay.
This commit is contained in:
parent
919e54c695
commit
e4767aec55
|
@ -34,6 +34,7 @@
|
||||||
#include "Host.h"
|
#include "Host.h"
|
||||||
#include "VideoBackendBase.h"
|
#include "VideoBackendBase.h"
|
||||||
#include "Movie.h"
|
#include "Movie.h"
|
||||||
|
#include "NetPlay.h"
|
||||||
|
|
||||||
namespace BootManager
|
namespace BootManager
|
||||||
{
|
{
|
||||||
|
@ -42,7 +43,7 @@ namespace BootManager
|
||||||
// Apply fire liberally
|
// Apply fire liberally
|
||||||
struct ConfigCache
|
struct ConfigCache
|
||||||
{
|
{
|
||||||
bool valid, bCPUThread, bSkipIdle, bEnableFPRF, bMMU, bDCBZOFF,
|
bool valid, bCPUThread, bSkipIdle, bEnableFPRF, bMMU, bDCBZOFF, m_EnableJIT,
|
||||||
bVBeamSpeedHack, bSyncGPU, bFastDiscSpeed, bMergeBlocks, bDSPHLE, bHLE_BS2;
|
bVBeamSpeedHack, bSyncGPU, bFastDiscSpeed, bMergeBlocks, bDSPHLE, bHLE_BS2;
|
||||||
int iTLBHack, iCPUCore;
|
int iTLBHack, iCPUCore;
|
||||||
std::string strBackend;
|
std::string strBackend;
|
||||||
|
@ -91,6 +92,7 @@ bool BootCore(const std::string& _rFilename)
|
||||||
config_cache.bDSPHLE = StartUp.bDSPHLE;
|
config_cache.bDSPHLE = StartUp.bDSPHLE;
|
||||||
config_cache.strBackend = StartUp.m_strVideoBackend;
|
config_cache.strBackend = StartUp.m_strVideoBackend;
|
||||||
config_cache.bHLE_BS2 = StartUp.bHLE_BS2;
|
config_cache.bHLE_BS2 = StartUp.bHLE_BS2;
|
||||||
|
config_cache.m_EnableJIT = SConfig::GetInstance().m_EnableJIT;
|
||||||
|
|
||||||
// General settings
|
// General settings
|
||||||
game_ini.Get("Core", "CPUThread", &StartUp.bCPUThread, StartUp.bCPUThread);
|
game_ini.Get("Core", "CPUThread", &StartUp.bCPUThread, StartUp.bCPUThread);
|
||||||
|
@ -134,6 +136,13 @@ bool BootCore(const std::string& _rFilename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (NetPlay::GetNetPlayPtr())
|
||||||
|
{
|
||||||
|
StartUp.bCPUThread = g_NetPlaySettings.m_CPUthread;
|
||||||
|
StartUp.bDSPHLE = g_NetPlaySettings.m_DSPHLE;
|
||||||
|
SConfig::GetInstance().m_EnableJIT = g_NetPlaySettings.m_DSPEnableJIT;
|
||||||
|
}
|
||||||
|
|
||||||
// Run the game
|
// Run the game
|
||||||
// Init the core
|
// Init the core
|
||||||
if (!Core::Init())
|
if (!Core::Init())
|
||||||
|
@ -170,6 +179,7 @@ void Stop()
|
||||||
StartUp.m_strVideoBackend = config_cache.strBackend;
|
StartUp.m_strVideoBackend = config_cache.strBackend;
|
||||||
VideoBackend::ActivateBackend(StartUp.m_strVideoBackend);
|
VideoBackend::ActivateBackend(StartUp.m_strVideoBackend);
|
||||||
StartUp.bHLE_BS2 = config_cache.bHLE_BS2;
|
StartUp.bHLE_BS2 = config_cache.bHLE_BS2;
|
||||||
|
SConfig::GetInstance().m_EnableJIT = config_cache.m_EnableJIT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,11 @@
|
||||||
#include "HW/EXI_DeviceIPL.h"
|
#include "HW/EXI_DeviceIPL.h"
|
||||||
// for wiimote/ OSD messages
|
// for wiimote/ OSD messages
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
#include "ConfigManager.h"
|
||||||
|
|
||||||
std::mutex crit_netplay_ptr;
|
std::mutex crit_netplay_ptr;
|
||||||
static NetPlay* netplay_ptr = NULL;
|
static NetPlay* netplay_ptr = NULL;
|
||||||
|
NetSettings g_NetPlaySettings;
|
||||||
|
|
||||||
#define RPT_SIZE_HACK (1 << 16)
|
#define RPT_SIZE_HACK (1 << 16)
|
||||||
|
|
||||||
|
@ -281,6 +283,21 @@ u8 NetPlay::GetPadNum(u8 numPAD)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NetPlay::GetNetSettings()
|
||||||
|
{
|
||||||
|
SConfig &instance = SConfig::GetInstance();
|
||||||
|
g_NetPlaySettings.m_CPUthread = instance.m_LocalCoreStartupParameter.bCPUThread;
|
||||||
|
g_NetPlaySettings.m_DSPHLE = instance.m_LocalCoreStartupParameter.bDSPHLE;
|
||||||
|
g_NetPlaySettings.m_DSPEnableJIT = instance.m_EnableJIT;
|
||||||
|
for (int i = 0; i < 4; ++i)
|
||||||
|
{
|
||||||
|
if (SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_CONTROLLER)
|
||||||
|
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
|
||||||
|
|
||||||
// called from ---CPU--- thread
|
// called from ---CPU--- thread
|
||||||
|
@ -394,5 +411,5 @@ NetPlay* NetPlay::GetNetPlayPtr()
|
||||||
|
|
||||||
bool NetPlay::IsUsingPad(int pad)
|
bool NetPlay::IsUsingPad(int pad)
|
||||||
{
|
{
|
||||||
return netplay_ptr->m_local_player->pad_map[pad] != -1;
|
return ((g_NetPlaySettings.m_Controllers & (1 << pad)) != 0);
|
||||||
}
|
}
|
|
@ -31,6 +31,15 @@ public:
|
||||||
u32 nLo;
|
u32 nLo;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct NetSettings
|
||||||
|
{
|
||||||
|
bool m_CPUthread;
|
||||||
|
bool m_DSPHLE;
|
||||||
|
bool m_DSPEnableJIT;
|
||||||
|
u8 m_Controllers;
|
||||||
|
};
|
||||||
|
extern NetSettings g_NetPlaySettings;
|
||||||
|
|
||||||
struct Rpt : public std::vector<u8>
|
struct Rpt : public std::vector<u8>
|
||||||
{
|
{
|
||||||
u16 channel;
|
u16 channel;
|
||||||
|
@ -38,7 +47,7 @@ struct Rpt : public std::vector<u8>
|
||||||
|
|
||||||
typedef std::vector<Rpt> NetWiimote;
|
typedef std::vector<Rpt> NetWiimote;
|
||||||
|
|
||||||
#define NETPLAY_VERSION "Dolphin NetPlay 2013-04-11"
|
#define NETPLAY_VERSION "Dolphin NetPlay 2013-07-19"
|
||||||
|
|
||||||
// messages
|
// messages
|
||||||
enum
|
enum
|
||||||
|
@ -125,6 +134,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
//void GetBufferedPad(const u8 pad_nb, NetPad* const netvalues);
|
//void GetBufferedPad(const u8 pad_nb, NetPad* const netvalues);
|
||||||
void ClearBuffers();
|
void ClearBuffers();
|
||||||
|
void GetNetSettings();
|
||||||
virtual void SendPadState(const PadMapping local_nb, const NetPad& np) = 0;
|
virtual void SendPadState(const PadMapping local_nb, const NetPad& np) = 0;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
|
|
|
@ -193,6 +193,10 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::recursive_mutex> lkg(m_crit.game);
|
std::lock_guard<std::recursive_mutex> lkg(m_crit.game);
|
||||||
packet >> m_current_game;
|
packet >> m_current_game;
|
||||||
|
packet >> g_NetPlaySettings.m_CPUthread;
|
||||||
|
packet >> g_NetPlaySettings.m_DSPEnableJIT;
|
||||||
|
packet >> g_NetPlaySettings.m_DSPHLE;
|
||||||
|
packet >> g_NetPlaySettings.m_Controllers;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_dialog->OnMsgStartGame();
|
m_dialog->OnMsgStartGame();
|
||||||
|
@ -317,13 +321,14 @@ bool NetPlayClient::StartGame(const std::string &path)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::recursive_mutex> lkg(m_crit.game);
|
std::lock_guard<std::recursive_mutex> lkg(m_crit.game);
|
||||||
|
|
||||||
if (false == NetPlay::StartGame(path))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// tell server i started the game
|
// tell server i started the game
|
||||||
sf::Packet spac;
|
sf::Packet spac;
|
||||||
spac << (MessageId)NP_MSG_START_GAME;
|
spac << (MessageId)NP_MSG_START_GAME;
|
||||||
spac << m_current_game;
|
spac << m_current_game;
|
||||||
|
spac << (char *)&g_NetPlaySettings;
|
||||||
|
|
||||||
|
if (false == NetPlay::StartGame(path))
|
||||||
|
return false;
|
||||||
|
|
||||||
std::lock_guard<std::recursive_mutex> lks(m_crit.send);
|
std::lock_guard<std::recursive_mutex> lks(m_crit.send);
|
||||||
m_socket.Send(spac);
|
m_socket.Send(spac);
|
||||||
|
|
|
@ -590,6 +590,7 @@ bool NetPlayServer::StartGame(const std::string &path)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::recursive_mutex> lkg(m_crit.game);
|
std::lock_guard<std::recursive_mutex> lkg(m_crit.game);
|
||||||
|
|
||||||
|
GetNetSettings();
|
||||||
if (false == NetPlay::StartGame(path))
|
if (false == NetPlay::StartGame(path))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -602,7 +603,12 @@ bool NetPlayServer::StartGame(const std::string &path)
|
||||||
// tell clients to start game
|
// tell clients to start game
|
||||||
sf::Packet spac;
|
sf::Packet spac;
|
||||||
spac << (MessageId)NP_MSG_START_GAME;
|
spac << (MessageId)NP_MSG_START_GAME;
|
||||||
spac << m_current_game;
|
spac << NetPlay::m_current_game;
|
||||||
|
spac << g_NetPlaySettings.m_CPUthread;
|
||||||
|
spac << g_NetPlaySettings.m_DSPEnableJIT;
|
||||||
|
spac << g_NetPlaySettings.m_DSPHLE;
|
||||||
|
spac << g_NetPlaySettings.m_Controllers;
|
||||||
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
Loading…
Reference in New Issue