[Project64] Update logging system to use module and severity

This commit is contained in:
zilmar 2015-12-14 21:51:33 +11:00
parent b4a3516654
commit 95a3319735
45 changed files with 834 additions and 760 deletions

View File

@ -61,7 +61,7 @@
<ClInclude Include="stdtypes.h" /> <ClInclude Include="stdtypes.h" />
<ClInclude Include="SyncEvent.h" /> <ClInclude Include="SyncEvent.h" />
<ClInclude Include="Trace.h" /> <ClInclude Include="Trace.h" />
<ClInclude Include="TraceDefs.h" /> <ClInclude Include="TraceModulesCommon.h" />
<ClInclude Include="Util.h" /> <ClInclude Include="Util.h" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -88,10 +88,10 @@
<ClInclude Include="Trace.h"> <ClInclude Include="Trace.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="TraceDefs.h"> <ClInclude Include="Util.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Util.h"> <ClInclude Include="TraceModulesCommon.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>

View File

@ -1,7 +1,10 @@
#include "stdafx.h" #include "stdafx.h"
#include <TChar.H>
BOOL TraceClosed = FALSE; typedef std::map<uint32_t, stdstr> ModuleNameMap;
uint32_t * g_ModuleLogLevel = NULL;
static bool g_TraceClosed = false;
static ModuleNameMap g_ModuleNames;
class CTraceLog class CTraceLog
{ {
@ -14,13 +17,65 @@ public:
} }
~CTraceLog() { CloseTrace(); } ~CTraceLog() { CloseTrace(); }
void TraceMessage(uint32_t module, uint8_t severity, const char * file, int line, const char * function, const char * Message);
CTraceModule * AddTraceModule(CTraceModule * TraceModule); CTraceModule * AddTraceModule(CTraceModule * TraceModule);
CTraceModule * RemoveTraceModule(CTraceModule * TraceModule); CTraceModule * RemoveTraceModule(CTraceModule * TraceModule);
void CloseTrace(void); void CloseTrace(void);
void WriteTrace(TraceType Type, LPCTSTR Message);
void WriteTraceF(TraceType Type, LPCTSTR strFormat, va_list args);
}; };
CTraceLog & GetTraceObjet(void)
{
static CTraceLog TraceLog;
return TraceLog;
}
void TraceSetModuleName(uint8_t module, const char * Name)
{
g_ModuleNames.insert(ModuleNameMap::value_type(module, Name));
}
void WriteTraceFull(uint32_t module, uint8_t severity, const char * file, int line, const char * function, const char *format, ...)
{
va_list args;
va_start(args, format);
size_t nlen = _vscprintf(format, args) + 1;
char * Message = (char *)alloca(nlen * sizeof(char));
Message[nlen - 1] = 0;
if (Message != NULL)
{
vsprintf(Message, format, args);
GetTraceObjet().TraceMessage(module, severity, file, line, function, Message);
}
va_end(args);
}
void CloseTrace(void)
{
g_TraceClosed = true;
GetTraceObjet().CloseTrace();
if (g_ModuleLogLevel)
{
delete g_ModuleLogLevel;
g_ModuleLogLevel = NULL;
}
}
void TraceSetMaxModule(uint32_t MaxModule, uint8_t DefaultSeverity)
{
if (g_ModuleLogLevel)
{
delete g_ModuleLogLevel;
g_ModuleLogLevel = NULL;
}
g_ModuleLogLevel = new uint32_t[MaxModule];
for (uint32_t i = 0; i < MaxModule; i++)
{
g_ModuleLogLevel[i] = DefaultSeverity;
}
}
CTraceModule * CTraceLog::AddTraceModule(CTraceModule * TraceModule) CTraceModule * CTraceLog::AddTraceModule(CTraceModule * TraceModule)
{ {
CGuard Guard(m_CS); CGuard Guard(m_CS);
@ -54,116 +109,22 @@ CTraceModule * CTraceLog::RemoveTraceModule(CTraceModule * TraceModule)
void CTraceLog::CloseTrace(void) void CTraceLog::CloseTrace(void)
{ {
CGuard Guard(m_CS); CGuard Guard(m_CS);
for (int i = 0; i < (int)m_Modules.size(); i++)
{
if (m_Modules[i])
delete m_Modules[i];
}
m_Modules.clear(); m_Modules.clear();
} }
void CTraceLog::WriteTraceF(TraceType Type, LPCTSTR strFormat, va_list args) void CTraceLog::TraceMessage(uint32_t module, uint8_t severity, const char * file, int line, const char * function, const char * Message)
{
const int nMaxSize = 32 * 1024;
TCHAR pBuffer[nMaxSize];
_vsntprintf(pBuffer, nMaxSize, strFormat, args);
pBuffer[nMaxSize - 1] = 0;
WriteTrace(Type, pBuffer);
}
void CTraceLog::WriteTrace(TraceType Type, LPCTSTR Message)
{ {
CGuard Guard(m_CS); CGuard Guard(m_CS);
if (Type != TraceNone) for (uint32_t i = 0, n = m_Modules.size(); i < n; i++)
{ {
bool WriteToLog = false; m_Modules[i]->Write(module, severity, file, line, function, Message);
for (int i = 0; i < (int)m_Modules.size(); i++)
{
if ((m_Modules[i]->GetTraceLevel() & Type) != 0)
{
WriteToLog = true;
break;
}
}
if (!WriteToLog) { return; }
}
if ((Type & TraceNoHeader) == 0)
{
TCHAR pBuffer[300];
int nPos = 0;
SYSTEMTIME sysTime;
::GetLocalTime(&sysTime);
nPos = _stprintf(pBuffer, _T("%04d/%02d/%02d %02d:%02d:%02d.%03d %05d: "), sysTime.wYear,
sysTime.wMonth, sysTime.wDay, sysTime.wHour, sysTime.wMinute, sysTime.wSecond, sysTime.wMilliseconds,
::GetCurrentThreadId()
);
// show the debug level
if (Type == TraceNone) { nPos += _stprintf(pBuffer + nPos, _T("%s"), _T("None : ")); }
else if ((Type & TraceError) != 0) { nPos += _stprintf(pBuffer + nPos, _T("%s"), _T("Error : ")); }
else if ((Type & TraceSettings) != 0) { nPos += _stprintf(pBuffer + nPos, _T("%s"), _T("Setting: ")); }
else if ((Type & TraceGfxPlugin) != 0) { nPos += _stprintf(pBuffer + nPos, _T("%s"), _T("Gfx : ")); }
else if ((Type & TraceDebug) != 0) { nPos += _stprintf(pBuffer + nPos, _T("%s"), _T("Debug : ")); }
else if ((Type & TraceRecompiler) != 0) { nPos += _stprintf(pBuffer + nPos, _T("%s"), _T("Recomp : ")); }
else if ((Type & TraceRSP) != 0) { nPos += _stprintf(pBuffer + nPos, _T("%s"), _T("RSP : ")); }
else if ((Type & TraceTLB) != 0) { nPos += _stprintf(pBuffer + nPos, _T("%s"), _T("TLB : ")); }
else if ((Type & TraceValidate) != 0) { nPos += _stprintf(pBuffer + nPos, _T("%s"), _T("Valid : ")); }
else if ((Type & TraceAudio) != 0) { nPos += _stprintf(pBuffer + nPos, _T("%s"), _T("Audio : ")); }
else { nPos += _stprintf(pBuffer + nPos, _T("%s"), _T("Unknown: ")); }
for (int i = 0; i < (int)m_Modules.size(); i++)
{
if ((m_Modules[i]->GetTraceLevel() & Type) != 0)
{
m_Modules[i]->Write(pBuffer, false);
}
}
}
for (int i = 0; i < (int)m_Modules.size(); i++)
{
if ((m_Modules[i]->GetTraceLevel() & Type) != 0)
{
m_Modules[i]->Write(Message, true);
}
} }
} }
CTraceLog & GetTraceObjet(void) CTraceModule * TraceAddModule(CTraceModule * TraceModule)
{ {
static CTraceLog TraceLog; if (g_TraceClosed)
return TraceLog;
}
void WriteTrace(TraceType Type, LPCTSTR Message)
{
if (TraceClosed)
{
return;
}
GetTraceObjet().WriteTrace(Type, Message);
}
void WriteTraceF(TraceType Type, LPCTSTR strFormat, ...)
{
if (TraceClosed)
{
return;
}
va_list args;
va_start(args, strFormat);
GetTraceObjet().WriteTraceF(Type, strFormat, args);
va_end(args);
}
CTraceModule * AddTraceModule(CTraceModule * TraceModule)
{
if (TraceClosed)
{ {
return NULL; return NULL;
} }
@ -171,27 +132,41 @@ CTraceModule * AddTraceModule(CTraceModule * TraceModule)
return TraceModule; return TraceModule;
} }
CTraceModule * RemoveTraceModule(CTraceModule * TraceModule) CTraceModule * TraceRemoveModule(CTraceModule * TraceModule)
{ {
return GetTraceObjet().RemoveTraceModule(TraceModule); return GetTraceObjet().RemoveTraceModule(TraceModule);
} }
void CloseTrace(void) const char * TraceSeverity(uint8_t severity)
{ {
TraceClosed = true; switch (severity)
GetTraceObjet().CloseTrace(); {
case TraceError: return "Error";
case TraceWarning: return "Warning";
case TraceNotice: return "Notice";
case TraceInfo: return "Info";
case TraceDebug: return "Debug";
case TraceVerbose: return "Verbose";
}
static stdstr Unknown;
Unknown.Format("Unknown (%d)", (int32_t)severity);
return Unknown.c_str();
} }
CTraceFileLog::CTraceFileLog(LPCTSTR FileName, bool FlushFile) : const char * TraceModule(uint32_t module)
m_FlushFile(FlushFile)
{ {
m_hLogFile.SetFlush(false); ModuleNameMap::const_iterator itr = g_ModuleNames.find(module);
m_hLogFile.SetTruncateFile(true); if (itr != g_ModuleNames.end())
m_hLogFile.SetMaxFileSize(5 * MB); {
m_hLogFile.Open(FileName, Log_Append); return itr->second.c_str();
}
static stdstr Unknown;
Unknown.Format("Unknown (%d)", module);
return Unknown.c_str();
} }
CTraceFileLog::CTraceFileLog(LPCTSTR FileName, bool FlushFile, LOG_OPEN_MODE eMode, size_t dwMaxFileSize) : CTraceFileLog::CTraceFileLog(const char * FileName, bool FlushFile, LOG_OPEN_MODE eMode, size_t dwMaxFileSize) :
m_FlushFile(FlushFile) m_FlushFile(FlushFile)
{ {
enum { MB = 1024 * 1024 }; enum { MB = 1024 * 1024 };
@ -210,35 +185,32 @@ m_FlushFile(FlushFile)
CTraceFileLog::~CTraceFileLog() CTraceFileLog::~CTraceFileLog()
{ {
TraceClosed = true;
} }
void CTraceFileLog::Write(LPCTSTR Message, bool EndOfLine) void CTraceFileLog::Write(uint32_t module, uint8_t severity, const char * /*file*/, int /*line*/, const char * function, const char * Message)
{ {
if (!m_hLogFile.IsOpen()) { return; } if (!m_hLogFile.IsOpen()) { return; }
CGuard Section(m_CriticalSection); SYSTEMTIME sysTime;
::GetLocalTime(&sysTime);
stdstr_f timestamp("%04d/%02d/%02d %02d:%02d:%02d.%03d %05d,", sysTime.wYear, sysTime.wMonth, sysTime.wDay, sysTime.wHour, sysTime.wMinute, sysTime.wSecond, sysTime.wMilliseconds, GetCurrentThreadId());
m_hLogFile.Log(timestamp.c_str());
m_hLogFile.Log(TraceSeverity(severity));
m_hLogFile.Log(",");
m_hLogFile.Log(TraceModule(module));
m_hLogFile.Log(",");
m_hLogFile.Log(function);
m_hLogFile.Log(",");
m_hLogFile.Log(Message); m_hLogFile.Log(Message);
if (EndOfLine) m_hLogFile.Log("\r\n");
if (m_FlushFile)
{ {
m_hLogFile.Log(_T("\r\n")); m_hLogFile.Flush();
if (m_FlushFile)
{
m_hLogFile.Flush();
}
} }
} }
void CTraceFileLog::SetFlushFile(bool bFlushFile) void CTraceFileLog::SetFlushFile(bool bFlushFile)
{ {
m_FlushFile = bFlushFile; m_FlushFile = bFlushFile;
}
void CDebugTraceLog::Write(const char * Message, bool EndOfLine)
{
OutputDebugString(Message);
if (EndOfLine)
{
OutputDebugString("\n");
}
} }

View File

@ -1,43 +1,45 @@
#pragma once #pragma once
#include "CriticalSection.h"
#include "LogClass.h" #include "LogClass.h"
class CTraceModule enum TraceSeverity
{ {
TraceLevel m_Type; TraceError = 0x00000001,
TraceWarning = 0x00000002,
TraceNotice = 0x00000003,
TraceInfo = 0x00000004,
TraceDebug = 0x00000005,
TraceVerbose = 0x00000006,
};
public: __interface CTraceModule
CTraceModule() { m_Type = TrLvError; } {
virtual ~CTraceModule() {} virtual void Write(uint32_t module, uint8_t severity, const char * file, int line, const char * function, const char * Message) = 0;
inline void SetTraceLevel(TraceLevel Type) { m_Type = Type; }
inline TraceLevel GetTraceLevel(void) const { return m_Type; }
virtual void Write(const char * Message, bool EndOfLine) = 0;
}; };
class CTraceFileLog : public CTraceModule class CTraceFileLog : public CTraceModule
{ {
enum { MB = 1024 * 1024 };
CriticalSection m_CriticalSection;
CLog m_hLogFile;
bool m_FlushFile;
public: public:
CTraceFileLog(const char * FileName, bool FlushFile = true);
CTraceFileLog(const char * FileName, bool FlushFile, LOG_OPEN_MODE eMode, size_t dwMaxFileSize = 5); CTraceFileLog(const char * FileName, bool FlushFile, LOG_OPEN_MODE eMode, size_t dwMaxFileSize = 5);
virtual ~CTraceFileLog(); virtual ~CTraceFileLog();
void Write(const char * Message, bool EndOfLine);
void SetFlushFile(bool bFlushFile); void SetFlushFile(bool bFlushFile);
void Write(uint32_t module, uint8_t severity, const char * file, int line, const char * function, const char * Message);
private:
CLog m_hLogFile;
bool m_FlushFile;
}; };
class CDebugTraceLog : public CTraceModule #define WriteTrace(m, s, format, ...) if(g_ModuleLogLevel[(m)] >= (s)) { WriteTraceFull((m), (s), __FILE__, __LINE__, __FUNCTION__, (format), ## __VA_ARGS__); }
{
public:
void Write(const char * Message, bool EndOfLine);
};
CTraceModule * AddTraceModule(CTraceModule * TraceModule); // Must be created with new CTraceModule * TraceAddModule(CTraceModule * TraceModule);
CTraceModule * RemoveTraceModule(CTraceModule * TraceModule); // Is not automaticly deleted CTraceModule * TraceRemoveModule(CTraceModule * TraceModule);
const char * TraceSeverity(uint8_t severity);
const char * TraceModule(uint32_t module);
void TraceSetModuleName(uint8_t module, const char * Name);
void CloseTrace(void);
void WriteTraceFull(uint32_t module, uint8_t severity, const char * file, int line, const char * function, const char *format, ...);
void TraceSetMaxModule(uint32_t MaxModule, uint8_t DefaultSeverity);
extern uint32_t * g_ModuleLogLevel;

View File

@ -1,31 +0,0 @@
#pragma once
enum TraceType
{
TraceNone = 0x00000000,
TraceError = 0x00000001,
TraceSettings = 0x00000002,
TraceGfxPlugin = 0x00000004,
TraceDebug = 0x00000010,
TraceRecompiler = 0x00000020,
TraceRSP = 0x00000040,
TraceTLB = 0x00000080,
TraceValidate = 0x00000100,
TraceAudio = 0x00000200,
TraceProtectedMem = 0x00000400,
TraceNoHeader = 0x80000000,
};
enum TraceLevel
{
//Handle Existing Code
TrLvError = TraceError,
TrLv1 = TraceSettings | TrLvError,
TrLv2 = TrLv1 | TraceDebug,
TrlvGfxPlugin = TraceGfxPlugin,
TrLvAll = ~TraceNoHeader,
};
void WriteTrace(TraceType Type, const char * Message);
void WriteTraceF(TraceType Type, const char * strFormat, ...);
void CloseTrace(void); //Free's all memory associated with trace

View File

@ -0,0 +1,7 @@
#pragma once
enum TraceModuleCommon
{
TraceMD5,
MaxTraceModuleCommon,
};

View File

@ -40,7 +40,6 @@
*/ */
#include "stdafx.h" #include "stdafx.h"
#include <TChar.H>
// MD5 simple initialization method // MD5 simple initialization method
MD5::MD5() MD5::MD5()
@ -62,7 +61,7 @@ void MD5::update(const uint1 *input, uint4 input_length)
if (finalized) // so we can't update! if (finalized) // so we can't update!
{ {
WriteTrace(TraceError, _T("MD5::update: Can't update a finalized digest!")); WriteTrace(TraceMD5, TraceError, "Can't update a finalized digest!");
return; return;
} }
@ -139,7 +138,7 @@ void MD5::finalize()
if (finalized) if (finalized)
{ {
WriteTrace(TraceError, _T("MD5::finalize: Already finalized this digest!")); WriteTrace(TraceMD5, TraceError, "Already finalized this digest!");
return; return;
} }
@ -168,7 +167,7 @@ MD5::MD5(CPath File)
init(); // must be called be all constructors init(); // must be called be all constructors
if (File.Exists()) if (File.Exists())
{ {
FILE * fp = fopen((LPCTSTR)File, _T("rb")); FILE * fp = fopen((LPCTSTR)File, "rb");
if (fp) if (fp)
{ {
update(fp); update(fp);
@ -202,7 +201,7 @@ const unsigned char *MD5::raw_digest()
{ {
if (!finalized) if (!finalized)
{ {
WriteTrace(TraceError, _T("MD5::raw_digest: Can't get digest if you haven't finalized the digest!")); WriteTrace(TraceMD5, TraceError, "Can't get digest if you haven't finalized the digest!");
return ((unsigned char*) ""); return ((unsigned char*) "");
} }
return digest; return digest;
@ -212,7 +211,7 @@ void MD5::get_digest(MD5Digest& extdigest)
{ {
if (!finalized) if (!finalized)
{ {
WriteTrace(TraceError, _T("MD5::get_digest: Can't get digest if you haven't finalized the digest!")); WriteTrace(TraceMD5, TraceError, "Can't get digest if you haven't finalized the digest!");
memset(extdigest.digest, 0, sizeof(extdigest.digest)); memset(extdigest.digest, 0, sizeof(extdigest.digest));
return; return;
} }
@ -229,7 +228,7 @@ const char *MD5::hex_digest()
if (!finalized) if (!finalized)
{ {
WriteTrace(TraceError, _T("MD5::hex_digest: Can't get digest if you haven't finalized the digest!")); WriteTrace(TraceMD5, TraceError, "Can't get digest if you haven't finalized the digest!");
return ""; return "";
} }
char c[33]; char c[33];

View File

@ -13,7 +13,7 @@
#include "IniFileClass.h" #include "IniFileClass.h"
#include "path.h" #include "path.h"
#include "LogClass.h" #include "LogClass.h"
#include "TraceDefs.h" #include "TraceModulesCommon.h"
#include "Trace.h" #include "Trace.h"
#include "md5.h" #include "md5.h"
#include "SmartPointer.h" #include "SmartPointer.h"

View File

@ -10,20 +10,23 @@
void FixDirectories(void); void FixDirectories(void);
static void IncreaseThreadPriority(void); static void IncreaseThreadPriority(void);
static CTraceFileLog * g_LogFile = NULL; static CTraceFileLog * g_LogFile = NULL;
void LogLevelChanged(CTraceFileLog * LogFile)
{
LogFile->SetTraceLevel((TraceLevel)g_Settings->LoadDword(Debugger_AppLogLevel));
}
void LogFlushChanged(CTraceFileLog * LogFile) void LogFlushChanged(CTraceFileLog * LogFile)
{ {
LogFile->SetFlushFile(g_Settings->LoadDword(Debugger_AppLogFlush) != 0); LogFile->SetFlushFile(g_Settings->LoadDword(Debugger_AppLogFlush) != 0);
} }
void InitializeLog(void) void InitializeLog(void)
{
#ifdef _DEBUG
TraceSetMaxModule(MaxTraceModuleProject64, TraceInfo);
#else
TraceSetMaxModule(MaxTraceModuleProject64, TraceError);
#endif
}
void AddLogModule(void)
{ {
CPath LogFilePath(CPath::MODULE_DIRECTORY); CPath LogFilePath(CPath::MODULE_DIRECTORY);
LogFilePath.AppendDirectory("Logs"); LogFilePath.AppendDirectory("Logs");
@ -34,15 +37,108 @@ void InitializeLog(void)
LogFilePath.SetNameExtension("Project64.log"); LogFilePath.SetNameExtension("Project64.log");
g_LogFile = new CTraceFileLog(LogFilePath, g_Settings->LoadDword(Debugger_AppLogFlush) != 0, Log_New, 500); g_LogFile = new CTraceFileLog(LogFilePath, g_Settings->LoadDword(Debugger_AppLogFlush) != 0, Log_New, 500);
#ifdef VALIDATE_DEBUG TraceAddModule(g_LogFile);
g_LogFile->SetTraceLevel((TraceLevel)(g_Settings->LoadDword(Debugger_AppLogLevel) | TraceValidate | TraceDebug)); }
#else
g_LogFile->SetTraceLevel((TraceLevel)g_Settings->LoadDword(Debugger_AppLogLevel));
#endif
AddTraceModule(g_LogFile);
g_Settings->RegisterChangeCB(Debugger_AppLogLevel, g_LogFile, (CSettings::SettingChangedFunc)LogLevelChanged); void SetTraceModuleNames(void)
{
TraceSetModuleName(TraceMD5, "MD5");
TraceSetModuleName(TraceSettings, "Settings");
TraceSetModuleName(TraceUnknown, "Unknown");
TraceSetModuleName(TraceAppInit, "App Init");
TraceSetModuleName(TraceAppCleanup, "App Cleanup");
TraceSetModuleName(TraceN64System, "N64 System");
TraceSetModuleName(TracePlugins, "Plugins");
TraceSetModuleName(TraceGFXPlugin, "GFX Plugin");
TraceSetModuleName(TraceAudioPlugin, "Audio Plugin");
TraceSetModuleName(TraceControllerPlugin, "Controller Plugin");
TraceSetModuleName(TraceRSPPlugin, "RSP Plugin");
TraceSetModuleName(TraceRSP, "RSP");
TraceSetModuleName(TraceAudio, "Audio");
TraceSetModuleName(TraceRegisterCache, "Register Cache");
TraceSetModuleName(TraceRecompiler, "Recompiler");
TraceSetModuleName(TraceTLB, "TLB");
TraceSetModuleName(TraceProtectedMem, "Protected Memory");
TraceSetModuleName(TraceUserInterface, "User Interface");
}
void UpdateTraceLevel(void * /*NotUsed*/)
{
g_ModuleLogLevel[TraceMD5] = (uint8_t)g_Settings->LoadDword(Debugger_TraceMD5);
g_ModuleLogLevel[TraceSettings] = (uint8_t)g_Settings->LoadDword(Debugger_TraceSettings);
g_ModuleLogLevel[TraceUnknown] = (uint8_t)g_Settings->LoadDword(Debugger_TraceUnknown);
g_ModuleLogLevel[TraceAppInit] = (uint8_t)g_Settings->LoadDword(Debugger_TraceAppInit);
g_ModuleLogLevel[TraceAppCleanup] = (uint8_t)g_Settings->LoadDword(Debugger_TraceAppCleanup);
g_ModuleLogLevel[TraceN64System] = (uint8_t)g_Settings->LoadDword(Debugger_TraceN64System);
g_ModuleLogLevel[TracePlugins] = (uint8_t)g_Settings->LoadDword(Debugger_TracePlugins);
g_ModuleLogLevel[TraceGFXPlugin] = (uint8_t)g_Settings->LoadDword(Debugger_TraceGFXPlugin);
g_ModuleLogLevel[TraceAudioPlugin] = (uint8_t)g_Settings->LoadDword(Debugger_TraceAudioPlugin);
g_ModuleLogLevel[TraceControllerPlugin] = (uint8_t)g_Settings->LoadDword(Debugger_TraceControllerPlugin);
g_ModuleLogLevel[TraceRSPPlugin] = (uint8_t)g_Settings->LoadDword(Debugger_TraceRSPPlugin);
g_ModuleLogLevel[TraceRSP] = (uint8_t)g_Settings->LoadDword(Debugger_TraceRSP);
g_ModuleLogLevel[TraceAudio] = (uint8_t)g_Settings->LoadDword(Debugger_TraceAudio);
g_ModuleLogLevel[TraceRegisterCache] = (uint8_t)g_Settings->LoadDword(Debugger_TraceRegisterCache);
g_ModuleLogLevel[TraceRecompiler] = (uint8_t)g_Settings->LoadDword(Debugger_TraceRecompiler);
g_ModuleLogLevel[TraceTLB] = (uint8_t)g_Settings->LoadDword(Debugger_TraceTLB);
g_ModuleLogLevel[TraceProtectedMem] = (uint8_t)g_Settings->LoadDword(Debugger_TraceProtectedMEM);
g_ModuleLogLevel[TraceUserInterface] = (uint8_t)g_Settings->LoadDword(Debugger_TraceUserInterface);
}
void SetupTrace(void)
{
SetTraceModuleNames();
AddLogModule();
g_Settings->RegisterChangeCB(Debugger_TraceMD5, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceSettings, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceUnknown, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceAppInit, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceAppCleanup, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceN64System, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TracePlugins, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceGFXPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceAudioPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceControllerPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceRSPPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceRSP, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceAudio, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceRegisterCache, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceRecompiler, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceTLB, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceProtectedMEM, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceUserInterface, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_AppLogFlush, g_LogFile, (CSettings::SettingChangedFunc)LogFlushChanged); g_Settings->RegisterChangeCB(Debugger_AppLogFlush, g_LogFile, (CSettings::SettingChangedFunc)LogFlushChanged);
UpdateTraceLevel(NULL);
WriteTrace(TraceAppInit, TraceInfo, "Application Starting %s", VER_FILE_VERSION_STR);
}
void CleanupTrace(void)
{
WriteTrace(TraceAppCleanup, TraceDebug, "Done");
g_Settings->UnregisterChangeCB(Debugger_TraceMD5, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceSettings, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceUnknown, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceAppInit, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceAppCleanup, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceN64System, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TracePlugins, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceGFXPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceAudioPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceControllerPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceRSPPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceRSP, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceAudio, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceRegisterCache, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceRecompiler, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceTLB, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceProtectedMEM, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceUserInterface, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_AppLogFlush, g_LogFile, (CSettings::SettingChangedFunc)LogFlushChanged);
CloseTrace();
if (g_LogFile) { delete g_LogFile; g_LogFile = NULL; }
} }
void AppInit(CNotification * Notify) void AppInit(CNotification * Notify)
@ -50,8 +146,7 @@ void AppInit(CNotification * Notify)
try try
{ {
g_Notify = Notify; g_Notify = Notify;
InitializeLog();
FixDirectories();
stdstr_f AppName("Project64 %s", VER_FILE_VERSION_STR); stdstr_f AppName("Project64 %s", VER_FILE_VERSION_STR);
IncreaseThreadPriority(); IncreaseThreadPriority();
@ -67,13 +162,12 @@ void AppInit(CNotification * Notify)
g_Settings->Initialize(AppName.c_str()); g_Settings->Initialize(AppName.c_str());
} }
InitializeLog(); SetupTrace();
WriteTrace(TraceDebug, __FUNCTION__ ": Application Starting");
CMipsMemoryVM::ReserveMemory(); CMipsMemoryVM::ReserveMemory();
FixDirectories();
//Create the plugin container //Create the plugin container
WriteTrace(TraceDebug, __FUNCTION__ ": Create Plugins"); WriteTrace(TraceAppInit, TraceInfo, "Create Plugins");
g_Plugins = new CPlugins(g_Settings->LoadStringVal(Directory_Plugin)); g_Plugins = new CPlugins(g_Settings->LoadStringVal(Directory_Plugin));
g_Lang = new CLanguage(); g_Lang = new CLanguage();
@ -88,9 +182,7 @@ void AppInit(CNotification * Notify)
void AppCleanup(void) void AppCleanup(void)
{ {
g_Settings->UnregisterChangeCB(Debugger_AppLogLevel, g_LogFile, (CSettings::SettingChangedFunc)LogLevelChanged); WriteTrace(TraceAppCleanup, TraceDebug, "cleaning up global objects");
g_Settings->UnregisterChangeCB(Debugger_AppLogFlush, g_LogFile, (CSettings::SettingChangedFunc)LogFlushChanged);
WriteTrace(TraceDebug, __FUNCTION__ ": cleaning up global objects");
if (g_Rom) { delete g_Rom; g_Rom = NULL; } if (g_Rom) { delete g_Rom; g_Rom = NULL; }
if (g_Plugins) { delete g_Plugins; g_Plugins = NULL; } if (g_Plugins) { delete g_Plugins; g_Plugins = NULL; }
@ -98,9 +190,7 @@ void AppCleanup(void)
if (g_Lang) { delete g_Lang; g_Lang = NULL; } if (g_Lang) { delete g_Lang; g_Lang = NULL; }
CMipsMemoryVM::FreeReservedMemory(); CMipsMemoryVM::FreeReservedMemory();
CleanupTrace();
WriteTrace(TraceDebug, __FUNCTION__ ": Done");
CloseTrace();
} }
void FixDirectories(void) void FixDirectories(void)
@ -109,10 +199,6 @@ void FixDirectories(void)
Directory.AppendDirectory("Config"); Directory.AppendDirectory("Config");
if (!Directory.DirectoryExists()) Directory.DirectoryCreate(); if (!Directory.DirectoryExists()) Directory.DirectoryCreate();
Directory.UpDirectory();
Directory.AppendDirectory("Logs");
if (!Directory.DirectoryExists()) Directory.DirectoryCreate();
Directory.UpDirectory(); Directory.UpDirectory();
Directory.AppendDirectory("Save"); Directory.AppendDirectory("Save");
if (!Directory.DirectoryExists()) Directory.DirectoryCreate(); if (!Directory.DirectoryExists()) Directory.DirectoryCreate();
@ -130,4 +216,4 @@ void FixDirectories(void)
void IncreaseThreadPriority(void) void IncreaseThreadPriority(void)
{ {
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL); SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
} }

View File

@ -34,30 +34,30 @@ void CAudio::Reset()
uint32_t CAudio::GetLength() uint32_t CAudio::GetLength()
{ {
WriteTraceF(TraceAudio, __FUNCTION__ ": Start (m_SecondBuff = %d)", m_SecondBuff); WriteTrace(TraceAudio, TraceDebug, "Start (m_SecondBuff = %d)", m_SecondBuff);
uint32_t TimeLeft = g_SystemTimer->GetTimer(CSystemTimer::AiTimerInterrupt), Res = 0; uint32_t TimeLeft = g_SystemTimer->GetTimer(CSystemTimer::AiTimerInterrupt), Res = 0;
if (TimeLeft > 0) if (TimeLeft > 0)
{ {
Res = (TimeLeft / m_CountsPerByte); Res = (TimeLeft / m_CountsPerByte);
} }
WriteTraceF(TraceAudio, __FUNCTION__ ": Done (res = %d, TimeLeft = %d)", Res, TimeLeft); WriteTrace(TraceAudio, TraceDebug, "Done (res = %d, TimeLeft = %d)", Res, TimeLeft);
return (Res + 3)&~3; return (Res + 3)&~3;
} }
uint32_t CAudio::GetStatus() uint32_t CAudio::GetStatus()
{ {
WriteTraceF(TraceAudio, __FUNCTION__ ": m_Status = %X", m_Status); WriteTrace(TraceAudio, TraceDebug, "m_Status = %X", m_Status);
return m_Status; return m_Status;
} }
void CAudio::LenChanged() void CAudio::LenChanged()
{ {
WriteTraceF(TraceAudio, __FUNCTION__ ": Start (g_Reg->AI_LEN_REG = %d)", g_Reg->AI_LEN_REG); WriteTrace(TraceAudio, TraceDebug, "Start (g_Reg->AI_LEN_REG = %d)", g_Reg->AI_LEN_REG);
if (g_Reg->AI_LEN_REG != 0) if (g_Reg->AI_LEN_REG != 0)
{ {
if (g_Reg->AI_LEN_REG >= 0x40000) if (g_Reg->AI_LEN_REG >= 0x40000)
{ {
WriteTraceF(TraceAudio, __FUNCTION__ ": *** Ignoring Write, To Large (%X)", g_Reg->AI_LEN_REG); WriteTrace(TraceAudio, TraceDebug, "*** Ignoring Write, To Large (%X)", g_Reg->AI_LEN_REG);
} }
else else
{ {
@ -67,12 +67,12 @@ void CAudio::LenChanged()
{ {
if (AudioLeft == 0) if (AudioLeft == 0)
{ {
WriteTraceF(TraceAudio, __FUNCTION__ ": Set Timer AI_LEN_REG: %d m_CountsPerByte: %d", g_Reg->AI_LEN_REG, m_CountsPerByte); WriteTrace(TraceAudio, TraceDebug, "Set Timer AI_LEN_REG: %d m_CountsPerByte: %d", g_Reg->AI_LEN_REG, m_CountsPerByte);
g_SystemTimer->SetTimer(CSystemTimer::AiTimerInterrupt, g_Reg->AI_LEN_REG * m_CountsPerByte, false); g_SystemTimer->SetTimer(CSystemTimer::AiTimerInterrupt, g_Reg->AI_LEN_REG * m_CountsPerByte, false);
} }
else else
{ {
WriteTraceF(TraceAudio, __FUNCTION__ ": Increasing Second Buffer (m_SecondBuff %d Increase: %d)", m_SecondBuff, g_Reg->AI_LEN_REG); WriteTrace(TraceAudio, TraceDebug, "Increasing Second Buffer (m_SecondBuff %d Increase: %d)", m_SecondBuff, g_Reg->AI_LEN_REG);
m_SecondBuff += g_Reg->AI_LEN_REG; m_SecondBuff += g_Reg->AI_LEN_REG;
m_Status |= ai_full; m_Status |= ai_full;
} }
@ -85,7 +85,7 @@ void CAudio::LenChanged()
} }
else else
{ {
WriteTraceF(TraceAudio, __FUNCTION__ ": *** Reset Timer to 0"); WriteTrace(TraceAudio, TraceDebug, "*** Reset Timer to 0");
g_SystemTimer->StopTimer(CSystemTimer::AiTimerBusy); g_SystemTimer->StopTimer(CSystemTimer::AiTimerBusy);
g_SystemTimer->StopTimer(CSystemTimer::AiTimerInterrupt); g_SystemTimer->StopTimer(CSystemTimer::AiTimerInterrupt);
m_SecondBuff = 0; m_SecondBuff = 0;
@ -96,12 +96,12 @@ void CAudio::LenChanged()
{ {
g_Plugins->Audio()->AiLenChanged(); g_Plugins->Audio()->AiLenChanged();
} }
WriteTraceF(TraceAudio, __FUNCTION__ ": Done"); WriteTrace(TraceAudio, TraceDebug, "Done");
} }
void CAudio::InterruptTimerDone() void CAudio::InterruptTimerDone()
{ {
WriteTraceF(TraceAudio, __FUNCTION__ ": Start (m_SecondBuff = %d)", m_SecondBuff); WriteTrace(TraceAudio, TraceDebug, "Start (m_SecondBuff = %d)", m_SecondBuff);
m_Status &= ~ai_full; m_Status &= ~ai_full;
g_Reg->MI_INTR_REG |= MI_INTR_AI; g_Reg->MI_INTR_REG |= MI_INTR_AI;
g_Reg->CheckInterrupts(); g_Reg->CheckInterrupts();
@ -118,12 +118,12 @@ void CAudio::InterruptTimerDone()
{ {
g_System->SyncToAudio(); g_System->SyncToAudio();
} }
WriteTrace(TraceAudio, __FUNCTION__ ": Done"); WriteTrace(TraceAudio, TraceDebug, "Done");
} }
void CAudio::BusyTimerDone() void CAudio::BusyTimerDone()
{ {
WriteTraceF(TraceAudio, __FUNCTION__ ": Start (m_SecondBuff = %d)", m_SecondBuff); WriteTrace(TraceAudio, TraceDebug, "Start (m_SecondBuff = %d)", m_SecondBuff);
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
m_Status &= ~ai_busy; m_Status &= ~ai_busy;
} }
@ -139,7 +139,7 @@ void CAudio::SetViIntr(uint32_t VI_INTR_TIME)
void CAudio::SetFrequency(uint32_t Dacrate, uint32_t System) void CAudio::SetFrequency(uint32_t Dacrate, uint32_t System)
{ {
WriteTraceF(TraceAudio, __FUNCTION__ "(Dacrate: %X System: %d): AI_BITRATE_REG = %X", Dacrate, System, g_Reg->AI_BITRATE_REG); WriteTrace(TraceAudio, TraceDebug, "(Dacrate: %X System: %d): AI_BITRATE_REG = %X", Dacrate, System, g_Reg->AI_BITRATE_REG);
uint32_t Frequency; uint32_t Frequency;
switch (System) switch (System)

View File

@ -160,7 +160,7 @@ void CEeprom::LoadEeprom()
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL); FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
if (m_hFile == INVALID_HANDLE_VALUE) if (m_hFile == INVALID_HANDLE_VALUE)
{ {
WriteTraceF(TraceError, __FUNCTION__ ": Failed to open (%s), ReadOnly = %d, LastError = %X", (LPCTSTR)FileName, m_ReadOnly, GetLastError()); WriteTrace(TraceN64System, TraceError, "Failed to open (%s), ReadOnly = %d, LastError = %X", (LPCTSTR)FileName, m_ReadOnly, GetLastError());
g_Notify->DisplayError(GS(MSG_FAIL_OPEN_EEPROM)); g_Notify->DisplayError(GS(MSG_FAIL_OPEN_EEPROM));
return; return;
} }

View File

@ -150,7 +150,7 @@ bool CFlashram::LoadFlashram()
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL); FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
if (m_hFile == INVALID_HANDLE_VALUE) if (m_hFile == INVALID_HANDLE_VALUE)
{ {
WriteTraceF(TraceError, __FUNCTION__ ": Failed to open (%s), ReadOnly = %d, LastError = %X", (LPCTSTR)FileName, m_ReadOnly, GetLastError()); WriteTrace(TraceN64System, TraceError, "Failed to open (%s), ReadOnly = %d, LastError = %X", (LPCTSTR)FileName, m_ReadOnly, GetLastError());
g_Notify->DisplayError(GS(MSG_FAIL_OPEN_FLASH)); g_Notify->DisplayError(GS(MSG_FAIL_OPEN_FLASH));
return false; return false;
} }

View File

@ -143,7 +143,7 @@ bool CMipsMemoryVM::Initialize()
} }
if (m_RDRAM == NULL) if (m_RDRAM == NULL)
{ {
WriteTraceF(TraceError, __FUNCTION__ ": Failed to Reserve RDRAM (Size: 0x%X)", 0x20000000); WriteTrace(TraceN64System, TraceError, "Failed to Reserve RDRAM (Size: 0x%X)", 0x20000000);
FreeMemory(); FreeMemory();
return false; return false;
} }
@ -151,14 +151,14 @@ bool CMipsMemoryVM::Initialize()
m_AllocatedRdramSize = g_Settings->LoadDword(Game_RDRamSize); m_AllocatedRdramSize = g_Settings->LoadDword(Game_RDRamSize);
if (VirtualAlloc(m_RDRAM, m_AllocatedRdramSize, MEM_COMMIT, PAGE_READWRITE) == NULL) if (VirtualAlloc(m_RDRAM, m_AllocatedRdramSize, MEM_COMMIT, PAGE_READWRITE) == NULL)
{ {
WriteTraceF(TraceError, __FUNCTION__ ": Failed to Allocate RDRAM (Size: 0x%X)", m_AllocatedRdramSize); WriteTrace(TraceN64System, TraceError, "Failed to Allocate RDRAM (Size: 0x%X)", m_AllocatedRdramSize);
FreeMemory(); FreeMemory();
return false; return false;
} }
if (VirtualAlloc(m_RDRAM + 0x04000000, 0x2000, MEM_COMMIT, PAGE_READWRITE) == NULL) if (VirtualAlloc(m_RDRAM + 0x04000000, 0x2000, MEM_COMMIT, PAGE_READWRITE) == NULL)
{ {
WriteTraceF(TraceError, __FUNCTION__ ": Failed to Allocate DMEM/IMEM (Size: 0x%X)", 0x2000); WriteTrace(TraceN64System, TraceError, "Failed to Allocate DMEM/IMEM (Size: 0x%X)", 0x2000);
FreeMemory(); FreeMemory();
return false; return false;
} }
@ -173,7 +173,7 @@ bool CMipsMemoryVM::Initialize()
m_RomSize = g_Rom->GetRomSize(); m_RomSize = g_Rom->GetRomSize();
if (VirtualAlloc(m_Rom, g_Rom->GetRomSize(), MEM_COMMIT, PAGE_READWRITE) == NULL) if (VirtualAlloc(m_Rom, g_Rom->GetRomSize(), MEM_COMMIT, PAGE_READWRITE) == NULL)
{ {
WriteTraceF(TraceError, __FUNCTION__ ": Failed to Allocate Rom (Size: 0x%X)", g_Rom->GetRomSize()); WriteTrace(TraceN64System, TraceError, "Failed to Allocate Rom (Size: 0x%X)", g_Rom->GetRomSize());
FreeMemory(); FreeMemory();
return false; return false;
} }
@ -198,7 +198,7 @@ bool CMipsMemoryVM::Initialize()
); );
if (m_TLB_ReadMap == NULL) if (m_TLB_ReadMap == NULL)
{ {
WriteTraceF(TraceError, __FUNCTION__": Failed to Allocate m_TLB_ReadMap (Size: 0x%X)", 0xFFFFF * sizeof(size_t)); WriteTrace(TraceN64System, TraceError, "Failed to Allocate m_TLB_ReadMap (Size: 0x%X)", 0xFFFFF * sizeof(size_t));
FreeMemory(); FreeMemory();
return false; return false;
} }
@ -211,7 +211,7 @@ bool CMipsMemoryVM::Initialize()
); );
if (m_TLB_WriteMap == NULL) if (m_TLB_WriteMap == NULL)
{ {
WriteTraceF(TraceError, __FUNCTION__": Failed to Allocate m_TLB_WriteMap (Size: 0x%X)", 0xFFFFF * sizeof(size_t)); WriteTrace(TraceN64System, TraceError, "Failed to Allocate m_TLB_WriteMap (Size: 0x%X)", 0xFFFFF * sizeof(size_t));
FreeMemory(); FreeMemory();
return false; return false;
} }
@ -3455,7 +3455,7 @@ void CMipsMemoryVM::UpdateFieldSerration(uint32_t interlaced)
void CMipsMemoryVM::ProtectMemory(uint32_t StartVaddr, uint32_t EndVaddr) void CMipsMemoryVM::ProtectMemory(uint32_t StartVaddr, uint32_t EndVaddr)
{ {
WriteTraceF(TraceProtectedMem, __FUNCTION__ ": StartVaddr: %08X EndVaddr: %08X", StartVaddr, EndVaddr); WriteTrace(TraceProtectedMem, TraceDebug, "StartVaddr: %08X EndVaddr: %08X", StartVaddr, EndVaddr);
if (!ValidVaddr(StartVaddr) || !ValidVaddr(EndVaddr)) if (!ValidVaddr(StartVaddr) || !ValidVaddr(EndVaddr))
{ {
return; return;
@ -3482,14 +3482,14 @@ void CMipsMemoryVM::ProtectMemory(uint32_t StartVaddr, uint32_t EndVaddr)
//Protect that memory address space //Protect that memory address space
DWORD OldProtect; DWORD OldProtect;
uint8_t * MemLoc = Rdram() + StartPAddr; uint8_t * MemLoc = Rdram() + StartPAddr;
WriteTraceF(TraceProtectedMem, __FUNCTION__ ": Paddr: %08X Length: %X", StartPAddr, Length); WriteTrace(TraceProtectedMem, TraceDebug, "Paddr: %08X Length: %X", StartPAddr, Length);
VirtualProtect(MemLoc, Length, PAGE_READONLY, &OldProtect); VirtualProtect(MemLoc, Length, PAGE_READONLY, &OldProtect);
} }
void CMipsMemoryVM::UnProtectMemory(uint32_t StartVaddr, uint32_t EndVaddr) void CMipsMemoryVM::UnProtectMemory(uint32_t StartVaddr, uint32_t EndVaddr)
{ {
WriteTraceF(TraceProtectedMem, __FUNCTION__ ": StartVaddr: %08X EndVaddr: %08X", StartVaddr, EndVaddr); WriteTrace(TraceProtectedMem, TraceDebug, "StartVaddr: %08X EndVaddr: %08X", StartVaddr, EndVaddr);
if (!ValidVaddr(StartVaddr) || !ValidVaddr(EndVaddr)) { return; } if (!ValidVaddr(StartVaddr) || !ValidVaddr(EndVaddr)) { return; }
//Get Physical Addresses passed //Get Physical Addresses passed
@ -5432,7 +5432,7 @@ void CMipsMemoryVM::RdramChanged(CMipsMemoryVM * _this)
); );
if (result == NULL) if (result == NULL)
{ {
WriteTrace(TraceError, __FUNCTION__": failed to allocate extended memory"); WriteTrace(TraceN64System, TraceError, "failed to allocate extended memory");
g_Notify->FatalError(GS(MSG_MEM_ALLOC_ERROR)); g_Notify->FatalError(GS(MSG_MEM_ALLOC_ERROR));
} }
} }

View File

@ -83,7 +83,7 @@ void LoadMempak(int Control)
if (hMempakFile[Control] == INVALID_HANDLE_VALUE) if (hMempakFile[Control] == INVALID_HANDLE_VALUE)
{ {
WriteTraceF(TraceError, __FUNCTION__ ": Failed to open (%s), lastError = %X", (LPCTSTR)FileName, GetLastError()); WriteTrace(TraceN64System, TraceError, "Failed to open (%s), lastError = %X", (LPCTSTR)FileName, GetLastError());
return; return;
} }

View File

@ -45,7 +45,7 @@ bool CSram::LoadSram()
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL); FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
if (m_hFile == INVALID_HANDLE_VALUE) if (m_hFile == INVALID_HANDLE_VALUE)
{ {
WriteTraceF(TraceError, __FUNCTION__ ": Failed to open (%s), ReadOnly = %d, LastError = %X", (LPCTSTR)FileName, m_ReadOnly, GetLastError()); WriteTrace(TraceN64System, TraceError, "Failed to open (%s), ReadOnly = %d, LastError = %X", (LPCTSTR)FileName, m_ReadOnly, GetLastError());
return false; return false;
} }
SetFilePointer(m_hFile, 0, NULL, FILE_BEGIN); SetFilePointer(m_hFile, 0, NULL, FILE_BEGIN);

View File

@ -214,7 +214,7 @@ void CSystemTimer::TimerDone()
} }
catch (...) catch (...)
{ {
WriteTraceF(TraceError, __FUNCTION__ ": Exception caught\nFile: %s\nLine: %d", __FILE__, __LINE__); WriteTrace(TraceN64System, TraceError, "Exception caught\nFile: %s\nLine: %d", __FILE__, __LINE__);
} }
g_Reg->MI_INTR_REG |= MI_INTR_VI; g_Reg->MI_INTR_REG |= MI_INTR_VI;
g_Reg->CheckInterrupts(); g_Reg->CheckInterrupts();

View File

@ -16,17 +16,17 @@
CTLB::CTLB(CTLB_CB * CallBack) : CTLB::CTLB(CTLB_CB * CallBack) :
m_CB(CallBack) m_CB(CallBack)
{ {
WriteTrace(TraceTLB, __FUNCTION__ ": Start"); WriteTrace(TraceTLB, TraceDebug, "Start");
memset(m_tlb, 0, sizeof(m_tlb)); memset(m_tlb, 0, sizeof(m_tlb));
memset(m_FastTlb, 0, sizeof(m_FastTlb)); memset(m_FastTlb, 0, sizeof(m_FastTlb));
Reset(true); Reset(true);
WriteTrace(TraceTLB, __FUNCTION__ ": Done"); WriteTrace(TraceTLB, TraceDebug, "Done");
} }
CTLB::~CTLB() CTLB::~CTLB()
{ {
WriteTrace(TraceTLB, __FUNCTION__ ": Start"); WriteTrace(TraceTLB, TraceDebug, "Start");
WriteTrace(TraceTLB, __FUNCTION__ ": Done"); WriteTrace(TraceTLB, TraceDebug, "Done");
} }
void CTLB::Reset(bool InvalidateTLB) void CTLB::Reset(bool InvalidateTLB)
@ -79,7 +79,7 @@ void CTLB::Probe()
{ {
int Counter; int Counter;
WriteTrace(TraceTLB, __FUNCTION__ ": Start"); WriteTrace(TraceTLB, TraceDebug, "Start");
g_Reg->INDEX_REGISTER |= 0x80000000; g_Reg->INDEX_REGISTER |= 0x80000000;
for (Counter = 0; Counter < 32; Counter++) for (Counter = 0; Counter < 32; Counter++)
{ {
@ -106,7 +106,7 @@ void CTLB::Probe()
} }
} }
} }
WriteTrace(TraceTLB, __FUNCTION__ ": Done"); WriteTrace(TraceTLB, TraceDebug, "Done");
} }
void CTLB::ReadEntry() void CTLB::ReadEntry()
@ -123,7 +123,7 @@ void CTLB::WriteEntry(int index, bool Random)
{ {
int FastIndx; int FastIndx;
WriteTraceF(TraceTLB, __FUNCTION__ ": %02d %d %08X %08X %08X %08X ", index, Random, g_Reg->PAGE_MASK_REGISTER, g_Reg->ENTRYHI_REGISTER, g_Reg->ENTRYLO0_REGISTER, g_Reg->ENTRYLO1_REGISTER); WriteTrace(TraceTLB, TraceDebug, "%02d %d %08X %08X %08X %08X ", index, Random, g_Reg->PAGE_MASK_REGISTER, g_Reg->ENTRYHI_REGISTER, g_Reg->ENTRYLO0_REGISTER, g_Reg->ENTRYLO1_REGISTER);
//Check to see if entry is unmapping it self //Check to see if entry is unmapping it self
if (m_tlb[index].EntryDefined) if (m_tlb[index].EntryDefined)
@ -133,14 +133,14 @@ void CTLB::WriteEntry(int index, bool Random)
*_PROGRAM_COUNTER < m_FastTlb[FastIndx].VEND && *_PROGRAM_COUNTER < m_FastTlb[FastIndx].VEND &&
m_FastTlb[FastIndx].ValidEntry && m_FastTlb[FastIndx].VALID) m_FastTlb[FastIndx].ValidEntry && m_FastTlb[FastIndx].VALID)
{ {
WriteTraceF(TraceTLB, __FUNCTION__ ": Ignored PC: %X VAddr Start: %X VEND: %X", *_PROGRAM_COUNTER, m_FastTlb[FastIndx].VSTART, m_FastTlb[FastIndx].VEND); WriteTrace(TraceTLB, TraceDebug, "Ignored PC: %X VAddr Start: %X VEND: %X", *_PROGRAM_COUNTER, m_FastTlb[FastIndx].VSTART, m_FastTlb[FastIndx].VEND);
return; return;
} }
if (*_PROGRAM_COUNTER >= m_FastTlb[FastIndx + 1].VSTART && if (*_PROGRAM_COUNTER >= m_FastTlb[FastIndx + 1].VSTART &&
*_PROGRAM_COUNTER < m_FastTlb[FastIndx + 1].VEND && *_PROGRAM_COUNTER < m_FastTlb[FastIndx + 1].VEND &&
m_FastTlb[FastIndx + 1].ValidEntry && m_FastTlb[FastIndx + 1].VALID) m_FastTlb[FastIndx + 1].ValidEntry && m_FastTlb[FastIndx + 1].VALID)
{ {
WriteTraceF(TraceTLB, __FUNCTION__ ": Ignored PC: %X VAddr Start: %X VEND: %X", *_PROGRAM_COUNTER, m_FastTlb[FastIndx + 1].VSTART, m_FastTlb[FastIndx + 1].VEND); WriteTrace(TraceTLB, TraceDebug, "Ignored PC: %X VAddr Start: %X VEND: %X", *_PROGRAM_COUNTER, m_FastTlb[FastIndx + 1].VSTART, m_FastTlb[FastIndx + 1].VEND);
return; return;
} }
} }

View File

@ -180,7 +180,7 @@ void CN64System::ExternalEvent(SystemEvent action)
} }
break; break;
default: default:
WriteTraceF(TraceError, __FUNCTION__ ": Unknown event %d", action); WriteTrace(TraceN64System, TraceError, "Unknown event %d", action);
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }
} }
@ -194,22 +194,22 @@ bool CN64System::RunFileImage(const char * FileLoc)
} }
//Mark the rom as loading //Mark the rom as loading
WriteTrace(TraceDebug, __FUNCTION__ ": Mark Rom as loading"); WriteTrace(TraceN64System, TraceDebug, "Mark Rom as loading");
g_Settings->SaveString(Game_File, ""); g_Settings->SaveString(Game_File, "");
g_Settings->SaveBool(GameRunning_LoadingInProgress, true); g_Settings->SaveBool(GameRunning_LoadingInProgress, true);
//Try to load the passed N64 rom //Try to load the passed N64 rom
if (g_Rom == NULL) if (g_Rom == NULL)
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": Allocating global rom object"); WriteTrace(TraceN64System, TraceDebug, "Allocating global rom object");
g_Rom = new CN64Rom(); g_Rom = new CN64Rom();
} }
else else
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": Use existing global rom object"); WriteTrace(TraceN64System, TraceDebug, "Use existing global rom object");
} }
WriteTraceF(TraceDebug, __FUNCTION__ ": Loading \"%s\"", FileLoc); WriteTrace(TraceN64System, TraceDebug, "Loading \"%s\"", FileLoc);
if (g_Rom->LoadN64Image(FileLoc)) if (g_Rom->LoadN64Image(FileLoc))
{ {
g_System->RefreshGameSettings(); g_System->RefreshGameSettings();
@ -228,7 +228,7 @@ bool CN64System::RunFileImage(const char * FileLoc)
} }
else else
{ {
WriteTraceF(TraceError, __FUNCTION__ ": LoadN64Image failed (\"%s\")", FileLoc); WriteTrace(TraceN64System, TraceError, "LoadN64Image failed (\"%s\")", FileLoc);
g_Notify->DisplayError(g_Rom->GetError()); g_Notify->DisplayError(g_Rom->GetError());
delete g_Rom; delete g_Rom;
g_Rom = NULL; g_Rom = NULL;
@ -252,18 +252,18 @@ bool CN64System::EmulationStarting(void * hThread, uint32_t ThreadId)
{ {
bool bRes = true; bool bRes = true;
WriteTrace(TraceDebug, __FUNCTION__ ": Setting N64 system as active"); WriteTrace(TraceN64System, TraceDebug, "Setting N64 system as active");
if (g_BaseSystem->SetActiveSystem(true)) if (g_BaseSystem->SetActiveSystem(true))
{ {
g_BaseSystem->m_CPU_Handle = hThread; g_BaseSystem->m_CPU_Handle = hThread;
g_BaseSystem->m_CPU_ThreadID = ThreadId; g_BaseSystem->m_CPU_ThreadID = ThreadId;
WriteTrace(TraceDebug, __FUNCTION__ ": Setting up N64 system done"); WriteTrace(TraceN64System, TraceDebug, "Setting up N64 system done");
g_Settings->SaveBool(GameRunning_LoadingInProgress, false); g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
try try
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": Game set to auto start, starting"); WriteTrace(TraceN64System, TraceDebug, "Game set to auto start, starting");
g_BaseSystem->StartEmulation2(false); g_BaseSystem->StartEmulation2(false);
WriteTrace(TraceDebug, __FUNCTION__ ": Game Done"); WriteTrace(TraceN64System, TraceDebug, "Game Done");
} }
catch (...) catch (...)
{ {
@ -272,7 +272,7 @@ bool CN64System::EmulationStarting(void * hThread, uint32_t ThreadId)
} }
else else
{ {
WriteTrace(TraceError, __FUNCTION__ ": SetActiveSystem failed"); WriteTrace(TraceN64System, TraceError, "SetActiveSystem failed");
g_Notify->DisplayError(__FUNCTIONW__ L": Failed to Initialize N64 System"); g_Notify->DisplayError(__FUNCTIONW__ L": Failed to Initialize N64 System");
g_Settings->SaveBool(GameRunning_LoadingInProgress, false); g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
bRes = false; bRes = false;
@ -284,7 +284,7 @@ void CN64System::StartEmulation2(bool NewThread)
{ {
if (NewThread) if (NewThread)
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": Starting"); WriteTrace(TraceN64System, TraceDebug, "Starting");
if (bHaveDebugger()) if (bHaveDebugger())
{ {
StartLog(); StartLog();
@ -552,13 +552,13 @@ bool CN64System::SetActiveSystem(bool bActive)
if (bInitPlugin) if (bInitPlugin)
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": Reseting Plugins"); WriteTrace(TraceN64System, TraceDebug, "Reseting Plugins");
g_Notify->DisplayMessage(5, MSG_PLUGIN_INIT); g_Notify->DisplayMessage(5, MSG_PLUGIN_INIT);
m_Plugins->CreatePlugins(); m_Plugins->CreatePlugins();
bRes = m_Plugins->Initiate(this); bRes = m_Plugins->Initiate(this);
if (!bRes) if (!bRes)
{ {
WriteTrace(TraceError, __FUNCTION__ ": g_Plugins->Initiate Failed"); WriteTrace(TraceN64System, TraceError, "g_Plugins->Initiate Failed");
} }
} }
@ -1238,7 +1238,7 @@ void CN64System::DumpSyncErrors(CN64System * SecondCPU)
bool CN64System::SaveState() bool CN64System::SaveState()
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": Start"); WriteTrace(TraceN64System, TraceDebug, "Start");
// if (!m_SystemTimer.SaveAllowed()) { return false; } // if (!m_SystemTimer.SaveAllowed()) { return false; }
if ((m_Reg.STATUS_REGISTER & STATUS_EXL) != 0) { return false; } if ((m_Reg.STATUS_REGISTER & STATUS_EXL) != 0) { return false; }
@ -1393,7 +1393,7 @@ bool CN64System::SaveState()
g_Notify->DisplayMessage(5, stdwstr_f(L"%ws %ws", SaveMessage.c_str(), stdstr(SavedFileName.GetNameExtension()).ToUTF16().c_str()).c_str()); g_Notify->DisplayMessage(5, stdwstr_f(L"%ws %ws", SaveMessage.c_str(), stdstr(SavedFileName.GetNameExtension()).ToUTF16().c_str()).c_str());
//Notify().RefreshMenu(); //Notify().RefreshMenu();
WriteTrace(TraceDebug, __FUNCTION__ ": Done"); WriteTrace(TraceN64System, TraceDebug, "Done");
return true; return true;
} }
@ -1449,7 +1449,7 @@ bool CN64System::LoadState(const char * FileName)
old_width = g_Reg->VI_WIDTH_REG; old_width = g_Reg->VI_WIDTH_REG;
old_dacrate = g_Reg->AI_DACRATE_REG; old_dacrate = g_Reg->AI_DACRATE_REG;
WriteTraceF((TraceType)(TraceDebug | TraceRecompiler), __FUNCTION__ "(%s): Start", FileName); WriteTrace(TraceN64System, TraceDebug, "(%s): Start", FileName);
char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT]; char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
_splitpath(FileName, drive, dir, fname, ext); _splitpath(FileName, drive, dir, fname, ext);
@ -1646,25 +1646,25 @@ bool CN64System::LoadState(const char * FileName)
m_Reg.RANDOM_REGISTER += 32 - m_Reg.WIRED_REGISTER; m_Reg.RANDOM_REGISTER += 32 - m_Reg.WIRED_REGISTER;
} }
//Fix up timer //Fix up timer
WriteTrace(TraceDebug, __FUNCTION__ ": 2"); WriteTrace(TraceN64System, TraceDebug, "2");
m_SystemTimer.SetTimer(CSystemTimer::CompareTimer, m_Reg.COMPARE_REGISTER - m_Reg.COUNT_REGISTER, false); m_SystemTimer.SetTimer(CSystemTimer::CompareTimer, m_Reg.COMPARE_REGISTER - m_Reg.COUNT_REGISTER, false);
m_SystemTimer.SetTimer(CSystemTimer::ViTimer, NextVITimer, false); m_SystemTimer.SetTimer(CSystemTimer::ViTimer, NextVITimer, false);
m_Reg.FixFpuLocations(); m_Reg.FixFpuLocations();
WriteTrace(TraceDebug, __FUNCTION__ ": 5"); WriteTrace(TraceN64System, TraceDebug, "5");
m_TLB.Reset(false); m_TLB.Reset(false);
WriteTrace(TraceDebug, __FUNCTION__ ": 6"); WriteTrace(TraceN64System, TraceDebug, "6");
m_CPU_Usage.ResetCounters(); m_CPU_Usage.ResetCounters();
WriteTrace(TraceDebug, __FUNCTION__ ": 7"); WriteTrace(TraceN64System, TraceDebug, "7");
m_Profile.ResetCounters(); m_Profile.ResetCounters();
WriteTrace(TraceDebug, __FUNCTION__ ": 8"); WriteTrace(TraceN64System, TraceDebug, "8");
m_FPS.Reset(true); m_FPS.Reset(true);
WriteTrace(TraceDebug, __FUNCTION__ ": 9"); WriteTrace(TraceN64System, TraceDebug, "9");
if (bLogX86Code()) if (bLogX86Code())
{ {
Stop_x86_Log(); Stop_x86_Log();
Start_x86_Log(); Start_x86_Log();
} }
WriteTrace(TraceDebug, __FUNCTION__ ": Done"); WriteTrace(TraceN64System, TraceDebug, "Done");
#ifdef TEST_SP_TRACKING #ifdef TEST_SP_TRACKING
m_CurrentSP = GPR[29].UW[0]; m_CurrentSP = GPR[29].UW[0];
@ -1685,10 +1685,10 @@ bool CN64System::LoadState(const char * FileName)
SyncCPU(m_SyncCPU); SyncCPU(m_SyncCPU);
} }
} }
WriteTrace(TraceDebug, __FUNCTION__ ": 13"); WriteTrace(TraceN64System, TraceDebug, "13");
std::wstring LoadMsg = g_Lang->GetString(MSG_LOADED_STATE); std::wstring LoadMsg = g_Lang->GetString(MSG_LOADED_STATE);
g_Notify->DisplayMessage(5, stdwstr_f(L"%ws %ws", LoadMsg.c_str(), stdstr(CPath(FileNameStr).GetNameExtension()).ToUTF16().c_str()).c_str()); g_Notify->DisplayMessage(5, stdwstr_f(L"%ws %ws", LoadMsg.c_str(), stdstr(CPath(FileNameStr).GetNameExtension()).ToUTF16().c_str()).c_str());
WriteTrace(TraceDebug, __FUNCTION__ ": Done"); WriteTrace(TraceN64System, TraceDebug, "Done");
return true; return true;
} }
@ -1699,7 +1699,7 @@ void CN64System::DisplayRSPListCount()
void CN64System::RunRSP() void CN64System::RunRSP()
{ {
WriteTraceF(TraceRSP, __FUNCTION__ ": Start (SP Status %X)", m_Reg.SP_STATUS_REG); WriteTrace(TraceRSP, TraceDebug, "Start (SP Status %X)", m_Reg.SP_STATUS_REG);
if ((m_Reg.SP_STATUS_REG & SP_STATUS_HALT) == 0) if ((m_Reg.SP_STATUS_REG & SP_STATUS_HALT) == 0)
{ {
if ((m_Reg.SP_STATUS_REG & SP_STATUS_BROKE) == 0) if ((m_Reg.SP_STATUS_REG & SP_STATUS_BROKE) == 0)
@ -1712,23 +1712,23 @@ void CN64System::RunRSP()
g_MMU->LW_VAddr(0xA4000FC0, Task); g_MMU->LW_VAddr(0xA4000FC0, Task);
if (Task == 1 && (m_Reg.DPC_STATUS_REG & DPC_STATUS_FREEZE) != 0) if (Task == 1 && (m_Reg.DPC_STATUS_REG & DPC_STATUS_FREEZE) != 0)
{ {
WriteTrace(TraceRSP, __FUNCTION__ ": Dlist that is frozen"); WriteTrace(TraceRSP, TraceDebug, "Dlist that is frozen");
return; return;
} }
switch (Task) switch (Task)
{ {
case 1: case 1:
WriteTrace(TraceRSP, __FUNCTION__ ": *** Display list ***"); WriteTrace(TraceRSP, TraceDebug, "*** Display list ***");
m_DlistCount += 1; m_DlistCount += 1;
m_FPS.UpdateDlCounter(); m_FPS.UpdateDlCounter();
break; break;
case 2: case 2:
WriteTrace(TraceRSP, __FUNCTION__ ": *** Audio list ***"); WriteTrace(TraceRSP, TraceDebug, "*** Audio list ***");
m_AlistCount += 1; m_AlistCount += 1;
break; break;
default: default:
WriteTrace(TraceRSP, __FUNCTION__ ": *** Unknown list ***"); WriteTrace(TraceRSP, TraceDebug, "*** Unknown list ***");
m_UnknownCount += 1; m_UnknownCount += 1;
break; break;
} }
@ -1750,13 +1750,13 @@ void CN64System::RunRSP()
__try __try
{ {
WriteTrace(TraceRSP, __FUNCTION__ ": do cycles - starting"); WriteTrace(TraceRSP, TraceDebug, "do cycles - starting");
g_Plugins->RSP()->DoRspCycles(100); g_Plugins->RSP()->DoRspCycles(100);
WriteTrace(TraceRSP, __FUNCTION__ ": do cycles - Done"); WriteTrace(TraceRSP, TraceDebug, "do cycles - Done");
} }
__except (g_MMU->MemoryFilter(GetExceptionCode(), GetExceptionInformation())) __except (g_MMU->MemoryFilter(GetExceptionCode(), GetExceptionInformation()))
{ {
WriteTrace(TraceError, __FUNCTION__ ": exception generated"); WriteTrace(TraceRSP, TraceError, "exception generated");
g_Notify->FatalError(__FUNCTIONW__ L"\nUnknown memory action\n\nEmulation stop"); g_Notify->FatalError(__FUNCTIONW__ L"\nUnknown memory action\n\nEmulation stop");
} }
@ -1779,11 +1779,11 @@ void CN64System::RunRSP()
{ {
m_RspBroke = true; m_RspBroke = true;
} }
WriteTrace(TraceRSP, __FUNCTION__ ": check interrupts"); WriteTrace(TraceRSP, TraceDebug, "check interrupts");
g_Reg->CheckInterrupts(); g_Reg->CheckInterrupts();
} }
} }
WriteTraceF(TraceRSP, __FUNCTION__ ": Done (SP Status %X)", m_Reg.SP_STATUS_REG); WriteTrace(TraceRSP, TraceDebug, "Done (SP Status %X)", m_Reg.SP_STATUS_REG);
} }
void CN64System::SyncToAudio() void CN64System::SyncToAudio()
@ -1800,7 +1800,7 @@ void CN64System::SyncToAudio()
{ {
if (g_Reg->m_AudioIntrReg != 0) if (g_Reg->m_AudioIntrReg != 0)
{ {
WriteTraceF(TraceAudio, __FUNCTION__ ": Audio Interrupt done (%d)", i); WriteTrace(TraceAudio, TraceDebug, "Audio Interrupt done (%d)", i);
break; break;
} }
pjutil::Sleep(1); pjutil::Sleep(1);
@ -1854,14 +1854,13 @@ void CN64System::RefreshScreen()
__try __try
{ {
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": Starting"); WriteTrace(TraceGFXPlugin, TraceDebug, "Starting");
g_Plugins->Gfx()->UpdateScreen(); g_Plugins->Gfx()->UpdateScreen();
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": Done"); WriteTrace(TraceGFXPlugin, TraceDebug, "Done");
} }
__except (g_MMU->MemoryFilter(GetExceptionCode(), GetExceptionInformation())) __except (g_MMU->MemoryFilter(GetExceptionCode(), GetExceptionInformation()))
{ {
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": Exception caught"); WriteTrace(TraceGFXPlugin, TraceError, "Exception caught");
WriteTrace(TraceError, __FUNCTION__ ": Exception caught");
} }
g_MMU->UpdateFieldSerration((m_Reg.VI_STATUS_REG & 0x40) != 0); g_MMU->UpdateFieldSerration((m_Reg.VI_STATUS_REG & 0x40) != 0);
@ -1912,7 +1911,7 @@ void CN64System::RefreshScreen()
bool CN64System::WriteToProtectedMemory(uint32_t Address, int length) bool CN64System::WriteToProtectedMemory(uint32_t Address, int length)
{ {
WriteTraceF(TraceDebug, __FUNCTION__ ": Address: %X Len: %d", Address, length); WriteTrace(TraceN64System, TraceDebug, "Address: %X Len: %d", Address, length);
if (m_Recomp) if (m_Recomp)
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
@ -1943,4 +1942,4 @@ void CN64System::TLB_Changed()
{ {
g_Debugger->TLBChanged(); g_Debugger->TLBChanged();
} }
} }

