Replaced DEBUG_SSL with INI options

This commit is contained in:
Sepalani 2015-06-16 21:48:09 +02:00
parent 55ec1b69fc
commit 170d0588a7
3 changed files with 34 additions and 10 deletions

View File

@ -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");

View File

@ -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;

View File

@ -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