mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-31 14:35:19 +00:00
sceNetShutdown,sceNetSocket,sceNetSocketAbort,sceNetSocketClose
This commit is contained in:
parent
e5317f09c7
commit
244c6f0079
@ -1347,24 +1347,172 @@ int PS4_SYSV_ABI sceNetShowRouteWithMemory() {
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceNetShutdown() {
|
||||
LOG_ERROR(Lib_Net, "(STUBBED) called");
|
||||
return ORBIS_OK;
|
||||
int PS4_SYSV_ABI sceNetShutdown(OrbisNetId s, int how) {
|
||||
if (!g_isNetInitialized) {
|
||||
return ORBIS_NET_ERROR_ENOTINIT;
|
||||
}
|
||||
int result;
|
||||
int err;
|
||||
int positiveErr;
|
||||
|
||||
do {
|
||||
result = sys_shutdown(s, how);
|
||||
|
||||
if (result >= 0) {
|
||||
return result; // Success
|
||||
}
|
||||
|
||||
err = *Libraries::Kernel::__Error(); // Standard errno
|
||||
|
||||
// Convert to positive error for comparison
|
||||
int positiveErr = (err < 0) ? -err : err;
|
||||
|
||||
if ((positiveErr & 0xfff0000) != 0) {
|
||||
// Unknown/fatal error range
|
||||
*sceNetErrnoLoc() = ORBIS_NET_ERETURN;
|
||||
return -positiveErr;
|
||||
}
|
||||
|
||||
// Retry if interrupted
|
||||
} while (positiveErr == ORBIS_NET_EINTR);
|
||||
|
||||
if (positiveErr == ORBIS_NET_EADDRINUSE) {
|
||||
result = -ORBIS_NET_EBADF;
|
||||
} else if (positiveErr == ORBIS_NET_EALREADY) {
|
||||
result = -ORBIS_NET_EINTR;
|
||||
} else {
|
||||
result = -positiveErr;
|
||||
}
|
||||
|
||||
*sceNetErrnoLoc() = -result;
|
||||
|
||||
return (-result) | ORBIS_NET_ERROR_BASE; // Convert to official ORBIS_NET_ERROR code
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceNetSocket(const char* name, int family, int type, int protocol) {
|
||||
LOG_ERROR(Lib_Net, "(STUBBED) called");
|
||||
return ORBIS_OK;
|
||||
OrbisNetId PS4_SYSV_ABI sceNetSocket(const char* name, int family, int type, int protocol) {
|
||||
if (!g_isNetInitialized) {
|
||||
return ORBIS_NET_ERROR_ENOTINIT;
|
||||
}
|
||||
int result;
|
||||
int err;
|
||||
int positiveErr;
|
||||
|
||||
do {
|
||||
result = sys_socketex(name, family, type, protocol);
|
||||
|
||||
if (result >= 0) {
|
||||
return result; // Success
|
||||
}
|
||||
|
||||
err = *Libraries::Kernel::__Error(); // Standard errno
|
||||
|
||||
// Convert to positive error for comparison
|
||||
int positiveErr = (err < 0) ? -err : err;
|
||||
|
||||
if ((positiveErr & 0xfff0000) != 0) {
|
||||
// Unknown/fatal error range
|
||||
*sceNetErrnoLoc() = ORBIS_NET_ERETURN;
|
||||
return -positiveErr;
|
||||
}
|
||||
|
||||
// Retry if interrupted
|
||||
} while (positiveErr == ORBIS_NET_EINTR);
|
||||
|
||||
if (positiveErr == ORBIS_NET_EADDRINUSE) {
|
||||
result = -ORBIS_NET_EBADF;
|
||||
} else if (positiveErr == ORBIS_NET_EALREADY) {
|
||||
result = -ORBIS_NET_EINTR;
|
||||
} else {
|
||||
result = -positiveErr;
|
||||
}
|
||||
|
||||
*sceNetErrnoLoc() = -result;
|
||||
|
||||
return (-result) | ORBIS_NET_ERROR_BASE; // Convert to official ORBIS_NET_ERROR code
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceNetSocketAbort() {
|
||||
LOG_ERROR(Lib_Net, "(STUBBED) called");
|
||||
return ORBIS_OK;
|
||||
int PS4_SYSV_ABI sceNetSocketAbort(OrbisNetId s, int flags) {
|
||||
if (!g_isNetInitialized) {
|
||||
return ORBIS_NET_ERROR_ENOTINIT;
|
||||
}
|
||||
int result;
|
||||
int err;
|
||||
int positiveErr;
|
||||
|
||||
do {
|
||||
result = sys_netabort(s, flags);
|
||||
|
||||
if (result >= 0) {
|
||||
return result; // Success
|
||||
}
|
||||
|
||||
err = *Libraries::Kernel::__Error(); // Standard errno
|
||||
|
||||
// Convert to positive error for comparison
|
||||
int positiveErr = (err < 0) ? -err : err;
|
||||
|
||||
if ((positiveErr & 0xfff0000) != 0) {
|
||||
// Unknown/fatal error range
|
||||
*sceNetErrnoLoc() = ORBIS_NET_ERETURN;
|
||||
return -positiveErr;
|
||||
}
|
||||
|
||||
// Retry if interrupted
|
||||
} while (positiveErr == ORBIS_NET_EINTR);
|
||||
|
||||
if (positiveErr == ORBIS_NET_EADDRINUSE) {
|
||||
result = -ORBIS_NET_EBADF;
|
||||
} else if (positiveErr == ORBIS_NET_EALREADY) {
|
||||
result = -ORBIS_NET_EINTR;
|
||||
} else {
|
||||
result = -positiveErr;
|
||||
}
|
||||
|
||||
*sceNetErrnoLoc() = -result;
|
||||
|
||||
return (-result) | ORBIS_NET_ERROR_BASE; // Convert to official ORBIS_NET_ERROR code
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceNetSocketClose() {
|
||||
LOG_ERROR(Lib_Net, "(STUBBED) called");
|
||||
return ORBIS_OK;
|
||||
int PS4_SYSV_ABI sceNetSocketClose(OrbisNetId s) {
|
||||
if (!g_isNetInitialized) {
|
||||
return ORBIS_NET_ERROR_ENOTINIT;
|
||||
}
|
||||
int result;
|
||||
int err;
|
||||
int positiveErr;
|
||||
|
||||
do {
|
||||
result = sys_socketclose(s);
|
||||
|
||||
if (result >= 0) {
|
||||
return result; // Success
|
||||
}
|
||||
|
||||
err = *Libraries::Kernel::__Error(); // Standard errno
|
||||
|
||||
// Convert to positive error for comparison
|
||||
int positiveErr = (err < 0) ? -err : err;
|
||||
|
||||
if ((positiveErr & 0xfff0000) != 0) {
|
||||
// Unknown/fatal error range
|
||||
*sceNetErrnoLoc() = ORBIS_NET_ERETURN;
|
||||
return -positiveErr;
|
||||
}
|
||||
|
||||
// Retry if interrupted
|
||||
} while (positiveErr == ORBIS_NET_EINTR);
|
||||
|
||||
if (positiveErr == ORBIS_NET_EADDRINUSE) {
|
||||
result = -ORBIS_NET_EBADF;
|
||||
} else if (positiveErr == ORBIS_NET_EALREADY) {
|
||||
result = -ORBIS_NET_EINTR;
|
||||
} else {
|
||||
result = -positiveErr;
|
||||
}
|
||||
|
||||
*sceNetErrnoLoc() = -result;
|
||||
|
||||
return (-result) | ORBIS_NET_ERROR_BASE; // Convert to official ORBIS_NET_ERROR code
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceNetSyncCreate() {
|
||||
|
@ -231,10 +231,10 @@ int PS4_SYSV_ABI sceNetShowRoute6ForBuffer();
|
||||
int PS4_SYSV_ABI sceNetShowRoute6WithMemory();
|
||||
int PS4_SYSV_ABI sceNetShowRouteForBuffer();
|
||||
int PS4_SYSV_ABI sceNetShowRouteWithMemory();
|
||||
int PS4_SYSV_ABI sceNetShutdown();
|
||||
int PS4_SYSV_ABI sceNetSocket(const char* name, int family, int type, int protocol);
|
||||
int PS4_SYSV_ABI sceNetSocketAbort();
|
||||
int PS4_SYSV_ABI sceNetSocketClose();
|
||||
int PS4_SYSV_ABI sceNetShutdown(OrbisNetId s, int how);
|
||||
OrbisNetId PS4_SYSV_ABI sceNetSocket(const char* name, int family, int type, int protocol);
|
||||
int PS4_SYSV_ABI sceNetSocketAbort(OrbisNetId s, int flags);
|
||||
int PS4_SYSV_ABI sceNetSocketClose(OrbisNetId s);
|
||||
int PS4_SYSV_ABI sceNetSyncCreate();
|
||||
int PS4_SYSV_ABI sceNetSyncDestroy();
|
||||
int PS4_SYSV_ABI sceNetSyncGet();
|
||||
|
@ -29,4 +29,16 @@ int sys_listen(OrbisNetId s, int backlog) {
|
||||
int sys_setsockopt(OrbisNetId s, int level, int optname, const void* optval, u32 optlen) {
|
||||
return -1;
|
||||
}
|
||||
int sys_shutdown(OrbisNetId s, int how) {
|
||||
return -1;
|
||||
}
|
||||
int sys_socketex(const char* name, int family, int type, int protocol) {
|
||||
return -1;
|
||||
}
|
||||
int sys_netabort(OrbisNetId s, int flags) {
|
||||
return -1;
|
||||
}
|
||||
int sys_socketclose(OrbisNetId s) {
|
||||
return -1;
|
||||
}
|
||||
} // namespace Libraries::Net
|
@ -16,4 +16,8 @@ int sys_getsockname(OrbisNetId s, const OrbisNetSockaddr* addr, u32* paddrlen);
|
||||
int sys_getsockopt(OrbisNetId s, int level, int optname, void* optval, u32* optlen);
|
||||
int sys_listen(OrbisNetId s, int backlog);
|
||||
int sys_setsockopt(OrbisNetId s, int level, int optname, const void* optval, u32 optlen);
|
||||
int sys_shutdown(OrbisNetId s, int how);
|
||||
int sys_socketex(const char* name, int family, int type, int protocol);
|
||||
int sys_netabort(OrbisNetId s, int flags);
|
||||
int sys_socketclose(OrbisNetId s);
|
||||
} // namespace Libraries::Net
|
Loading…
Reference in New Issue
Block a user