View File

@ -377,7 +377,7 @@ void CCodeSection::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo &Exi
ExitCodeBlock(); ExitCodeBlock();
break; break;
default: default:
WriteTraceF(TraceError, __FUNCTION__ ": how did you want to exit on reason (%d) ???", reason); WriteTrace(TraceRecompiler, TraceError, "how did you want to exit on reason (%d) ???", reason);
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }
} }
@ -2145,7 +2145,7 @@ bool CCodeSection::InheritParentInfo()
} }
break; break;
default: default:
WriteTraceF(TraceError, __FUNCTION__ ": Unhandled Reg state %d\nin InheritParentInfo", GetMipsRegState(i2)); WriteTrace(TraceRecompiler, TraceError, "Unhandled Reg state %d\nin InheritParentInfo", GetMipsRegState(i2));
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }
} }

View File

@ -15,8 +15,8 @@
#include <Windows.h> #include <Windows.h>
CFunctionMap::CFunctionMap() : CFunctionMap::CFunctionMap() :
m_JumpTable(NULL), m_JumpTable(NULL),
m_FunctionTable(NULL) m_FunctionTable(NULL)
{ {
} }
@ -32,7 +32,7 @@ bool CFunctionMap::AllocateMemory()
m_FunctionTable = (PCCompiledFunc_TABLE *)VirtualAlloc(NULL, 0xFFFFF * sizeof(CCompiledFunc *), MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); m_FunctionTable = (PCCompiledFunc_TABLE *)VirtualAlloc(NULL, 0xFFFFF * sizeof(CCompiledFunc *), MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
if (m_FunctionTable == NULL) if (m_FunctionTable == NULL)
{ {
WriteTrace(TraceError, __FUNCTION__ ": failed to allocate function table"); WriteTrace(TraceRecompiler, TraceError, "failed to allocate function table");
g_Notify->FatalError(MSG_MEM_ALLOC_ERROR); g_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
return false; return false;
} }
@ -43,7 +43,7 @@ bool CFunctionMap::AllocateMemory()
m_JumpTable = new PCCompiledFunc[g_MMU->RdramSize() >> 2]; m_JumpTable = new PCCompiledFunc[g_MMU->RdramSize() >> 2];
if (m_JumpTable == NULL) if (m_JumpTable == NULL)
{ {
WriteTrace(TraceError, __FUNCTION__ ": failed to allocate jump table"); WriteTrace(TraceRecompiler, TraceError, "failed to allocate jump table");
g_Notify->FatalError(MSG_MEM_ALLOC_ERROR); g_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
return false; return false;
} }
@ -80,4 +80,4 @@ void CFunctionMap::Reset(bool bAllocate)
{ {
AllocateMemory(); AllocateMemory();
} }
} }

