Core/IOS/Network/Socket: Avoid global system accessor.

This commit is contained in:
Admiral H. Curtiss 2024-01-12 07:22:15 +01:00
parent 8760aca8ec
commit 4a362ddd33
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
2 changed files with 5 additions and 3 deletions

View File

@ -252,7 +252,7 @@ s32 WiiSocket::FCntl(u32 cmd, u32 arg)
void WiiSocket::Update(bool read, bool write, bool except) void WiiSocket::Update(bool read, bool write, bool except)
{ {
auto& system = Core::System::GetInstance(); auto& system = m_socket_manager.m_ios.GetSystem();
auto& memory = system.GetMemory(); auto& memory = system.GetMemory();
auto it = pending_sockops.begin(); auto it = pending_sockops.begin();
@ -878,7 +878,7 @@ s32 WiiSockMan::AddSocket(s32 fd, bool is_rw)
WiiSocket& sock = WiiSockets.emplace(wii_fd, *this).first->second; WiiSocket& sock = WiiSockets.emplace(wii_fd, *this).first->second;
sock.SetFd(fd); sock.SetFd(fd);
sock.SetWiiFd(wii_fd); sock.SetWiiFd(wii_fd);
Core::System::GetInstance().GetPowerPC().GetDebugInterface().NetworkLogger()->OnNewSocket(fd); m_ios.GetSystem().GetPowerPC().GetDebugInterface().NetworkLogger()->OnNewSocket(fd);
#ifdef __APPLE__ #ifdef __APPLE__
int opt_no_sigpipe = 1; int opt_no_sigpipe = 1;
@ -1050,7 +1050,7 @@ void WiiSockMan::UpdatePollCommands()
pcmd.timeout = std::max<s64>(0, pcmd.timeout - elapsed); pcmd.timeout = std::max<s64>(0, pcmd.timeout - elapsed);
} }
auto& system = Core::System::GetInstance(); auto& system = m_ios.GetSystem();
auto& memory = system.GetMemory(); auto& memory = system.GetMemory();
std::erase_if(pending_polls, [&system, &memory, this](PollCommand& pcmd) { std::erase_if(pending_polls, [&system, &memory, this](PollCommand& pcmd) {

View File

@ -305,6 +305,8 @@ public:
private: private:
void UpdatePollCommands(); void UpdatePollCommands();
friend class WiiSocket;
EmulationKernel& m_ios; EmulationKernel& m_ios;
std::unordered_map<s32, WiiSocket> WiiSockets; std::unordered_map<s32, WiiSocket> WiiSockets;
s32 errno_last = 0; s32 errno_last = 0;