diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index 47f2abe044..a473532ca9 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -82,6 +82,7 @@ void SConfig::SaveSettings() SaveInputSettings(ini); SaveFifoPlayerSettings(ini); SaveAnalyticsSettings(ini); + SaveNetworkSettings(ini); ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX)); m_SYSCONF->Save(); @@ -312,6 +313,14 @@ void SConfig::SaveFifoPlayerSettings(IniFile& ini) fifoplayer->Set("LoopReplay", bLoopFifoReplay); } +void SConfig::SaveNetworkSettings(IniFile& ini) +{ + IniFile::Section* network = ini.GetOrCreateSection("Network"); + + network->Set("SSLDumpRead", m_SSLDumpRead); + network->Set("SSLDumpWrite", m_SSLDumpWrite); +} + void SConfig::SaveAnalyticsSettings(IniFile& ini) { IniFile::Section* analytics = ini.GetOrCreateSection("Analytics"); @@ -336,6 +345,7 @@ void SConfig::LoadSettings() LoadDSPSettings(ini); LoadInputSettings(ini); LoadFifoPlayerSettings(ini); + LoadNetworkSettings(ini); LoadAnalyticsSettings(ini); m_SYSCONF = new SysConf(); @@ -602,6 +612,14 @@ void SConfig::LoadFifoPlayerSettings(IniFile& ini) fifoplayer->Get("LoopReplay", &bLoopFifoReplay, true); } +void SConfig::LoadNetworkSettings(IniFile& ini) +{ + IniFile::Section* network = ini.GetOrCreateSection("Network"); + + network->Get("SSLDumpRead", &m_SSLDumpRead, false); + network->Get("SSLDumpWrite", &m_SSLDumpWrite, false); +} + void SConfig::LoadAnalyticsSettings(IniFile& ini) { IniFile::Section* analytics = ini.GetOrCreateSection("Analytics"); diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h index a05e93c287..642758e00c 100644 --- a/Source/Core/Core/ConfigManager.h +++ b/Source/Core/Core/ConfigManager.h @@ -273,6 +273,10 @@ struct SConfig : NonCopyable bool m_AdapterRumble[4]; bool m_AdapterKonga[4]; + // Network settings + bool m_SSLDumpRead; + bool m_SSLDumpWrite; + SysConf* m_SYSCONF; // Save settings @@ -299,6 +303,7 @@ private: void SaveInputSettings(IniFile& ini); void SaveMovieSettings(IniFile& ini); void SaveFifoPlayerSettings(IniFile& ini); + void SaveNetworkSettings(IniFile& ini); void SaveAnalyticsSettings(IniFile& ini); void LoadGeneralSettings(IniFile& ini); @@ -310,6 +315,7 @@ private: void LoadInputSettings(IniFile& ini); void LoadMovieSettings(IniFile& ini); void LoadFifoPlayerSettings(IniFile& ini); + void LoadNetworkSettings(IniFile& ini); void LoadAnalyticsSettings(IniFile& ini); static SConfig* m_Instance; diff --git a/Source/Core/Core/IPC_HLE/WII_Socket.cpp b/Source/Core/Core/IPC_HLE/WII_Socket.cpp index 1608316061..229073bbfd 100644 --- a/Source/Core/Core/IPC_HLE/WII_Socket.cpp +++ b/Source/Core/Core/IPC_HLE/WII_Socket.cpp @@ -8,6 +8,7 @@ #endif #include "Common/FileUtil.h" +#include "Core/ConfigManager.h" #include "Core/Core.h" #include "Core/IPC_HLE/WII_IPC_HLE.h" #include "Core/IPC_HLE/WII_IPC_HLE_Device.h" @@ -344,10 +345,10 @@ void WiiSocket::Update(bool read, bool write, bool except) int ret = mbedtls_ssl_write(&CWII_IPC_HLE_Device_net_ssl::_SSL[sslID].ctx, Memory::GetPointer(BufferOut2), BufferOutSize2); -#ifdef DEBUG_SSL - File::IOFile("ssl_write.bin", "ab") - .WriteBytes(Memory::GetPointer(BufferOut2), BufferOutSize2); -#endif + if (SConfig::GetInstance().m_SSLDumpWrite && ret > 0) + File::IOFile("ssl_write.bin", "ab") + .WriteBytes(Memory::GetPointer(BufferOut2), ret); + if (ret >= 0) { // Return bytes written or SSL_ERR_ZERO if none @@ -378,12 +379,11 @@ void WiiSocket::Update(bool read, bool write, bool except) { int ret = mbedtls_ssl_read(&CWII_IPC_HLE_Device_net_ssl::_SSL[sslID].ctx, Memory::GetPointer(BufferIn2), BufferInSize2); -#ifdef DEBUG_SSL - if (ret > 0) - { - File::IOFile("ssl_read.bin", "ab").WriteBytes(Memory::GetPointer(BufferIn2), ret); - } -#endif + + if (SConfig::GetInstance().m_SSLDumpRead && ret > 0) + File::IOFile("ssl_read.bin", "ab") + .WriteBytes(Memory::GetPointer(BufferIn2), ret); + if (ret >= 0) { // Return bytes read or SSL_ERR_ZERO if none