View File

@ -43,12 +43,12 @@ void CRecompiler::Run()
if (!CRecompMemory::AllocateMemory()) if (!CRecompMemory::AllocateMemory())
{ {
WriteTrace(TraceError, __FUNCTION__ ": AllocateMemory failed"); WriteTrace(TraceRecompiler, TraceError, "AllocateMemory failed");
return; return;
} }
if (!CFunctionMap::AllocateMemory()) if (!CFunctionMap::AllocateMemory())
{ {
WriteTrace(TraceError, __FUNCTION__ ": AllocateMemory failed"); WriteTrace(TraceRecompiler, TraceError, "AllocateMemory failed");
return; return;
} }
m_EndEmulation = false; m_EndEmulation = false;
@ -145,13 +145,13 @@ void CRecompiler::RecompilerMain_VirtualTable()
table = new PCCompiledFunc[(0x1000 >> 2)]; table = new PCCompiledFunc[(0x1000 >> 2)];
if (table == NULL) if (table == NULL)
{ {
WriteTrace(TraceError, __FUNCTION__ ": failed to allocate PCCompiledFunc"); WriteTrace(TraceRecompiler, TraceError, "failed to allocate PCCompiledFunc");
g_Notify->FatalError(MSG_MEM_ALLOC_ERROR); g_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
} }
memset(table, 0, sizeof(PCCompiledFunc) * (0x1000 >> 2)); memset(table, 0, sizeof(PCCompiledFunc) * (0x1000 >> 2));
if (g_System->bSMM_Protect()) if (g_System->bSMM_Protect())
{ {
WriteTraceF(TraceError, __FUNCTION__ ": Create Table (%X): Index = %d", table, PC >> 0xC); WriteTrace(TraceRecompiler, TraceError, "Create Table (%X): Index = %d", table, PC >> 0xC);
g_MMU->ProtectMemory(PC & ~0xFFF, PC | 0xFFF); g_MMU->ProtectMemory(PC & ~0xFFF, PC | 0xFFF);
} }
} }
@ -905,7 +905,7 @@ CCompiledFunc * CRecompiler::CompilerCode()
uint32_t pAddr = 0; uint32_t pAddr = 0;
if (!g_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, pAddr)) if (!g_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, pAddr))
{ {
WriteTraceF(TraceError, __FUNCTION__ ": Failed to translate %X", PROGRAM_COUNTER); WriteTrace(TraceRecompiler, TraceError, "Failed to translate %X", PROGRAM_COUNTER);
return NULL; return NULL;
} }
@ -930,7 +930,7 @@ CCompiledFunc * CRecompiler::CompilerCode()
CheckRecompMem(); CheckRecompMem();
//uint32_t StartTime = timeGetTime(); //uint32_t StartTime = timeGetTime();
WriteTraceF(TraceRecompiler, __FUNCTION__ ": Compile Block-Start: Program Counter: %X pAddr: %X", PROGRAM_COUNTER, pAddr); WriteTrace(TraceRecompiler, TraceDebug, ": Compile Block-Start: Program Counter: %X pAddr: %X", PROGRAM_COUNTER, pAddr);
CCodeBlock CodeBlock(PROGRAM_COUNTER, RecompPos()); CCodeBlock CodeBlock(PROGRAM_COUNTER, RecompPos());
if (!CodeBlock.Compile()) if (!CodeBlock.Compile())
@ -966,7 +966,7 @@ void CRecompiler::ClearRecompCode_Phys(uint32_t Address, int length, REMOVE_REAS
uint32_t VAddr, Index = 0; uint32_t VAddr, Index = 0;
while (g_TLB->PAddrToVAddr(Address, VAddr, Index)) while (g_TLB->PAddrToVAddr(Address, VAddr, Index))
{ {
WriteTraceF(TraceRecompiler, __FUNCTION__ ": ClearRecompCode Vaddr %X len: %d", VAddr, length); WriteTrace(TraceRecompiler, TraceDebug, "ClearRecompCode Vaddr %X len: %d", VAddr, length);
ClearRecompCode_Virt(VAddr, length, Reason); ClearRecompCode_Virt(VAddr, length, Reason);
} }
} }
@ -981,7 +981,7 @@ void CRecompiler::ClearRecompCode_Phys(uint32_t Address, int length, REMOVE_REAS
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
ClearLen = g_System->RdramSize() - Address; ClearLen = g_System->RdramSize() - Address;
} }
WriteTraceF(TraceRecompiler, __FUNCTION__ ": Reseting Jump Table, Addr: %X len: %d", Address, ClearLen); WriteTrace(TraceRecompiler, TraceDebug, "Reseting Jump Table, Addr: %X len: %d", Address, ClearLen);
memset((uint8_t *)JumpTable() + Address, 0, ClearLen); memset((uint8_t *)JumpTable() + Address, 0, ClearLen);
if (g_System->bSMM_Protect()) if (g_System->bSMM_Protect())
{ {
@ -990,7 +990,7 @@ void CRecompiler::ClearRecompCode_Phys(uint32_t Address, int length, REMOVE_REAS
} }
else else
{ {
WriteTraceF(TraceRecompiler, __FUNCTION__ ": Ignoring reset of Jump Table, Addr: %X len: %d", Address, ((length + 3) & ~3)); WriteTrace(TraceRecompiler, TraceDebug, "Ignoring reset of Jump Table, Addr: %X len: %d", Address, ((length + 3) & ~3));
} }
} }
} }
@ -1012,7 +1012,7 @@ void CRecompiler::ClearRecompCode_Virt(uint32_t Address, int length, REMOVE_REAS
PCCompiledFunc_TABLE & table = FunctionTable()[AddressIndex]; PCCompiledFunc_TABLE & table = FunctionTable()[AddressIndex];
if (table) if (table)
{ {
WriteTraceF(TraceError, __FUNCTION__ ": Delete Table (%X): Index = %d", table, AddressIndex); WriteTrace(TraceRecompiler, TraceError, "Delete Table (%X): Index = %d", table, AddressIndex);
delete table; delete table;
table = NULL; table = NULL;
g_MMU->UnProtectMemory(Address, Address + length); g_MMU->UnProtectMemory(Address, Address + length);
@ -1058,7 +1058,7 @@ void CRecompiler::ResetMemoryStackPos()
} }
else else
{ {
WriteTraceF(TraceError, __FUNCTION__ ": Failed to translate SP address (%s)", m_Registers.m_GPR[29].UW[0]); WriteTrace(TraceRecompiler, TraceError, "Failed to translate SP address (%s)", m_Registers.m_GPR[29].UW[0]);
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }
} }

