[Projet64] Move logging class and clean up code

This commit is contained in:
zilmar 2015-11-08 20:17:13 +11:00
parent 786be5b062
commit 4ac266bd94
10 changed files with 709 additions and 717 deletions

View File

@ -2,7 +2,7 @@
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Configuration">
<PlatformToolset>v140_xp</PlatformToolset>
<PlatformToolset>v120_xp</PlatformToolset>
</PropertyGroup>
<ImportGroup Label="PropertySheets">

File diff suppressed because it is too large Load Diff

View File

@ -9,55 +9,48 @@
* *
****************************************************************************/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
BOOL GenerateLog;
bool GenerateLog;
/* Registers Log */
BOOL LogRDRamRegisters;
BOOL LogSPRegisters;
BOOL LogDPCRegisters;
BOOL LogDPSRegisters;
BOOL LogMIPSInterface;
BOOL LogVideoInterface;
BOOL LogAudioInterface;
BOOL LogPerInterface;
BOOL LogRDRAMInterface;
BOOL LogSerialInterface;
/* Registers Log */
bool LogRDRamRegisters;
bool LogSPRegisters;
bool LogDPCRegisters;
bool LogDPSRegisters;
bool LogMIPSInterface;
bool LogVideoInterface;
bool LogAudioInterface;
bool LogPerInterface;
bool LogRDRAMInterface;
bool LogSerialInterface;
/* Pif Ram Log */
BOOL LogPRDMAOperations;
BOOL LogPRDirectMemLoads;
BOOL LogPRDMAMemLoads;
BOOL LogPRDirectMemStores;
BOOL LogPRDMAMemStores;
BOOL LogControllerPak;
/* Pif Ram Log */
bool LogPRDMAOperations;
bool LogPRDirectMemLoads;
bool LogPRDMAMemLoads;
bool LogPRDirectMemStores;
bool LogPRDMAMemStores;
bool LogControllerPak;
/* Special Log */
BOOL LogCP0changes;
BOOL LogCP0reads;
BOOL LogTLB;
BOOL LogExceptions;
BOOL NoInterrupts;
BOOL LogCache;
BOOL LogRomHeader;
BOOL LogUnknown;
/* Special Log */
bool LogCP0changes;
bool LogCP0reads;
bool LogTLB;
bool LogExceptions;
bool NoInterrupts;
bool LogCache;
bool LogRomHeader;
bool LogUnknown;
} LOG_OPTIONS;
extern LOG_OPTIONS LogOptions;
extern LOG_OPTIONS g_LogOptions;
void EnterLogOptions ( HWND hwndOwner );
void LoadLogOptions ( LOG_OPTIONS * LogOptions, BOOL AlwaysFill );
void Log_LW ( DWORD PC, DWORD VAddr );
void __cdecl LogMessage ( char * Message, ... );
void Log_SW ( DWORD PC, DWORD VAddr, DWORD Value );
void StartLog ( void );
void StopLog ( void );
#ifdef __cplusplus
}
#endif
void StartLog ( void );
void StopLog ( void );
void LoadLogOptions ( LOG_OPTIONS * LogOptions, bool AlwaysFill );
void Log_LW ( uint32_t PC, uint32_t VAddr );
void Log_SW ( uint32_t PC, uint32_t VAddr, uint32_t Value );
void LogMessage ( const char * Message, ... );

View File

