Skip to content
Permalink
Browse files
Merge pull request #8753 from sepalani/network-tab
Debugger: Add a Network widget
  • Loading branch information
leoetlino committed Apr 27, 2020
2 parents 88ae4c7 + 5e33cd4 commit 7a77abb
Show file tree
Hide file tree
Showing 14 changed files with 406 additions and 20 deletions.
@@ -23,7 +23,7 @@

namespace IOS::HLE::Device
{
WII_SSL NetSSL::_SSL[NET_SSL_MAXINSTANCES];
WII_SSL NetSSL::_SSL[IOS::HLE::NET_SSL_MAXINSTANCES];

static constexpr mbedtls_x509_crt_profile mbedtls_x509_crt_profile_wii = {
/* Hashes from SHA-1 and above */
@@ -247,7 +247,7 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
case IOCTLV_NET_SSL_SHUTDOWN:
{
int sslID = Memory::Read_U32(BufferOut) - 1;
if (SSLID_VALID(sslID))
if (IsSSLIDValid(sslID))
{
WII_SSL* ssl = &_SSL[sslID];

@@ -292,7 +292,7 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
BufferOutSize, BufferOut2, BufferOutSize2, BufferOut3, BufferOutSize3);

int sslID = Memory::Read_U32(BufferOut) - 1;
if (SSLID_VALID(sslID))
if (IsSSLIDValid(sslID))
{
WII_SSL* ssl = &_SSL[sslID];
int ret =
@@ -333,7 +333,7 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
BufferOutSize, BufferOut2, BufferOutSize2, BufferOut3, BufferOutSize3);

int sslID = Memory::Read_U32(BufferOut) - 1;
if (SSLID_VALID(sslID))
if (IsSSLIDValid(sslID))
{
WII_SSL* ssl = &_SSL[sslID];
const std::string cert_base_path = File::GetUserPath(D_SESSION_WIIROOT_IDX);
@@ -380,7 +380,7 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
BufferOutSize, BufferOut2, BufferOutSize2, BufferOut3, BufferOutSize3);

int sslID = Memory::Read_U32(BufferOut) - 1;
if (SSLID_VALID(sslID))
if (IsSSLIDValid(sslID))
{
WII_SSL* ssl = &_SSL[sslID];
mbedtls_x509_crt_free(&ssl->clicert);
@@ -399,7 +399,7 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
case IOCTLV_NET_SSL_SETBUILTINROOTCA:
{
int sslID = Memory::Read_U32(BufferOut) - 1;
if (SSLID_VALID(sslID))
if (IsSSLIDValid(sslID))
{
WII_SSL* ssl = &_SSL[sslID];
const std::string cert_base_path = File::GetUserPath(D_SESSION_WIIROOT_IDX);
@@ -437,7 +437,7 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
case IOCTLV_NET_SSL_CONNECT:
{
int sslID = Memory::Read_U32(BufferOut) - 1;
if (SSLID_VALID(sslID))
if (IsSSLIDValid(sslID))
{
WII_SSL* ssl = &_SSL[sslID];
mbedtls_ssl_setup(&ssl->ctx, &ssl->config);
@@ -464,7 +464,7 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
case IOCTLV_NET_SSL_DOHANDSHAKE:
{
int sslID = Memory::Read_U32(BufferOut) - 1;
if (SSLID_VALID(sslID))
if (IsSSLIDValid(sslID))
{
WiiSockMan& sm = WiiSockMan::GetInstance();
sm.DoSock(_SSL[sslID].sockfd, request, IOCTLV_NET_SSL_DOHANDSHAKE);
@@ -479,7 +479,7 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
case IOCTLV_NET_SSL_WRITE:
{
int sslID = Memory::Read_U32(BufferOut) - 1;
if (SSLID_VALID(sslID))
if (IsSSLIDValid(sslID))
{
WiiSockMan& sm = WiiSockMan::GetInstance();
sm.DoSock(_SSL[sslID].sockfd, request, IOCTLV_NET_SSL_WRITE);
@@ -503,7 +503,7 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
{
int ret = 0;
int sslID = Memory::Read_U32(BufferOut) - 1;
if (SSLID_VALID(sslID))
if (IsSSLIDValid(sslID))
{
WiiSockMan& sm = WiiSockMan::GetInstance();
sm.DoSock(_SSL[sslID].sockfd, request, IOCTLV_NET_SSL_READ);
@@ -526,7 +526,7 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
case IOCTLV_NET_SSL_SETROOTCADEFAULT:
{
int sslID = Memory::Read_U32(BufferOut) - 1;
if (SSLID_VALID(sslID))
if (IsSSLIDValid(sslID))
{
WriteReturnValue(SSL_OK, BufferIn);
}
@@ -554,7 +554,7 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
BufferOutSize, BufferOut2, BufferOutSize2, BufferOut3, BufferOutSize3);

int sslID = Memory::Read_U32(BufferOut) - 1;
if (SSLID_VALID(sslID))
if (IsSSLIDValid(sslID))
{
WriteReturnValue(SSL_OK, BufferIn);
}
@@ -24,11 +24,7 @@

namespace IOS::HLE
{
#define NET_SSL_MAXINSTANCES 4

// TODO: remove this macro.
#define SSLID_VALID(x) \
(x >= 0 && x < NET_SSL_MAXINSTANCES && ::IOS::HLE::Device::NetSSL::_SSL[x].active)
constexpr int NET_SSL_MAXINSTANCES = 4;

enum ssl_err_t : s32
{
@@ -103,5 +99,10 @@ class NetSSL : public Device
private:
bool m_cert_error_shown = false;
};

constexpr bool IsSSLIDValid(int id)
{
return (id >= 0 && id < NET_SSL_MAXINSTANCES && IOS::HLE::Device::NetSSL::_SSL[id].active);
}
} // namespace Device
} // namespace IOS::HLE
@@ -33,8 +33,6 @@

namespace IOS::HLE
{
constexpr int WII_SOCKET_FD_MAX = 24;

char* WiiSockMan::DecodeError(s32 ErrorCode)
{
#ifdef _WIN32
@@ -325,7 +323,7 @@ void WiiSocket::Update(bool read, bool write, bool except)
if (it->is_ssl)
{
int sslID = Memory::Read_U32(BufferOut) - 1;
if (SSLID_VALID(sslID))
if (IOS::HLE::Device::IsSSLIDValid(sslID))
{
switch (it->ssl_type)
{
@@ -57,6 +57,8 @@ typedef struct pollfd pollfd_t;

namespace IOS::HLE
{
constexpr int WII_SOCKET_FD_MAX = 24;

enum
{
SO_MSG_OOB = 0x01,
@@ -176,6 +176,8 @@ add_executable(dolphin-emu
Debugger/MemoryViewWidget.h
Debugger/MemoryWidget.cpp
Debugger/MemoryWidget.h
Debugger/NetworkWidget.cpp
Debugger/NetworkWidget.h
Debugger/NewBreakpointDialog.cpp
Debugger/NewBreakpointDialog.h
Debugger/PatchInstructionDialog.cpp

0 comments on commit 7a77abb

Please sign in to comment.