View File

@ -36,7 +36,7 @@ bool CRecompMemory::AllocateMemory()
uint8_t * RecompCodeBase = (uint8_t *)VirtualAlloc(NULL, MaxCompileBufferSize + 4, MEM_RESERVE | MEM_TOP_DOWN, PAGE_EXECUTE_READWRITE); uint8_t * RecompCodeBase = (uint8_t *)VirtualAlloc(NULL, MaxCompileBufferSize + 4, MEM_RESERVE | MEM_TOP_DOWN, PAGE_EXECUTE_READWRITE);
if (RecompCodeBase == NULL) if (RecompCodeBase == NULL)
{ {
WriteTrace(TraceError, __FUNCTION__ ": failed to allocate RecompCodeBase"); WriteTrace(TraceRecompiler, TraceError, "failed to allocate RecompCodeBase");
g_Notify->DisplayError(MSG_MEM_ALLOC_ERROR); g_Notify->DisplayError(MSG_MEM_ALLOC_ERROR);
return false; return false;
} }
@ -44,7 +44,7 @@ bool CRecompMemory::AllocateMemory()
m_RecompCode = (uint8_t *)VirtualAlloc(RecompCodeBase, InitialCompileBufferSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE); m_RecompCode = (uint8_t *)VirtualAlloc(RecompCodeBase, InitialCompileBufferSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
if (m_RecompCode == NULL) if (m_RecompCode == NULL)
{ {
WriteTrace(TraceError, __FUNCTION__ ": failed to commit initial buffer"); WriteTrace(TraceRecompiler, TraceError, "failed to commit initial buffer");
VirtualFree(RecompCodeBase, 0, MEM_RELEASE); VirtualFree(RecompCodeBase, 0, MEM_RELEASE);
g_Notify->DisplayError(MSG_MEM_ALLOC_ERROR); g_Notify->DisplayError(MSG_MEM_ALLOC_ERROR);
return false; return false;
@ -70,7 +70,7 @@ void CRecompMemory::CheckRecompMem()
LPVOID MemAddr = VirtualAlloc(m_RecompCode + m_RecompSize, IncreaseCompileBufferSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE); LPVOID MemAddr = VirtualAlloc(m_RecompCode + m_RecompSize, IncreaseCompileBufferSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
if (MemAddr == NULL) if (MemAddr == NULL)
{ {
WriteTrace(TraceError, __FUNCTION__ ": failed to increase buffer"); WriteTrace(TraceRecompiler, TraceError, "failed to increase buffer");
g_Notify->FatalError(MSG_MEM_ALLOC_ERROR); g_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
} }
m_RecompSize += IncreaseCompileBufferSize; m_RecompSize += IncreaseCompileBufferSize;

View File

@ -826,7 +826,7 @@ CX86Ops::x86Reg CRegInfo::Map_TempReg(CX86Ops::x86Reg Reg, int32_t MipsReg, bool
Reg = FreeX86Reg(); Reg = FreeX86Reg();
if (Reg == x86_Unknown) if (Reg == x86_Unknown)
{ {
WriteTrace(TraceError, __FUNCTION__ ": Failed to find a free register"); WriteTrace(TraceRegisterCache, TraceError, "Failed to find a free register");
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
return x86_Unknown; return x86_Unknown;
} }
@ -844,7 +844,7 @@ CX86Ops::x86Reg CRegInfo::Map_TempReg(CX86Ops::x86Reg Reg, int32_t MipsReg, bool
Reg = Free8BitX86Reg(); Reg = Free8BitX86Reg();
if (Reg < 0) if (Reg < 0)
{ {
WriteTrace(TraceError, __FUNCTION__ ": Failed to find a free 8 bit register"); WriteTrace(TraceRegisterCache, TraceError, "Failed to find a free 8 bit register");
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
return x86_Unknown; return x86_Unknown;
} }
@ -854,7 +854,7 @@ CX86Ops::x86Reg CRegInfo::Map_TempReg(CX86Ops::x86Reg Reg, int32_t MipsReg, bool
{ {
if (GetX86Protected(Reg)) if (GetX86Protected(Reg))
{ {
WriteTrace(TraceError, __FUNCTION__ ": Register is protected"); WriteTrace(TraceRegisterCache, TraceError, "Register is protected");
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
return x86_Unknown; return x86_Unknown;
} }

View File

@ -18,12 +18,12 @@
#include <Windows.h> #include <Windows.h>
CAudioPlugin::CAudioPlugin() : CAudioPlugin::CAudioPlugin() :
AiLenChanged(NULL), AiLenChanged(NULL),
AiReadLength(NULL), AiReadLength(NULL),
ProcessAList(NULL), ProcessAList(NULL),
m_hAudioThread(NULL), m_hAudioThread(NULL),
AiUpdate(NULL), AiUpdate(NULL),
AiDacrateChanged(NULL) AiDacrateChanged(NULL)
{ {
} }
@ -148,7 +148,7 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
{ {
if (m_hAudioThread) if (m_hAudioThread)
{ {
WriteTraceF(TraceAudio, __FUNCTION__ ": Terminate Audio Thread"); WriteTrace(TraceAudioPlugin, TraceDebug, "Terminate Audio Thread");
TerminateThread(m_hAudioThread, 0); TerminateThread(m_hAudioThread, 0);
} }
m_hAudioThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)AudioThread, (LPVOID)this, 0, &ThreadID); m_hAudioThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)AudioThread, (LPVOID)this, 0, &ThreadID);
@ -166,7 +166,7 @@ void CAudioPlugin::UnloadPluginDetails(void)
{ {
if (m_hAudioThread) if (m_hAudioThread)
{ {
WriteTraceF(TraceAudio, __FUNCTION__ ": Terminate Audio Thread"); WriteTrace(TraceAudioPlugin, TraceDebug, "Terminate Audio Thread");
TerminateThread(m_hAudioThread, 0); TerminateThread(m_hAudioThread, 0);
m_hAudioThread = NULL; m_hAudioThread = NULL;
} }
@ -180,21 +180,22 @@ void CAudioPlugin::UnloadPluginDetails(void)
void CAudioPlugin::DacrateChanged(SYSTEM_TYPE Type) void CAudioPlugin::DacrateChanged(SYSTEM_TYPE Type)
{ {
if (!Initialized()) { return; } if (!Initialized()) { return; }
WriteTraceF(TraceAudio, __FUNCTION__ ": SystemType: %s", Type == SYSTEM_NTSC ? "SYSTEM_NTSC" : "SYSTEM_PAL"); WriteTrace(TraceAudioPlugin, TraceDebug, "SystemType: %s", Type == SYSTEM_NTSC ? "SYSTEM_NTSC" : "SYSTEM_PAL");
//uint32_t Frequency = g_Reg->AI_DACRATE_REG * 30; //uint32_t Frequency = g_Reg->AI_DACRATE_REG * 30;
//uint32_t CountsPerSecond = (g_Reg->VI_V_SYNC_REG != 0 ? (g_Reg->VI_V_SYNC_REG + 1) * g_Settings->LoadDword(Game_ViRefreshRate) : 500000) * 60; //uint32_t CountsPerSecond = (g_Reg->VI_V_SYNC_REG != 0 ? (g_Reg->VI_V_SYNC_REG + 1) * g_Settings->LoadDword(Game_ViRefreshRate) : 500000) * 60;
AiDacrateChanged(Type); AiDacrateChanged(Type);
} }
void CAudioPlugin::AudioThread(CAudioPlugin * _this) { void CAudioPlugin::AudioThread(CAudioPlugin * _this)
{
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
if (g_Settings->LoadBool(Setting_CN64TimeCritical)) if (g_Settings->LoadBool(Setting_CN64TimeCritical))
{ {
SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_HIGHEST); SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
} }
for (;;) for (;;)
{ {
_this->AiUpdate(true); _this->AiUpdate(true);
} }
} }

View File

@ -120,13 +120,13 @@ bool CPlugin::Load(const char * FileName)
{ {
return false; return false;
} }
WriteTraceF(PluginTraceType(), __FUNCTION__ "(%s): Functions loaded", PluginType()); WriteTrace(PluginTraceType(), TraceDebug, "Functions loaded");
if (PluginOpened) if (PluginOpened)
{ {
WriteTraceF(PluginTraceType(), __FUNCTION__ "(%s): Before Plugin Opened", PluginType()); WriteTrace(PluginTraceType(), TraceDebug, "Before Plugin Opened");
PluginOpened(); PluginOpened();
WriteTraceF(PluginTraceType(), __FUNCTION__ "(%s): After Plugin Opened", PluginType()); WriteTrace(PluginTraceType(), TraceDebug, "After Plugin Opened");
} }
return true; return true;
} }
@ -134,13 +134,15 @@ bool CPlugin::Load(const char * FileName)
void CPlugin::RomOpened() void CPlugin::RomOpened()
{ {
if (m_RomOpen) if (m_RomOpen)
{
return; return;
}
if (RomOpen != NULL) if (RomOpen != NULL)
{ {
WriteTraceF(PluginTraceType(), __FUNCTION__ "(%s): Before Rom Open", PluginType()); WriteTrace(PluginTraceType(), TraceDebug, "Before Rom Open");
RomOpen(); RomOpen();
WriteTraceF(PluginTraceType(), __FUNCTION__ "(%s): After Rom Open", PluginType()); WriteTrace(PluginTraceType(), TraceDebug, "After Rom Open");
} }
m_RomOpen = true; m_RomOpen = true;
} }
@ -150,10 +152,10 @@ void CPlugin::RomClose()
if (!m_RomOpen) if (!m_RomOpen)
return; return;
WriteTraceF(PluginTraceType(), __FUNCTION__ "(%s): Before Rom Close", PluginType()); WriteTrace(PluginTraceType(), TraceDebug, "Before Rom Close");
RomClosed(); RomClosed();
m_RomOpen = false; m_RomOpen = false;
WriteTraceF(PluginTraceType(), __FUNCTION__ "(%s): After Rom Close", PluginType()); WriteTrace(PluginTraceType(), TraceDebug, "After Rom Close");
} }
void CPlugin::GameReset() void CPlugin::GameReset()
@ -170,19 +172,19 @@ void CPlugin::GameReset()
void CPlugin::Close() void CPlugin::Close()
{ {
WriteTraceF(PluginTraceType(), __FUNCTION__ "(%s): Start", PluginType()); WriteTrace(PluginTraceType(), TraceDebug, "(%s): Start", PluginType());
RomClose(); RomClose();
if (m_Initialized) if (m_Initialized)
{ {
CloseDLL(); CloseDLL();
m_Initialized = false; m_Initialized = false;
} }
WriteTraceF(PluginTraceType(), __FUNCTION__ "(%s): Done", PluginType()); WriteTrace(PluginTraceType(), TraceDebug, "(%s): Done", PluginType());
} }
void CPlugin::UnloadPlugin() void CPlugin::UnloadPlugin()
{ {
WriteTraceF(PluginTraceType(), __FUNCTION__ "(%s): unloading", PluginType()); WriteTrace(PluginTraceType(), TraceDebug, "(%s): unloading", PluginType());
memset(&m_PluginInfo, 0, sizeof(m_PluginInfo)); memset(&m_PluginInfo, 0, sizeof(m_PluginInfo));
if (m_hDll != NULL) if (m_hDll != NULL)
{ {
@ -214,16 +216,16 @@ const char * CPlugin::PluginType() const
return "Unknown"; return "Unknown";
} }
TraceType CPlugin::PluginTraceType() const TraceModuleProject64 CPlugin::PluginTraceType() const
{ {
switch (m_PluginInfo.Type) switch (m_PluginInfo.Type)
{ {
case PLUGIN_TYPE_RSP: return TraceRSP; case PLUGIN_TYPE_RSP: return TraceRSPPlugin;
case PLUGIN_TYPE_GFX: return TraceGfxPlugin; case PLUGIN_TYPE_GFX: return TraceGFXPlugin;
case PLUGIN_TYPE_AUDIO: return TraceDebug; case PLUGIN_TYPE_AUDIO: return TraceAudioPlugin;
case PLUGIN_TYPE_CONTROLLER: return TraceDebug; case PLUGIN_TYPE_CONTROLLER: return TraceControllerPlugin;
} }
return TraceDebug; return TraceUnknown;
} }
bool CPlugin::ValidPluginVersion(PLUGIN_INFO & PluginInfo) bool CPlugin::ValidPluginVersion(PLUGIN_INFO & PluginInfo)

View File

@ -11,6 +11,7 @@
#pragma once #pragma once
#include <Project64-core/Settings/DebugSettings.h> #include <Project64-core/Settings/DebugSettings.h>
#include <Project64-core/TraceModulesProject64.h>
#include "PluginClass.h" #include "PluginClass.h"
class CPlugin : class CPlugin :
@ -40,7 +41,7 @@ public:
protected: protected:
void UnloadPlugin(); void UnloadPlugin();
const char * PluginType() const; const char * PluginType() const;
TraceType PluginTraceType() const; TraceModuleProject64 PluginTraceType() const;
virtual void UnloadPluginDetails() = 0; virtual void UnloadPluginDetails() = 0;
virtual PLUGIN_TYPE type() = 0; virtual PLUGIN_TYPE type() = 0;
virtual bool LoadFunctions(void) = 0; virtual bool LoadFunctions(void) = 0;

View File

@ -84,7 +84,7 @@ void CPlugins::PluginChanged(CPlugins * _this)
} }
template <typename plugin_type> template <typename plugin_type>
static void LoadPlugin(SettingID PluginSettingID, SettingID PluginVerSettingID, plugin_type * & plugin, const char * PluginDir, stdstr & FileName, TraceType TraceLevel, const char * type) static void LoadPlugin(SettingID PluginSettingID, SettingID PluginVerSettingID, plugin_type * & plugin, const char * PluginDir, stdstr & FileName, TraceModuleProject64 TraceLevel, const char * type)
{ {
if (plugin != NULL) if (plugin != NULL)
{ {
@ -95,39 +95,39 @@ static void LoadPlugin(SettingID PluginSettingID, SettingID PluginVerSettingID,
plugin = new plugin_type(); plugin = new plugin_type();
if (plugin) if (plugin)
{ {
WriteTraceF(TraceLevel, __FUNCTION__ ": %s Loading (%s): Starting", type, (const char *)PluginFileName); WriteTrace(TraceLevel, TraceDebug, "%s Loading (%s): Starting", type, (const char *)PluginFileName);
if (plugin->Load(PluginFileName)) if (plugin->Load(PluginFileName))
{ {
WriteTraceF(TraceLevel, __FUNCTION__ ": %s Current Ver: %s", type, plugin->PluginName()); WriteTrace(TraceLevel, TraceDebug, "%s Current Ver: %s", type, plugin->PluginName());
g_Settings->SaveString(PluginVerSettingID, plugin->PluginName()); g_Settings->SaveString(PluginVerSettingID, plugin->PluginName());
} }
else else
{ {
WriteTraceF(TraceError, __FUNCTION__ ": Failed to load %s", (const char *)PluginFileName); WriteTrace(TraceError, TraceDebug, "Failed to load %s", (const char *)PluginFileName);
delete plugin; delete plugin;
plugin = NULL; plugin = NULL;
} }
WriteTraceF(TraceLevel, __FUNCTION__ ": %s Loading Done", type); WriteTrace(TraceLevel, TraceDebug, "%s Loading Done", type);
} }
else else
{ {
WriteTraceF(TraceError, __FUNCTION__ ": Failed to allocate %s plugin", type); WriteTrace(TraceError, TraceDebug, "Failed to allocate %s plugin", type);
} }
} }
void CPlugins::CreatePlugins(void) void CPlugins::CreatePlugins(void)
{ {
LoadPlugin(Game_Plugin_Gfx, Plugin_GFX_CurVer, m_Gfx, m_PluginDir.c_str(), m_GfxFile, TraceGfxPlugin, "GFX"); LoadPlugin(Game_Plugin_Gfx, Plugin_GFX_CurVer, m_Gfx, m_PluginDir.c_str(), m_GfxFile, TraceGFXPlugin, "GFX");
LoadPlugin(Game_Plugin_Audio, Plugin_AUDIO_CurVer, m_Audio, m_PluginDir.c_str(), m_AudioFile, TraceDebug, "Audio"); LoadPlugin(Game_Plugin_Audio, Plugin_AUDIO_CurVer, m_Audio, m_PluginDir.c_str(), m_AudioFile, TraceAudioPlugin, "Audio");
LoadPlugin(Game_Plugin_RSP, Plugin_RSP_CurVer, m_RSP, m_PluginDir.c_str(), m_RSPFile, TraceRSP, "RSP"); LoadPlugin(Game_Plugin_RSP, Plugin_RSP_CurVer, m_RSP, m_PluginDir.c_str(), m_RSPFile, TraceRSPPlugin, "RSP");
LoadPlugin(Game_Plugin_Controller, Plugin_CONT_CurVer, m_Control, m_PluginDir.c_str(), m_ControlFile, TraceDebug, "Control"); LoadPlugin(Game_Plugin_Controller, Plugin_CONT_CurVer, m_Control, m_PluginDir.c_str(), m_ControlFile, TraceControllerPlugin, "Control");
//Enable debugger //Enable debugger
if (m_RSP != NULL && m_RSP->EnableDebugging) if (m_RSP != NULL && m_RSP->EnableDebugging)
{ {
WriteTrace(TraceRSP, __FUNCTION__ ": EnableDebugging starting"); WriteTrace(TraceRSPPlugin, TraceInfo, "EnableDebugging starting");
m_RSP->EnableDebugging(bHaveDebugger()); m_RSP->EnableDebugging(bHaveDebugger());
WriteTrace(TraceRSP, __FUNCTION__ ": EnableDebugging done"); WriteTrace(TraceRSPPlugin, TraceInfo, "EnableDebugging done");
} }
} }
@ -157,9 +157,9 @@ void CPlugins::DestroyGfxPlugin(void)
{ {
return; return;
} }
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": before delete m_Gfx"); WriteTrace(TraceGFXPlugin, TraceInfo, "before delete m_Gfx");
delete m_Gfx; delete m_Gfx;
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": after delete m_Gfx"); WriteTrace(TraceGFXPlugin, TraceInfo, "after delete m_Gfx");
m_Gfx = NULL; m_Gfx = NULL;
// g_Settings->UnknownSetting_GFX = NULL; // g_Settings->UnknownSetting_GFX = NULL;
DestroyRspPlugin(); DestroyRspPlugin();
@ -171,15 +171,16 @@ void CPlugins::DestroyAudioPlugin(void)
{ {
return; return;
} }
WriteTrace(TraceDebug, __FUNCTION__ ": 5"); WriteTrace(TraceAudioPlugin, TraceDebug, "before close");
m_Audio->Close(); m_Audio->Close();
WriteTrace(TraceDebug, __FUNCTION__ ": 6"); WriteTrace(TraceAudioPlugin, TraceDebug, "before delete");
delete m_Audio; delete m_Audio;
WriteTrace(TraceDebug, __FUNCTION__ ": 7"); WriteTrace(TraceAudioPlugin, TraceDebug, "after delete");
m_Audio = NULL; m_Audio = NULL;
WriteTrace(TraceDebug, __FUNCTION__ ": 8"); WriteTrace(TraceAudioPlugin, TraceDebug, "before DestroyRspPlugin");
// g_Settings->UnknownSetting_AUDIO = NULL; // g_Settings->UnknownSetting_AUDIO = NULL;
DestroyRspPlugin(); DestroyRspPlugin();
WriteTrace(TraceAudioPlugin, TraceDebug, "after DestroyRspPlugin");
} }
void CPlugins::DestroyRspPlugin(void) void CPlugins::DestroyRspPlugin(void)
@ -188,13 +189,12 @@ void CPlugins::DestroyRspPlugin(void)
{ {
return; return;
} }
WriteTrace(TraceDebug, __FUNCTION__ ": 9"); WriteTrace(TraceRSPPlugin, TraceDebug, "before close");
m_RSP->Close(); m_RSP->Close();
WriteTrace(TraceDebug, __FUNCTION__ ": 10"); WriteTrace(TraceRSPPlugin, TraceDebug, "before delete");
delete m_RSP; delete m_RSP;
WriteTrace(TraceDebug, __FUNCTION__ ": 11");
m_RSP = NULL; m_RSP = NULL;
WriteTrace(TraceDebug, __FUNCTION__ ": 12"); WriteTrace(TraceRSPPlugin, TraceDebug, "after delete");
// g_Settings->UnknownSetting_RSP = NULL; // g_Settings->UnknownSetting_RSP = NULL;
} }
@ -204,13 +204,12 @@ void CPlugins::DestroyControlPlugin(void)
{ {
return; return;
} }
WriteTrace(TraceDebug, __FUNCTION__ ": 13"); WriteTrace(TraceControllerPlugin, TraceDebug, "before close");
m_Control->Close(); m_Control->Close();
WriteTrace(TraceDebug, __FUNCTION__ ": 14"); WriteTrace(TraceControllerPlugin, TraceDebug, "before delete");
delete m_Control; delete m_Control;
WriteTrace(TraceDebug, __FUNCTION__ ": 15");
m_Control = NULL; m_Control = NULL;
WriteTrace(TraceDebug, __FUNCTION__ ": 16"); WriteTrace(TraceControllerPlugin, TraceDebug, "after delete");
// g_Settings->UnknownSetting_CTRL = NULL; // g_Settings->UnknownSetting_CTRL = NULL;
} }
@ -238,26 +237,26 @@ void CPlugins::RomClosed(void)
bool CPlugins::Initiate(CN64System * System) bool CPlugins::Initiate(CN64System * System)
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": Start"); WriteTrace(TracePlugins, TraceDebug, "Start");
//Check to make sure we have the plugin available to be used //Check to make sure we have the plugin available to be used
if (m_Gfx == NULL) { return false; } if (m_Gfx == NULL) { return false; }
if (m_Audio == NULL) { return false; } if (m_Audio == NULL) { return false; }
if (m_RSP == NULL) { return false; } if (m_RSP == NULL) { return false; }
if (m_Control == NULL) { return false; } if (m_Control == NULL) { return false; }
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": Gfx Initiate Starting"); WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Starting");
if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; } if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; }
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": Gfx Initiate Done"); WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Done");
WriteTrace(TraceDebug, __FUNCTION__ ": Audio Initiate Starting"); WriteTrace(TraceAudioPlugin, TraceDebug, "Audio Initiate Starting");
if (!m_Audio->Initiate(System, m_MainWindow)) { return false; } if (!m_Audio->Initiate(System, m_MainWindow)) { return false; }
WriteTrace(TraceDebug, __FUNCTION__ ": Audio Initiate Done"); WriteTrace(TraceAudioPlugin, TraceDebug, "Audio Initiate Done");
WriteTrace(TraceDebug, __FUNCTION__ ": Control Initiate Starting"); WriteTrace(TraceControllerPlugin, TraceDebug, "Control Initiate Starting");
if (!m_Control->Initiate(System, m_MainWindow)) { return false; } if (!m_Control->Initiate(System, m_MainWindow)) { return false; }
WriteTrace(TraceDebug, __FUNCTION__ ": Control Initiate Done"); WriteTrace(TraceControllerPlugin, TraceDebug, "Control Initiate Done");
WriteTrace(TraceRSP, __FUNCTION__ ": RSP Initiate Starting"); WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Starting");
if (!m_RSP->Initiate(this, System)) { return false; } if (!m_RSP->Initiate(this, System)) { return false; }
WriteTrace(TraceRSP, __FUNCTION__ ": RSP Initiate Done"); WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Done");
WriteTrace(TraceDebug, __FUNCTION__ ": Done"); WriteTrace(TracePlugins, TraceDebug, "Done");
return true; return true;
} }
@ -268,7 +267,7 @@ bool CPlugins::ResetInUiThread(CN64System * System)
bool CPlugins::Reset(CN64System * System) bool CPlugins::Reset(CN64System * System)
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": Start"); WriteTrace(TracePlugins, TraceDebug, "Start");
bool bGfxChange = _stricmp(m_GfxFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str()) != 0; bool bGfxChange = _stricmp(m_GfxFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str()) != 0;
bool bAudioChange = _stricmp(m_AudioFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Audio).c_str()) != 0; bool bAudioChange = _stricmp(m_AudioFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Audio).c_str()) != 0;
@ -288,29 +287,29 @@ bool CPlugins::Reset(CN64System * System)
if (m_Gfx && bGfxChange) if (m_Gfx && bGfxChange)
{ {
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": Gfx Initiate Starting"); WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Starting");
if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; } if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; }
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": Gfx Initiate Done"); WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Done");
} }
if (m_Audio && bAudioChange) if (m_Audio && bAudioChange)
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": Audio Initiate Starting"); WriteTrace(TraceAudioPlugin, TraceDebug, "Audio Initiate Starting");
if (!m_Audio->Initiate(System, m_MainWindow)) { return false; } if (!m_Audio->Initiate(System, m_MainWindow)) { return false; }
WriteTrace(TraceDebug, __FUNCTION__ ": Audio Initiate Done"); WriteTrace(TraceAudioPlugin, TraceDebug, "Audio Initiate Done");
} }
if (m_Control && bContChange) if (m_Control && bContChange)
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": Control Initiate Starting"); WriteTrace(TraceControllerPlugin, TraceDebug, "Control Initiate Starting");
if (!m_Control->Initiate(System, m_MainWindow)) { return false; } if (!m_Control->Initiate(System, m_MainWindow)) { return false; }
WriteTrace(TraceDebug, __FUNCTION__ ": Control Initiate Done"); WriteTrace(TraceControllerPlugin, TraceDebug, "Control Initiate Done");
} }
if (m_RSP && bRspChange) if (m_RSP && bRspChange)
{ {
WriteTrace(TraceRSP, __FUNCTION__ ": RSP Initiate Starting"); WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Starting");
if (!m_RSP->Initiate(this, System)) { return false; } if (!m_RSP->Initiate(this, System)) { return false; }
WriteTrace(TraceRSP, __FUNCTION__ ": RSP Initiate Done"); WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Done");
} }
WriteTrace(TraceDebug, __FUNCTION__ ": Done"); WriteTrace(TracePlugins, TraceDebug, "Done");
return true; return true;
} }