@ -951,7 +951,7 @@ void R4300iOp32::LW()
ADDRESS_ERROR_EXCEPTION(Address, true);
}
if (LogOptions.GenerateLog)
if (g_LogOptions.GenerateLog)
{
Log_LW((*_PROGRAM_COUNTER),Address);
}
@ -1323,7 +1323,7 @@ void R4300iOp32::REGIMM_BGEZAL()
}
/************************** COP0 functions **************************/
void R4300iOp32::COP0_MF() {
if (LogOptions.LogCP0reads)
if (g_LogOptions.LogCP0reads)
{
LogMessage("%08X: R4300i Read from %s (0x%08X)", (*_PROGRAM_COUNTER), CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]);
}
@ -1337,7 +1337,7 @@ void R4300iOp32::COP0_MF() {
void R4300iOp32::COP0_MT()
{
if (LogOptions.LogCP0changes)
if (g_LogOptions.LogCP0changes)
{
LogMessage("%08X: Writing 0x%X to %s register (Originally: 0x%08X)",(*_PROGRAM_COUNTER), _GPR[m_Opcode.rt].UW[0],CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]);
if (m_Opcode.rd == 11) //Compare

View File

@ -1115,7 +1115,7 @@ void R4300iOp::LW()
ADDRESS_ERROR_EXCEPTION(Address, true);
}
if (LogOptions.GenerateLog)
if (g_LogOptions.GenerateLog)
{
Log_LW((*_PROGRAM_COUNTER),Address);
}
@ -1295,7 +1295,7 @@ void R4300iOp::SW()
{
ADDRESS_ERROR_EXCEPTION(Address, false);
}
if (LogOptions.GenerateLog)
if (g_LogOptions.GenerateLog)
{
Log_SW((*_PROGRAM_COUNTER),Address,_GPR[m_Opcode.rt].UW[0]);
}
@ -1445,7 +1445,7 @@ void R4300iOp::SWR()
void R4300iOp::CACHE()
{
if (!LogOptions.LogCache)
if (!g_LogOptions.LogCache)
{
return;
}
@ -2094,7 +2094,7 @@ void R4300iOp::REGIMM_BGEZAL()
/************************** COP0 functions **************************/
void R4300iOp::COP0_MF()
{
if (LogOptions.LogCP0reads)
if (g_LogOptions.LogCP0reads)
{
LogMessage("%08X: R4300i Read from %s (0x%08X)", (*_PROGRAM_COUNTER), CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]);
}
@ -2108,7 +2108,7 @@ void R4300iOp::COP0_MF()
void R4300iOp::COP0_MT()
{
if (LogOptions.LogCP0changes)
if (g_LogOptions.LogCP0changes)
{
LogMessage("%08X: Writing 0x%X to %s register (Originally: 0x%08X)",(*_PROGRAM_COUNTER), _GPR[m_Opcode.rt].UW[0],CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]);
if (m_Opcode.rd == 11) //Compare

View File

@ -308,7 +308,7 @@ void CPifRam::SI_DMA_READ()
}
}
if (LogOptions.LogPRDMAMemStores)
if (g_LogOptions.LogPRDMAMemStores)
{
int count;
char HexData[100], AsciiData[100], Addon[20];
@ -394,7 +394,7 @@ void CPifRam::SI_DMA_WRITE()
}
}
if (LogOptions.LogPRDMAMemLoads)
if (g_LogOptions.LogPRDMAMemLoads)
{
int count;
char HexData[100], AsciiData[100], Addon[20];
@ -505,7 +505,7 @@ void CPifRam::ProcessControllerCommand ( int Control, BYTE * Command)
}
break;
case 0x02: //read from controller pack
if (LogOptions.LogControllerPak)
if (g_LogOptions.LogControllerPak)
{
LogControllerPakData("Read: Before Gettting Results");
}
@ -541,13 +541,13 @@ void CPifRam::ProcessControllerCommand ( int Control, BYTE * Command)
{
Command[1] |= 0x80;
}
if (LogOptions.LogControllerPak)
if (g_LogOptions.LogControllerPak)
{
LogControllerPakData("Read: After Gettting Results");
}
break;
case 0x03: //write controller pak
if (LogOptions.LogControllerPak)
if (g_LogOptions.LogControllerPak)
{
LogControllerPakData("Write: Before Processing");
}
@ -581,7 +581,7 @@ void CPifRam::ProcessControllerCommand ( int Control, BYTE * Command)
{
Command[1] |= 0x80;
}
if (LogOptions.LogControllerPak)
if (g_LogOptions.LogControllerPak)
{
LogControllerPakData("Write: After Processing");
}

View File

