mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 16:19:28 +01:00
Fix determinism issues with Wiimote netplay.
- Change the Wiimote emulation SYSCONF R/W to use the temporary NAND if in use. - Fix up SysConf API so this actually works. Kind of a hack. Like I said, this can be cleaned up when configuration is synced...
This commit is contained in:
parent
0d257b9e88
commit
45b07cbdcd
@ -38,6 +38,10 @@ void SysConf::Clear()
|
|||||||
|
|
||||||
bool SysConf::LoadFromFile(const std::string& filename)
|
bool SysConf::LoadFromFile(const std::string& filename)
|
||||||
{
|
{
|
||||||
|
if (m_IsValid)
|
||||||
|
Clear();
|
||||||
|
m_IsValid = false;
|
||||||
|
|
||||||
// Basic check
|
// Basic check
|
||||||
if (!File::Exists(filename))
|
if (!File::Exists(filename))
|
||||||
{
|
{
|
||||||
@ -67,6 +71,7 @@ bool SysConf::LoadFromFile(const std::string& filename)
|
|||||||
if (LoadFromFileInternal(f.ReleaseHandle()))
|
if (LoadFromFileInternal(f.ReleaseHandle()))
|
||||||
{
|
{
|
||||||
m_Filename = filename;
|
m_Filename = filename;
|
||||||
|
m_IsValid = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,6 +112,7 @@ bool SysConf::LoadFromFileInternal(FILE *fh)
|
|||||||
f.ReadArray(curEntry.name, curEntry.nameLength);
|
f.ReadArray(curEntry.name, curEntry.nameLength);
|
||||||
curEntry.name[curEntry.nameLength] = '\0';
|
curEntry.name[curEntry.nameLength] = '\0';
|
||||||
// Get length of data
|
// Get length of data
|
||||||
|
curEntry.data = nullptr;
|
||||||
curEntry.dataLength = 0;
|
curEntry.dataLength = 0;
|
||||||
switch (curEntry.type)
|
switch (curEntry.type)
|
||||||
{
|
{
|
||||||
@ -362,6 +368,7 @@ void SysConf::GenerateSysConf()
|
|||||||
g.WriteBytes("SCed", 4);
|
g.WriteBytes("SCed", 4);
|
||||||
|
|
||||||
m_Filename = m_FilenameDefault;
|
m_Filename = m_FilenameDefault;
|
||||||
|
m_IsValid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SysConf::SaveToFile(const std::string& filename)
|
bool SysConf::SaveToFile(const std::string& filename)
|
||||||
@ -418,11 +425,8 @@ void SysConf::UpdateLocation()
|
|||||||
|
|
||||||
bool SysConf::Reload()
|
bool SysConf::Reload()
|
||||||
{
|
{
|
||||||
if (m_IsValid)
|
|
||||||
Clear();
|
|
||||||
|
|
||||||
std::string& filename = m_Filename.empty() ? m_FilenameDefault : m_Filename;
|
std::string& filename = m_Filename.empty() ? m_FilenameDefault : m_Filename;
|
||||||
|
|
||||||
m_IsValid = LoadFromFile(filename);
|
LoadFromFile(filename);
|
||||||
return m_IsValid;
|
return m_IsValid;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "Common/CommonPaths.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
@ -35,11 +36,25 @@ CWII_IPC_HLE_Device_usb_oh1_57e_305::CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _De
|
|||||||
, m_ACLEndpoint(0)
|
, m_ACLEndpoint(0)
|
||||||
, m_last_ticks(0)
|
, m_last_ticks(0)
|
||||||
{
|
{
|
||||||
|
SysConf* sysconf;
|
||||||
|
std::unique_ptr<SysConf> owned_sysconf;
|
||||||
|
if (Core::g_want_determinism)
|
||||||
|
{
|
||||||
|
// See SysConf::UpdateLocation for comment about the Future.
|
||||||
|
owned_sysconf.reset(new SysConf());
|
||||||
|
sysconf = owned_sysconf.get();
|
||||||
|
sysconf->LoadFromFile(File::GetUserPath(D_SESSION_WIIROOT_IDX) + DIR_SEP WII_SYSCONF_DIR DIR_SEP WII_SYSCONF);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sysconf = SConfig::GetInstance().m_SYSCONF;
|
||||||
|
}
|
||||||
|
|
||||||
// Activate only first Wiimote by default
|
// Activate only first Wiimote by default
|
||||||
|
|
||||||
_conf_pads BT_DINF;
|
_conf_pads BT_DINF;
|
||||||
SetUsbPointer(this);
|
SetUsbPointer(this);
|
||||||
if (!SConfig::GetInstance().m_SYSCONF->GetArrayData("BT.DINF", (u8*)&BT_DINF, sizeof(_conf_pads)))
|
if (!sysconf->GetArrayData("BT.DINF", (u8*)&BT_DINF, sizeof(_conf_pads)))
|
||||||
{
|
{
|
||||||
PanicAlertT("Trying to read from invalid SYSCONF\nWiimote bt ids are not available");
|
PanicAlertT("Trying to read from invalid SYSCONF\nWiimote bt ids are not available");
|
||||||
}
|
}
|
||||||
@ -83,7 +98,7 @@ CWII_IPC_HLE_Device_usb_oh1_57e_305::CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _De
|
|||||||
|
|
||||||
// save now so that when games load sysconf file it includes the new Wiimotes
|
// save now so that when games load sysconf file it includes the new Wiimotes
|
||||||
// and the correct order for connected Wiimotes
|
// and the correct order for connected Wiimotes
|
||||||
if (!SConfig::GetInstance().m_SYSCONF->SetArrayData("BT.DINF", (u8*)&BT_DINF, sizeof(_conf_pads)) || !SConfig::GetInstance().m_SYSCONF->Save())
|
if (!sysconf->SetArrayData("BT.DINF", (u8*)&BT_DINF, sizeof(_conf_pads)) || !sysconf->Save())
|
||||||
PanicAlertT("Failed to write BT.DINF to SYSCONF");
|
PanicAlertT("Failed to write BT.DINF to SYSCONF");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user