View File

@ -200,6 +200,7 @@
<ClInclude Include="Settings\SettingType\SettingsType-TempNumber.h" /> <ClInclude Include="Settings\SettingType\SettingsType-TempNumber.h" />
<ClInclude Include="Settings\SettingType\SettingsType-TempString.h" /> <ClInclude Include="Settings\SettingType\SettingsType-TempString.h" />
<ClInclude Include="stdafx.h" /> <ClInclude Include="stdafx.h" />
<ClInclude Include="TraceModulesProject64.h" />
<ClInclude Include="Version.h" /> <ClInclude Include="Version.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -452,9 +452,6 @@
<ClInclude Include="N64System\ProfilingClass.h"> <ClInclude Include="N64System\ProfilingClass.h">
<Filter>Header Files\N64 System</Filter> <Filter>Header Files\N64 System</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="N64System\Speed LimitorClass.h">
<Filter>Header Files\N64 System</Filter>
</ClInclude>
<ClInclude Include="N64System\SystemGlobals.h"> <ClInclude Include="N64System\SystemGlobals.h">
<Filter>Header Files\N64 System</Filter> <Filter>Header Files\N64 System</Filter>
</ClInclude> </ClInclude>
@ -563,5 +560,11 @@
<ClInclude Include="Settings\SettingsClass.h"> <ClInclude Include="Settings\SettingsClass.h">
<Filter>Header Files\Settings</Filter> <Filter>Header Files\Settings</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="N64System\SpeedLimitorClass.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="TraceModulesProject64.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -12,13 +12,13 @@
#include "SettingsType-RomDatabase.h" #include "SettingsType-RomDatabase.h"
#include "SettingsType-RDBYesNo.h" #include "SettingsType-RDBYesNo.h"
CSettingTypeRDBYesNo::CSettingTypeRDBYesNo(const char * Name, SettingID DefaultSetting ) : CSettingTypeRDBYesNo::CSettingTypeRDBYesNo(const char * Name, SettingID DefaultSetting) :
CSettingTypeRomDatabase(Name,DefaultSetting) CSettingTypeRomDatabase(Name, DefaultSetting)
{ {
} }
CSettingTypeRDBYesNo::CSettingTypeRDBYesNo(const char * Name, int DefaultValue ) : CSettingTypeRDBYesNo::CSettingTypeRDBYesNo(const char * Name, int DefaultValue) :
CSettingTypeRomDatabase(Name,DefaultValue) CSettingTypeRomDatabase(Name, DefaultValue)
{ {
} }
@ -26,98 +26,99 @@ CSettingTypeRDBYesNo::~CSettingTypeRDBYesNo()
{ {
} }
bool CSettingTypeRDBYesNo::Load ( int Index, bool & Value ) const bool CSettingTypeRDBYesNo::Load(int Index, bool & Value) const
{ {
stdstr strValue; stdstr strValue;
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue); bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(), m_KeyName.c_str(), m_DefaultStr, strValue);
if (!bRes) if (!bRes)
{ {
LoadDefault(Index,Value); LoadDefault(Index, Value);
return false; return false;
} }
const char * String = strValue.c_str(); const char * String = strValue.c_str();
if (_stricmp(String,"Yes") == 0) if (_stricmp(String, "Yes") == 0)
{ {
Value = true; Value = true;
} }
else if (_stricmp(String,"No") == 0) else if (_stricmp(String, "No") == 0)
{ {
Value = false; Value = false;
} }
else if (_stricmp(String,"default") == 0) else if (_stricmp(String, "default") == 0)
{ {
LoadDefault(Index,Value); LoadDefault(Index, Value);
return false; return false;
} }
else else
{ {
WriteTraceF(TraceError,__FUNCTION__ ": Invalid Yes/No setting value (Section: %s Key: %s Value: %s)",m_SectionIdent->c_str(),String,m_KeyName.c_str(),strValue.c_str()); WriteTrace(TraceSettings, TraceError, "Invalid Yes/No setting value (Section: %s Key: %s Value: %s)", m_SectionIdent->c_str(), String, m_KeyName.c_str(), strValue.c_str());
LoadDefault(Index,Value); LoadDefault(Index, Value);
return false; return false;
} }
return true; return true;
} }
bool CSettingTypeRDBYesNo::Load ( int /*Index*/, uint32_t & /*Value*/ ) const bool CSettingTypeRDBYesNo::Load(int /*Index*/, uint32_t & /*Value*/) const
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
return false; return false;
} }
bool CSettingTypeRDBYesNo::Load ( int /*Index*/, stdstr & /*Value*/ ) const bool CSettingTypeRDBYesNo::Load(int /*Index*/, stdstr & /*Value*/) const
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
return false; return false;
} }
//return the default values //return the default values
void CSettingTypeRDBYesNo::LoadDefault ( int /*Index*/, bool & Value ) const void CSettingTypeRDBYesNo::LoadDefault(int /*Index*/, bool & Value) const
{ {
if (m_DefaultSetting != Default_None) if (m_DefaultSetting != Default_None)
{ {
if (m_DefaultSetting == Default_Constant) if (m_DefaultSetting == Default_Constant)
{ {
Value = m_DefaultValue != 0; Value = m_DefaultValue != 0;
} else { }
g_Settings->LoadBool(m_DefaultSetting,Value); else {
g_Settings->LoadBool(m_DefaultSetting, Value);
} }
} }
} }
void CSettingTypeRDBYesNo::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const void CSettingTypeRDBYesNo::LoadDefault(int /*Index*/, uint32_t & /*Value*/) const
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }
void CSettingTypeRDBYesNo::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const void CSettingTypeRDBYesNo::LoadDefault(int /*Index*/, stdstr & /*Value*/) const
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }
//Update the settings //Update the settings
void CSettingTypeRDBYesNo::Save ( int /*Index*/, bool Value ) void CSettingTypeRDBYesNo::Save(int /*Index*/, bool Value)
{ {
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),Value? "Yes" : "No"); m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), Value ? "Yes" : "No");
} }
void CSettingTypeRDBYesNo::Save ( int /*Index*/, uint32_t Value ) void CSettingTypeRDBYesNo::Save(int /*Index*/, uint32_t Value)
{ {
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),Value? "Yes" : "No"); m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), Value ? "Yes" : "No");
} }
void CSettingTypeRDBYesNo::Save ( int /*Index*/, const stdstr & /*Value*/ ) void CSettingTypeRDBYesNo::Save(int /*Index*/, const stdstr & /*Value*/)
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }
void CSettingTypeRDBYesNo::Save ( int /*Index*/, const char * /*Value*/ ) void CSettingTypeRDBYesNo::Save(int /*Index*/, const char * /*Value*/)
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }
void CSettingTypeRDBYesNo::Delete( int /*Index*/ ) void CSettingTypeRDBYesNo::Delete(int /*Index*/)
{ {
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL); m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), NULL);
} }

View File

@ -233,6 +233,26 @@ enum SettingID
Debugger_ShowDListAListCount, Debugger_ShowDListAListCount,
Debugger_ShowRecompMemSize, Debugger_ShowRecompMemSize,
//Trace
Debugger_TraceMD5,
Debugger_TraceSettings,
Debugger_TraceUnknown,
Debugger_TraceAppInit,
Debugger_TraceAppCleanup,
Debugger_TraceN64System,
Debugger_TracePlugins,
Debugger_TraceGFXPlugin,
Debugger_TraceAudioPlugin,
Debugger_TraceControllerPlugin,
Debugger_TraceRSPPlugin,
Debugger_TraceRSP,
Debugger_TraceAudio,
Debugger_TraceRegisterCache,
Debugger_TraceRecompiler,
Debugger_TraceTLB,
Debugger_TraceProtectedMEM,
Debugger_TraceUserInterface,
//Plugins //Plugins
Plugin_RSP_Current, Plugin_RSP_Current,
Plugin_RSP_CurVer, Plugin_RSP_CurVer,

View File

@ -31,7 +31,7 @@
#include "SettingType/SettingsType-TempBool.h" #include "SettingType/SettingsType-TempBool.h"
#include "SettingsClass.h" #include "SettingsClass.h"
#include "N64System/N64Types.h" #include "N64System/N64Types.h"
#include <Common/TraceDefs.h> #include <Common/Trace.h>
CSettings * g_Settings = NULL; CSettings * g_Settings = NULL;
@ -308,10 +308,29 @@ void CSettings::AddHowToHandleSetting()
AddHandler(Debugger_ShowRecompMemSize, new CSettingTypeApplication("Debugger", "Show Recompiler Memory size", false)); AddHandler(Debugger_ShowRecompMemSize, new CSettingTypeApplication("Debugger", "Show Recompiler Memory size", false));
AddHandler(Debugger_ShowDivByZero, new CSettingTypeApplication("Debugger", "Show Div by zero", false)); AddHandler(Debugger_ShowDivByZero, new CSettingTypeApplication("Debugger", "Show Div by zero", false));
AddHandler(Debugger_ProfileCode, new CSettingTypeApplication("Debugger", "Profile Code", (uint32_t)false)); AddHandler(Debugger_ProfileCode, new CSettingTypeApplication("Debugger", "Profile Code", (uint32_t)false));
AddHandler(Debugger_AppLogLevel, new CSettingTypeApplication("Logging", "Log Level", (uint32_t)TraceError));
AddHandler(Debugger_AppLogFlush, new CSettingTypeApplication("Logging", "Log Auto Flush", (uint32_t)false)); AddHandler(Debugger_AppLogFlush, new CSettingTypeApplication("Logging", "Log Auto Flush", (uint32_t)false));
AddHandler(Debugger_GenerateLogFiles, new CSettingTypeApplication("Debugger", "Generate Log Files", false)); AddHandler(Debugger_GenerateLogFiles, new CSettingTypeApplication("Debugger", "Generate Log Files", false));
//Logging
AddHandler(Debugger_TraceMD5, new CSettingTypeApplication("Logging", "MD5", (uint32_t)g_ModuleLogLevel[TraceMD5]));
AddHandler(Debugger_TraceSettings, new CSettingTypeApplication("Logging", "Settings", (uint32_t)g_ModuleLogLevel[TraceSettings]));
AddHandler(Debugger_TraceUnknown, new CSettingTypeApplication("Logging", "Unknown", (uint32_t)g_ModuleLogLevel[TraceUnknown]));
AddHandler(Debugger_TraceAppInit, new CSettingTypeApplication("Logging", "App Init", (uint32_t)g_ModuleLogLevel[TraceAppInit]));
AddHandler(Debugger_TraceAppCleanup, new CSettingTypeApplication("Logging", "App Cleanup", (uint32_t)g_ModuleLogLevel[TraceAppCleanup]));
AddHandler(Debugger_TraceN64System, new CSettingTypeApplication("Logging", "N64 System", (uint32_t)g_ModuleLogLevel[TraceN64System]));
AddHandler(Debugger_TracePlugins, new CSettingTypeApplication("Logging", "Plugins", (uint32_t)g_ModuleLogLevel[TracePlugins]));
AddHandler(Debugger_TraceGFXPlugin, new CSettingTypeApplication("Logging", "GFX Plugin", (uint32_t)g_ModuleLogLevel[TraceGFXPlugin]));
AddHandler(Debugger_TraceAudioPlugin, new CSettingTypeApplication("Logging", "Audio Plugin", (uint32_t)g_ModuleLogLevel[TraceAudioPlugin]));
AddHandler(Debugger_TraceControllerPlugin, new CSettingTypeApplication("Logging", "Controller Plugin", (uint32_t)g_ModuleLogLevel[TraceControllerPlugin]));
AddHandler(Debugger_TraceRSPPlugin, new CSettingTypeApplication("Logging", "RSP Plugin", (uint32_t)g_ModuleLogLevel[TraceRSPPlugin]));
AddHandler(Debugger_TraceRSP, new CSettingTypeApplication("Logging", "RSP", (uint32_t)g_ModuleLogLevel[TraceRSP]));
AddHandler(Debugger_TraceAudio, new CSettingTypeApplication("Logging", "Audio", (uint32_t)g_ModuleLogLevel[TraceAudio]));
AddHandler(Debugger_TraceRegisterCache, new CSettingTypeApplication("Logging", "Register Cache", (uint32_t)g_ModuleLogLevel[TraceRegisterCache]));
AddHandler(Debugger_TraceRecompiler, new CSettingTypeApplication("Logging", "Recompiler", (uint32_t)g_ModuleLogLevel[TraceRecompiler]));
AddHandler(Debugger_TraceTLB, new CSettingTypeApplication("Logging", "TLB", (uint32_t)g_ModuleLogLevel[TraceTLB]));
AddHandler(Debugger_TraceProtectedMEM, new CSettingTypeApplication("Logging", "Protected MEM", (uint32_t)g_ModuleLogLevel[TraceProtectedMem]));
AddHandler(Debugger_TraceUserInterface, new CSettingTypeApplication("Logging", "User Interface", (uint32_t)g_ModuleLogLevel[TraceUserInterface]));
//Plugin //Plugin
AddHandler(Plugin_RSP_Current, new CSettingTypeApplication("Plugin", "RSP Dll", "RSP\\RSP 1.7.dll")); AddHandler(Plugin_RSP_Current, new CSettingTypeApplication("Plugin", "RSP Dll", "RSP\\RSP 1.7.dll"));
AddHandler(Plugin_GFX_Current, new CSettingTypeApplication("Plugin", "Graphics Dll", "GFX\\Jabo_Direct3D8.dll")); AddHandler(Plugin_GFX_Current, new CSettingTypeApplication("Plugin", "Graphics Dll", "GFX\\Jabo_Direct3D8.dll"));

View File

@ -0,0 +1,24 @@
#pragma once
#include <Common/TraceModulesCommon.h>
enum TraceModuleProject64
{
TraceSettings = MaxTraceModuleCommon,
TraceUnknown,
TraceAppInit,
TraceAppCleanup,
TraceN64System,
TracePlugins,
TraceGFXPlugin,
TraceAudioPlugin,
TraceControllerPlugin,
TraceRSPPlugin,
TraceRSP,
TraceAudio,
TraceRegisterCache,
TraceRecompiler,
TraceTLB,
TraceProtectedMem,
TraceUserInterface,
MaxTraceModuleProject64,
};

View File

@ -1,8 +1,9 @@
#include <Common/stdtypes.h> #include <Common/stdtypes.h>
#include <Common/StdString.h> #include <Common/StdString.h>
#include <Common/TraceDefs.h> #include <Common/Trace.h>
#include "Multilanguage.h" #include "Multilanguage.h"
#include "Notification.h" #include "Notification.h"
#include "version.h" #include "version.h"
#include "Settings/SettingsClass.h" #include "Settings/SettingsClass.h"
#include "TraceModulesProject64.h"

View File

@ -47,7 +47,7 @@ public:
{ {
if (WaitForSingleObject(m_DialogThread, 5000) == WAIT_TIMEOUT) if (WaitForSingleObject(m_DialogThread, 5000) == WAIT_TIMEOUT)
{ {
WriteTrace(TraceError, "CDebugDialog - time out on close"); WriteTrace(TraceUserInterface, TraceError, "CDebugDialog - time out on close");
TerminateThread(m_DialogThread, 1); TerminateThread(m_DialogThread, 1);
} }
@ -69,7 +69,7 @@ public:
m_DialogThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)CreateDebuggerWindow, (LPVOID)this, 0, &ThreadID); m_DialogThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)CreateDebuggerWindow, (LPVOID)this, 0, &ThreadID);
if (WaitForSingleObject(m_CreatedEvent, 20000) == WAIT_TIMEOUT) if (WaitForSingleObject(m_CreatedEvent, 20000) == WAIT_TIMEOUT)
{ {
WriteTrace(TraceError, "Failed to get window create notification"); WriteTrace(TraceUserInterface, TraceError, "Failed to get window create notification");
} }
} }
} }

View File

@ -13,10 +13,10 @@
#include "DebuggerUI.h" #include "DebuggerUI.h"
CDebugMemoryView::CDebugMemoryView(CDebuggerUI * debugger) : CDebugMemoryView::CDebugMemoryView(CDebuggerUI * debugger) :
CDebugDialog<CDebugMemoryView>(debugger), CDebugDialog<CDebugMemoryView>(debugger),
m_MemoryList(NULL) m_MemoryList(NULL)
{ {
if (m_MemoryList== NULL) if (m_MemoryList == NULL)
{ {
m_MemoryList = new CListCtrl; m_MemoryList = new CListCtrl;
m_MemoryList->RegisterClass(); m_MemoryList->RegisterClass();
@ -209,14 +209,14 @@ LRESULT CDebugMemoryView::OnMemoryModified(LPNMHDR lpNMHDR)
{ {
if (!g_MMU->SB_VAddr(m_DataStartLoc + Pos, (BYTE)Value)) if (!g_MMU->SB_VAddr(m_DataStartLoc + Pos, (BYTE)Value))
{ {
WriteTraceF(TraceError, __FUNCTION__ ": failed to store at %X", m_DataStartLoc + Pos); WriteTrace(TraceUserInterface, TraceError, "failed to store at %X", m_DataStartLoc + Pos);
} }
} }
else else
{ {
if (!g_MMU->SB_PAddr(m_DataStartLoc + Pos, (BYTE)Value)) if (!g_MMU->SB_PAddr(m_DataStartLoc + Pos, (BYTE)Value))
{ {
WriteTraceF(TraceError, __FUNCTION__ ": failed to store at %X", m_DataStartLoc + Pos); WriteTrace(TraceUserInterface, TraceError, "failed to store at %X", m_DataStartLoc + Pos);
} }
} }
Insert_MemoryLineDump(LineNumber); Insert_MemoryLineDump(LineNumber);
@ -469,4 +469,4 @@ void CDebugMemoryView::RefreshMemory(bool ResetCompare)
{ {
Insert_MemoryLineDump(count); Insert_MemoryLineDump(count);
} }
} }

View File

@ -42,10 +42,10 @@ const CPluginList::PLUGIN * CPluginList::GetPluginInfo(int indx) const
bool CPluginList::LoadList() bool CPluginList::LoadList()
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": Start"); WriteTrace(TraceUserInterface, TraceDebug, "Start");
m_PluginList.clear(); m_PluginList.clear();
AddPluginFromDir(m_PluginDir); AddPluginFromDir(m_PluginDir);
WriteTrace(TraceDebug, __FUNCTION__ ": Done"); WriteTrace(TraceUserInterface, TraceDebug, "Done");
return true; return true;
} }
@ -72,14 +72,14 @@ void CPluginList::AddPluginFromDir(CPath Dir)
} }
//UINT LastErrorMode = SetErrorMode( SEM_FAILCRITICALERRORS ); //UINT LastErrorMode = SetErrorMode( SEM_FAILCRITICALERRORS );
WriteTraceF(TraceDebug, __FUNCTION__ ": loading %s", (LPCSTR)Dir); WriteTrace(TraceUserInterface, TraceDebug, "loading %s", (LPCSTR)Dir);
hLib = LoadLibrary(Dir); hLib = LoadLibrary(Dir);
//SetErrorMode(LastErrorMode); //SetErrorMode(LastErrorMode);
if (hLib == NULL) if (hLib == NULL)
{ {
DWORD LoadError = GetLastError(); DWORD LoadError = GetLastError();
WriteTraceF(TraceDebug, __FUNCTION__ ": failed to loadi %s (error: %d)", (LPCSTR)Dir, LoadError); WriteTrace(TraceUserInterface, TraceDebug, "failed to loadi %s (error: %d)", (LPCSTR)Dir, LoadError);
continue; continue;
} }
@ -114,4 +114,4 @@ void CPluginList::AddPluginFromDir(CPath Dir)
hLib = NULL; hLib = NULL;
} }
} }
} }

View File

@ -1,12 +1,10 @@
#include <windows.h> #include <windows.h>
#include <common/memtest.h> #include <common/memtest.h>
//#include "Support/CppSeh.h"
#include <common/CriticalSection.h> #include <common/CriticalSection.h>
#include <common/StdString.h> #include <common/StdString.h>
#include <common/FileClass.h> #include <common/FileClass.h>
#include <common/LogClass.h> #include <common/LogClass.h>
#include <common/TraceDefs.h>
#include <common/Trace.h> #include <common/Trace.h>
#include <common/path.h> #include <common/path.h>
#include <common/SmartPointer.h> #include <common/SmartPointer.h>

View File

