mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-16 03:38:38 +12:00
sys_net: redirects 0.0.0.0 packets on windows
This commit is contained in:
parent
43302f937c
commit
0e625e193e
1 changed files with 15 additions and 0 deletions
|
@ -1603,6 +1603,13 @@ error_code sys_net_bnet_connect(ppu_thread& ppu, s32 s, vm::ptr<sys_net_sockaddr
|
|||
std::memcpy(addr_buf.buf, addr.get_ptr(), 16);
|
||||
name.sin_port = std::bit_cast<u16>(psa_in->sin_port);
|
||||
name.sin_addr.s_addr = std::bit_cast<u32>(psa_in->sin_addr);
|
||||
#ifdef _WIN32
|
||||
// Windows doesn't support sending packets to 0.0.0.0 but it works on unixes, send to 127.0.0.1 instead
|
||||
if (name.sin_addr.s_addr == 0x00000000)
|
||||
{
|
||||
name.sin_addr.s_addr = 0x0100007F;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2608,6 +2615,14 @@ error_code sys_net_bnet_sendto(ppu_thread& ppu, s32 s, vm::cptr<void> buf, u32 l
|
|||
name.sin_port = std::bit_cast<u16>(psa_in->sin_port);
|
||||
name.sin_addr.s_addr = std::bit_cast<u32>(psa_in->sin_addr);
|
||||
|
||||
#ifdef _WIN32
|
||||
// Windows doesn't support sending packets to 0.0.0.0 but it works on unixes, send to 127.0.0.1 instead
|
||||
if (name.sin_addr.s_addr == 0x00000000)
|
||||
{
|
||||
name.sin_addr.s_addr = 0x0100007F;
|
||||
}
|
||||
#endif
|
||||
|
||||
char ip_str[16];
|
||||
inet_ntop(AF_INET, &name.sin_addr, ip_str, sizeof(ip_str));
|
||||
sys_net.trace("Sending to %s:%d", ip_str, psa_in->sin_port);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue