mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 16:32:39 +00:00
improved net_errno
This commit is contained in:
parent
ab689aa334
commit
8e0078b467
@ -25,6 +25,12 @@ namespace Libraries::Net {
|
||||
|
||||
static thread_local int32_t net_errno = 0;
|
||||
|
||||
int setErrnoFromOrbis(int code) {
|
||||
if (code != 0) {
|
||||
net_errno = code + ORBIS_NET_ERROR_EPERM + 1;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
int PS4_SYSV_ABI in6addr_any() {
|
||||
LOG_ERROR(Lib_Net, "(STUBBED) called");
|
||||
return ORBIS_OK;
|
||||
@ -146,7 +152,7 @@ int PS4_SYSV_ABI sceNetBind(OrbisNetId s, const OrbisNetSockaddr* addr, u32 addr
|
||||
LOG_ERROR(Lib_Net, "socket id is invalid = {}", s);
|
||||
return ORBIS_NET_ERROR_EBADF;
|
||||
}
|
||||
return sock->Bind(addr, addrlen);
|
||||
return setErrnoFromOrbis(sock->Bind(addr, addrlen));
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceNetClearDnsCache() {
|
||||
@ -897,7 +903,7 @@ int PS4_SYSV_ABI sceNetListen(OrbisNetId s, int backlog) {
|
||||
LOG_ERROR(Lib_Net, "socket id is invalid = {}", s);
|
||||
return ORBIS_NET_ERROR_EBADF;
|
||||
}
|
||||
return sock->Listen(backlog);
|
||||
return setErrnoFromOrbis(sock->Listen(backlog));
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceNetMemoryAllocate() {
|
||||
@ -957,7 +963,7 @@ int PS4_SYSV_ABI sceNetRecvfrom(OrbisNetId s, void* buf, size_t len, int flags,
|
||||
LOG_ERROR(Lib_Net, "socket id is invalid = {}", s);
|
||||
return ORBIS_NET_ERROR_EBADF;
|
||||
}
|
||||
return sock->ReceivePacket(buf, len, flags, addr, paddrlen);
|
||||
return setErrnoFromOrbis(sock->ReceivePacket(buf, len, flags, addr, paddrlen));
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceNetRecvmsg() {
|
||||
@ -1062,7 +1068,7 @@ int PS4_SYSV_ABI sceNetSendto(OrbisNetId s, const void* buf, u32 len, int flags,
|
||||
LOG_ERROR(Lib_Net, "socket id is invalid = {}", s);
|
||||
return ORBIS_NET_ERROR_EBADF;
|
||||
}
|
||||
return sock->SendPacket(buf, len, flags, addr, addrlen);
|
||||
return setErrnoFromOrbis(sock->SendPacket(buf, len, flags, addr, addrlen));
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceNetSetDns6Info() {
|
||||
@ -1095,7 +1101,7 @@ int PS4_SYSV_ABI sceNetSetsockopt(OrbisNetId s, int level, int optname, const vo
|
||||
LOG_ERROR(Lib_Net, "socket id is invalid = {}", s);
|
||||
return ORBIS_NET_ERROR_EBADF;
|
||||
}
|
||||
return sock->SetSocketOptions(level, optname, optval, optlen);
|
||||
return setErrnoFromOrbis(sock->SetSocketOptions(level, optname, optval, optlen));
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceNetShowIfconfig() {
|
||||
|
@ -11,6 +11,7 @@ constexpr int ORBIS_NET_EEXIST = 17;
|
||||
constexpr int ORBIS_NET_EINVAL = 22;
|
||||
|
||||
// error codes
|
||||
constexpr int ORBIS_NET_ERROR_EPERM = 0x80410101;
|
||||
constexpr int ORBIS_NET_ERROR_ENOENT = 0x80410102;
|
||||
constexpr int ORBIS_NET_ERROR_EBADF = 0x80410109;
|
||||
constexpr int ORBIS_NET_ERROR_EFAULT = 0x8041010e;
|
||||
|
Loading…
Reference in New Issue
Block a user