Merge branch 'possibly-useful-netplay-changes'

This commit is contained in:
Rachel Bryk 2013-07-21 13:33:14 -04:00
commit 481c081db3
6 changed files with 56 additions and 7 deletions

View File

@ -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,12 @@ bool BootCore(const std::string& _rFilename)
} }
} }
if (NetPlay::GetNetPlayPtr())
{
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 +178,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;
} }
} }

View File

@ -7,6 +7,7 @@
#include "../ConfigManager.h" #include "../ConfigManager.h"
#include "../CoreTiming.h" #include "../CoreTiming.h"
#include "../Movie.h" #include "../Movie.h"
#include "../NetPlay.h"
#include "SystemTimers.h" #include "SystemTimers.h"
#include "ProcessorInterface.h" #include "ProcessorInterface.h"
@ -261,6 +262,8 @@ 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())
AddDevice((SIDevices) g_NetPlaySettings.m_Controllers[i], i);
else else
AddDevice(SConfig::GetInstance().m_SIDevice[i], i); AddDevice(SConfig::GetInstance().m_SIDevice[i], i);
} }
@ -641,7 +644,7 @@ void RunSIBuffer()
int GetTicksToNextSIPoll() int GetTicksToNextSIPoll()
{ {
// Poll for input at regular intervals (once per frame) when playing or recording a movie // Poll for input at regular intervals (once per frame) when playing or recording a movie
if (Movie::IsPlayingInput() || Movie::IsRecordingInput()) if (Movie::IsPlayingInput() || Movie::IsRecordingInput() || NetPlay::GetNetPlayPtr())
{ {
return SystemTimers::GetTicksPerSecond() / VideoInterface::TargetRefreshRate; return SystemTimers::GetTicksPerSecond() / VideoInterface::TargetRefreshRate;
} }

View File

@ -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,16 @@ u8 NetPlay::GetPadNum(u8 numPAD)
return i; return i;
} }
void NetPlay::GetNetSettings()
{
SConfig &instance = SConfig::GetInstance();
g_NetPlaySettings.m_DSPHLE = instance.m_LocalCoreStartupParameter.bDSPHLE;
g_NetPlaySettings.m_DSPEnableJIT = instance.m_EnableJIT;
for (unsigned int i = 0; i < 4; ++i)
g_NetPlaySettings.m_Controllers[i] = SConfig::GetInstance().m_SIDevice[i];
}
// stuff hacked into dolphin // stuff hacked into dolphin
// called from ---CPU--- thread // called from ---CPU--- thread
@ -386,3 +398,8 @@ bool CWII_IPC_HLE_WiiMote::NetPlay_WiimoteInput(int, u16, const void*, u32&)
else else
return false; return false;
} }
NetPlay* NetPlay::GetNetPlayPtr()
{
return netplay_ptr;
}

View File

@ -31,6 +31,14 @@ public:
u32 nLo; u32 nLo;
}; };
struct NetSettings
{
bool m_DSPHLE;
bool m_DSPEnableJIT;
u8 m_Controllers[4];
};
extern NetSettings g_NetPlaySettings;
struct Rpt : public std::vector<u8> struct Rpt : public std::vector<u8>
{ {
u16 channel; u16 channel;
@ -38,7 +46,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
@ -119,10 +127,12 @@ public:
//void PushPadStates(unsigned int count); //void PushPadStates(unsigned int count);
u8 GetPadNum(u8 numPAD); u8 GetPadNum(u8 numPAD);
static NetPlay* GetNetPlayPtr();
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

View File

@ -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_DSPEnableJIT;
packet >> g_NetPlaySettings.m_DSPHLE;
for (unsigned int i = 0; i < 4; ++i)
packet >> g_NetPlaySettings.m_Controllers[i];
} }
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);

View File

@ -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,11 @@ 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_DSPEnableJIT;
spac << g_NetPlaySettings.m_DSPHLE;
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);