[NetPlay] Make the Memory Card A/B setting sync across netplay.

Fixes issue 6575.
This commit is contained in:
Justin Chadwick 2013-09-03 17:41:52 -04:00 committed by Rachel Bryk
parent 70cfe96492
commit e110f1049c
5 changed files with 19 additions and 1 deletions

View File

@ -46,6 +46,7 @@ struct ConfigCache
bool valid, bCPUThread, bSkipIdle, bEnableFPRF, bMMU, bDCBZOFF, m_EnableJIT, bDSPThread,
bVBeamSpeedHack, bSyncGPU, bFastDiscSpeed, bMergeBlocks, bDSPHLE, bHLE_BS2;
int iTLBHack, iCPUCore;
TEXIDevices m_EXIDevice[2];
std::string strBackend;
};
static ConfigCache config_cache;
@ -94,6 +95,8 @@ bool BootCore(const std::string& _rFilename)
config_cache.bHLE_BS2 = StartUp.bHLE_BS2;
config_cache.m_EnableJIT = SConfig::GetInstance().m_EnableJIT;
config_cache.bDSPThread = StartUp.bDSPThread;
config_cache.m_EXIDevice[0] = SConfig::GetInstance().m_EXIDevice[0];
config_cache.m_EXIDevice[1] = SConfig::GetInstance().m_EXIDevice[1];
// General settings
game_ini.Get("Core", "CPUThread", &StartUp.bCPUThread, StartUp.bCPUThread);
@ -144,6 +147,8 @@ bool BootCore(const std::string& _rFilename)
StartUp.bDSPHLE = g_NetPlaySettings.m_DSPHLE;
StartUp.bEnableMemcardSaving = g_NetPlaySettings.m_WriteToMemcard;
SConfig::GetInstance().m_EnableJIT = g_NetPlaySettings.m_DSPEnableJIT;
SConfig::GetInstance().m_EXIDevice[0] = g_NetPlaySettings.m_EXIDevice[0];
SConfig::GetInstance().m_EXIDevice[1] = g_NetPlaySettings.m_EXIDevice[1];
}
// Run the game
@ -184,6 +189,8 @@ void Stop()
VideoBackend::ActivateBackend(StartUp.m_strVideoBackend);
StartUp.bHLE_BS2 = config_cache.bHLE_BS2;
SConfig::GetInstance().m_EnableJIT = config_cache.m_EnableJIT;
SConfig::GetInstance().m_EXIDevice[0] = config_cache.m_EXIDevice[0];
SConfig::GetInstance().m_EXIDevice[1] = config_cache.m_EXIDevice[1];
}
}

View File

@ -237,6 +237,11 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
packet >> g_NetPlaySettings.m_DSPEnableJIT;
packet >> g_NetPlaySettings.m_DSPHLE;
packet >> g_NetPlaySettings.m_WriteToMemcard;
int tmp;
packet >> tmp;
g_NetPlaySettings.m_EXIDevice[0] = (TEXIDevices) tmp;
packet >> tmp;
g_NetPlaySettings.m_EXIDevice[1] = (TEXIDevices) tmp;
}
m_dialog->OnMsgStartGame();

View File

@ -7,6 +7,7 @@
#include "Common.h"
#include "CommonTypes.h"
#include "HW/EXI_Device.h"
struct NetSettings
{
@ -14,6 +15,7 @@ struct NetSettings
bool m_DSPHLE;
bool m_DSPEnableJIT;
bool m_WriteToMemcard;
TEXIDevices m_EXIDevice[2];
};
struct Rpt : public std::vector<u8>
@ -23,7 +25,7 @@ struct Rpt : public std::vector<u8>
typedef std::vector<Rpt> NetWiimote;
#define NETPLAY_VERSION "Dolphin NetPlay 2013-08-31"
#define NETPLAY_VERSION "Dolphin NetPlay 2013-09-03"
// messages
enum

View File

@ -455,6 +455,8 @@ bool NetPlayServer::StartGame(const std::string &path)
spac << m_settings.m_DSPEnableJIT;
spac << m_settings.m_DSPHLE;
spac << m_settings.m_WriteToMemcard;
spac << m_settings.m_EXIDevice[0];
spac << m_settings.m_EXIDevice[1];
std::lock_guard<std::recursive_mutex> lkp(m_crit.players);
std::lock_guard<std::recursive_mutex> lks(m_crit.send);

View File

@ -408,6 +408,8 @@ void NetPlayDiag::GetNetSettings(NetSettings &settings)
settings.m_DSPHLE = instance.m_LocalCoreStartupParameter.bDSPHLE;
settings.m_DSPEnableJIT = instance.m_EnableJIT;
settings.m_WriteToMemcard = m_memcard_write->GetValue();
settings.m_EXIDevice[0] = instance.m_EXIDevice[0];
settings.m_EXIDevice[1] = instance.m_EXIDevice[1];
}
std::string NetPlayDiag::FindGame()