Merge pull request #12422 from lioncash/global
WiiNetConfig: Eliminate usages of the global system accessor
This commit is contained in:
commit
370474a7cb
|
@ -87,24 +87,24 @@ std::optional<IPCReply> NetNCDManageDevice::IOCtlV(const IOCtlVRequest& request)
|
||||||
|
|
||||||
case IOCTLV_NCD_GETCONFIG:
|
case IOCTLV_NCD_GETCONFIG:
|
||||||
INFO_LOG_FMT(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_GETCONFIG");
|
INFO_LOG_FMT(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_GETCONFIG");
|
||||||
config.WriteToMem(request.io_vectors.at(0).address);
|
config.WriteToMem(memory, request.io_vectors.at(0).address);
|
||||||
common_vector = 1;
|
common_vector = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTLV_NCD_SETCONFIG:
|
case IOCTLV_NCD_SETCONFIG:
|
||||||
INFO_LOG_FMT(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_SETCONFIG");
|
INFO_LOG_FMT(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_SETCONFIG");
|
||||||
config.ReadFromMem(request.in_vectors.at(0).address);
|
config.ReadFromMem(memory, request.in_vectors.at(0).address);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTLV_NCD_READCONFIG:
|
case IOCTLV_NCD_READCONFIG:
|
||||||
INFO_LOG_FMT(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_READCONFIG");
|
INFO_LOG_FMT(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_READCONFIG");
|
||||||
config.ReadConfig(m_ios.GetFS().get());
|
config.ReadConfig(m_ios.GetFS().get());
|
||||||
config.WriteToMem(request.io_vectors.at(0).address);
|
config.WriteToMem(memory, request.io_vectors.at(0).address);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTLV_NCD_WRITECONFIG:
|
case IOCTLV_NCD_WRITECONFIG:
|
||||||
INFO_LOG_FMT(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_WRITECONFIG");
|
INFO_LOG_FMT(IOS_NET, "NET_NCD_MANAGE: IOCTLV_NCD_WRITECONFIG");
|
||||||
config.ReadFromMem(request.in_vectors.at(0).address);
|
config.ReadFromMem(memory, request.in_vectors.at(0).address);
|
||||||
config.WriteConfig(m_ios.GetFS().get());
|
config.WriteConfig(m_ios.GetFS().get());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include "Core/IOS/FS/FileSystem.h"
|
#include "Core/IOS/FS/FileSystem.h"
|
||||||
#include "Core/IOS/IOS.h"
|
#include "Core/IOS/IOS.h"
|
||||||
#include "Core/IOS/Uids.h"
|
#include "Core/IOS/Uids.h"
|
||||||
#include "Core/System.h"
|
|
||||||
|
|
||||||
namespace IOS::HLE::Net
|
namespace IOS::HLE::Net
|
||||||
{
|
{
|
||||||
|
@ -52,17 +51,13 @@ void WiiNetConfig::ResetConfig(FS::FileSystem* fs)
|
||||||
WriteConfig(fs);
|
WriteConfig(fs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WiiNetConfig::WriteToMem(const u32 address) const
|
void WiiNetConfig::WriteToMem(Memory::MemoryManager& memory, const u32 address) const
|
||||||
{
|
{
|
||||||
auto& system = Core::System::GetInstance();
|
|
||||||
auto& memory = system.GetMemory();
|
|
||||||
memory.CopyToEmu(address, &m_data, sizeof(m_data));
|
memory.CopyToEmu(address, &m_data, sizeof(m_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WiiNetConfig::ReadFromMem(const u32 address)
|
void WiiNetConfig::ReadFromMem(const Memory::MemoryManager& memory, const u32 address)
|
||||||
{
|
{
|
||||||
auto& system = Core::System::GetInstance();
|
|
||||||
auto& memory = system.GetMemory();
|
|
||||||
memory.CopyFromEmu(&m_data, address, sizeof(m_data));
|
memory.CopyFromEmu(&m_data, address, sizeof(m_data));
|
||||||
}
|
}
|
||||||
} // namespace IOS::HLE::Net
|
} // namespace IOS::HLE::Net
|
||||||
|
|
|
@ -6,6 +6,11 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
|
namespace Memory
|
||||||
|
{
|
||||||
|
class MemoryManager;
|
||||||
|
}
|
||||||
|
|
||||||
namespace IOS::HLE
|
namespace IOS::HLE
|
||||||
{
|
{
|
||||||
namespace FS
|
namespace FS
|
||||||
|
@ -111,8 +116,8 @@ public:
|
||||||
void WriteConfig(FS::FileSystem* fs) const;
|
void WriteConfig(FS::FileSystem* fs) const;
|
||||||
void ResetConfig(FS::FileSystem* fs);
|
void ResetConfig(FS::FileSystem* fs);
|
||||||
|
|
||||||
void WriteToMem(u32 address) const;
|
void WriteToMem(Memory::MemoryManager& memory, u32 address) const;
|
||||||
void ReadFromMem(u32 address);
|
void ReadFromMem(const Memory::MemoryManager& memory, u32 address);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Data layout of the network configuration file (/shared2/sys/net/02/config.dat)
|
// Data layout of the network configuration file (/shared2/sys/net/02/config.dat)
|
||||||
|
|
Loading…
Reference in New Issue