@ -463,7 +463,7 @@ bool CRegisters::DoIntrException(bool DelaySlot)
return false;
}
if (LogOptions.GenerateLog && LogOptions.LogExceptions && !LogOptions.NoInterrupts)
if (g_LogOptions.GenerateLog && g_LogOptions.LogExceptions && !g_LogOptions.NoInterrupts)
{
LogMessage("%08X: Interrupt Generated", m_PROGRAM_COUNTER);
}

View File

@ -296,8 +296,8 @@ void CN64System::StartEmulation2 ( bool NewThread )
if (bHaveDebugger())
{
LogOptions.GenerateLog = g_Settings->LoadDword(Debugger_GenerateDebugLog);
LoadLogOptions(&LogOptions, FALSE);
g_LogOptions.GenerateLog = g_Settings->LoadBool(Debugger_GenerateDebugLog);
LoadLogOptions(&g_LogOptions, FALSE);
StartLog();
}

View File

@ -41,6 +41,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Logging.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="Multilanguage\LanguageSelector.cpp" />
<ClCompile Include="N64 System\Mips\Rumblepak.cpp" />
@ -122,7 +123,6 @@
<ClCompile Include="N64 System\Mips\System Events.cpp" />
<ClCompile Include="N64 System\Mips\System Timing.cpp" />
<ClCompile Include="N64 System\Mips\TLB class.cpp" />
<ClCompile Include="N64 System\C Core\Logging.cpp" />
<ClCompile Include="N64 System\C Core\r4300i Commands.cpp" />
<ClCompile Include="N64 System\Recompiler\Code Block.cpp" />
<ClCompile Include="N64 System\Recompiler\Code Section.cpp" />
@ -178,6 +178,7 @@
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Logging.h" />
<ClInclude Include="Multilanguage.h" />
<ClInclude Include="Multilanguage\LanguageSelector.h" />
<ClInclude Include="N64 System.h" />
@ -267,7 +268,6 @@
<ClInclude Include="N64 System\Mips\System Timing.h" />
<ClInclude Include="N64 System\Mips\TLB Class.h" />
<ClInclude Include="N64 System\Mips\TranslateVaddr.h" />
<ClInclude Include="N64 System\C Core\Logging.h" />
<ClInclude Include="N64 System\C Core\r4300i Commands.h" />
<ClInclude Include="N64 System\Debugger\Debugger - Memory Dump.h" />
<ClInclude Include="N64 System\Debugger\Debugger - Memory Search.h" />

View File

@ -330,9 +330,6 @@
<ClCompile Include="N64 System\Mips\TLB class.cpp">
<Filter>Source Files\N64 System Source\Mips Source</Filter>
</ClCompile>
<ClCompile Include="N64 System\C Core\Logging.cpp">
<Filter>Source Files\N64 System Source\C Core Source</Filter>
</ClCompile>
<ClCompile Include="N64 System\C Core\r4300i Commands.cpp">
<Filter>Source Files\N64 System Source\C Core Source</Filter>
</ClCompile>
@ -420,6 +417,9 @@
<ClCompile Include="User Interface\Cheat Class UI.cpp">
<Filter>Source Files\User Interface Source</Filter>
</ClCompile>
<ClCompile Include="Logging.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Image Include="User Interface\Bitmaps\AboutScreenBottom.bmp">
@ -722,9 +722,6 @@
<ClInclude Include="N64 System\Mips\TranslateVaddr.h">
<Filter>Header Files\N64 System Headers\Mips Headers</Filter>
</ClInclude>
<ClInclude Include="N64 System\C Core\Logging.h">
<Filter>Header Files\N64 System Headers\C Core Headers</Filter>
</ClInclude>
<ClInclude Include="N64 System\C Core\r4300i Commands.h">
<Filter>Header Files\N64 System Headers\C Core Headers</Filter>
</ClInclude>
@ -848,5 +845,8 @@
<ClInclude Include="User Interface\Cheat Class UI.h">
<Filter>Header Files\User Interface Headers</Filter>
</ClInclude>
<ClInclude Include="Logging.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>