Skip to content

sceNetInet socket remap #19827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Track non-blocking state
  • Loading branch information
hrydgard committed Jan 8, 2025
commit c9c594462f41cef722851f8d9d1a15ed1f5628fc
1 change: 1 addition & 0 deletions Core/HLE/SocketManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ InetSocket *SocketManager::CreateSocket(int *index, SocketState state, int domai
inetSock->domain = domain;
inetSock->type = type;
inetSock->protocol = protocol;
inetSock->nonblocking = false;
return inetSock;
}
}
Expand Down
1 change: 1 addition & 0 deletions Core/HLE/SocketManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ struct InetSocket {
int domain;
int type;
int protocol;
bool nonblocking;
};

// Only use this for sockets whose ID are exposed to the game.
Expand Down
2 changes: 2 additions & 0 deletions Core/HLE/proAdhoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ int actionAfterMatchingMipsCall;
// Broadcast MAC
uint8_t broadcastMAC[ETHER_ADDR_LEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };

// NOTE: This does not need to be managed by the socket manager - not exposed to the game.
std::atomic<int> metasocket((int)INVALID_SOCKET);

SceNetAdhocctlParameter parameter;
SceNetAdhocctlAdhocId product_code;
std::thread friendFinderThread;
Expand Down
6 changes: 4 additions & 2 deletions Core/HLE/sceNetInet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,11 @@ static int sceNetInetSetsockopt(int socket, int level, int optname, u32 optvalPt
u32_le* optval = (u32_le*)Memory::GetPointer(optvalPtr);
DEBUG_LOG(Log::sceNet, "SockOpt: Level = %s, OptName = %s, OptValue = %d", inetSockoptLevel2str(level).c_str(), inetSockoptName2str(optname, level).c_str(), *optval);
timeval tval{};
// TODO: Ignoring SO_NBIO/SO_NONBLOCK flag if we always use non-bloking mode (ie. simulated blocking mode)
// TODO: Ignoring SO_NBIO/SO_NONBLOCK flag if we always use non-blocking mode (ie. simulated blocking mode)
if (level == PSP_NET_INET_SOL_SOCKET && optname == PSP_NET_INET_SO_NBIO) {
//memcpy(&sock->nonblocking, (int*)optval, std::min(sizeof(sock->nonblocking), optlen));
int nonblocking;
memcpy(&nonblocking, (int*)optval, sizeof(int));
inetSock->nonblocking = nonblocking;
return hleLogSuccessI(Log::sceNet, 0);
}
// FIXME: Should we ignore SO_BROADCAST flag since we are using fake broadcast (ie. only broadcast to friends),
Expand Down