Merge pull request #1556 from comex/project-moration

Rudimentary version of Wii IPC determinism.  Ported from my old udpnet branch.
This commit is contained in:
comex
2015-06-02 18:38:19 -04:00
43 changed files with 417 additions and 483 deletions
+4 -1
View File
@@ -199,7 +199,10 @@ bool CBoot::SetupWiiMemory(DiscIO::IVolume::ECountry country)
if (serno.empty() || serno == "000000000")
{
serno = gen.generateSerialNumber();
if (Core::g_want_determinism)
serno = "123456789";
else
serno = gen.generateSerialNumber();
INFO_LOG(BOOT, "No previous serial number found, generated one instead: %s", serno.c_str());
}
else
-2
View File
@@ -475,8 +475,6 @@ void SConfig::LoadGeneralSettings(IniFile& ini)
general->Get("NANDRootPath", &m_NANDPath);
File::SetUserPath(D_WIIROOT_IDX, m_NANDPath);
DiscIO::cUIDsys::AccessInstance().UpdateLocation();
DiscIO::CSharedContent::AccessInstance().UpdateLocation();
general->Get("WirelessMac", &m_WirelessMac);
}
+1
View File
@@ -831,6 +831,7 @@ void UpdateWantDeterminism(bool initial)
g_video_backend->UpdateWantDeterminism(new_want_determinism);
// We need to clear the cache because some parts of the JIT depend on want_determinism, e.g. use of FMA.
JitInterface::ClearCache();
Common::InitializeWiiRoot(g_want_determinism);
Core::PauseAndLock(false, was_unpaused);
}
+6
View File
@@ -226,6 +226,12 @@ u64 GetIdleTicks()
void ScheduleEvent_Threadsafe(int cyclesIntoFuture, int event_type, u64 userdata)
{
_assert_msg_(POWERPC, !Core::IsCPUThread(), "ScheduleEvent_Threadsafe from wrong thread");
if (Core::g_want_determinism)
{
ERROR_LOG(POWERPC, "Someone scheduled an off-thread \"%s\" event while netplay or movie play/record "
"was active. This is likely to cause a desync.",
event_types[event_type].name.c_str());
}
std::lock_guard<std::mutex> lk(tsWriteLock);
Event ne;
ne.time = globalTimer + cyclesIntoFuture;
+2 -11
View File
@@ -151,16 +151,7 @@ GCMemcardDirectory::GCMemcardDirectory(const std::string& directory, int slot, u
hdrfile.ReadBytes(&m_hdr, BLOCK_SIZE);
}
File::FSTEntry FST_Temp;
File::ScanDirectoryTree(m_SaveDirectory, FST_Temp);
CFileSearch::XStringVector Directory;
Directory.push_back(m_SaveDirectory);
CFileSearch::XStringVector Extensions;
Extensions.push_back("*.gci");
CFileSearch FileSearch(Extensions, Directory);
const CFileSearch::XStringVector& rFilenames = FileSearch.GetFileNames();
std::vector<std::string> rFilenames = DoFileSearch({"*.gci"}, {m_SaveDirectory});
if (rFilenames.size() > 112)
{
@@ -170,7 +161,7 @@ GCMemcardDirectory::GCMemcardDirectory(const std::string& directory, int slot, u
4000);
}
for (auto gciFile : rFilenames)
for (const std::string& gciFile : rFilenames)
{
if (m_saves.size() == DIRLEN)
{
+6
View File
@@ -4,6 +4,7 @@
#include "Common/ChunkFile.h"
#include "Common/CommonTypes.h"
#include "Common/NandPaths.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
@@ -25,6 +26,7 @@
#include "Core/IPC_HLE/WII_IPC_HLE.h"
#include "Core/PowerPC/PowerPC.h"
#include "Core/PowerPC/PPCAnalyst.h"
#include "DiscIO/NANDContentLoader.h"
namespace HW
{
@@ -50,6 +52,9 @@ namespace HW
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
{
Common::InitializeWiiRoot(Core::g_want_determinism);
DiscIO::cUIDsys::AccessInstance().UpdateLocation();
DiscIO::CSharedContent::AccessInstance().UpdateLocation();
WII_IPCInterface::Init();
WII_IPC_HLE_Interface::Init();
}
@@ -70,6 +75,7 @@ namespace HW
{
WII_IPCInterface::Shutdown();
WII_IPC_HLE_Interface::Shutdown();
Common::ShutdownWiiRoot();
}
State::Shutdown();
+3 -5
View File
@@ -62,14 +62,13 @@ bool CWiiSaveCrypted::ExportWiiSave(u64 title_id)
void CWiiSaveCrypted::ExportAllSaves()
{
std::string title_folder = File::GetUserPath(D_WIIUSER_IDX) + "title";
std::string title_folder = File::GetUserPath(D_WIIROOT_IDX) + "/title";
std::vector<u64> titles;
const u32 path_mask = 0x00010000;
for (int i = 0; i < 8; ++i)
{
File::FSTEntry fst_tmp;
std::string folder = StringFromFormat("%s/%08x/", title_folder.c_str(), path_mask | i);
File::ScanDirectoryTree(folder, fst_tmp);
File::FSTEntry fst_tmp = File::ScanDirectoryTree(folder, false);
for (const File::FSTEntry& entry : fst_tmp.children)
{
@@ -627,8 +626,7 @@ void CWiiSaveCrypted::ScanForFiles(const std::string& save_directory, std::vecto
file_list.push_back(directories[i]);
}
File::FSTEntry fst_tmp;
File::ScanDirectoryTree(directories[i], fst_tmp);
File::FSTEntry fst_tmp = File::ScanDirectoryTree(directories[i], false);
for (const File::FSTEntry& elem : fst_tmp.children)
{
if (elem.virtualName != "banner.bin")
@@ -22,6 +22,7 @@
#include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
#include "Common/NandPaths.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
#include "Core/HW/WiimoteEmu/WiimoteHid.h"
@@ -275,7 +276,7 @@ void Wiimote::WriteData(const wm_write_data* const wd)
{
// writing the whole mii block each write :/
std::ofstream file;
OpenFStream(file, File::GetUserPath(D_WIIUSER_IDX) + "mii.bin", std::ios::binary | std::ios::out);
OpenFStream(file, File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/mii.bin", std::ios::binary | std::ios::out);
file.write((char*)m_eeprom + 0x0FCA, 0x02f0);
file.close();
}
@@ -417,7 +418,7 @@ void Wiimote::ReadData(const wm_read_data* const rd)
{
// reading the whole mii block :/
std::ifstream file;
file.open((File::GetUserPath(D_WIIUSER_IDX) + "mii.bin").c_str(), std::ios::binary | std::ios::in);
file.open((File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/mii.bin").c_str(), std::ios::binary | std::ios::in);
file.read((char*)m_eeprom + 0x0FCA, 0x02f0);
file.close();
}
@@ -5,11 +5,14 @@
#include <algorithm>
#include "Common/ChunkFile.h"
#include "Common/CommonPaths.h"
#include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
#include "Common/NandPaths.h"
#include "Common/StringUtil.h"
#include "Core/Core.h"
#include "Core/IPC_HLE/WII_IPC_HLE.h"
#include "Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.h"
#include "Core/IPC_HLE/WII_IPC_HLE_Device_fs.h"
@@ -19,7 +22,7 @@ static Common::replace_v replacements;
// This is used by several of the FileIO and /dev/fs functions
std::string HLE_IPC_BuildFilename(std::string path_wii)
{
std::string path_full = File::GetUserPath(D_WIIROOT_IDX);
std::string path_full = File::GetUserPath(D_SESSION_WIIROOT_IDX);
// Replaces chars that FAT32 can't support with strings defined in /sys/replace
for (auto& replacement : replacements)
@@ -5,7 +5,6 @@
#include "Common/ChunkFile.h"
#include "Common/CommonPaths.h"
#include "Common/CommonTypes.h"
#include "Common/FileSearch.h"
#include "Common/FileUtil.h"
#include "Common/NandPaths.h"
#include "Common/StringUtil.h"
@@ -33,7 +32,7 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::Open(u32 _CommandAddress, u32 _Mode)
{
// clear tmp folder
{
std::string Path = File::GetUserPath(D_WIIUSER_IDX) + "tmp";
std::string Path = HLE_IPC_BuildFilename("/tmp");
File::DeleteDirRecursively(Path);
File::CreateDir(Path);
}
@@ -106,25 +105,28 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress)
break;
}
// make a file search
CFileSearch::XStringVector Directories;
Directories.push_back(DirName);
CFileSearch::XStringVector Extensions;
Extensions.push_back("*.*");
CFileSearch FileSearch(Extensions, Directories);
File::FSTEntry entry = File::ScanDirectoryTree(DirName, false);
// it is one
if ((CommandBuffer.InBuffer.size() == 1) && (CommandBuffer.PayloadBuffer.size() == 1))
{
size_t numFile = FileSearch.GetFileNames().size();
size_t numFile = entry.children.size();
INFO_LOG(WII_IPC_FILEIO, "\t%lu files found", (unsigned long)numFile);
Memory::Write_U32((u32)numFile, CommandBuffer.PayloadBuffer[0].m_Address);
}
else
{
for (File::FSTEntry& child : entry.children)
{
// Decode entities of invalid file system characters so that
// games (such as HP:HBP) will be able to find what they expect.
for (const Common::replace_t& r : replacements)
child.virtualName = ReplaceAll(child.virtualName, r.second, {r.first});
}
std::sort(entry.children.begin(), entry.children.end(), [](const File::FSTEntry& one, const File::FSTEntry& two) { return one.virtualName < two.virtualName; });
u32 MaxEntries = Memory::Read_U32(CommandBuffer.InBuffer[0].m_Address);
memset(Memory::GetPointer(CommandBuffer.PayloadBuffer[0].m_Address), 0, CommandBuffer.PayloadBuffer[0].m_Size);
@@ -132,22 +134,10 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress)
size_t numFiles = 0;
char* pFilename = (char*)Memory::GetPointer((u32)(CommandBuffer.PayloadBuffer[0].m_Address));
for (size_t i=0; i<FileSearch.GetFileNames().size(); i++)
for (size_t i=0; i < entry.children.size() && i < MaxEntries; i++)
{
if (i >= MaxEntries)
break;
const std::string& FileName = entry.children[i].virtualName;
std::string name, ext;
SplitPath(FileSearch.GetFileNames()[i], nullptr, &name, &ext);
std::string FileName = name + ext;
// Decode entities of invalid file system characters so that
// games (such as HP:HBP) will be able to find what they expect.
for (const Common::replace_t& r : replacements)
{
for (size_t j = 0; (j = FileName.find(r.second, j)) != FileName.npos; ++j)
FileName.replace(j, r.second.length(), 1, r.first);
}
strcpy(pFilename, FileName.c_str());
pFilename += FileName.length();
@@ -192,10 +182,9 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress)
}
else
{
File::FSTEntry parentDir;
// add one for the folder itself, allows some games to create their save files
// R8XE52 (Jurassic: The Hunted), STEETR (Tetris Party Deluxe) now create their saves with this change
iNodes = 1 + File::ScanDirectoryTree(path, parentDir);
File::FSTEntry parentDir = File::ScanDirectoryTree(path, true);
// add one for the folder itself
iNodes = 1 + (u32)parentDir.size;
u64 totalSize = ComputeTotalFileSize(parentDir); // "Real" size, to be converted to nand blocks
@@ -232,7 +221,6 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress)
IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtl(u32 _CommandAddress)
{
//u32 DeviceID = Memory::Read_U32(_CommandAddress + 8);
//LOG(WII_IPC_FILEIO, "FS: IOCtl (Device=%s, DeviceID=%08x)", GetDeviceName().c_str(), DeviceID);
u32 Parameter = Memory::Read_U32(_CommandAddress + 0xC);
u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
@@ -494,7 +482,7 @@ void CWII_IPC_HLE_Device_fs::DoState(PointerWrap& p)
// handle /tmp
std::string Path = File::GetUserPath(D_WIIUSER_IDX) + "tmp";
std::string Path = File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/tmp";
if (p.GetMode() == PointerWrap::MODE_READ)
{
File::DeleteDirRecursively(Path);
@@ -542,8 +530,7 @@ void CWII_IPC_HLE_Device_fs::DoState(PointerWrap& p)
{
//recurse through tmp and save dirs and files
File::FSTEntry parentEntry;
File::ScanDirectoryTree(Path, parentEntry);
File::FSTEntry parentEntry = File::ScanDirectoryTree(Path, true);
std::deque<File::FSTEntry> todo;
todo.insert(todo.end(), parentEntry.children.begin(),
parentEntry.children.end());
@@ -129,6 +129,12 @@ IPCCommandResult CWII_IPC_HLE_Device_hid::Close(u32 _CommandAddress, bool _bForc
IPCCommandResult CWII_IPC_HLE_Device_hid::IOCtl(u32 _CommandAddress)
{
if (Core::g_want_determinism)
{
Memory::Write_U32(-1, _CommandAddress + 0x4);
return IPC_DEFAULT_REPLY;
}
u32 Parameter = Memory::Read_U32(_CommandAddress + 0xC);
u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
@@ -15,6 +15,7 @@
#include "Common/StringUtil.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/ec_wii.h"
#include "Core/IPC_HLE/ICMP.h"
#include "Core/IPC_HLE/WII_IPC_HLE_Device_es.h"
@@ -314,6 +315,10 @@ static void GetMacAddress(u8* mac)
// Parse MAC address from config, and generate a new one if it doesn't
// exist or can't be parsed.
std::string wireless_mac = SConfig::GetInstance().m_WirelessMac;
if (Core::g_want_determinism)
wireless_mac = "12:34:56:78:9a:bc";
if (!StringToMacAddress(wireless_mac, mac))
{
GenerateMacAddress(IOS, mac);
@@ -639,6 +644,13 @@ static unsigned int opt_name_mapping[][2] = {
IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress)
{
if (Core::g_want_determinism)
{
Memory::Write_U32(-1, _CommandAddress + 4);
return IPC_DEFAULT_REPLY;
}
u32 Command = Memory::Read_U32(_CommandAddress + 0x0C);
u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
@@ -1217,65 +1229,68 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 CommandAddress)
{
u32 address = 0;
#ifdef _WIN32
PIP_ADAPTER_ADDRESSES AdapterAddresses = nullptr;
ULONG OutBufferLength = 0;
ULONG RetVal = 0, i;
for (i = 0; i < 5; ++i)
if (!Core::g_want_determinism)
{
RetVal = GetAdaptersAddresses(
AF_INET,
0,
nullptr,
AdapterAddresses,
&OutBufferLength);
if (RetVal != ERROR_BUFFER_OVERFLOW)
PIP_ADAPTER_ADDRESSES AdapterAddresses = nullptr;
ULONG OutBufferLength = 0;
ULONG RetVal = 0, i;
for (i = 0; i < 5; ++i)
{
break;
}
RetVal = GetAdaptersAddresses(
AF_INET,
0,
nullptr,
AdapterAddresses,
&OutBufferLength);
if (RetVal != ERROR_BUFFER_OVERFLOW)
{
break;
}
if (AdapterAddresses != nullptr)
{
FREE(AdapterAddresses);
}
AdapterAddresses = (PIP_ADAPTER_ADDRESSES)MALLOC(OutBufferLength);
if (AdapterAddresses == nullptr)
{
RetVal = GetLastError();
break;
}
}
if (RetVal == NO_ERROR)
{
unsigned long dwBestIfIndex = 0;
IPAddr dwDestAddr = (IPAddr)0x08080808;
// If successful, output some information from the data we received
PIP_ADAPTER_ADDRESSES AdapterList = AdapterAddresses;
if (GetBestInterface(dwDestAddr, &dwBestIfIndex) == NO_ERROR)
{
while (AdapterList)
{
if (AdapterList->IfIndex == dwBestIfIndex &&
AdapterList->FirstDnsServerAddress &&
AdapterList->OperStatus == IfOperStatusUp)
{
INFO_LOG(WII_IPC_NET, "Name of valid interface: %S", AdapterList->FriendlyName);
INFO_LOG(WII_IPC_NET, "DNS: %u.%u.%u.%u",
(unsigned char)AdapterList->FirstDnsServerAddress->Address.lpSockaddr->sa_data[2],
(unsigned char)AdapterList->FirstDnsServerAddress->Address.lpSockaddr->sa_data[3],
(unsigned char)AdapterList->FirstDnsServerAddress->Address.lpSockaddr->sa_data[4],
(unsigned char)AdapterList->FirstDnsServerAddress->Address.lpSockaddr->sa_data[5]);
address = Common::swap32(*(u32*)(&AdapterList->FirstDnsServerAddress->Address.lpSockaddr->sa_data[2]));
break;
}
AdapterList = AdapterList->Next;
}
}
}
if (AdapterAddresses != nullptr)
{
FREE(AdapterAddresses);
}
AdapterAddresses = (PIP_ADAPTER_ADDRESSES)MALLOC(OutBufferLength);
if (AdapterAddresses == nullptr)
{
RetVal = GetLastError();
break;
}
}
if (RetVal == NO_ERROR)
{
unsigned long dwBestIfIndex = 0;
IPAddr dwDestAddr = (IPAddr)0x08080808;
// If successful, output some information from the data we received
PIP_ADAPTER_ADDRESSES AdapterList = AdapterAddresses;
if (GetBestInterface(dwDestAddr, &dwBestIfIndex) == NO_ERROR)
{
while (AdapterList)
{
if (AdapterList->IfIndex == dwBestIfIndex &&
AdapterList->FirstDnsServerAddress &&
AdapterList->OperStatus == IfOperStatusUp)
{
INFO_LOG(WII_IPC_NET, "Name of valid interface: %S", AdapterList->FriendlyName);
INFO_LOG(WII_IPC_NET, "DNS: %u.%u.%u.%u",
(unsigned char)AdapterList->FirstDnsServerAddress->Address.lpSockaddr->sa_data[2],
(unsigned char)AdapterList->FirstDnsServerAddress->Address.lpSockaddr->sa_data[3],
(unsigned char)AdapterList->FirstDnsServerAddress->Address.lpSockaddr->sa_data[4],
(unsigned char)AdapterList->FirstDnsServerAddress->Address.lpSockaddr->sa_data[5]);
address = Common::swap32(*(u32*)(&AdapterList->FirstDnsServerAddress->Address.lpSockaddr->sa_data[2]));
break;
}
AdapterList = AdapterList->Next;
}
}
}
if (AdapterAddresses != nullptr)
{
FREE(AdapterAddresses);
}
#endif
if (address == 0)
@@ -4,9 +4,12 @@
#pragma once
#include "Common/CommonPaths.h"
#include "Common/FileUtil.h"
#include "Common/NandPaths.h"
#include "Common/Timer.h"
#include "Core/HW/EXI_DeviceIPL.h"
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
#ifdef _WIN32
@@ -171,7 +174,7 @@ private:
public:
NWC24Config()
{
path = File::GetUserPath(D_WIIWC24_IDX) + "nwc24msg.cfg";
path = File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/" WII_WC24CONF_DIR "/nwc24msg.cfg";
ReadConfig();
}
@@ -210,7 +213,7 @@ public:
{
if (!File::Exists(path))
{
if (!File::CreateFullPath(File::GetUserPath(D_WIIWC24_IDX)))
if (!File::CreateFullPath(File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/" WII_WC24CONF_DIR))
{
ERROR_LOG(WII_IPC_WC24, "Failed to create directory for WC24");
}
@@ -321,7 +324,7 @@ class WiiNetConfig
public:
WiiNetConfig()
{
path = File::GetUserPath(D_WIISYSCONF_IDX) + "net/02/config.dat";
path = File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/" WII_SYSCONF_DIR "/net/02/config.dat";
ReadConfig();
}
@@ -346,7 +349,7 @@ public:
{
if (!File::Exists(path))
{
if (!File::CreateFullPath(std::string(File::GetUserPath(D_WIISYSCONF_IDX) + "net/02/")))
if (!File::CreateFullPath(std::string(File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/" WII_SYSCONF_DIR "/net/02/")))
{
ERROR_LOG(WII_IPC_NET, "Failed to create directory for network config file");
}
@@ -528,21 +531,26 @@ private:
u64 rtc;
s64 utcdiff;
// Seconds between 1.1.1970 and 4.1.2008 16:00:38
static const u64 wii_bias = 0x477E5826;
// TODO: depending on CEXIIPL is a hack which I don't feel like removing
// because the function itself is pretty hackish; wait until I re-port my
// netplay rewrite; also, is that random 16:00:38 actually meaningful?
// seems very very doubtful since Wii was released in 2006
// Seconds between 1.1.2000 and 4.1.2008 16:00:38
static const u64 wii_bias = 0x477E5826 - 0x386D4380;
// Returns seconds since Wii epoch
// +/- any bias set from IOCTL_NW24_SET_UNIVERSAL_TIME
u64 GetAdjustedUTC() const
{
return Common::Timer::GetTimeSinceJan1970() - wii_bias + utcdiff;
return CEXIIPL::GetGCTime() - wii_bias + utcdiff;
}
// Store the difference between what the Wii thinks is UTC and
// what the host OS thinks
void SetAdjustedUTC(u64 wii_utc)
{
utcdiff = Common::Timer::GetTimeSinceJan1970() - wii_bias - wii_utc;
utcdiff = CEXIIPL::GetGCTime() - wii_bias - wii_utc;
}
};
@@ -5,6 +5,8 @@
#include <algorithm>
#include "Common/FileUtil.h"
#include "Common/NandPaths.h"
#include "Core/Core.h"
#include "Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h"
#include "Core/IPC_HLE/WII_Socket.h"
@@ -127,6 +129,14 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(u32 _CommandAddress)
BufferOutSize3 = CommandBuffer.PayloadBuffer.at(2).m_Size;
}
// I don't trust SSL to be deterministic, and this is never going to sync
// as such (as opposed to forwarding IPC results or whatever), so -
if (Core::g_want_determinism)
{
Memory::Write_U32(-1, _CommandAddress + 0x4);
return IPC_DEFAULT_REPLY;
}
switch (CommandBuffer.Parameter)
{
case IOCTLV_NET_SSL_NEW:
@@ -277,7 +287,7 @@ _SSL_NEW_ERROR:
if (SSLID_VALID(sslID))
{
WII_SSL* ssl = &_SSL[sslID];
std::string cert_base_path(File::GetUserPath(D_WIIUSER_IDX));
std::string cert_base_path = File::GetUserPath(D_SESSION_WIIROOT_IDX);
int ret = x509_crt_parse_file(&ssl->clicert, (cert_base_path + "clientca.pem").c_str());
int pk_ret = pk_parse_keyfile(&ssl->pk, (cert_base_path + "clientcakey.pem").c_str(), nullptr);
if (ret || pk_ret)
@@ -334,9 +344,8 @@ _SSL_NEW_ERROR:
if (SSLID_VALID(sslID))
{
WII_SSL* ssl = &_SSL[sslID];
std::string cert_base_path(File::GetUserPath(D_WIIUSER_IDX));
int ret = x509_crt_parse_file(&ssl->cacert, (cert_base_path + "rootca.pem").c_str());
int ret = x509_crt_parse_file(&ssl->cacert, (File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/rootca.pem").c_str());
if (ret)
{
x509_crt_free(&ssl->clicert);
@@ -61,7 +61,7 @@ void CWII_IPC_HLE_Device_sdio_slot0::EventNotify()
void CWII_IPC_HLE_Device_sdio_slot0::OpenInternal()
{
const std::string filename = File::GetUserPath(D_WIIUSER_IDX) + "sd.raw";
const std::string filename = File::GetUserPath(D_WIIROOT_IDX) + "/sd.raw";
m_Card.Open(filename, "r+b");
if (!m_Card)
{
@@ -2,6 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "Common/CommonPaths.h"
#include "Core/ConfigManager.h"
#include "Core/Core.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_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
_conf_pads BT_DINF;
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");
}
@@ -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
// 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");
}
@@ -13,6 +13,8 @@
#include <windows.h>
#endif
// TODO: support in netplay/movies.
CWII_IPC_HLE_Device_usb_kbd::CWII_IPC_HLE_Device_usb_kbd(u32 _DeviceID, const std::string& _rDeviceName)
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
{}
@@ -64,7 +66,7 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_kbd::IOCtl(u32 _CommandAddress)
{
u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
if (SConfig::GetInstance().m_WiiKeyboard && !m_MessageQueue.empty())
if (SConfig::GetInstance().m_WiiKeyboard && !Core::g_want_determinism && !m_MessageQueue.empty())
{
Memory::CopyToEmu(BufferOut, &m_MessageQueue.front(), sizeof(SMessageData));
m_MessageQueue.pop();
@@ -89,7 +91,7 @@ bool CWII_IPC_HLE_Device_usb_kbd::IsKeyPressed(int _Key)
u32 CWII_IPC_HLE_Device_usb_kbd::Update()
{
if (!SConfig::GetInstance().m_WiiKeyboard || !m_Active)
if (!SConfig::GetInstance().m_WiiKeyboard || Core::g_want_determinism || !m_Active)
return 0;
u8 Modifiers = 0x00;
-5
View File
@@ -562,11 +562,6 @@ void WiiSockMan::AddSocket(s32 fd)
s32 WiiSockMan::NewSocket(s32 af, s32 type, s32 protocol)
{
if (Core::g_want_determinism)
{
return SO_ENOMEM;
}
s32 fd = (s32)socket(af, type, protocol);
s32 ret = GetNetErrorCode(fd, "NewSocket", false);
AddSocket(ret);
+1 -1
View File
@@ -119,7 +119,7 @@ void make_blanksig_ec_cert(u8 *cert_out, const char *signer, const char *name, c
EcWii::EcWii()
{
bool init = true;
std::string keys_path = File::GetUserPath(D_WIIUSER_IDX) + "keys.bin";
std::string keys_path = File::GetUserPath(D_WIIROOT_IDX) + "/keys.bin";
if (File::Exists(keys_path))
{
File::IOFile keys_f(keys_path, "rb");