@ -62,7 +62,7 @@ m_ResetInfo(NULL)
CMainGui::~CMainGui(void) CMainGui::~CMainGui(void)
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": Start"); WriteTrace(TraceUserInterface, TraceDebug, "Start");
if (m_bMainWindow) if (m_bMainWindow)
{ {
g_Settings->UnregisterChangeCB(RomBrowser_Enabled, this, (CSettings::SettingChangedFunc)RomBowserEnabledChanged); g_Settings->UnregisterChangeCB(RomBrowser_Enabled, this, (CSettings::SettingChangedFunc)RomBowserEnabledChanged);
@ -77,7 +77,7 @@ CMainGui::~CMainGui(void)
{ {
DestroyWindow(m_hMainWindow); DestroyWindow(m_hMainWindow);
} }
WriteTrace(TraceDebug, __FUNCTION__ ": Done"); WriteTrace(TraceUserInterface, TraceDebug, "Done");
} }
bool CMainGui::RegisterWinClass(void) bool CMainGui::RegisterWinClass(void)
@ -198,7 +198,7 @@ void CMainGui::GameLoaded(CMainGui * Gui)
stdstr FileLoc = g_Settings->LoadStringVal(Game_File); stdstr FileLoc = g_Settings->LoadStringVal(Game_File);
if (FileLoc.length() > 0) if (FileLoc.length() > 0)
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": Add Recent Rom"); WriteTrace(TraceUserInterface, TraceDebug, "Add Recent Rom");
Gui->AddRecentRom(FileLoc.c_str()); Gui->AddRecentRom(FileLoc.c_str());
Gui->SetWindowCaption(g_Settings->LoadStringVal(Game_GoodName).ToUTF16().c_str()); Gui->SetWindowCaption(g_Settings->LoadStringVal(Game_GoodName).ToUTF16().c_str());
Gui->HideRomList(); Gui->HideRomList();
@ -217,7 +217,7 @@ void CMainGui::GameCpuRunning(CMainGui * Gui)
Gui->MakeWindowOnTop(g_Settings->LoadBool(UserInterface_AlwaysOnTop)); Gui->MakeWindowOnTop(g_Settings->LoadBool(UserInterface_AlwaysOnTop));
if (g_Settings->LoadBool(Setting_AutoFullscreen)) if (g_Settings->LoadBool(Setting_AutoFullscreen))
{ {
WriteTrace(TraceDebug, __FUNCTION__ " 15"); WriteTrace(TraceUserInterface, TraceDebug, "15");
CIniFile RomIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str()); CIniFile RomIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
stdstr Status = g_Settings->LoadStringVal(Rdb_Status); stdstr Status = g_Settings->LoadStringVal(Rdb_Status);
@ -418,7 +418,7 @@ bool CMainGui::ResetPluginsInUiThread(CPlugins * plugins, CN64System * System)
} }
else else
{ {
WriteTrace(TraceError, __FUNCTION__ ": Failed to create event"); WriteTrace(TraceUserInterface, TraceError, "Failed to create event");
bRes = false; bRes = false;
} }
Notify().RefreshMenu(); Notify().RefreshMenu();
@ -749,9 +749,9 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
{ {
if (g_Plugins->Gfx() && g_Plugins->Gfx()->MoveScreen) if (g_Plugins->Gfx() && g_Plugins->Gfx()->MoveScreen)
{ {
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": Starting"); WriteTrace(TraceGFXPlugin, TraceDebug, "Starting");
g_Plugins->Gfx()->MoveScreen((int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam)); g_Plugins->Gfx()->MoveScreen((int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam));
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": Done"); WriteTrace(TraceGFXPlugin, TraceDebug, "Done");
} }
} }
break; break;
@ -1029,9 +1029,9 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
{ {
if (g_Plugins->Gfx()) if (g_Plugins->Gfx())
{ {
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": Starting"); WriteTrace(TraceGFXPlugin, TraceDebug, "Starting");
g_Plugins->Gfx()->ProcessMenuItem(LOWORD(wParam)); g_Plugins->Gfx()->ProcessMenuItem(LOWORD(wParam));
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": Done"); WriteTrace(TraceGFXPlugin, TraceDebug, "Done");
} }
} }
else if (LOWORD(wParam) > 5200 && LOWORD(wParam) <= 5300) else if (LOWORD(wParam) > 5200 && LOWORD(wParam) <= 5300)
@ -1046,9 +1046,9 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
Rom.SaveRomSettingID(true); Rom.SaveRomSettingID(true);
g_Notify->DisplayMessage(0, L""); g_Notify->DisplayMessage(0, L"");
BYTE * RomHeader = Rom.GetRomAddress(); BYTE * RomHeader = Rom.GetRomAddress();
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": OnRomBrowserMenuItem - Starting"); WriteTrace(TraceGFXPlugin, TraceDebug, "OnRomBrowserMenuItem - Starting");
g_Plugins->Gfx()->OnRomBrowserMenuItem(LOWORD(wParam), hWnd, RomHeader); g_Plugins->Gfx()->OnRomBrowserMenuItem(LOWORD(wParam), hWnd, RomHeader);
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": OnRomBrowserMenuItem - Done"); WriteTrace(TraceGFXPlugin, TraceDebug, "OnRomBrowserMenuItem - Done");
if (g_Rom) if (g_Rom)
{ {
g_Rom->SaveRomSettingID(false); g_Rom->SaveRomSettingID(false);
@ -1079,7 +1079,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
} }
break; break;
case WM_DESTROY: case WM_DESTROY:
WriteTrace(TraceDebug, __FUNCTION__ ": WM_DESTROY - start"); WriteTrace(TraceUserInterface, TraceDebug, "WM_DESTROY - start");
{ {
CMainGui * _this = (CMainGui *)GetProp(hWnd, "Class"); CMainGui * _this = (CMainGui *)GetProp(hWnd, "Class");
if (_this->m_bMainWindow) if (_this->m_bMainWindow)
@ -1087,19 +1087,19 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
Notify().WindowMode(); Notify().WindowMode();
} }
_this->m_hMainWindow = NULL; _this->m_hMainWindow = NULL;
WriteTrace(TraceDebug, __FUNCTION__ ": WM_DESTROY - 1"); WriteTrace(TraceUserInterface, TraceDebug, "WM_DESTROY - 1");
if (_this->m_bMainWindow) if (_this->m_bMainWindow)
{ {
_this->SaveRomListColoumnInfo(); _this->SaveRomListColoumnInfo();
WriteTrace(TraceDebug, __FUNCTION__ ": WM_DESTROY - 2"); WriteTrace(TraceUserInterface, TraceDebug, "WM_DESTROY - 2");
_this->SaveWindowLoc(); _this->SaveWindowLoc();
} }
} }
WriteTrace(TraceDebug, __FUNCTION__ ": WM_DESTROY - 3"); WriteTrace(TraceUserInterface, TraceDebug, "WM_DESTROY - 3");
RemoveProp(hWnd, "Class"); RemoveProp(hWnd, "Class");
WriteTrace(TraceDebug, __FUNCTION__ ": WM_DESTROY - 4"); WriteTrace(TraceUserInterface, TraceDebug, "WM_DESTROY - 4");
PostQuitMessage(0); PostQuitMessage(0);
WriteTrace(TraceDebug, __FUNCTION__ ": WM_DESTROY - Done"); WriteTrace(TraceUserInterface, TraceDebug, "WM_DESTROY - Done");
break; break;
default: default:
return DefWindowProc(hWnd, uMsg, wParam, lParam); return DefWindowProc(hWnd, uMsg, wParam, lParam);

View File

@ -27,7 +27,24 @@ m_Gui(hMainWindow)
m_ChangeSettingList.push_back(Debugger_ShowDivByZero); m_ChangeSettingList.push_back(Debugger_ShowDivByZero);
m_ChangeSettingList.push_back(Debugger_GenerateLogFiles); m_ChangeSettingList.push_back(Debugger_GenerateLogFiles);
m_ChangeSettingList.push_back(Debugger_DisableGameFixes); m_ChangeSettingList.push_back(Debugger_DisableGameFixes);
m_ChangeSettingList.push_back(Debugger_AppLogLevel); m_ChangeSettingList.push_back(Debugger_TraceMD5);
m_ChangeSettingList.push_back(Debugger_TraceSettings);
m_ChangeSettingList.push_back(Debugger_TraceUnknown);
m_ChangeSettingList.push_back(Debugger_TraceAppInit);
m_ChangeSettingList.push_back(Debugger_TraceAppCleanup);
m_ChangeSettingList.push_back(Debugger_TraceN64System);
m_ChangeSettingList.push_back(Debugger_TracePlugins);
m_ChangeSettingList.push_back(Debugger_TraceGFXPlugin);
m_ChangeSettingList.push_back(Debugger_TraceAudioPlugin);
m_ChangeSettingList.push_back(Debugger_TraceControllerPlugin);
m_ChangeSettingList.push_back(Debugger_TraceRSPPlugin);
m_ChangeSettingList.push_back(Debugger_TraceRSP);
m_ChangeSettingList.push_back(Debugger_TraceAudio);
m_ChangeSettingList.push_back(Debugger_TraceRegisterCache);
m_ChangeSettingList.push_back(Debugger_TraceRecompiler);
m_ChangeSettingList.push_back(Debugger_TraceTLB);
m_ChangeSettingList.push_back(Debugger_TraceProtectedMEM);
m_ChangeSettingList.push_back(Debugger_TraceUserInterface);
m_ChangeSettingList.push_back(Debugger_AppLogFlush); m_ChangeSettingList.push_back(Debugger_AppLogFlush);
m_ChangeSettingList.push_back(Game_CurrentSaveState); m_ChangeSettingList.push_back(Game_CurrentSaveState);
m_ChangeSettingList.push_back(Setting_CurrentLanguage); m_ChangeSettingList.push_back(Setting_CurrentLanguage);
@ -87,6 +104,12 @@ stdstr CMainMenu::ChooseFileToOpen(HWND hParent)
return stdstr(""); return stdstr("");
} }
void CMainMenu::SetTraceModuleSetttings(SettingID Type)
{
uint32_t value = g_Settings->LoadDword(Type) == TraceVerbose ? g_Settings->LoadDefaultDword(Type) : TraceVerbose;
g_Settings->SaveDword(Type, value);
}
bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuID) bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuID)
{ {
switch (MenuID) { switch (MenuID) {
@ -118,48 +141,48 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
g_BaseSystem->StartEmulation(true); g_BaseSystem->StartEmulation(true);
break; break;
case ID_FILE_ENDEMULATION: case ID_FILE_ENDEMULATION:
WriteTrace(TraceDebug, __FUNCTION__ ": ID_FILE_ENDEMULATION"); WriteTrace(TraceUserInterface, TraceDebug, "ID_FILE_ENDEMULATION");
CN64System::CloseSystem(); CN64System::CloseSystem();
m_Gui->SaveWindowLoc(); m_Gui->SaveWindowLoc();
break; break;
case ID_FILE_ROMDIRECTORY: case ID_FILE_ROMDIRECTORY:
WriteTrace(TraceDebug, __FUNCTION__ ": ID_FILE_ROMDIRECTORY 1"); WriteTrace(TraceUserInterface, TraceDebug, "ID_FILE_ROMDIRECTORY 1");
m_Gui->SelectRomDir(); m_Gui->SelectRomDir();
WriteTrace(TraceDebug, __FUNCTION__ ": ID_FILE_ROMDIRECTORY 2"); WriteTrace(TraceUserInterface, TraceDebug, "ID_FILE_ROMDIRECTORY 2");
m_Gui->RefreshMenu(); m_Gui->RefreshMenu();
WriteTrace(TraceDebug, __FUNCTION__ ": ID_FILE_ROMDIRECTORY 3"); WriteTrace(TraceUserInterface, TraceDebug, "ID_FILE_ROMDIRECTORY 3");
break; break;
case ID_FILE_REFRESHROMLIST: m_Gui->RefreshRomBrowser(); break; case ID_FILE_REFRESHROMLIST: m_Gui->RefreshRomBrowser(); break;
case ID_FILE_EXIT: DestroyWindow((HWND)hWnd); break; case ID_FILE_EXIT: DestroyWindow((HWND)hWnd); break;
case ID_SYSTEM_RESET_SOFT: case ID_SYSTEM_RESET_SOFT:
WriteTrace(TraceDebug, __FUNCTION__ ": ID_SYSTEM_RESET_SOFT"); WriteTrace(TraceUserInterface, TraceDebug, "ID_SYSTEM_RESET_SOFT");
g_BaseSystem->ExternalEvent(SysEvent_ResetCPU_Soft); g_BaseSystem->ExternalEvent(SysEvent_ResetCPU_Soft);
break; break;
case ID_SYSTEM_RESET_HARD: case ID_SYSTEM_RESET_HARD:
WriteTrace(TraceDebug, __FUNCTION__ ": ID_SYSTEM_RESET_HARD"); WriteTrace(TraceUserInterface, TraceDebug, "ID_SYSTEM_RESET_HARD");
g_BaseSystem->ExternalEvent(SysEvent_ResetCPU_Hard); g_BaseSystem->ExternalEvent(SysEvent_ResetCPU_Hard);
break; break;
case ID_SYSTEM_PAUSE: case ID_SYSTEM_PAUSE:
m_Gui->SaveWindowLoc(); m_Gui->SaveWindowLoc();
WriteTrace(TraceDebug, __FUNCTION__ ": ID_SYSTEM_PAUSE"); WriteTrace(TraceUserInterface, TraceDebug, "ID_SYSTEM_PAUSE");
g_BaseSystem->ExternalEvent(g_Settings->LoadBool(GameRunning_CPU_Paused) ? SysEvent_ResumeCPU_FromMenu : SysEvent_PauseCPU_FromMenu); g_BaseSystem->ExternalEvent(g_Settings->LoadBool(GameRunning_CPU_Paused) ? SysEvent_ResumeCPU_FromMenu : SysEvent_PauseCPU_FromMenu);
WriteTrace(TraceDebug, __FUNCTION__ ": ID_SYSTEM_PAUSE 1"); WriteTrace(TraceUserInterface, TraceDebug, "ID_SYSTEM_PAUSE 1");
break; break;
case ID_SYSTEM_BITMAP: case ID_SYSTEM_BITMAP:
{ {
stdstr Dir(g_Settings->LoadStringVal(Directory_SnapShot)); stdstr Dir(g_Settings->LoadStringVal(Directory_SnapShot));
WriteTraceF(TraceGfxPlugin, __FUNCTION__ ": CaptureScreen(%s): Starting", Dir.c_str()); WriteTrace(TraceGFXPlugin, TraceDebug, "CaptureScreen(%s): Starting", Dir.c_str());
g_Plugins->Gfx()->CaptureScreen(Dir.c_str()); g_Plugins->Gfx()->CaptureScreen(Dir.c_str());
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": CaptureScreen: Done"); WriteTrace(TraceGFXPlugin, TraceDebug, "CaptureScreen: Done");
} }
break; break;
case ID_SYSTEM_LIMITFPS: case ID_SYSTEM_LIMITFPS:
WriteTrace(TraceDebug, __FUNCTION__ ": ID_SYSTEM_LIMITFPS"); WriteTrace(TraceUserInterface, TraceDebug, "ID_SYSTEM_LIMITFPS");
g_Settings->SaveBool(GameRunning_LimitFPS, !g_Settings->LoadBool(GameRunning_LimitFPS)); g_Settings->SaveBool(GameRunning_LimitFPS, !g_Settings->LoadBool(GameRunning_LimitFPS));
WriteTrace(TraceDebug, __FUNCTION__ ": ID_SYSTEM_LIMITFPS 1"); WriteTrace(TraceUserInterface, TraceDebug, "ID_SYSTEM_LIMITFPS 1");
break; break;
case ID_SYSTEM_SAVE: case ID_SYSTEM_SAVE:
WriteTrace(TraceDebug, __FUNCTION__ ": ID_SYSTEM_SAVE"); WriteTrace(TraceUserInterface, TraceDebug, "ID_SYSTEM_SAVE");
g_BaseSystem->ExternalEvent(SysEvent_SaveMachineState); g_BaseSystem->ExternalEvent(SysEvent_SaveMachineState);
break; break;
case ID_SYSTEM_SAVEAS: case ID_SYSTEM_SAVEAS:
@ -204,7 +227,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_SaveGame); g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_SaveGame);
} }
break; break;
case ID_SYSTEM_RESTORE: WriteTrace(TraceDebug, __FUNCTION__ ": ID_SYSTEM_RESTORE"); g_BaseSystem->ExternalEvent(SysEvent_LoadMachineState); break; case ID_SYSTEM_RESTORE: WriteTrace(TraceUserInterface, TraceDebug, "ID_SYSTEM_RESTORE"); g_BaseSystem->ExternalEvent(SysEvent_LoadMachineState); break;
case ID_SYSTEM_LOAD: case ID_SYSTEM_LOAD:
{ {
char Directory[255], SaveFile[255]; char Directory[255], SaveFile[255];
@ -274,12 +297,12 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
case ID_OPTIONS_FULLSCREEN2: case ID_OPTIONS_FULLSCREEN2:
if (g_Settings->LoadBool(UserInterface_InFullScreen)) if (g_Settings->LoadBool(UserInterface_InFullScreen))
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": ID_OPTIONS_FULLSCREEN a"); WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_FULLSCREEN a");
m_Gui->MakeWindowOnTop(false); m_Gui->MakeWindowOnTop(false);
Notify().SetGfxPlugin(NULL); Notify().SetGfxPlugin(NULL);
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": ChangeWindow: Starting"); WriteTrace(TraceGFXPlugin, TraceDebug, "ChangeWindow: Starting");
g_Plugins->Gfx()->ChangeWindow(); g_Plugins->Gfx()->ChangeWindow();
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": ChangeWindow: Done"); WriteTrace(TraceGFXPlugin, TraceDebug, "ChangeWindow: Done");
ShowCursor(true); ShowCursor(true);
m_Gui->ShowStatusBar(true); m_Gui->ShowStatusBar(true);
m_Gui->MakeWindowOnTop(g_Settings->LoadBool(UserInterface_AlwaysOnTop)); m_Gui->MakeWindowOnTop(g_Settings->LoadBool(UserInterface_AlwaysOnTop));
@ -287,33 +310,33 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
} }
else else
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": ID_OPTIONS_FULLSCREEN b"); WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_FULLSCREEN b");
ShowCursor(false); ShowCursor(false);
WriteTrace(TraceDebug, __FUNCTION__ ": ID_OPTIONS_FULLSCREEN b 1"); WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_FULLSCREEN b 1");
m_Gui->ShowStatusBar(false); m_Gui->ShowStatusBar(false);
WriteTrace(TraceDebug, __FUNCTION__ ": ID_OPTIONS_FULLSCREEN b 2"); WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_FULLSCREEN b 2");
try try
{ {
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": ChangeWindow: Starting"); WriteTrace(TraceGFXPlugin, TraceDebug, "ChangeWindow: Starting");
g_Plugins->Gfx()->ChangeWindow(); g_Plugins->Gfx()->ChangeWindow();
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": ChangeWindow: Done"); WriteTrace(TraceGFXPlugin, TraceDebug, "ChangeWindow: Done");
} }
catch (...) catch (...)
{ {
WriteTrace(TraceError, __FUNCTION__ ": Exception when going to full screen"); WriteTrace(TraceError, TraceDebug, "Exception when going to full screen");
char Message[600]; char Message[600];
sprintf(Message, "Exception caught\nFile: %s\nLine: %d", __FILE__, __LINE__); sprintf(Message, "Exception caught\nFile: %s\nLine: %d", __FILE__, __LINE__);
MessageBox(NULL, Message, "Exception", MB_OK); MessageBox(NULL, Message, "Exception", MB_OK);
} }
WriteTrace(TraceDebug, __FUNCTION__ ": ID_OPTIONS_FULLSCREEN b 4"); WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_FULLSCREEN b 4");
m_Gui->MakeWindowOnTop(false); m_Gui->MakeWindowOnTop(false);
WriteTrace(TraceDebug, __FUNCTION__ ": ID_OPTIONS_FULLSCREEN b 5"); WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_FULLSCREEN b 5");
Notify().SetGfxPlugin(g_Plugins->Gfx()); Notify().SetGfxPlugin(g_Plugins->Gfx());
WriteTrace(TraceDebug, __FUNCTION__ ": ID_OPTIONS_FULLSCREEN b 3"); WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_FULLSCREEN b 3");
g_Settings->SaveBool(UserInterface_InFullScreen, true); g_Settings->SaveBool(UserInterface_InFullScreen, true);
WriteTrace(TraceDebug, __FUNCTION__ ": ID_OPTIONS_FULLSCREEN b 6"); WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_FULLSCREEN b 6");
} }
WriteTrace(TraceDebug, __FUNCTION__ ": ID_OPTIONS_FULLSCREEN 1"); WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_FULLSCREEN 1");
break; break;
case ID_OPTIONS_ALWAYSONTOP: case ID_OPTIONS_ALWAYSONTOP:
if (g_Settings->LoadDword(UserInterface_AlwaysOnTop)) if (g_Settings->LoadDword(UserInterface_AlwaysOnTop))
@ -328,23 +351,23 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
} }
break; break;
case ID_OPTIONS_CONFIG_RSP: case ID_OPTIONS_CONFIG_RSP:
WriteTrace(TraceDebug, __FUNCTION__ ": ID_OPTIONS_CONFIG_RSP"); WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_CONFIG_RSP");
g_Plugins->ConfigPlugin(hWnd, PLUGIN_TYPE_RSP); g_Plugins->ConfigPlugin(hWnd, PLUGIN_TYPE_RSP);
break; break;
case ID_OPTIONS_CONFIG_GFX: case ID_OPTIONS_CONFIG_GFX:
WriteTrace(TraceDebug, __FUNCTION__ ": ID_OPTIONS_CONFIG_GFX"); WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_CONFIG_GFX");
g_Plugins->ConfigPlugin(hWnd, PLUGIN_TYPE_GFX); g_Plugins->ConfigPlugin(hWnd, PLUGIN_TYPE_GFX);
break; break;
case ID_OPTIONS_CONFIG_AUDIO: case ID_OPTIONS_CONFIG_AUDIO:
WriteTrace(TraceDebug, __FUNCTION__ ": ID_OPTIONS_CONFIG_AUDIO"); WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_CONFIG_AUDIO");
g_Plugins->ConfigPlugin(hWnd, PLUGIN_TYPE_AUDIO); g_Plugins->ConfigPlugin(hWnd, PLUGIN_TYPE_AUDIO);
break; break;
case ID_OPTIONS_CONFIG_CONT: case ID_OPTIONS_CONFIG_CONT:
WriteTrace(TraceDebug, __FUNCTION__ ": ID_OPTIONS_CONFIG_CONT"); WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_CONFIG_CONT");
g_Plugins->ConfigPlugin(hWnd, PLUGIN_TYPE_CONTROLLER); g_Plugins->ConfigPlugin(hWnd, PLUGIN_TYPE_CONTROLLER);
break; break;
case ID_OPTIONS_CPU_USAGE: case ID_OPTIONS_CPU_USAGE:
WriteTrace(TraceDebug, __FUNCTION__ ": ID_OPTIONS_CPU_USAGE"); WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_CPU_USAGE");
if (g_Settings->LoadBool(UserInterface_ShowCPUPer)) if (g_Settings->LoadBool(UserInterface_ShowCPUPer))
{ {
g_Settings->SaveBool(UserInterface_ShowCPUPer, false); g_Settings->SaveBool(UserInterface_ShowCPUPer, false);
@ -393,118 +416,25 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
case ID_DEBUG_DISABLE_GAMEFIX: case ID_DEBUG_DISABLE_GAMEFIX:
g_Settings->SaveBool(Debugger_DisableGameFixes, !g_Settings->LoadBool(Debugger_DisableGameFixes)); g_Settings->SaveBool(Debugger_DisableGameFixes, !g_Settings->LoadBool(Debugger_DisableGameFixes));
break; break;
case ID_DEBUGGER_APPLOG_ERRORS: case ID_DEBUGGER_TRACE_MD5: SetTraceModuleSetttings(Debugger_TraceMD5); break;
{ case ID_DEBUGGER_TRACE_SETTINGS: SetTraceModuleSetttings(Debugger_TraceSettings); break;
DWORD LogLevel = g_Settings->LoadDword(Debugger_AppLogLevel); case ID_DEBUGGER_TRACE_UNKNOWN: SetTraceModuleSetttings(Debugger_TraceUnknown); break;
if ((LogLevel & TraceError) != 0) case ID_DEBUGGER_TRACE_APPINIT: SetTraceModuleSetttings(Debugger_TraceAppInit); break;
{ case ID_DEBUGGER_TRACE_APPCLEANUP: SetTraceModuleSetttings(Debugger_TraceAppCleanup); break;
LogLevel &= ~TraceError; case ID_DEBUGGER_TRACE_N64SYSTEM: SetTraceModuleSetttings(Debugger_TraceN64System); break;
} case ID_DEBUGGER_TRACE_PLUGINS: SetTraceModuleSetttings(Debugger_TracePlugins); break;
else case ID_DEBUGGER_TRACE_GFXPLUGIN: SetTraceModuleSetttings(Debugger_TraceGFXPlugin); break;
{ case ID_DEBUGGER_TRACE_AUDIOPLUGIN: SetTraceModuleSetttings(Debugger_TraceAudioPlugin); break;
LogLevel |= TraceError; case ID_DEBUGGER_TRACE_CONTROLLERPLUGIN: SetTraceModuleSetttings(Debugger_TraceControllerPlugin); break;
} case ID_DEBUGGER_TRACE_RSPPLUGIN: SetTraceModuleSetttings(Debugger_TraceRSPPlugin); break;
g_Settings->SaveDword(Debugger_AppLogLevel, LogLevel); case ID_DEBUGGER_TRACE_RSP: SetTraceModuleSetttings(Debugger_TraceRSP); break;
} case ID_DEBUGGER_TRACE_AUDIO: SetTraceModuleSetttings(Debugger_TraceAudio); break;
break; case ID_DEBUGGER_TRACE_REGISTERCACHE: SetTraceModuleSetttings(Debugger_TraceRegisterCache); break;
case ID_DEBUGGER_APPLOG_SETTINGS: case ID_DEBUGGER_TRACE_RECOMPILER: SetTraceModuleSetttings(Debugger_TraceRecompiler); break;
{ case ID_DEBUGGER_TRACE_TLB: SetTraceModuleSetttings(Debugger_TraceTLB); break;
DWORD LogLevel = g_Settings->LoadDword(Debugger_AppLogLevel); case ID_DEBUGGER_TRACE_PROTECTEDMEM: SetTraceModuleSetttings(Debugger_TraceProtectedMEM); break;
if ((LogLevel & TraceSettings) != 0) case ID_DEBUGGER_TRACE_USERINTERFACE: SetTraceModuleSetttings(Debugger_TraceUserInterface); break;
{
LogLevel &= ~TraceSettings;
}
else
{
LogLevel |= TraceSettings;
}
g_Settings->SaveDword(Debugger_AppLogLevel, LogLevel);
}
break;
case ID_DEBUGGER_APPLOG_RECOMPILER:
{
DWORD LogLevel = g_Settings->LoadDword(Debugger_AppLogLevel);
if ((LogLevel & TraceRecompiler) != 0)
{
LogLevel &= ~TraceRecompiler;
}
else
{
LogLevel |= TraceRecompiler;
}
g_Settings->SaveDword(Debugger_AppLogLevel, LogLevel);
}
break;
case ID_DEBUGGER_APPLOG_RSP:
{
DWORD LogLevel = g_Settings->LoadDword(Debugger_AppLogLevel);
if ((LogLevel & TraceRSP) != 0)
{
LogLevel &= ~TraceRSP;
}
else
{
LogLevel |= TraceRSP;
}
g_Settings->SaveDword(Debugger_AppLogLevel, LogLevel);
}
break;
case ID_DEBUGGER_APPLOG_TLB:
{
DWORD LogLevel = g_Settings->LoadDword(Debugger_AppLogLevel);
if ((LogLevel & TraceTLB) != 0)
{
LogLevel &= ~TraceTLB;
}
else
{
LogLevel |= TraceTLB;
}
g_Settings->SaveDword(Debugger_AppLogLevel, LogLevel);
}
break;
case ID_DEBUGGER_APPLOG_GFX_PLUGIN:
{
DWORD LogLevel = g_Settings->LoadDword(Debugger_AppLogLevel);
if ((LogLevel & TraceGfxPlugin) != 0)
{
LogLevel &= ~TraceGfxPlugin;
}
else
{
LogLevel |= TraceGfxPlugin;
}
g_Settings->SaveDword(Debugger_AppLogLevel, LogLevel);
}
break;
case ID_DEBUGGER_APPLOG_DEBUG:
{
DWORD LogLevel = g_Settings->LoadDword(Debugger_AppLogLevel);
if ((LogLevel & TraceDebug) != 0)
{
LogLevel &= ~TraceDebug;
}
else
{
LogLevel |= TraceDebug;
}
g_Settings->SaveDword(Debugger_AppLogLevel, LogLevel);
}
break;
case ID_DEBUGGER_APPLOG_AUDIO_EMU:
{
DWORD LogLevel = g_Settings->LoadDword(Debugger_AppLogLevel);
if ((LogLevel & TraceAudio) != 0)
{
LogLevel &= ~TraceAudio;
}
else
{
LogLevel |= TraceAudio;
}
g_Settings->SaveDword(Debugger_AppLogLevel, LogLevel);
}
break;
case ID_DEBUGGER_APPLOG_FLUSH: case ID_DEBUGGER_APPLOG_FLUSH:
g_Settings->SaveBool(Debugger_AppLogFlush, !g_Settings->LoadBool(Debugger_AppLogFlush)); g_Settings->SaveBool(Debugger_AppLogFlush, !g_Settings->LoadBool(Debugger_AppLogFlush));
break; break;
@ -1037,47 +967,83 @@ void CMainMenu::FillOutMenu(HMENU hMenu)
/* Debug - App logging /* Debug - App logging
*******************/ *******************/
{ Item.Reset(ID_DEBUGGER_TRACE_MD5, EMPTY_STRING, EMPTY_STDSTR, NULL, L"MD5");
DWORD LogLevel = g_Settings->LoadDword(Debugger_AppLogLevel); Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceMD5) == TraceVerbose);
DebugAppLoggingMenu.push_back(Item);
Item.Reset(ID_DEBUGGER_APPLOG_ERRORS, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Error Messages"); Item.Reset(ID_DEBUGGER_TRACE_SETTINGS, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Settings");
if ((LogLevel & TraceError) != 0) { Item.SetItemTicked(true); } Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceSettings) == TraceVerbose);
DebugAppLoggingMenu.push_back(Item); DebugAppLoggingMenu.push_back(Item);
Item.Reset(ID_DEBUGGER_APPLOG_SETTINGS, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Settings"); Item.Reset(ID_DEBUGGER_TRACE_UNKNOWN, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Unknown");
if ((LogLevel & TraceSettings) != 0) { Item.SetItemTicked(true); } Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceUnknown) == TraceVerbose);
DebugAppLoggingMenu.push_back(Item); DebugAppLoggingMenu.push_back(Item);
Item.Reset(ID_DEBUGGER_APPLOG_RECOMPILER, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Recompiler"); Item.Reset(ID_DEBUGGER_TRACE_APPINIT, EMPTY_STRING, EMPTY_STDSTR, NULL, L"App Init");
if ((LogLevel & TraceRecompiler) != 0) { Item.SetItemTicked(true); } Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceAppInit) == TraceVerbose);
DebugAppLoggingMenu.push_back(Item); DebugAppLoggingMenu.push_back(Item);
Item.Reset(ID_DEBUGGER_APPLOG_RSP, EMPTY_STRING, EMPTY_STDSTR, NULL, L"RSP"); Item.Reset(ID_DEBUGGER_TRACE_APPCLEANUP, EMPTY_STRING, EMPTY_STDSTR, NULL, L"App Cleanup");
if ((LogLevel & TraceRSP) != 0) { Item.SetItemTicked(true); } Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceAppCleanup) == TraceVerbose);
DebugAppLoggingMenu.push_back(Item); DebugAppLoggingMenu.push_back(Item);
Item.Reset(ID_DEBUGGER_APPLOG_TLB, EMPTY_STRING, EMPTY_STDSTR, NULL, L"TLB"); Item.Reset(ID_DEBUGGER_TRACE_N64SYSTEM, EMPTY_STRING, EMPTY_STDSTR, NULL, L"N64 System");
if ((LogLevel & TraceTLB) != 0) { Item.SetItemTicked(true); } Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceN64System) == TraceVerbose);
DebugAppLoggingMenu.push_back(Item); DebugAppLoggingMenu.push_back(Item);
Item.Reset(ID_DEBUGGER_APPLOG_GFX_PLUGIN, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Gfx Plugin"); Item.Reset(ID_DEBUGGER_TRACE_PLUGINS, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Plugins");
if ((LogLevel & TraceGfxPlugin) != 0) { Item.SetItemTicked(true); } Item.SetItemTicked(g_Settings->LoadDword(Debugger_TracePlugins) == TraceVerbose);;
DebugAppLoggingMenu.push_back(Item); DebugAppLoggingMenu.push_back(Item);
Item.Reset(ID_DEBUGGER_APPLOG_AUDIO_EMU, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Audio Emulation"); Item.Reset(ID_DEBUGGER_TRACE_GFXPLUGIN, EMPTY_STRING, EMPTY_STDSTR, NULL, L"GFX Plugin");
if ((LogLevel & TraceAudio) != 0) { Item.SetItemTicked(true); } Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceGFXPlugin) == TraceVerbose);
DebugAppLoggingMenu.push_back(Item); DebugAppLoggingMenu.push_back(Item);
Item.Reset(ID_DEBUGGER_APPLOG_DEBUG, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Debug Messages"); Item.Reset(ID_DEBUGGER_TRACE_AUDIOPLUGIN, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Audio Plugin");
if ((LogLevel & TraceDebug) != 0) { Item.SetItemTicked(true); } Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceAudioPlugin) == TraceVerbose);
DebugAppLoggingMenu.push_back(Item); DebugAppLoggingMenu.push_back(Item);
DebugAppLoggingMenu.push_back(MENU_ITEM(SPLITER)); Item.Reset(ID_DEBUGGER_TRACE_CONTROLLERPLUGIN, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Controller Plugin");
Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceControllerPlugin) == TraceVerbose);
DebugAppLoggingMenu.push_back(Item);
Item.Reset(ID_DEBUGGER_APPLOG_FLUSH, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Auto flush file"); Item.Reset(ID_DEBUGGER_TRACE_RSPPLUGIN, EMPTY_STRING, EMPTY_STDSTR, NULL, L"RSP Plugin");
if (g_Settings->LoadBool(Debugger_AppLogFlush)) { Item.SetItemTicked(true); } Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceRSPPlugin) == TraceVerbose);;
DebugAppLoggingMenu.push_back(Item); DebugAppLoggingMenu.push_back(Item);
}
Item.Reset(ID_DEBUGGER_TRACE_RSP, EMPTY_STRING, EMPTY_STDSTR, NULL, L"RSP");
Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceRSP) == TraceVerbose);
DebugAppLoggingMenu.push_back(Item);
Item.Reset(ID_DEBUGGER_TRACE_AUDIO, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Audio");
Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceAudio) == TraceVerbose);
DebugAppLoggingMenu.push_back(Item);
Item.Reset(ID_DEBUGGER_TRACE_REGISTERCACHE, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Register Cache");
Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceRegisterCache) == TraceVerbose);
DebugAppLoggingMenu.push_back(Item);
Item.Reset(ID_DEBUGGER_TRACE_RECOMPILER, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Recompiler");
Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceRecompiler) == TraceVerbose);
DebugAppLoggingMenu.push_back(Item);
Item.Reset(ID_DEBUGGER_TRACE_TLB, EMPTY_STRING, EMPTY_STDSTR, NULL, L"TLB");
Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceTLB) == TraceVerbose);
DebugAppLoggingMenu.push_back(Item);
Item.Reset(ID_DEBUGGER_TRACE_PROTECTEDMEM, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Protected MEM");
Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceProtectedMEM) == TraceVerbose);
DebugAppLoggingMenu.push_back(Item);
Item.Reset(ID_DEBUGGER_TRACE_USERINTERFACE, EMPTY_STRING, EMPTY_STDSTR, NULL, L"User Interface");
Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceUserInterface) == TraceVerbose);
DebugAppLoggingMenu.push_back(Item);
DebugAppLoggingMenu.push_back(MENU_ITEM(SPLITER));
Item.Reset(ID_DEBUGGER_APPLOG_FLUSH, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Auto flush file");
if (g_Settings->LoadBool(Debugger_AppLogFlush)) { Item.SetItemTicked(true); }
DebugAppLoggingMenu.push_back(Item);
/* Debug - Logging /* Debug - Logging
*******************/ *******************/
@ -1222,26 +1188,26 @@ void CMainMenu::RebuildAccelerators(void)
CGuard Guard(m_CS); CGuard Guard(m_CS);
//Delete the old accel list //Delete the old accel list
WriteTrace(TraceDebug, __FUNCTION__ ": Start"); WriteTrace(TraceUserInterface, TraceDebug, "Start");
HACCEL m_OldAccelTable = (HACCEL)m_AccelTable; HACCEL m_OldAccelTable = (HACCEL)m_AccelTable;
m_AccelTable = m_ShortCuts.GetAcceleratorTable(); m_AccelTable = m_ShortCuts.GetAcceleratorTable();
if (m_OldAccelTable) { if (m_OldAccelTable) {
DestroyAcceleratorTable(m_OldAccelTable); DestroyAcceleratorTable(m_OldAccelTable);
} }
WriteTrace(TraceDebug, __FUNCTION__ ": Done"); WriteTrace(TraceUserInterface, TraceDebug, "Done");
} }
void CMainMenu::ResetMenu(void) void CMainMenu::ResetMenu(void)
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": Start"); WriteTrace(TraceUserInterface, TraceDebug, "Start");
if (!g_Settings->LoadBool(UserInterface_InFullScreen)) if (!g_Settings->LoadBool(UserInterface_InFullScreen))
{ {
//Create a new window with all the items //Create a new window with all the items
WriteTrace(TraceDebug, __FUNCTION__ ": Create Menu"); WriteTrace(TraceUserInterface, TraceDebug, "Create Menu");
HMENU hMenu = CreateMenu(); HMENU hMenu = CreateMenu();
FillOutMenu(hMenu); FillOutMenu(hMenu);
WriteTrace(TraceDebug, __FUNCTION__ ": Create Menu Done"); WriteTrace(TraceUserInterface, TraceDebug, "Create Menu Done");
//save old menu to destroy latter //save old menu to destroy latter
HMENU OldMenuHandle; HMENU OldMenuHandle;
@ -1250,12 +1216,12 @@ void CMainMenu::ResetMenu(void)
OldMenuHandle = m_MenuHandle; OldMenuHandle = m_MenuHandle;
//save handle and re-attach to a window //save handle and re-attach to a window
WriteTrace(TraceDebug, __FUNCTION__ ": Attach Menu"); WriteTrace(TraceUserInterface, TraceDebug, "Attach Menu");
m_MenuHandle = hMenu; m_MenuHandle = hMenu;
} }
m_Gui->SetWindowMenu(this); m_Gui->SetWindowMenu(this);
WriteTrace(TraceDebug, __FUNCTION__ ": Remove plugin menu"); WriteTrace(TraceUserInterface, TraceDebug, "Remove plugin menu");
if (g_Plugins->Gfx() != NULL && IsMenu((HMENU)g_Plugins->Gfx()->GetDebugMenu())) if (g_Plugins->Gfx() != NULL && IsMenu((HMENU)g_Plugins->Gfx()->GetDebugMenu()))
{ {
RemoveMenu((HMENU)OldMenuHandle, (DWORD)g_Plugins->Gfx()->GetDebugMenu(), MF_BYCOMMAND); RemoveMenu((HMENU)OldMenuHandle, (DWORD)g_Plugins->Gfx()->GetDebugMenu(), MF_BYCOMMAND);
@ -1264,7 +1230,7 @@ void CMainMenu::ResetMenu(void)
{ {
RemoveMenu((HMENU)OldMenuHandle, (DWORD)g_Plugins->RSP()->GetDebugMenu(), MF_BYCOMMAND); RemoveMenu((HMENU)OldMenuHandle, (DWORD)g_Plugins->RSP()->GetDebugMenu(), MF_BYCOMMAND);
} }
WriteTrace(TraceDebug, __FUNCTION__ ": Destroy Old Menu"); WriteTrace(TraceUserInterface, TraceDebug, "Destroy Old Menu");
//Destroy the old menu //Destroy the old menu
DestroyMenu((HMENU)OldMenuHandle); DestroyMenu((HMENU)OldMenuHandle);
@ -1272,5 +1238,5 @@ void CMainMenu::ResetMenu(void)
ResetAccelerators(); ResetAccelerators();
WriteTrace(TraceDebug, __FUNCTION__ ": Done"); WriteTrace(TraceUserInterface, TraceDebug, "Done");
} }

