mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Add some socket data in the debugger
This commit is contained in:
1 parent
748c4e4a49
commit
e4de9dbfb5
5 files changed
+18
-3
No files matched your search
@@ -27,6 +27,7 @@ InetSocket *SocketManager::CreateSocket(int *index, int *returned_errno, SocketS
|
||||
if (inetSockets_[i].state == SocketState::Unused) {
|
||||
*index = i;
|
||||
InetSocket *inetSock = inetSockets_ + i;
|
||||
*inetSock = {}; // Reset to default.
|
||||
inetSock->sock = hostSock;
|
||||
inetSock->state = state;
|
||||
inetSock->domain = domain;
|
||||
|
||||
@@ -20,6 +20,9 @@ struct InetSocket {
|
||||
int type;
|
||||
int protocol;
|
||||
bool nonblocking;
|
||||
// Metadata for debug use only.
|
||||
std::string addr;
|
||||
int port;
|
||||
};
|
||||
|
||||
// Only use this for sockets whose ID are exposed to the game.
|
||||
|
||||
@@ -618,7 +618,12 @@ static int sceNetInetBind(int socket, u32 namePtr, int namelen) {
|
||||
}
|
||||
// TODO: Make use Port Offset only for PPSSPP to PPSSPP communications (ie. IP addresses available in the group/friendlist), otherwise should be considered as Online Service thus should use the port as is.
|
||||
//saddr.in.sin_port = htons(ntohs(saddr.in.sin_port) + portOffset);
|
||||
|
||||
DEBUG_LOG(Log::sceNet, "Bind: Family = %s, Address = %s, Port = %d", inetSocketDomain2str(saddr.addr.sa_family).c_str(), ip2str(saddr.in.sin_addr).c_str(), ntohs(saddr.in.sin_port));
|
||||
// Update socket debug metadata
|
||||
inetSock->addr = ip2str(saddr.in.sin_addr);
|
||||
inetSock->port = ntohs(saddr.in.sin_port);
|
||||
|
||||
changeBlockingMode(inetSock->sock, 0);
|
||||
int retval = bind(inetSock->sock, (struct sockaddr*)&saddr, len);
|
||||
if (retval < 0) {
|
||||
|
||||
@@ -732,6 +732,7 @@ static int sceUtilityCheckNetParam(int id)
|
||||
* @param data - parameter data
|
||||
* @return 0 on success
|
||||
*/
|
||||
// Let's figure out what games use this.
|
||||
static int sceUtilityGetNetParam(int id, int param, u32 dataAddr) {
|
||||
if (id < 0 || id > 24) {
|
||||
return hleLogWarning(Log::sceUtility, SCE_ERROR_NETPARAM_BAD_NETCONF, "invalid id=%d", id);
|
||||
|
||||
@@ -620,14 +620,16 @@ static void DrawSockets(ImConfig &cfg) {
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
if (ImGui::BeginTable("sock", 7, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH | ImGuiTableFlags_Resizable)) {
|
||||
if (ImGui::BeginTable("sock", 9, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH | ImGuiTableFlags_Resizable)) {
|
||||
ImGui::TableSetupColumn("ID", ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableSetupColumn("Host", ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableSetupColumn("Port", ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableSetupColumn("IP address", ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableSetupColumn("Non-blocking", ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableSetupColumn("Created by", ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableSetupColumn("Domain", ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableSetupColumn("Type", ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableSetupColumn("Protocol", ImGuiTableColumnFlags_WidthStretch);
|
||||
ImGui::TableSetupColumn("Host handle", ImGuiTableColumnFlags_WidthFixed);
|
||||
|
||||
ImGui::TableHeadersRow();
|
||||
|
||||
@@ -641,7 +643,9 @@ static void DrawSockets(ImConfig &cfg) {
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%d", i);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%d", (int)inetSocket->sock);
|
||||
ImGui::Text("%d", inetSocket->port);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted(inetSocket->addr.c_str());
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted(inetSocket->nonblocking ? "Non-blocking" : "Blocking");
|
||||
ImGui::TableNextColumn();
|
||||
@@ -656,6 +660,7 @@ static void DrawSockets(ImConfig &cfg) {
|
||||
str = inetSocketProto2str(inetSocket->protocol);
|
||||
ImGui::TextUnformatted(str.c_str());
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%d", (int)inetSocket->sock);
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
|
||||
Reference in new issue
Block a user