Readded log manager changes, now with a LOGV function to use the verbosity levels.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1093 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2008-11-07 20:08:31 +00:00
parent 47f103567c
commit 825335fc2c
26 changed files with 456 additions and 221 deletions
+2
View File
@@ -235,6 +235,7 @@ void Host_UpdateLogDisplay();
#ifdef LOGGING
#define LOG(t, ...) __Log(LogTypes::t, __VA_ARGS__);
#define LOGV(t,v, ...) __Log(LogTypes::t + v*100, __VA_ARGS__);
#define _dbg_assert_(_t_, _a_) \
if (!(_a_)){\
@@ -252,6 +253,7 @@ void Host_UpdateLogDisplay();
#else
#define LOG(_t_, ...)
#define LOGV(_t_,_v_, ...)
#define _dbg_clear_()
#ifndef _dbg_assert_
#define _dbg_assert_(_t_, _a_) ;
+6 -6
View File
@@ -45,7 +45,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\Common\Src;..\DiscIO\Src;..\..\PluginSpecs;..\Debugger\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib;..\..\..\Externals\LZO"
AdditionalIncludeDirectories="..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\Common\Src;..\DiscIO\Src;..\..\PluginSpecs;..\Debugger\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib;..\..\..\Externals\LZO"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LOGGING;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -116,7 +116,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\Externals\LZO;..\Common\Src;..\DiscIO\Src;..\..\PluginSpecs;..\Debugger\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib"
AdditionalIncludeDirectories="..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Externals\LZO;..\Common\Src;..\DiscIO\Src;..\..\PluginSpecs;..\Debugger\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LOGGING;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -191,7 +191,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="false"
AdditionalIncludeDirectories="..\Common\Src;..\DiscIO\Src;..\..\PluginSpecs;..\Debugger\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib;..\..\..\Externals\LZO"
AdditionalIncludeDirectories="..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\Common\Src;..\DiscIO\Src;..\..\PluginSpecs;..\Debugger\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib;..\..\..\Externals\LZO"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
StringPooling="true"
RuntimeLibrary="0"
@@ -268,7 +268,7 @@
OmitFramePointers="true"
EnableFiberSafeOptimizations="false"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\Common\Src;..\DiscIO\Src;..\..\PluginSpecs;..\Debugger\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\LZO"
AdditionalIncludeDirectories="..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\Common\Src;..\DiscIO\Src;..\..\PluginSpecs;..\Debugger\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\LZO"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
StringPooling="true"
RuntimeLibrary="0"
@@ -343,7 +343,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="false"
AdditionalIncludeDirectories="..\Common\Src;..\DiscIO\Src;..\..\PluginSpecs;..\Debugger\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib;..\..\..\Externals\LZO"
AdditionalIncludeDirectories="..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\Common\Src;..\DiscIO\Src;..\..\PluginSpecs;..\Debugger\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib;..\..\..\Externals\LZO"
PreprocessorDefinitions="NDEBUG;_LIB;LOGGING;DEBUGFAST;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
RuntimeLibrary="0"
BufferSecurityCheck="true"
@@ -418,7 +418,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="false"
AdditionalIncludeDirectories="..\..\..\Externals\LZO;..\Common\Src;..\DiscIO\Src;..\..\PluginSpecs;..\Debugger\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib"
AdditionalIncludeDirectories="..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Externals\LZO;..\Common\Src;..\DiscIO\Src;..\..\PluginSpecs;..\Debugger\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib"
PreprocessorDefinitions="NDEBUG;_LIB;LOGGING;DEBUGFAST;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
RuntimeLibrary="0"
BufferSecurityCheck="false"
+2 -2
View File
@@ -142,7 +142,7 @@ void CBoot::EmulatedBIOS(bool _bDebug)
u32 iLength = Memory::ReadUnchecked_U32(0x81300008);
u32 iDVDOffset = Memory::ReadUnchecked_U32(0x8130000c);
LOG(MASTER_LOG, "DVDRead: offset: %08x memOffset: %08x length: %i", iDVDOffset, iRamAddress, iLength);
LOGV(MASTER_LOG, 2, "DVDRead: offset: %08x memOffset: %08x length: %i", iDVDOffset, iRamAddress, iLength);
DVDInterface::DVDRead(iDVDOffset, iRamAddress, iLength);
} while(PowerPC::ppcState.gpr[3] != 0x00);
@@ -349,7 +349,7 @@ bool CBoot::EmulatedBIOS_Wii(bool _bDebug)
u32 iLength = Memory::ReadUnchecked_U32(0x81300008);
u32 iDVDOffset = Memory::ReadUnchecked_U32(0x8130000c) << 2;
LOG(BOOT, "DVDRead: offset: %08x memOffse: %08x length: %i", iDVDOffset, iRamAddress, iLength);
LOGV(BOOT, 1, "DVDRead: offset: %08x memOffse: %08x length: %i", iDVDOffset, iRamAddress, iLength);
DVDInterface::DVDRead(iDVDOffset, iRamAddress, iLength);
} while(PowerPC::ppcState.gpr[3] != 0x00);
+1 -1
View File
@@ -347,7 +347,7 @@ void LogPendingEvents()
void Idle()
{
LOG(GEKKO, "Idle");
LOGV(GEKKO, 3, "Idle");
idledCycles += downcount;
downcount = 0;
+5 -5
View File
@@ -124,7 +124,7 @@ void Read32(u32& _rReturnValue, const u32 _Address)
switch (_Address & 0xFFFF)
{
case AI_CONTROL_REGISTER: //0x6C00
LOG(AUDIO_INTERFACE, "AudioInterface(R) 0x%08x", _Address);
LOGV(AUDIO_INTERFACE, 1, "AudioInterface(R) 0x%08x", _Address);
_rReturnValue = g_AudioRegister.m_Control.hex;
return;
@@ -132,7 +132,7 @@ void Read32(u32& _rReturnValue, const u32 _Address)
// Sample Rate (AIGetDSPSampleRate)
// 32bit state (highest bit PlayState) // AIGetStreamPlayState
case AI_VOLUME_REGISTER: //0x6C04
LOG(AUDIO_INTERFACE, "AudioInterface(R) 0x%08x", _Address);
LOGV(AUDIO_INTERFACE, 1, "AudioInterface(R) 0x%08x", _Address);
_rReturnValue = g_AudioRegister.m_Volume.hex;
return;
@@ -145,7 +145,7 @@ void Read32(u32& _rReturnValue, const u32 _Address)
case AI_INTERRUPT_TIMING:
// When sample counter reaches the value of this register, the interrupt AIINT should
// fire.
LOG(AUDIO_INTERFACE, "AudioInterface(R) 0x%08x", _Address);
LOGV(AUDIO_INTERFACE, 1, "AudioInterface(R) 0x%08x", _Address);
_rReturnValue = g_AudioRegister.m_InterruptTiming;
return;
@@ -200,7 +200,7 @@ void Write32(const u32 _Value, const u32 _Address)
// Sample Count Reset
if (tmpAICtrl.SCRESET)
{
LOG(AUDIO_INTERFACE, "Reset SampleCounter");
LOGV(AUDIO_INTERFACE, 1, "Reset SampleCounter");
g_AudioRegister.m_SampleCounter = 0;
g_AudioRegister.m_Control.SCRESET = 0;
@@ -217,7 +217,7 @@ void Write32(const u32 _Value, const u32 _Address)
case AI_VOLUME_REGISTER:
g_AudioRegister.m_Volume.hex = _Value;
LOG(AUDIO_INTERFACE, "Set m_Volume: left(%i) right(%i)", g_AudioRegister.m_Volume.leftVolume, g_AudioRegister.m_Volume.rightVolume);
LOGV(AUDIO_INTERFACE, 1, "Set m_Volume: left(%i) right(%i)", g_AudioRegister.m_Volume.leftVolume, g_AudioRegister.m_Volume.rightVolume);
break;
case AI_SAMPLE_COUNTER:
+2 -2
View File
@@ -202,7 +202,7 @@ void Shutdown()
void Read16(u16& _rReturnValue, const u32 _Address)
{
LOG(COMMANDPROCESSOR, "(r): 0x%08x", _Address);
LOGV(COMMANDPROCESSOR, 1, "(r): 0x%08x", _Address);
switch (_Address & 0xFFF)
{
case STATUS_REGISTER: _rReturnValue = m_CPStatusReg.Hex; return;
@@ -274,7 +274,7 @@ bool AllowIdleSkipping()
void Write16(const u16 _Value, const u32 _Address)
{
LOG(COMMANDPROCESSOR, "(w): 0x%04x @ 0x%08x",_Value,_Address);
LOGV(COMMANDPROCESSOR, 1, "(w): 0x%04x @ 0x%08x",_Value,_Address);
//Spin until queue is empty - it WILL become empty because this is the only thread
//that submits data
+5 -5
View File
@@ -218,7 +218,7 @@ void Read16(u16& _uReturnValue, const u32 _iAddress)
if ((_iAddress & 0x6C00) != 0x6c00)
{
if (_iAddress != 0xCC005004) {
LOG(DSPINTERFACE, "DSPInterface(r16) 0x%08x", _iAddress);
LOGV(DSPINTERFACE, 3, "DSPInterface(r16) 0x%08x", _iAddress);
}
switch (_iAddress & 0xFFFF)
@@ -303,7 +303,7 @@ void Read16(u16& _uReturnValue, const u32 _iAddress)
void Write16(const u16 _Value, const u32 _Address)
{
LOG(DSPINTERFACE, "DSPInterface(w16) 0x%04x 0x%08x", _Value, _Address);
LOGV(DSPINTERFACE, 3, "DSPInterface(w16) 0x%04x 0x%08x", _Value, _Address);
switch(_Address & 0xFFFF)
{
@@ -559,13 +559,13 @@ void Update_ARAM_DMA()
return;
g_arDMA.CntValid[0] = g_arDMA.CntValid[1] = false;
LOG(DSPINTERFACE,"ARAM DMA triggered");
LOGV(DSPINTERFACE, 1, "ARAM DMA triggered");
//TODO: speedup
if (g_arDMA.Cnt.dir)
{
//read from ARAM
LOG(DSPINTERFACE,"ARAM DMA read %08x bytes from %08x to Mem: %08x",g_arDMA.Cnt.count, g_arDMA.ARAddr, g_arDMA.MMAddr);
LOGV(DSPINTERFACE, 1, "ARAM DMA read %08x bytes from %08x to Mem: %08x",g_arDMA.Cnt.count, g_arDMA.ARAddr, g_arDMA.MMAddr);
u32 iMemAddress = g_arDMA.MMAddr;
u32 iARAMAddress = g_arDMA.ARAddr;
@@ -585,7 +585,7 @@ void Update_ARAM_DMA()
u32 iARAMAddress = g_arDMA.ARAddr;
//write to g_ARAM
LOG(DSPINTERFACE,"g_ARAM DMA write %08x bytes from %08x to Aram: %08x",g_arDMA.Cnt.count, g_arDMA.MMAddr, g_arDMA.ARAddr);
LOGV(DSPINTERFACE, 1, "g_ARAM DMA write %08x bytes from %08x to Aram: %08x",g_arDMA.Cnt.count, g_arDMA.MMAddr, g_arDMA.ARAddr);
for (u32 i = 0; i < g_arDMA.Cnt.count; i++)
{
if (iARAMAddress < ARAM_SIZE)
+3 -3
View File
@@ -279,7 +279,7 @@ bool DVDReadADPCM(u8* _pDestBuffer, u32 _iNumSamples)
void Read32(u32& _uReturnValue, const u32 _iAddress)
{
LOG(DVDINTERFACE, "DVD(r): 0x%08x", _iAddress);
LOGV(DVDINTERFACE, 3, "DVD(r): 0x%08x", _iAddress);
switch (_iAddress & 0xFFF)
{
@@ -308,7 +308,7 @@ void Read32(u32& _uReturnValue, const u32 _iAddress)
void Write32(const u32 _iValue, const u32 _iAddress)
{
LOG(DVDINTERFACE, "DVD(w): 0x%08x @ 0x%08x", _iValue, _iAddress);
LOGV(DVDINTERFACE, 3, "DVD(w): 0x%08x @ 0x%08x", _iValue, _iAddress);
switch (_iAddress & 0x3FF)
{
@@ -466,7 +466,7 @@ void ExecuteCommand(UDIDMAControlRegister& _DMAControlReg)
u32 iDVDOffset = dvdMem.Command[1] << 2;
u32 iSrcLength = dvdMem.Command[2];
if (false) { iSrcLength++; } // avoid warning << wtf is this?
LOG(DVDINTERFACE, "DVD: Read ISO: DVDOffset=%08x, DMABuffer=%08x, SrcLength=%08x, DMALength=%08x",iDVDOffset,dvdMem.DMAAddress.Address,iSrcLength,dvdMem.DMALength.Length);
LOGV(DVDINTERFACE, 2, "DVD: Read ISO: DVDOffset=%08x, DMABuffer=%08x, SrcLength=%08x, DMALength=%08x",iDVDOffset,dvdMem.DMAAddress.Address,iSrcLength,dvdMem.DMALength.Length);
_dbg_assert_(DVDINTERFACE, iSrcLength == dvdMem.DMALength.Length);
if (DVDRead(iDVDOffset, dvdMem.DMAAddress.Address, dvdMem.DMALength.Length) != true)
+6 -6
View File
@@ -128,7 +128,7 @@ void CEXIChannel::Update()
void CEXIChannel::Read32(u32& _uReturnValue, const u32 _iRegister)
{
LOG(EXPANSIONINTERFACE, "ExtensionInterface(R): channel: %i reg: %i", m_ChannelId, _iRegister);
LOGV(EXPANSIONINTERFACE, 3, "ExtensionInterface(R): channel: %i reg: %i", m_ChannelId, _iRegister);
switch (_iRegister)
{
@@ -172,7 +172,7 @@ void CEXIChannel::Read32(u32& _uReturnValue, const u32 _iRegister)
void CEXIChannel::Write32(const u32 _iValue, const u32 _iRegister)
{
LOG(EXPANSIONINTERFACE, "ExtensionInterface(W): 0x%08x channel: %i reg: %i", _iValue, m_ChannelId, _iRegister);
LOGV(EXPANSIONINTERFACE, 2, "ExtensionInterface(W): 0x%08x channel: %i reg: %i", _iValue, m_ChannelId, _iRegister);
switch (_iRegister)
{
@@ -226,17 +226,17 @@ void CEXIChannel::Write32(const u32 _iValue, const u32 _iRegister)
break;
case EXI_DMAADDR:
LOG(EXPANSIONINTERFACE, "EXI: Wrote DMABuf, chan %i", m_ChannelId);
LOGV(EXPANSIONINTERFACE, 2, "EXI: Wrote DMABuf, chan %i", m_ChannelId);
m_DMAMemoryAddress = _iValue;
break;
case EXI_DMALENGTH:
LOG(EXPANSIONINTERFACE, "EXI: Wrote DMASize, chan %i", m_ChannelId);
LOGV(EXPANSIONINTERFACE, 2, "EXI: Wrote DMASize, chan %i", m_ChannelId);
m_DMALength = _iValue;
break;
case EXI_DMACONTROL:
LOG(EXPANSIONINTERFACE, "EXI: Wrote DMAControl, chan %i", m_ChannelId);
LOGV(EXPANSIONINTERFACE, 2, "EXI: Wrote DMAControl, chan %i", m_ChannelId);
m_Control.hex = _iValue;
if (m_Control.TSTART)
@@ -277,7 +277,7 @@ void CEXIChannel::Write32(const u32 _iValue, const u32 _iRegister)
break;
case EXI_IMMDATA:
LOG(EXPANSIONINTERFACE, "EXI: Wrote IMMData, chan %i", m_ChannelId);
LOGV(EXPANSIONINTERFACE, 2, "EXI: Wrote IMMData, chan %i", m_ChannelId);
m_ImmData = _iValue;
break;
}
+2 -2
View File
@@ -188,7 +188,7 @@ void CEXIIPL::TransferByte(u8& _uByte)
// debug only
else if ((m_uAddress & 0x60000000) == 0)
{
LOG(EXPANSIONINTERFACE, "EXI IPL-DEV: IPL access");
LOGV(EXPANSIONINTERFACE, 2, "EXI IPL-DEV: IPL access");
}
else if ((m_uAddress & 0x7FFFFF00) == 0x20000000)
{
@@ -200,7 +200,7 @@ void CEXIIPL::TransferByte(u8& _uByte)
}
else if ((m_uAddress & 0x7FFFFF00) == 0x20010000)
{
LOG(EXPANSIONINTERFACE, "EXI IPL-DEV: UART");
LOGV(EXPANSIONINTERFACE, 3, "EXI IPL-DEV: UART");
}
else
{
@@ -252,12 +252,12 @@ bool CEXIMemoryCard::IsInterruptSet()
void CEXIMemoryCard::TransferByte(u8 &byte)
{
LOG(EXPANSIONINTERFACE, "EXI MEMCARD: > %02x", byte);
LOGV(EXPANSIONINTERFACE, 3, "EXI MEMCARD: > %02x", byte);
if (m_uPosition == 0)
{
command = byte; // first byte is command
byte = 0xFF; // would be tristate, but we don't care.
LOG(EXPANSIONINTERFACE, "EXI MEMCARD: command %02x", byte)
LOGV(EXPANSIONINTERFACE, 1, "EXI MEMCARD: command %02x", byte)
if(command == cmdClearStatus)
{
@@ -382,5 +382,5 @@ void CEXIMemoryCard::TransferByte(u8 &byte)
}
}
m_uPosition++;
LOG(EXPANSIONINTERFACE, "EXI MEMCARD: < %02x", byte);
LOGV(EXPANSIONINTERFACE, 3, "EXI MEMCARD: < %02x", byte);
}
@@ -79,7 +79,7 @@ void CPeripheralInterface::Read32(u32& _uReturnValue, const u32 _iAddress)
return;
case PI_FIFO_WPTR:
LOG(PERIPHERALINTERFACE,"read writepointer, value = %08x",Fifo_CPUWritePointer);
LOGV(PERIPHERALINTERFACE, 3, "read writepointer, value = %08x",Fifo_CPUWritePointer);
_uReturnValue = Fifo_CPUWritePointer; //really writes in 32-byte chunks
// Monk's gcube does some crazy align trickery here.
@@ -206,12 +206,12 @@ void CPeripheralInterface::SetInterrupt(InterruptCause _causemask, bool _bSet)
if (_bSet && !(m_InterruptCause & (u32)_causemask))
{
LOG(PERIPHERALINTERFACE,"Setting Interrupt %s (%s)",Debug_GetInterruptName(_causemask), "set");
LOGV(PERIPHERALINTERFACE, 2, "Setting Interrupt %s (%s)",Debug_GetInterruptName(_causemask), "set");
}
if (!_bSet && (m_InterruptCause & (u32)_causemask))
{
LOG(PERIPHERALINTERFACE,"Setting Interrupt %s (%s)",Debug_GetInterruptName(_causemask), "clear");
LOGV(PERIPHERALINTERFACE, 2, "Setting Interrupt %s (%s)",Debug_GetInterruptName(_causemask), "clear");
}
if (_bSet)
+5 -5
View File
@@ -87,7 +87,7 @@ void Init()
void Read16(u16& _uReturnValue, const u32 _iAddress)
{
LOG(PIXELENGINE, "(r16): 0x%08x", _iAddress);
LOGV(PIXELENGINE, 3, "(r16): 0x%08x", _iAddress);
switch (_iAddress & 0xFFF)
{
@@ -109,12 +109,12 @@ void Read16(u16& _uReturnValue, const u32 _iAddress)
void Write32(const u32 _iValue, const u32 _iAddress)
{
LOG(PIXELENGINE, "(w32): 0x%08x @ 0x%08x",_iValue,_iAddress);
LOGV(PIXELENGINE, 2, "(w32): 0x%08x @ 0x%08x",_iValue,_iAddress);
}
void Write16(const u16 _iValue, const u32 _iAddress)
{
LOG(PIXELENGINE, "(w16): 0x%04x @ 0x%08x",_iValue,_iAddress);
LOGV(PIXELENGINE, 3, "(w16): 0x%04x @ 0x%08x",_iValue,_iAddress);
switch(_iAddress & 0xFFF)
{
@@ -169,7 +169,7 @@ void SetToken_OnMainThread(u64 userdata, int cyclesLate)
if (userdata >> 16)
g_bSignalTokenInterrupt = true;
g_token = (u16)(userdata & 0xFFFF);
LOG(PIXELENGINE, "VIDEO Plugin wrote token: %i", g_token);
LOGV(PIXELENGINE, 1, "VIDEO Plugin wrote token: %i", g_token);
UpdateInterrupts();
}
@@ -193,7 +193,7 @@ void SetFinish()
{
CoreTiming::ScheduleEvent_Threadsafe(
0, et_SetFinishOnMainThread);
LOG(PIXELENGINE, "VIDEO Set Finish");
LOGV(PIXELENGINE, 2, "VIDEO Set Finish");
}
} // end of namespace PixelEngine
+3 -3
View File
@@ -268,7 +268,7 @@ void Shutdown()
void Read32(u32& _uReturnValue, const u32 _iAddress)
{
LOG(SERIALINTERFACE, "(r32): 0x%08x", _iAddress);
LOGV(SERIALINTERFACE, 3, "(r32): 0x%08x", _iAddress);
// SIBuffer
if ((_iAddress >= 0xCC006480 && _iAddress < 0xCC006500) ||
@@ -375,7 +375,7 @@ void Read32(u32& _uReturnValue, const u32 _iAddress)
void Write32(const u32 _iValue, const u32 _iAddress)
{
LOG(SERIALINTERFACE, "(w32): 0x%08x 0x%08x", _iValue,_iAddress);
LOGV(SERIALINTERFACE, 3, "(w32): 0x%08x 0x%08x", _iValue,_iAddress);
// SIBuffer
if ((_iAddress >= 0xCC006480 && _iAddress < 0xCC006500) ||
@@ -546,7 +546,7 @@ void RunSIBuffer()
int numOutput =
#endif
g_Channel[g_ComCSR.CHANNEL].m_pDevice->RunBuffer(g_SIBuffer, inLength);
LOG(SERIALINTERFACE, "RunSIBuffer (intLen: %i outLen: %i) (processed: %i)", inLength, outLength, numOutput);
LOGV(SERIALINTERFACE, 2, "RunSIBuffer (intLen: %i outLen: %i) (processed: %i)", inLength, outLength, numOutput);
// Transfer completed
GenerateSIInterrupt(INT_TCINT);
+2 -2
View File
@@ -205,7 +205,7 @@ void Read16(u16& _uReturnValue, const u32 _iAddress)
return;
case VI_CONTROL_REGISTER:
LOG(VIDEOINTERFACE, "VideoInterface(r16): VI_CONTROL_REGISTER 0x%08x", m_VIDisplayControlRegister.Hex);
LOGV(VIDEOINTERFACE, 3, "VideoInterface(r16): VI_CONTROL_REGISTER 0x%08x", m_VIDisplayControlRegister.Hex);
_uReturnValue = m_VIDisplayControlRegister.Hex;
return;
@@ -272,7 +272,7 @@ void Read16(u16& _uReturnValue, const u32 _iAddress)
void Write16(const u16 _iValue, const u32 _iAddress)
{
LOG(VIDEOINTERFACE, "(w16): 0x%04x, 0x%08x",_iValue,_iAddress);
LOGV(VIDEOINTERFACE, 3, "(w16): 0x%04x, 0x%08x",_iValue,_iAddress);
//Somewhere it sets screen width.. we need to communicate this to the gfx plugin...
+6 -6
View File
@@ -38,17 +38,17 @@ void HWCALL Read32(u32& _rReturnValue, const u32 _Address)
{
case 0xc0: // __VISendI2CData
_rReturnValue = 0;
LOG(WII_IOB, "IOP: Read32 from 0xc0 = 0x%08x (__VISendI2CData)", _rReturnValue);
LOGV(WII_IOB, 2, "IOP: Read32 from 0xc0 = 0x%08x (__VISendI2CData)", _rReturnValue);
break;
case 0xc4: // __VISendI2CData
_rReturnValue = 0;
LOG(WII_IOB, "IOP: Read32 from 0xc4 = 0x%08x (__VISendI2CData)", _rReturnValue);
LOGV(WII_IOB, 2, "IOP: Read32 from 0xc4 = 0x%08x (__VISendI2CData)", _rReturnValue);
break;
case 0xc8: // __VISendI2CData
_rReturnValue = 0;
LOG(WII_IOB, "IOP: Read32 from 0xc8 = 0x%08x (__VISendI2CData)", _rReturnValue);
LOGV(WII_IOB, 2, "IOP: Read32 from 0xc8 = 0x%08x (__VISendI2CData)", _rReturnValue);
break;
case 0x180: // __AIClockInit
@@ -92,15 +92,15 @@ void HWCALL Write32(const u32 _Value, const u32 _Address)
switch(_Address & 0xFFFF)
{
case 0xc0: // __VISendI2CData
LOG(WII_IOB, "IOP: Write32 to 0xc0 = 0x%08x (__VISendI2CData)", _Value);
LOGV(WII_IOB, 2, "IOP: Write32 to 0xc0 = 0x%08x (__VISendI2CData)", _Value);
break;
case 0xc4: // __VISendI2CData
LOG(WII_IOB, "IOP: Write32 to 0xc4 = 0x%08x (__VISendI2CData)", _Value);
LOGV(WII_IOB, 2, "IOP: Write32 to 0xc4 = 0x%08x (__VISendI2CData)", _Value);
break;
case 0xc8: // __VISendI2CData
LOG(WII_IOB, "IOP: Write32 to 0xc8 = 0x%08x (__VISendI2CData)", _Value);
LOGV(WII_IOB, 2, "IOP: Write32 to 0xc8 = 0x%08x (__VISendI2CData)", _Value);
break;
case 0x180: // __AIClockInit
+5 -5
View File
@@ -129,7 +129,7 @@ void HWCALL Read32(u32& _rReturnValue, const u32 _Address)
_rReturnValue = g_IPC_Control.Hex;
LOG(WII_IPC, "IOP: Read32 from IPC_CONTROL_REGISTER(0x04) = 0x%08x", _rReturnValue);
LOGV(WII_IPC, 2, "IOP: Read32 from IPC_CONTROL_REGISTER(0x04) = 0x%08x", _rReturnValue);
// CCPU::Break();
// if ((REASON_REG & 0x14) == 0x14) CALL IPCReplayHanlder
@@ -139,7 +139,7 @@ void HWCALL Read32(u32& _rReturnValue, const u32 _Address)
case IPC_REPLY_REGISTER: // looks a little bit like a callback function
_rReturnValue = g_Reply;
LOG(WII_IPC, "IOP: Write32 to IPC_REPLAY_REGISTER(0x08) = 0x%08x ", _rReturnValue);
LOGV(WII_IPC, 2, "IOP: Write32 to IPC_REPLAY_REGISTER(0x08) = 0x%08x ", _rReturnValue);
break;
case IPC_SENSOR_BAR_POWER_REGISTER:
@@ -160,13 +160,13 @@ void HWCALL Write32(const u32 _Value, const u32 _Address)
case IPC_COMMAND_REGISTER: // __ios_Ipc2 ... a value from __responses is loaded
{
g_Address = _Value;
LOG(WII_IPC, "IOP: Write32 to IPC_ADDRESS_REGISTER(0x00) = 0x%08x", g_Address);
LOGV(WII_IPC, 1, "IOP: Write32 to IPC_ADDRESS_REGISTER(0x00) = 0x%08x", g_Address);
}
break;
case IPC_CONTROL_REGISTER:
{
LOG(WII_IPC, "IOP: Write32 to IPC_CONTROL_REGISTER(0x04) = 0x%08x (old: 0x%08x)", _Value, g_IPC_Control.Hex);
LOGV(WII_IPC, 1, "IOP: Write32 to IPC_CONTROL_REGISTER(0x04) = 0x%08x (old: 0x%08x)", _Value, g_IPC_Control.Hex);
UIPC_Control TempControl(_Value);
_dbg_assert_msg_(WII_IPC, TempControl.pad == 0, "IOP: Write to UIPC_Control.pad", _Address);
@@ -192,7 +192,7 @@ void HWCALL Write32(const u32 _Value, const u32 _Address)
UIPC_Status NewStatus(_Value);
if (NewStatus.INTERRUPT) g_IPC_Status.INTERRUPT = 0; // clear interrupt
LOG(WII_IPC, "IOP: Write32 to IPC_STATUS_REGISTER(0x30) = 0x%08x", _Value);
LOGV(WII_IPC, 1, "IOP: Write32 to IPC_STATUS_REGISTER(0x30) = 0x%08x", _Value);
}
break;
+2 -2
View File
@@ -362,7 +362,7 @@ void Update()
// check if we have to execute an acknowledged command
if (!m_ReplyQueue.empty())
{
LOG(WII_IPC_HLE, "-- Generate Reply %s (0x%08x)", m_ReplyQueue.front().second.c_str(), m_ReplyQueue.front().first);
LOGV(WII_IPC_HLE, 1, "-- Generate Reply %s (0x%08x)", m_ReplyQueue.front().second.c_str(), m_ReplyQueue.front().first);
WII_IPCInterface::GenerateReply(m_ReplyQueue.front().first);
m_ReplyQueue.pop();
return;
@@ -373,7 +373,7 @@ void Update()
u32 _Address = m_Ack.front();
m_Ack.pop_front();
ExecuteCommand(_Address);
LOG(WII_IPC_HLE, "-- Generate Ack (0x%08x)", _Address);
LOGV(WII_IPC_HLE, 1, "-- Generate Ack (0x%08x)", _Address);
WII_IPCInterface::GenerateAck(_Address);
}
}
+158 -90
View File
@@ -16,18 +16,20 @@
// http://code.google.com/p/dolphin-emu/
#include <stdio.h>
#include <wx/datetime.h> // for the timestamps
#include "Common.h"
#include "StringUtil.h"
#include "LogManager.h"
#include "PowerPC/PowerPC.h"
#include "PowerPC/SymbolDB.h" // for g_symbolDB
#include "Debugger/Debugger_SymbolMap.h"
LogManager::SMessage *LogManager::m_Messages;
int LogManager::m_nextMessages = 0;
LogManager::SMessage (*LogManager::m_Messages)[MAX_MESSAGES];
int LogManager::m_nextMessages[LogManager::VERBOSITY_LEVELS + 1];
CDebugger_Log* LogManager::m_Log[LogTypes::NUMBER_OF_LOGS];
CDebugger_Log* LogManager::m_Log[LogTypes::NUMBER_OF_LOGS + (LogManager::VERBOSITY_LEVELS * 100)];
int LogManager::m_activeLog = LogTypes::MASTER_LOG;
bool LogManager::m_bDirty = true;
bool LogManager::m_bInitialized = false;
@@ -35,9 +37,6 @@ bool LogManager::m_bInitialized = false;
void __Log(int log, const char *format, ...)
{
if (!LogManager::IsLogEnabled((LogTypes::LOG_TYPE)log))
return;
char* temp = (char*)alloca(strlen(format)+512);
va_list args;
va_start(args, format);
@@ -46,15 +45,16 @@ void __Log(int log, const char *format, ...)
LogManager::Log((LogTypes::LOG_TYPE)log, temp);
}
CDebugger_Log::CDebugger_Log(const char* _szShortName, const char* _szName) :
m_bLogToFile(true),
m_bShowInLog(true),
m_bEnable(true),
CDebugger_Log::CDebugger_Log(const char* _szShortName, const char* _szName, int a) :
m_bLogToFile(true), // write to file or not
m_bShowInLog(false),
m_bEnable(false),
m_pFile(NULL)
{
strcpy((char*)m_szName, _szName);
strcpy((char*)m_szShortName, _szShortName);
sprintf((char*)m_szFilename, "Logs/%s.txt", _szName);
strcpy((char*)m_szShortName_, _szShortName);
sprintf((char*)m_szShortName, "%s%i", _szShortName, a);
sprintf((char*)m_szFilename, "Logs/%s%i.txt", _szName, a);
unlink(m_szFilename);
}
@@ -68,6 +68,10 @@ CDebugger_Log::~CDebugger_Log(void)
}
}
// we may need to declare these
CDebugger_LogSettings::CDebugger_LogSettings() {}
CDebugger_LogSettings::~CDebugger_LogSettings(void) {}
void CDebugger_Log::Init()
{
m_pFile = fopen(m_szFilename, "wtb");
@@ -85,44 +89,53 @@ void CDebugger_Log::Shutdown()
void LogManager::Init()
{
m_Messages = new SMessage[MAX_MESSAGES];
m_Messages = new SMessage[LogManager::VERBOSITY_LEVELS + 1][MAX_MESSAGES];
m_bDirty = true;
// create Logs
m_Log[LogTypes::MASTER_LOG] = new CDebugger_Log("*", "Master Log");
m_Log[LogTypes::BOOT] = new CDebugger_Log("BOOT", "Boot");
m_Log[LogTypes::PIXELENGINE] = new CDebugger_Log("PE", "PixelEngine");
m_Log[LogTypes::COMMANDPROCESSOR] = new CDebugger_Log("CP", "CommandProc");
m_Log[LogTypes::VIDEOINTERFACE] = new CDebugger_Log("VI", "VideoInt");
m_Log[LogTypes::SERIALINTERFACE] = new CDebugger_Log("SI", "SerialInt");
m_Log[LogTypes::PERIPHERALINTERFACE]= new CDebugger_Log("PI", "PeripheralInt");
m_Log[LogTypes::MEMMAP] = new CDebugger_Log("MI", "MI & memmap");
m_Log[LogTypes::STREAMINGINTERFACE] = new CDebugger_Log("Stream", "StreamingInt");
m_Log[LogTypes::DSPINTERFACE] = new CDebugger_Log("DSP", "DSPInterface");
m_Log[LogTypes::DVDINTERFACE] = new CDebugger_Log("DVD", "DVDInterface");
m_Log[LogTypes::GPFIFO] = new CDebugger_Log("GP", "GPFifo");
m_Log[LogTypes::EXPANSIONINTERFACE] = new CDebugger_Log("EXI", "ExpansionInt.");
m_Log[LogTypes::AUDIO_INTERFACE] = new CDebugger_Log("AI", "AudioInt.");
m_Log[LogTypes::GEKKO] = new CDebugger_Log("GEKKO", "IBM CPU");
m_Log[LogTypes::HLE] = new CDebugger_Log("HLE", "HLE");
m_Log[LogTypes::DSPHLE] = new CDebugger_Log("DSPHLE", "DSP HLE");
m_Log[LogTypes::VIDEO] = new CDebugger_Log("Video", "Video Plugin");
m_Log[LogTypes::AUDIO] = new CDebugger_Log("Audio", "Audio Plugin");
m_Log[LogTypes::DYNA_REC] = new CDebugger_Log("DYNA", "Dynamic Recompiler");
m_Log[LogTypes::CONSOLE] = new CDebugger_Log("CONSOLE", "Dolphin Console");
m_Log[LogTypes::OSREPORT] = new CDebugger_Log("OSREPORT", "OSReport");
m_Log[LogTypes::WII_IOB] = new CDebugger_Log("WII_IOB", "WII IO Bridge");
m_Log[LogTypes::WII_IPC] = new CDebugger_Log("WII_IPC", "WII IPC");
m_Log[LogTypes::WII_IPC_HLE] = new CDebugger_Log("WII_IPC_HLE", "WII IPC HLE");
m_Log[LogTypes::WII_IPC_DVD] = new CDebugger_Log("WII_IPC_DVD", "WII IPC DVD");
m_Log[LogTypes::WII_IPC_ES] = new CDebugger_Log("WII_IPC_ES", "WII IPC ES");
m_Log[LogTypes::WII_IPC_FILEIO] = new CDebugger_Log("WII_IPC_FILEIO", "WII IPC FILEIO");
m_Log[LogTypes::WII_IPC_NET] = new CDebugger_Log("WII_IPC_NET", "WII IPC NET");
m_Log[LogTypes::WII_IPC_WIIMOTE] = new CDebugger_Log("WII_IPC_WIIMOTE", "WII IPC WIIMOTE");
// create log files
for(int i = 0; i <= LogManager::VERBOSITY_LEVELS; i++)
{
m_Log[LogTypes::MASTER_LOG + i*100] = new CDebugger_Log("*", "Master Log", i);
m_Log[LogTypes::BOOT + i*100] = new CDebugger_Log("BOOT", "Boot", i);
m_Log[LogTypes::PIXELENGINE + i*100] = new CDebugger_Log("PE", "PixelEngine", i);
m_Log[LogTypes::COMMANDPROCESSOR + i*100] = new CDebugger_Log("CP", "CommandProc", i);
m_Log[LogTypes::VIDEOINTERFACE + i*100] = new CDebugger_Log("VI", "VideoInt", i);
m_Log[LogTypes::SERIALINTERFACE + i*100] = new CDebugger_Log("SI", "SerialInt", i);
m_Log[LogTypes::PERIPHERALINTERFACE + i*100]= new CDebugger_Log("PI", "PeripheralInt", i);
m_Log[LogTypes::MEMMAP + i*100] = new CDebugger_Log("MI", "MI & memmap", i);
m_Log[LogTypes::STREAMINGINTERFACE + i*100] = new CDebugger_Log("Stream", "StreamingInt", i);
m_Log[LogTypes::DSPINTERFACE + i*100] = new CDebugger_Log("DSP", "DSPInterface", i);
m_Log[LogTypes::DVDINTERFACE + i*100] = new CDebugger_Log("DVD", "DVDInterface", i);
m_Log[LogTypes::GPFIFO + i*100] = new CDebugger_Log("GP", "GPFifo", i);
m_Log[LogTypes::EXPANSIONINTERFACE + i*100] = new CDebugger_Log("EXI", "ExpansionInt", i);
m_Log[LogTypes::AUDIO_INTERFACE + i*100] = new CDebugger_Log("AI", "AudioInt", i);
m_Log[LogTypes::GEKKO + i*100] = new CDebugger_Log("GEKKO", "IBM CPU", i);
m_Log[LogTypes::HLE + i*100] = new CDebugger_Log("HLE", "HLE", i);
m_Log[LogTypes::DSPHLE + i*100] = new CDebugger_Log("DSPHLE", "DSP HLE", i);
m_Log[LogTypes::VIDEO + i*100] = new CDebugger_Log("Video", "Video Plugin", i);
m_Log[LogTypes::AUDIO + i*100] = new CDebugger_Log("Audio", "Audio Plugin", i);
m_Log[LogTypes::DYNA_REC + i*100] = new CDebugger_Log("DYNA", "Dynamic Recompiler", i);
m_Log[LogTypes::OSREPORT + i*100] = new CDebugger_Log("OSREPORT", "Dolphin Console", i);
m_Log[LogTypes::CONSOLE + i*100] = new CDebugger_Log("CONSOLE", "OSReport", i);
m_Log[LogTypes::WII_IOB + i*100] = new CDebugger_Log("WII_IOB", "WII IO Bridge", i);
m_Log[LogTypes::WII_IPC + i*100] = new CDebugger_Log("WII_IPC", "WII IPC", i);
m_Log[LogTypes::WII_IPC_HLE + i*100] = new CDebugger_Log("WII_IPC_HLE", "WII IPC HLE", i);
m_Log[LogTypes::WII_IPC_DVD + i*100] = new CDebugger_Log("WII_IPC_DVD", "WII IPC DVD", i);
m_Log[LogTypes::WII_IPC_ES + i*100] = new CDebugger_Log("WII_IPC_ES", "WII IPC ES", i);
m_Log[LogTypes::WII_IPC_FILEIO + i*100] = new CDebugger_Log("WII_IPC_FILEIO", "WII IPC FILEIO", i);
m_Log[LogTypes::WII_IPC_NET + i*100] = new CDebugger_Log("WII_IPC_NET", "WII IPC NET", i);
m_Log[LogTypes::WII_IPC_WIIMOTE + i*100] = new CDebugger_Log("WII_IPC_WIIMOTE", "WII IPC WIIMOTE", i);
m_nextMessages[i] = 0; // initiate to zero
}
// create the files
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
{
m_Log[i]->Init();
for (int j = 0; j <= LogManager::VERBOSITY_LEVELS; j++)
{
m_Log[j*100 + i]->Init();
}
}
m_bInitialized = true;
}
@@ -130,15 +143,21 @@ void LogManager::Init()
void LogManager::Clear()
{
for (int i = 0;i < MAX_MESSAGES;i++)
for (int v = 0; v <= LogManager::VERBOSITY_LEVELS; v++)
{
strcpy(m_Messages[i].m_szMessage,"");
m_Messages[i].m_dwMsgLen = 0;
m_Messages[i].m_bInUse = false;
for (int i = 0; i < MAX_MESSAGES; i++)
{
strcpy(m_Messages[v][i].m_szMessage,"");
m_Messages[v][i].m_dwMsgLen = 0;
m_Messages[v][i].m_bInUse = false;
}
m_nextMessages[v] = 0;
}
m_nextMessages = 0;
}
// __________________________________________________________________________________________________
// Shutdown
//
void LogManager::Shutdown()
{
m_bInitialized = false;
@@ -157,68 +176,117 @@ void LogManager::Shutdown()
delete [] m_Messages;
}
bool LogManager::IsLogEnabled(LogTypes::LOG_TYPE _type)
{
if (_type >= LogTypes::NUMBER_OF_LOGS)
{
PanicAlert("Try to access unknown log (%i)", _type);
return false;
}
if (m_Log[_type] == NULL || !m_Log[_type]->m_bEnable)
return false;
return true;
}
// ==========================================================================================
// The function that finally writes the log.
// ---------------
u32 lastPC;
std::string lastSymbol;
void LogManager::Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...)
{
if (m_Log[_type] == NULL || !m_Log[_type]->m_bEnable)
if (m_LogSettings == NULL)
return;
// declarations
int v; // verbosity level
int type; // the log type, CONSOLE etc.
char cvv[20];
std::string svv;
// get the current verbosity level and type
sprintf(cvv, "%03i", (int)_type);
svv = cvv;
v = atoi(svv.substr(0, 1).c_str());
type = atoi(svv.substr(1, 2).c_str());
// security checks
if (m_Log[_type] == NULL || !m_Log[_type]->m_bEnable || PC == 0
|| _type > (LogTypes::NUMBER_OF_LOGS + LogManager::VERBOSITY_LEVELS * 100)
|| _type < 0)
return;
// prepare message
char Msg[512];
va_list ap;
va_start(ap, _fmt);
vsprintf(Msg, _fmt, ap);
va_end(ap);
SMessage& Message = m_Messages[m_nextMessages];
static u32 count = 0;
wxDateTime datetime = wxDateTime::UNow(); // get timestamp
char* Msg2 = (char*)alloca(strlen(_fmt)+512);
int Index = 0; //Debugger::FindSymbol(PC);
const char *eol = "\n";
if (Index > 0)
{
// const Debugger::Symbol& symbol = Debugger::GetSymbol(Index);
sprintf(Msg2, "%i: %x %s (%s, %08x ) : %s%s",
++count,
PowerPC::ppcState.DebugCount,
m_Log[_type]->m_szShortName,
"", //symbol.GetName().c_str(),
PC,
Msg, eol);
// Here's the old symbol request
//Debugger::FindSymbol(PC);
// const Debugger::Symbol& symbol = Debugger::GetSymbol(Index);
//symbol.GetName().c_str(),
// Warning: Getting the function name this often is very demanding on the CPU.
// I have limited it to the two lowest verbosity levels because of that. I've also
// added a simple caching function so that we don't search again if we get the same
// question again.
std::string symbol;
if ((v == 0 || v == 1) && lastPC != PC && LogManager::m_LogSettings->bResolve)
{
symbol = g_symbolDB.GetDescription(PC);
lastSymbol = symbol;
lastPC = PC;
}
else if(lastPC == PC && LogManager::m_LogSettings->bResolve)
{
symbol = lastSymbol;
}
else
{
sprintf(Msg2, "%i: %x %s ( %08x ) : %s%s", ++count, PowerPC::ppcState.DebugCount, m_Log[_type]->m_szShortName, PC, Msg, eol);
symbol = "---";
}
Message.Set(_type, Msg2);
int Index = 1;
const char *eol = "\n";
if (Index > 0)
{
sprintf(Msg2, "%i %02i:%02i:%03i: %x %s (%s, %08x) : %s%s",
++count,
datetime.GetMinute(), datetime.GetSecond(), datetime.GetMillisecond(),
PowerPC::ppcState.DebugCount,
m_Log[_type]->m_szShortName_, // (CONSOLE etc)
symbol.c_str(), PC, // current PC location (name, address)
Msg, eol);
}
if (m_Log[_type]->m_pFile && m_Log[_type]->m_bLogToFile)
fprintf(m_Log[_type]->m_pFile, "%s", Msg2);
if (m_Log[LogTypes::MASTER_LOG] && m_Log[LogTypes::MASTER_LOG]->m_pFile && m_Log[_type]->m_bShowInLog)
fprintf(m_Log[LogTypes::MASTER_LOG]->m_pFile, "%s", Msg2);
// ==========================================================================================
// Level 0 verbosity logs will be written to all verbosity levels. Given that logging is enabled
// for that level. Level 1 verbosity will only be written to level 1, 2, 3 and so on.
// ---------------
int id;
for (int i = LogManager::VERBOSITY_LEVELS; i >= v ; i--)
{
// prepare the right id
id = i*100 + type;
printf("%s", Msg2);
// write to memory
m_Messages[i][m_nextMessages[i]].Set((LogTypes::LOG_TYPE)id, Msg2);
m_nextMessages++;
if (m_nextMessages >= MAX_MESSAGES)
m_nextMessages = 0;
m_bDirty = true;
// ----------------------------------------------------------------------------------------
// write to file
// ---------------
if (m_Log[id]->m_pFile && m_Log[id]->m_bLogToFile)
fprintf(m_Log[id]->m_pFile, "%s", Msg2);
if (m_Log[i*100 + LogTypes::MASTER_LOG] && m_Log[i*100 + LogTypes::MASTER_LOG]->m_pFile
&& LogManager::m_LogSettings->bWriteMaster)
fprintf(m_Log[i*100 + LogTypes::MASTER_LOG]->m_pFile, "%s", Msg2);
printf("%s", Msg2); // write to console screen
// this limits the memory space used for the memory logs to MAX_MESSAGES rows
m_nextMessages[i]++;
if (m_nextMessages[i] >= MAX_MESSAGES)
m_nextMessages[i] = 0;
// ---------------
}
m_bDirty = true; // tell LogWindow that the log has been updated
}
bool IsLoggingActivated()
@@ -228,4 +296,4 @@ bool IsLoggingActivated()
#else
return false;
#endif
}
}
+26 -7
View File
@@ -30,6 +30,7 @@ struct CDebugger_Log
{
char m_szName[128];
char m_szShortName[32];
char m_szShortName_[32]; // save the unadjusted originals here
char m_szFilename[256];
bool m_bLogToFile;
bool m_bShowInLog;
@@ -40,12 +41,26 @@ struct CDebugger_Log
void Shutdown();
// constructor
CDebugger_Log(const char* _szShortName, const char* _szName);
CDebugger_Log(const char* _szShortName, const char* _szName, int a);
// destructor
~CDebugger_Log();
};
// make a variable that can be accessed from both LogManager.cpp and LogWindow.cpp
struct CDebugger_LogSettings
{
int m_iVerbosity; // verbosity level 0 - 2
bool bResolve;
bool bWriteMaster;
// constructor
CDebugger_LogSettings();
// destructor
~CDebugger_LogSettings();
};
class LogManager
{
#define MAX_MESSAGES 8000 // the old value was to large
@@ -80,26 +95,30 @@ public:
m_szMessage[m_dwMsgLen] = 0;
m_type = _type;
m_bInUse = true;
m_bInUse = true; // turn on this message line
}
//
static void Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...);
};
private:
enum LOG_SETTINGS
{
VERBOSITY_LEVELS = 3
};
friend class CDebugger_LogWindow;
friend class CLogWindow;
static SMessage *m_Messages;
static int m_nextMessages;
static SMessage (*m_Messages)[MAX_MESSAGES];
static int m_nextMessages[VERBOSITY_LEVELS + 1];
static int m_activeLog;
static bool m_bDirty;
static bool m_bInitialized;
static CDebugger_Log* m_Log[LogTypes::NUMBER_OF_LOGS];
static CDebugger_LogSettings* m_LogSettings;
static CDebugger_Log* m_Log[LogTypes::NUMBER_OF_LOGS + (VERBOSITY_LEVELS * 100)]; // make 326 of them
public:
static void Init();
static void Clear(void);
static void Shutdown();
static bool IsLogEnabled(LogTypes::LOG_TYPE _type);
static void Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...);
};

Some files were not shown because too many files have changed in this diff Show More