View File

@ -41,9 +41,11 @@ enum MainMenuID
ID_DEBUGGER_INTERRUPT_PI, ID_DEBUGGER_INTERRUPT_DP, ID_DEBUGGER_INTERRUPT_PI, ID_DEBUGGER_INTERRUPT_DP,
// App logging // App logging
ID_DEBUGGER_APPLOG_ERRORS, ID_DEBUGGER_APPLOG_SETTINGS, ID_DEBUGGER_APPLOG_GFX_PLUGIN, ID_DEBUGGER_APPLOG_FLUSH, ID_DEBUGGER_TRACE_MD5, ID_DEBUGGER_TRACE_SETTINGS, ID_DEBUGGER_TRACE_UNKNOWN, ID_DEBUGGER_TRACE_APPINIT,
ID_DEBUGGER_APPLOG_DEBUG, ID_DEBUGGER_APPLOG_FLUSH, ID_DEBUGGER_APPLOG_RECOMPILER, ID_DEBUGGER_TRACE_APPCLEANUP, ID_DEBUGGER_TRACE_N64SYSTEM, ID_DEBUGGER_TRACE_PLUGINS, ID_DEBUGGER_TRACE_GFXPLUGIN,
ID_DEBUGGER_APPLOG_RSP, ID_DEBUGGER_APPLOG_TLB, ID_DEBUGGER_APPLOG_AUDIO_EMU, ID_DEBUGGER_TRACE_AUDIOPLUGIN, ID_DEBUGGER_TRACE_CONTROLLERPLUGIN, ID_DEBUGGER_TRACE_RSPPLUGIN, ID_DEBUGGER_TRACE_RSP,
ID_DEBUGGER_TRACE_AUDIO, ID_DEBUGGER_TRACE_REGISTERCACHE, ID_DEBUGGER_TRACE_RECOMPILER, ID_DEBUGGER_TRACE_TLB,
ID_DEBUGGER_TRACE_PROTECTEDMEM, ID_DEBUGGER_TRACE_USERINTERFACE,
//Profile Menu //Profile Menu
ID_PROFILE_PROFILE, ID_PROFILE_RESETCOUNTER, ID_PROFILE_GENERATELOG, ID_PROFILE_PROFILE, ID_PROFILE_RESETCOUNTER, ID_PROFILE_GENERATELOG,
@ -75,6 +77,7 @@ private:
stdstr GetFileLastMod(stdstr FileName); stdstr GetFileLastMod(stdstr FileName);
void RebuildAccelerators(void); void RebuildAccelerators(void);
stdstr ChooseFileToOpen(HWND hParent); stdstr ChooseFileToOpen(HWND hParent);
void SetTraceModuleSetttings(SettingID Type);
static void SettingsChanged(CMainMenu * _this); static void SettingsChanged(CMainMenu * _this);

View File

@ -496,9 +496,9 @@ HACCEL CShortCuts::GetAcceleratorTable(void)
} }
} }
WriteTrace(TraceDebug, __FUNCTION__ ": CreateAcceleratorTable"); WriteTrace(TraceUserInterface, TraceDebug, "CreateAcceleratorTable");
HACCEL AccelTable = CreateAcceleratorTable(AccelList, size); HACCEL AccelTable = CreateAcceleratorTable(AccelList, size);
WriteTrace(TraceDebug, __FUNCTION__ ": Delete accel list"); WriteTrace(TraceUserInterface, TraceDebug, "Delete accel list");
delete[] AccelList; delete[] AccelList;
return AccelTable; return AccelTable;
} }

View File

@ -59,7 +59,7 @@ void CNotificationImp::DisplayError(const wchar_t * Message) const
stdstr TraceMessage; stdstr TraceMessage;
TraceMessage.FromUTF16(Message); TraceMessage.FromUTF16(Message);
WriteTrace(TraceError, TraceMessage.c_str()); WriteTrace(TraceUserInterface, TraceError, TraceMessage.c_str());
WindowMode(); WindowMode();
HWND Parent = NULL; HWND Parent = NULL;
@ -100,11 +100,11 @@ void CNotificationImp::DisplayMessage(int DisplayTime, const wchar_t * Message)
{ {
if (m_gfxPlugin && m_gfxPlugin->DrawStatus) if (m_gfxPlugin && m_gfxPlugin->DrawStatus)
{ {
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": DrawStatus - Starting"); WriteTrace(TraceGFXPlugin, TraceDebug, "DrawStatus - Starting");
stdstr PluginMessage; stdstr PluginMessage;
PluginMessage.FromUTF16(Message); PluginMessage.FromUTF16(Message);
m_gfxPlugin->DrawStatus(PluginMessage.c_str(), FALSE); m_gfxPlugin->DrawStatus(PluginMessage.c_str(), FALSE);
WriteTrace(TraceGfxPlugin, __FUNCTION__ ": DrawStatus - Done"); WriteTrace(TraceGFXPlugin, TraceDebug, "DrawStatus - Done");
} }
} }
else else
@ -124,7 +124,7 @@ bool CNotificationImp::AskYesNoQuestion(const wchar_t * Question) const
{ {
if (this == NULL) { return false; } if (this == NULL) { return false; }
WriteTrace(TraceError, stdstr().FromUTF16(Question).c_str()); WriteTrace(TraceUserInterface, TraceError, stdstr().FromUTF16(Question).c_str());
WindowMode(); WindowMode();
HWND Parent = NULL; HWND Parent = NULL;

View File

@ -576,7 +576,7 @@ void CRomBrowser::FillRomList(strlist & FileList, const CPath & BaseDirectory, c
CPath SearchPath(BaseDirectory, "*.*"); CPath SearchPath(BaseDirectory, "*.*");
SearchPath.AppendDirectory(Directory.c_str()); SearchPath.AppendDirectory(Directory.c_str());
WriteTraceF(TraceDebug, __FUNCTION__ ": 1 %s", (const char *)SearchPath); WriteTrace(TraceUserInterface, TraceDebug, "1 %s", (const char *)SearchPath);
if (!SearchPath.FindFirst(CPath::_A_ALLFILES)) if (!SearchPath.FindFirst(CPath::_A_ALLFILES))
{ {
return; return;
@ -588,7 +588,7 @@ void CRomBrowser::FillRomList(strlist & FileList, const CPath & BaseDirectory, c
int8_t new_list_entry = 0; int8_t new_list_entry = 0;
const uint8_t exts = sizeof(ROM_extensions) / sizeof(ROM_extensions[0]); const uint8_t exts = sizeof(ROM_extensions) / sizeof(ROM_extensions[0]);
WriteTraceF(TraceDebug, __FUNCTION__ ": 2 %s m_StopRefresh = %d", (const char *)SearchPath, m_StopRefresh); WriteTrace(TraceUserInterface, TraceDebug, ": 2 %s m_StopRefresh = %d", (const char *)SearchPath, m_StopRefresh);
if (m_StopRefresh) { break; } if (m_StopRefresh) { break; }
if (SearchPath.IsDirectory()) if (SearchPath.IsDirectory())
@ -633,7 +633,7 @@ void CRomBrowser::FillRomList(strlist & FileList, const CPath & BaseDirectory, c
stdstr_f SectionName("%s-%d", ZipFile.FileName(ZipFileName, sizeof(ZipFileName)), ZipFile.FileSize()); stdstr_f SectionName("%s-%d", ZipFile.FileName(ZipFileName, sizeof(ZipFileName)), ZipFile.FileSize());
SectionName.ToLower(); SectionName.ToLower();
WriteTraceF(TraceDebug, __FUNCTION__ ": 4 %s", SectionName.c_str()); WriteTrace(TraceUserInterface, TraceDebug, "4 %s", SectionName.c_str());
for (int32_t i = 0; i < ZipFile.NumFiles(); i++) for (int32_t i = 0; i < ZipFile.NumFiles(); i++)
{ {
CSzFileItem * f = ZipFile.FileItem(i); CSzFileItem * f = ZipFile.FileItem(i);
@ -651,16 +651,16 @@ void CRomBrowser::FillRomList(strlist & FileList, const CPath & BaseDirectory, c
stdstr FileName; stdstr FileName;
FileName.FromUTF16(FileNameW.c_str()); FileName.FromUTF16(FileNameW.c_str());
WriteTrace(TraceDebug, __FUNCTION__ ": 5"); WriteTrace(TraceUserInterface, TraceDebug, "5");
char drive2[_MAX_DRIVE], dir2[_MAX_DIR], FileName2[MAX_PATH], ext2[_MAX_EXT]; char drive2[_MAX_DRIVE], dir2[_MAX_DIR], FileName2[MAX_PATH], ext2[_MAX_EXT];
_splitpath(FileName.c_str(), drive2, dir2, FileName2, ext2); _splitpath(FileName.c_str(), drive2, dir2, FileName2, ext2);
WriteTraceF(TraceDebug, __FUNCTION__ ": 6 %s", ext2); WriteTrace(TraceUserInterface, TraceDebug, ": 6 %s", ext2);
if (_stricmp(ext2, ".bin") == 0) if (_stricmp(ext2, ".bin") == 0)
{ {
continue; continue;
} }
WriteTrace(TraceDebug, __FUNCTION__ ": 7"); WriteTrace(TraceUserInterface, TraceDebug, "7");
memset(&RomInfo, 0, sizeof(ROM_INFO)); memset(&RomInfo, 0, sizeof(ROM_INFO));
stdstr_f zipFileName("%s?%s", (LPCSTR)SearchPath, FileName.c_str()); stdstr_f zipFileName("%s?%s", (LPCSTR)SearchPath, FileName.c_str());
ZipFile.SetNotificationCallback((C7zip::LP7ZNOTIFICATION)NotificationCB, this); ZipFile.SetNotificationCallback((C7zip::LP7ZNOTIFICATION)NotificationCB, this);
@ -670,7 +670,7 @@ void CRomBrowser::FillRomList(strlist & FileList, const CPath & BaseDirectory, c
strcpy(RomInfo.FileName, strstr(RomInfo.szFullFileName, "?") + 1); strcpy(RomInfo.FileName, strstr(RomInfo.szFullFileName, "?") + 1);
RomInfo.FileFormat = Format_7zip; RomInfo.FileFormat = Format_7zip;
WriteTrace(TraceDebug, __FUNCTION__ ": 8"); WriteTrace(TraceUserInterface, TraceDebug, "8");
char szHeader[0x90]; char szHeader[0x90];
if (m_ZipIniFile->GetString(SectionName.c_str(), FileName.c_str(), "", szHeader, sizeof(szHeader)) == 0) if (m_ZipIniFile->GetString(SectionName.c_str(), FileName.c_str(), "", szHeader, sizeof(szHeader)) == 0)
{ {
@ -679,27 +679,27 @@ void CRomBrowser::FillRomList(strlist & FileList, const CPath & BaseDirectory, c
{ {
continue; continue;
} }
WriteTrace(TraceDebug, __FUNCTION__ ": 9"); WriteTrace(TraceUserInterface, TraceDebug, "9");
if (!CN64Rom::IsValidRomImage(RomData)) { continue; } if (!CN64Rom::IsValidRomImage(RomData)) { continue; }
WriteTrace(TraceDebug, __FUNCTION__ ": 10"); WriteTrace(TraceUserInterface, TraceDebug, "10");
ByteSwapRomData(RomData, sizeof(RomData)); ByteSwapRomData(RomData, sizeof(RomData));
WriteTrace(TraceDebug, __FUNCTION__ ": 11"); WriteTrace(TraceUserInterface, TraceDebug, "11");
stdstr RomHeader; stdstr RomHeader;
for (int32_t x = 0; x < 0x40; x += 4) for (int32_t x = 0; x < 0x40; x += 4)
{ {
RomHeader += stdstr_f("%08X", *((uint32_t *)&RomData[x])); RomHeader += stdstr_f("%08X", *((uint32_t *)&RomData[x]));
} }
WriteTraceF(TraceDebug, __FUNCTION__ ": 11a %s", RomHeader.c_str()); WriteTrace(TraceUserInterface, TraceDebug, "11a %s", RomHeader.c_str());
int32_t CicChip = GetCicChipID(RomData); int32_t CicChip = GetCicChipID(RomData);
//save this info //save this info
WriteTrace(TraceDebug, __FUNCTION__ ": 12"); WriteTrace(TraceUserInterface, TraceDebug, "12");
m_ZipIniFile->SaveString(SectionName.c_str(), FileName.c_str(), RomHeader.c_str()); m_ZipIniFile->SaveString(SectionName.c_str(), FileName.c_str(), RomHeader.c_str());
m_ZipIniFile->SaveNumber(SectionName.c_str(), stdstr_f("%s-Cic", FileName.c_str()).c_str(), CicChip); m_ZipIniFile->SaveNumber(SectionName.c_str(), stdstr_f("%s-Cic", FileName.c_str()).c_str(), CicChip);
strcpy(szHeader, RomHeader.c_str()); strcpy(szHeader, RomHeader.c_str());
} }
WriteTrace(TraceDebug, __FUNCTION__ ": 13"); WriteTrace(TraceUserInterface, TraceDebug, "13");
uint8_t RomData[0x40]; uint8_t RomData[0x40];
for (int32_t x = 0; x < 0x40; x += 4) for (int32_t x = 0; x < 0x40; x += 4)
@ -712,7 +712,7 @@ void CRomBrowser::FillRomList(strlist & FileList, const CPath & BaseDirectory, c
szHeader[2 * x + delimit_offset] = backup_character; szHeader[2 * x + delimit_offset] = backup_character;
} }
WriteTrace(TraceDebug, __FUNCTION__ ": 14"); WriteTrace(TraceUserInterface, TraceDebug, "14");
{ {
char InternalName[22]; char InternalName[22];
memcpy(InternalName, (void *)(RomData + 0x20), 20); memcpy(InternalName, (void *)(RomData + 0x20), 20);
@ -730,7 +730,7 @@ void CRomBrowser::FillRomList(strlist & FileList, const CPath & BaseDirectory, c
} }
RomInfo.RomSize = (int32_t)f->Size; RomInfo.RomSize = (int32_t)f->Size;
WriteTrace(TraceDebug, __FUNCTION__ ": 15"); WriteTrace(TraceUserInterface, TraceDebug, "15");
RomInfo.CartID[0] = *(RomData + 0x3F); RomInfo.CartID[0] = *(RomData + 0x3F);
RomInfo.CartID[1] = *(RomData + 0x3E); RomInfo.CartID[1] = *(RomData + 0x3E);
RomInfo.CartID[2] = '\0'; RomInfo.CartID[2] = '\0';
@ -739,7 +739,7 @@ void CRomBrowser::FillRomList(strlist & FileList, const CPath & BaseDirectory, c
RomInfo.CRC1 = *(uint32_t *)(RomData + 0x10); RomInfo.CRC1 = *(uint32_t *)(RomData + 0x10);
RomInfo.CRC2 = *(uint32_t *)(RomData + 0x14); RomInfo.CRC2 = *(uint32_t *)(RomData + 0x14);
m_ZipIniFile->GetNumber(SectionName.c_str(), stdstr_f("%s-Cic", FileName.c_str()).c_str(), (ULONG)-1, (uint32_t &)RomInfo.CicChip); m_ZipIniFile->GetNumber(SectionName.c_str(), stdstr_f("%s-Cic", FileName.c_str()).c_str(), (ULONG)-1, (uint32_t &)RomInfo.CicChip);
WriteTrace(TraceDebug, __FUNCTION__ ": 16"); WriteTrace(TraceUserInterface, TraceDebug, "16");
FillRomExtensionInfo(&RomInfo); FillRomExtensionInfo(&RomInfo);
if (RomInfo.SelColor == -1) if (RomInfo.SelColor == -1)
@ -750,13 +750,13 @@ void CRomBrowser::FillRomList(strlist & FileList, const CPath & BaseDirectory, c
{ {
RomInfo.SelColorBrush = (uint32_t)CreateSolidBrush(RomInfo.SelColor); RomInfo.SelColorBrush = (uint32_t)CreateSolidBrush(RomInfo.SelColor);
} }
WriteTrace(TraceDebug, __FUNCTION__ ": 17"); WriteTrace(TraceUserInterface, TraceDebug, "17");
AddRomInfoToList(RomInfo, lpLastRom); AddRomInfoToList(RomInfo, lpLastRom);
} }
} }
catch (...) catch (...)
{ {
WriteTraceF(TraceError, __FUNCTION__ "(): execpetion processing %s", (LPCSTR)SearchPath); WriteTrace(TraceUserInterface, TraceError, "execpetion processing %s", (LPCSTR)SearchPath);
} }
continue; continue;
} }
@ -781,8 +781,8 @@ int32_t CRomBrowser::GetCicChipID(uint8_t * RomData)
case 0x000000D6497E414B: return CIC_NUS_6103; case 0x000000D6497E414B: return CIC_NUS_6103;
case 0x0000011A49F60E96: return CIC_NUS_6105; case 0x0000011A49F60E96: return CIC_NUS_6105;
case 0x000000D6D5BE5580: return CIC_NUS_6106; case 0x000000D6D5BE5580: return CIC_NUS_6106;
case 0x000001053BC19870: return CIC_NUS_5167; //64DD CONVERSION CIC case 0x000001053BC19870: return CIC_NUS_5167; //64DD CONVERSION CIC
case 0x000000D2E53EF008: return CIC_NUS_8303; //64DD IPL case 0x000000D2E53EF008: return CIC_NUS_8303; //64DD IPL
default: default:
return CIC_UNKNOWN; return CIC_UNKNOWN;
} }
@ -930,7 +930,7 @@ void CRomBrowser::ByteSwapRomData(uint8_t * Data, int32_t DataLen)
Data[count + 1] ^= Data[count + 3]; Data[count + 1] ^= Data[count + 3];
} }
break; break;
case 0x40072780: //64DD IPL case 0x40072780: //64DD IPL
case 0x40123780: case 0x40123780:
for (count = 0; count < DataLen; count += 4) for (count = 0; count < DataLen; count += 4)
{ {
@ -1031,10 +1031,10 @@ void CRomBrowser::RefreshRomBrowser(void)
{ {
return; return;
} }
WriteTrace(TraceDebug, __FUNCTION__ ": 1"); WriteTrace(TraceUserInterface, TraceDebug, "1");
m_StopRefresh = false; m_StopRefresh = false;
m_RefreshThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)RefreshRomBrowserStatic, (LPVOID)this, 0, &ThreadID); m_RefreshThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)RefreshRomBrowserStatic, (LPVOID)this, 0, &ThreadID);
WriteTrace(TraceDebug, __FUNCTION__ ": 2"); WriteTrace(TraceUserInterface, TraceDebug, "2");
} }
void CRomBrowser::RefreshRomBrowserStatic(CRomBrowser * _this) void CRomBrowser::RefreshRomBrowserStatic(CRomBrowser * _this)
@ -1048,41 +1048,41 @@ void CRomBrowser::RefreshRomBrowserStatic(CRomBrowser * _this)
DeleteFile(CacheFileName.c_str()); DeleteFile(CacheFileName.c_str());
//clear all current items //clear all current items
WriteTrace(TraceDebug, __FUNCTION__ " 1"); WriteTrace(TraceUserInterface, TraceDebug, "1");
ListView_DeleteAllItems((HWND)_this->m_hRomList); ListView_DeleteAllItems((HWND)_this->m_hRomList);
_this->DeallocateBrushs(); _this->DeallocateBrushs();
_this->m_RomInfo.clear(); _this->m_RomInfo.clear();
WriteTrace(TraceDebug, __FUNCTION__ " 2"); WriteTrace(TraceUserInterface, TraceDebug, "2");
InvalidateRect((HWND)_this->m_hRomList, NULL, TRUE); InvalidateRect((HWND)_this->m_hRomList, NULL, TRUE);
Sleep(100); Sleep(100);
WriteTrace(TraceDebug, __FUNCTION__ " 3"); WriteTrace(TraceUserInterface, TraceDebug, "3");
if (_this->m_WatchRomDir != g_Settings->LoadStringVal(Directory_Game)) if (_this->m_WatchRomDir != g_Settings->LoadStringVal(Directory_Game))
{ {
WriteTrace(TraceDebug, __FUNCTION__ " 4"); WriteTrace(TraceUserInterface, TraceDebug, "4");
_this->WatchThreadStop(); _this->WatchThreadStop();
WriteTrace(TraceDebug, __FUNCTION__ " 5"); WriteTrace(TraceUserInterface, TraceDebug, "5");
_this->WatchThreadStart(); _this->WatchThreadStart();
WriteTrace(TraceDebug, __FUNCTION__ " 6"); WriteTrace(TraceUserInterface, TraceDebug, "6");
} }
WriteTrace(TraceDebug, __FUNCTION__ " 7"); WriteTrace(TraceUserInterface, TraceDebug, "7");
stdstr RomDir = g_Settings->LoadStringVal(Directory_Game); stdstr RomDir = g_Settings->LoadStringVal(Directory_Game);
stdstr LastRom = g_Settings->LoadStringIndex(File_RecentGameFileIndex, 0); stdstr LastRom = g_Settings->LoadStringIndex(File_RecentGameFileIndex, 0);
WriteTrace(TraceDebug, __FUNCTION__ " 8"); WriteTrace(TraceUserInterface, TraceDebug, "8");
strlist FileNames; strlist FileNames;
_this->FillRomList(FileNames, CPath(RomDir), stdstr(""), LastRom.c_str()); _this->FillRomList(FileNames, CPath(RomDir), stdstr(""), LastRom.c_str());
WriteTrace(TraceDebug, __FUNCTION__ " 9"); WriteTrace(TraceUserInterface, TraceDebug, "9");
_this->SaveRomList(FileNames); _this->SaveRomList(FileNames);
WriteTrace(TraceDebug, __FUNCTION__ " 10"); WriteTrace(TraceUserInterface, TraceDebug, "10");
CloseHandle(_this->m_RefreshThread); CloseHandle(_this->m_RefreshThread);
_this->m_RefreshThread = NULL; _this->m_RefreshThread = NULL;
WriteTrace(TraceDebug, __FUNCTION__ " 11"); WriteTrace(TraceUserInterface, TraceDebug, "11");
} }
catch (...) catch (...)
{ {
WriteTrace(TraceError, __FUNCTION__ "(): Unhandled Exception "); WriteTrace(TraceUserInterface, TraceError, "Unhandled Exception ");
} }
} }
@ -1410,14 +1410,14 @@ void CRomBrowser::RomList_GetDispInfo(uint32_t pnmh)
{ {
swprintf(lpdi->item.pszText, lpdi->item.cchTextMax / sizeof(wchar_t), L"Unknown CIC Chip"); swprintf(lpdi->item.pszText, lpdi->item.cchTextMax / sizeof(wchar_t), L"Unknown CIC Chip");
} }
else if (pRomInfo->CicChip == CIC_NUS_8303) else if (pRomInfo->CicChip == CIC_NUS_8303)
{ {
swprintf(lpdi->item.pszText, lpdi->item.cchTextMax / sizeof(wchar_t), L"CIC-NUS-8303", pRomInfo->CicChip); swprintf(lpdi->item.pszText, lpdi->item.cchTextMax / sizeof(wchar_t), L"CIC-NUS-8303", pRomInfo->CicChip);
} }
else if (pRomInfo->CicChip == CIC_NUS_5167) else if (pRomInfo->CicChip == CIC_NUS_5167)
{ {
swprintf(lpdi->item.pszText, lpdi->item.cchTextMax / sizeof(wchar_t), L"CIC-NUS-5167", pRomInfo->CicChip); swprintf(lpdi->item.pszText, lpdi->item.cchTextMax / sizeof(wchar_t), L"CIC-NUS-5167", pRomInfo->CicChip);
} }
else else
{ {
swprintf(lpdi->item.pszText, lpdi->item.cchTextMax / sizeof(wchar_t), L"CIC-NUS-610%d", pRomInfo->CicChip); swprintf(lpdi->item.pszText, lpdi->item.cchTextMax / sizeof(wchar_t), L"CIC-NUS-610%d", pRomInfo->CicChip);
@ -1600,7 +1600,7 @@ void CRomBrowser::SaveRomList(strlist & FileList)
void CRomBrowser::SaveRomListColoumnInfo(void) void CRomBrowser::SaveRomListColoumnInfo(void)
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": Start"); WriteTrace(TraceUserInterface, TraceDebug, "Start");
// if (!RomBrowserVisible()) { return; } // if (!RomBrowserVisible()) { return; }
if (g_Settings == NULL) { return; } if (g_Settings == NULL) { return; }
@ -1629,7 +1629,7 @@ void CRomBrowser::SaveRomListColoumnInfo(void)
} }
} }
} }
WriteTrace(TraceDebug, __FUNCTION__ ": Done"); WriteTrace(TraceUserInterface, TraceDebug, "Done");
} }
int32_t CALLBACK CRomBrowser::SelectRomDirCallBack(HWND hwnd, uint32_t uMsg, uint32_t /*lp*/, uint32_t lpData) int32_t CALLBACK CRomBrowser::SelectRomDirCallBack(HWND hwnd, uint32_t uMsg, uint32_t /*lp*/, uint32_t lpData)
@ -1655,7 +1655,7 @@ void CRomBrowser::SelectRomDir(void)
LPITEMIDLIST pidl; LPITEMIDLIST pidl;
BROWSEINFOW bi; BROWSEINFOW bi;
WriteTrace(TraceDebug, __FUNCTION__ " 1"); WriteTrace(TraceUserInterface, TraceDebug, "1");
stdstr RomDir = g_Settings->LoadStringVal(Directory_Game); stdstr RomDir = g_Settings->LoadStringVal(Directory_Game);
bi.hwndOwner = m_MainWindow; bi.hwndOwner = m_MainWindow;
bi.pidlRoot = NULL; bi.pidlRoot = NULL;
@ -1664,28 +1664,28 @@ void CRomBrowser::SelectRomDir(void)
bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS; bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
bi.lpfn = (BFFCALLBACK)SelectRomDirCallBack; bi.lpfn = (BFFCALLBACK)SelectRomDirCallBack;
bi.lParam = (uint32_t)RomDir.c_str(); bi.lParam = (uint32_t)RomDir.c_str();
WriteTrace(TraceDebug, __FUNCTION__ " 2"); WriteTrace(TraceUserInterface, TraceDebug, "2");
if ((pidl = SHBrowseForFolderW(&bi)) != NULL) if ((pidl = SHBrowseForFolderW(&bi)) != NULL)
{ {
WriteTrace(TraceDebug, __FUNCTION__ " 3"); WriteTrace(TraceUserInterface, TraceDebug, "3");
char Directory[_MAX_PATH]; char Directory[_MAX_PATH];
if (SHGetPathFromIDList(pidl, Directory)) if (SHGetPathFromIDList(pidl, Directory))
{ {
int32_t len = strlen(Directory); int32_t len = strlen(Directory);
WriteTrace(TraceDebug, __FUNCTION__ " 4"); WriteTrace(TraceUserInterface, TraceDebug, "4");
if (Directory[len - 1] != '\\') if (Directory[len - 1] != '\\')
{ {
strcat(Directory, "\\"); strcat(Directory, "\\");
} }
WriteTrace(TraceDebug, __FUNCTION__ " 5"); WriteTrace(TraceUserInterface, TraceDebug, "5");
WriteTrace(TraceDebug, __FUNCTION__ " 6"); WriteTrace(TraceUserInterface, TraceDebug, "6");
g_Settings->SaveString(Directory_Game, Directory); g_Settings->SaveString(Directory_Game, Directory);
WriteTrace(TraceDebug, __FUNCTION__ " 7"); WriteTrace(TraceUserInterface, TraceDebug, "7");
Notify().AddRecentDir(Directory); Notify().AddRecentDir(Directory);
WriteTrace(TraceDebug, __FUNCTION__ " 8"); WriteTrace(TraceUserInterface, TraceDebug, "8");
RefreshRomBrowser(); RefreshRomBrowser();
WriteTrace(TraceDebug, __FUNCTION__ " 9"); WriteTrace(TraceUserInterface, TraceDebug, "9");
} }
} }
} }
@ -1844,7 +1844,7 @@ MD5 CRomBrowser::RomListHash(strlist & FileList)
NewFileNames += ";"; NewFileNames += ";";
} }
MD5 md5Hash((const unsigned char *)NewFileNames.c_str(), NewFileNames.length()); MD5 md5Hash((const unsigned char *)NewFileNames.c_str(), NewFileNames.length());
WriteTraceF(TraceDebug, __FUNCTION__ ": %s - %s", md5Hash.hex_digest(), NewFileNames.c_str()); WriteTrace(TraceUserInterface, TraceDebug, "%s - %s", md5Hash.hex_digest(), NewFileNames.c_str());
return md5Hash; return md5Hash;
} }
@ -1852,58 +1852,58 @@ void CRomBrowser::WatchRomDirChanged(CRomBrowser * _this)
{ {
try try
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": 1"); WriteTrace(TraceUserInterface, TraceDebug, "1");
_this->m_WatchRomDir = g_Settings->LoadStringVal(Directory_Game); _this->m_WatchRomDir = g_Settings->LoadStringVal(Directory_Game);
WriteTrace(TraceDebug, __FUNCTION__ ": 2"); WriteTrace(TraceUserInterface, TraceDebug, "2");
if (_this->RomDirNeedsRefresh()) if (_this->RomDirNeedsRefresh())
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": 2a"); WriteTrace(TraceUserInterface, TraceDebug, "2a");
PostMessage((HWND)_this->m_MainWindow, WM_COMMAND, ID_FILE_REFRESHROMLIST, 0); PostMessage((HWND)_this->m_MainWindow, WM_COMMAND, ID_FILE_REFRESHROMLIST, 0);
} }
WriteTrace(TraceDebug, __FUNCTION__ ": 3"); WriteTrace(TraceUserInterface, TraceDebug, "3");
HANDLE hChange[] = { HANDLE hChange[] = {
_this->m_WatchStopEvent, _this->m_WatchStopEvent,
FindFirstChangeNotification(_this->m_WatchRomDir.c_str(), g_Settings->LoadDword(RomBrowser_Recursive), FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_SIZE), FindFirstChangeNotification(_this->m_WatchRomDir.c_str(), g_Settings->LoadDword(RomBrowser_Recursive), FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_SIZE),
}; };
WriteTrace(TraceDebug, __FUNCTION__ ": 4"); WriteTrace(TraceUserInterface, TraceDebug, "4");
for (;;) for (;;)
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": 5"); WriteTrace(TraceUserInterface, TraceDebug, "5");
if (WaitForMultipleObjects(sizeof(hChange) / sizeof(hChange[0]), hChange, false, INFINITE) == WAIT_OBJECT_0) if (WaitForMultipleObjects(sizeof(hChange) / sizeof(hChange[0]), hChange, false, INFINITE) == WAIT_OBJECT_0)
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": 5a"); WriteTrace(TraceUserInterface, TraceDebug, "5a");
FindCloseChangeNotification(hChange[1]); FindCloseChangeNotification(hChange[1]);
return; return;
} }
WriteTrace(TraceDebug, __FUNCTION__ ": 5b"); WriteTrace(TraceUserInterface, TraceDebug, "5b");
if (_this->RomDirNeedsRefresh()) if (_this->RomDirNeedsRefresh())
{ {
PostMessage((HWND)_this->m_MainWindow, WM_COMMAND, ID_FILE_REFRESHROMLIST, 0); PostMessage((HWND)_this->m_MainWindow, WM_COMMAND, ID_FILE_REFRESHROMLIST, 0);
} }
WriteTrace(TraceDebug, __FUNCTION__ ": 5c"); WriteTrace(TraceUserInterface, TraceDebug, "5c");
if (!FindNextChangeNotification(hChange[1])) if (!FindNextChangeNotification(hChange[1]))
{ {
FindCloseChangeNotification(hChange[1]); FindCloseChangeNotification(hChange[1]);
return; return;
} }
WriteTrace(TraceDebug, __FUNCTION__ ": 5d"); WriteTrace(TraceUserInterface, TraceDebug, "5d");
} }
} }
catch (...) catch (...)
{ {
WriteTraceF(TraceError, __FUNCTION__ ": Unhandled Exception"); WriteTrace(TraceUserInterface, TraceError, __FUNCTION__ ": Unhandled Exception");
} }
} }
void CRomBrowser::WatchThreadStart(void) void CRomBrowser::WatchThreadStart(void)
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": 1"); WriteTrace(TraceUserInterface, TraceDebug, "1");
WatchThreadStop(); WatchThreadStop();
WriteTrace(TraceDebug, __FUNCTION__ ": 2"); WriteTrace(TraceUserInterface, TraceDebug, "2");
m_WatchStopEvent = CreateEvent(NULL, true, false, NULL); m_WatchStopEvent = CreateEvent(NULL, true, false, NULL);
WriteTrace(TraceDebug, __FUNCTION__ ": 3"); WriteTrace(TraceUserInterface, TraceDebug, "3");
m_WatchThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)WatchRomDirChanged, this, 0, &m_WatchThreadID); m_WatchThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)WatchRomDirChanged, this, 0, &m_WatchThreadID);
WriteTrace(TraceDebug, __FUNCTION__ ": 4"); WriteTrace(TraceUserInterface, TraceDebug, "4");
} }
void CRomBrowser::WatchThreadStop(void) void CRomBrowser::WatchThreadStop(void)
@ -1912,12 +1912,12 @@ void CRomBrowser::WatchThreadStop(void)
{ {
return; return;
} }
WriteTrace(TraceDebug, __FUNCTION__ ": 1"); WriteTrace(TraceUserInterface, TraceDebug, "1");
SetEvent(m_WatchStopEvent); SetEvent(m_WatchStopEvent);
DWORD ExitCode = 0; DWORD ExitCode = 0;
for (int32_t count = 0; count < 20; count++) for (int32_t count = 0; count < 20; count++)
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": 2"); WriteTrace(TraceUserInterface, TraceDebug, "2");
GetExitCodeThread(m_WatchThread, &ExitCode); GetExitCodeThread(m_WatchThread, &ExitCode);
if (ExitCode != STILL_ACTIVE) if (ExitCode != STILL_ACTIVE)
{ {
@ -1925,18 +1925,18 @@ void CRomBrowser::WatchThreadStop(void)
} }
Sleep(200); Sleep(200);
} }
WriteTrace(TraceDebug, __FUNCTION__ ": 3"); WriteTrace(TraceUserInterface, TraceDebug, "3");
if (ExitCode == STILL_ACTIVE) if (ExitCode == STILL_ACTIVE)
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": 3a"); WriteTrace(TraceUserInterface, TraceDebug, "3a");
TerminateThread(m_WatchThread, 0); TerminateThread(m_WatchThread, 0);
} }
WriteTrace(TraceDebug, __FUNCTION__ ": 4"); WriteTrace(TraceUserInterface, TraceDebug, "4");
CloseHandle(m_WatchThread); CloseHandle(m_WatchThread);
CloseHandle(m_WatchStopEvent); CloseHandle(m_WatchStopEvent);
m_WatchStopEvent = NULL; m_WatchStopEvent = NULL;
m_WatchThread = NULL; m_WatchThread = NULL;
m_WatchThreadID = 0; m_WatchThreadID = 0;
WriteTrace(TraceDebug, __FUNCTION__ ": 5"); WriteTrace(TraceUserInterface, TraceDebug, "5");
} }

View File

@ -14,7 +14,7 @@ int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /
} }
//Create the main window with Menu //Create the main window with Menu
WriteTrace(TraceDebug, __FUNCTION__ ": Create Main Window"); WriteTrace(TraceUserInterface, TraceDebug, "Create Main Window");
CMainGui MainWindow(true, stdstr_f("Project64 %s", VER_FILE_VERSION_STR).c_str()), HiddenWindow(false); CMainGui MainWindow(true, stdstr_f("Project64 %s", VER_FILE_VERSION_STR).c_str()), HiddenWindow(false);
CMainMenu MainMenu(&MainWindow); CMainMenu MainMenu(&MainWindow);
g_Plugins->SetRenderWindows(&MainWindow, &HiddenWindow); g_Plugins->SetRenderWindows(&MainWindow, &HiddenWindow);
@ -22,7 +22,7 @@ int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /
if (__argc > 1) if (__argc > 1)
{ {
WriteTraceF(TraceDebug, __FUNCTION__ ": Cmd line found \"%s\"", __argv[1]); WriteTrace(TraceUserInterface, TraceDebug, "Cmd line found \"%s\"", __argv[1]);
MainWindow.Show(true); //Show the main window MainWindow.Show(true); //Show the main window
CN64System::RunFileImage(__argv[1]); CN64System::RunFileImage(__argv[1]);
} }
@ -30,22 +30,23 @@ int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /
{ {
if (g_Settings->LoadDword(RomBrowser_Enabled)) if (g_Settings->LoadDword(RomBrowser_Enabled))
{ {
WriteTrace(TraceDebug, __FUNCTION__ ": Show Rom Browser"); WriteTrace(TraceUserInterface, TraceDebug, "Show Rom Browser");
//Display the rom browser //Display the rom browser
MainWindow.ShowRomList(); MainWindow.ShowRomList();
MainWindow.Show(true); //Show the main window MainWindow.Show(true); //Show the main window
MainWindow.HighLightLastRom(); MainWindow.HighLightLastRom();
} }
else { else
WriteTrace(TraceDebug, __FUNCTION__ ": Show Main Window"); {
WriteTrace(TraceUserInterface, TraceDebug, "Show Main Window");
MainWindow.Show(true); //Show the main window MainWindow.Show(true); //Show the main window
} }
} }
//Process Messages till program is closed //Process Messages till program is closed
WriteTrace(TraceDebug, __FUNCTION__ ": Entering Message Loop"); WriteTrace(TraceUserInterface, TraceDebug, "Entering Message Loop");
MainWindow.ProcessAllMessages(); MainWindow.ProcessAllMessages();
WriteTrace(TraceDebug, __FUNCTION__ ": Message Loop Finished"); WriteTrace(TraceUserInterface, TraceDebug, "Message Loop Finished");
if (g_BaseSystem) if (g_BaseSystem)
{ {
@ -53,11 +54,11 @@ int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /
delete g_BaseSystem; delete g_BaseSystem;
g_BaseSystem = NULL; g_BaseSystem = NULL;
} }
WriteTrace(TraceDebug, __FUNCTION__ ": System Closed"); WriteTrace(TraceUserInterface, TraceDebug, "System Closed");
} }
catch (...) catch (...)
{ {
WriteTraceF(TraceError, __FUNCTION__ ": Exception caught (File: \"%s\" Line: %d)", __FILE__, __LINE__); WriteTrace(TraceUserInterface, TraceError, "Exception caught (File: \"%s\" Line: %d)", __FILE__, __LINE__);
MessageBox(NULL, stdstr_f("Exception caught\nFile: %s\nLine: %d", __FILE__, __LINE__).c_str(), "Exception", MB_OK); MessageBox(NULL, stdstr_f("Exception caught\nFile: %s\nLine: %d", __FILE__, __LINE__).c_str(), "Exception", MB_OK);
} }
AppCleanup(); AppCleanup();