More log cleanup. Commented the old macros in Log.h, uncomment it if there are any problems.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2520 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2009-03-02 11:43:38 +00:00
parent 63590b8879
commit d419d3fc29
10 changed files with 90 additions and 80 deletions

View File

@ -69,32 +69,44 @@ enum LOG_LEVELS {
} // namespace } // namespace
/*
FIXME:
- How can generic_log support log levels in compile time?
Maybe it should call ERROR/.. according to level instead of the other way around.
- Check if we can make the win32 and gcc togther (get rid of those ##)
- Compile the log functions according to LOGLEVEL
*/
#ifdef LOGGING #ifdef LOGGING
#define LOGLEVEL 4
extern void __Log(int logNumber, const char* text, ...); extern void __Log(int logNumber, const char* text, ...);
extern void __Logv(int log, int v, const char *format, ...); //extern void __Logv(int log, int v, const char *format, ...);
#ifdef _WIN32 #ifdef _WIN32
#define LOG(t, ...) __Log(LogTypes::t, __VA_ARGS__); /* #define LOG(t, ...) __Log(LogTypes::t, __VA_ARGS__); */
#define LOGV(t, v, ...) __Log(LogTypes::t + (v)*100, __VA_ARGS__); /* #define LOGV(t, v, ...) __Log(LogTypes::t + (v)*100, __VA_ARGS__); */
#define LOGP(t, ...) __Log(t, __VA_ARGS__); /* #define LOGP(t, ...) __Log(t, __VA_ARGS__); */
#define LOGVP(t, v, ...) __Log(t + (v)*100, __VA_ARGS__); /* #define LOGVP(t, v, ...) __Log(t + (v)*100, __VA_ARGS__); */
#define ERROR_LOG(t, ...) {LOGV(t, LogTypes::LERROR, __VA_ARGS__)}
#define WARN_LOG(t, ...) {LOGV(t, LogTypes::LINFO, __VA_ARGS__)}
#define INFO_LOG(t, ...) {LOGV(t, LogTypes::LWARNING, __VA_ARGS__)} #define GENERIC_LOG(t,v, ...) {__Log(t + (v)*100, __VA_ARGS__);}
#define DEBUG_LOG(t ,...) {LOGV(t, LogTypes::LDEBUG, __VA_ARGS__)} #define ERROR_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__)}
#define WARN_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__)}
#define INFO_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__)}
#define DEBUG_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__)}
#else #else
//#define LOG(t, ...) __Log(LogTypes::t, ##__VA_ARGS__); //#define LOG(t, ...) __Log(LogTypes::t, ##__VA_ARGS__);
#define LOGV(t,v, ...) __Log(LogTypes::t + (v)*100, ##__VA_ARGS__); //#define LOGV(t,v, ...) __Log(LogTypes::t + (v)*100, ##__VA_ARGS__);
#define LOGP(t, ...) __Log(t, ##__VA_ARGS__); //#define LOGP(t, ...) __Log(t, ##__VA_ARGS__);
#define LOGVP(t,v, ...) __Log(t + (v)*100, ##__VA_ARGS__); //#define LOGVP(t,v, ...) __Log(t + (v)*100, ##__VA_ARGS__);
#define ERROR_LOG(t,...) {LOGV(t, LogTypes::LERROR, ##__VA_ARGS__)} #define GENERIC_LOG(t,v, ...) {__Log(t + (v)*100, ##__VA_ARGS__);}
#define WARN_LOG(t,...) {LOGV(t, LogTypes::LINFO, ##__VA_ARGS__)} #define ERROR_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LERROR, ##__VA_ARGS__)}
#define INFO_LOG(t,...) {LOGV(t, LogTypes::LWARNING, ##__VA_ARGS__)} #define WARN_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LINFO, ##__VA_ARGS__)}
#define DEBUG_LOG(t,...) {LOGV(t, LogTypes::LDEBUG, ##__VA_ARGS__)} #define INFO_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, ##__VA_ARGS__)}
#define DEBUG_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, ##__VA_ARGS__)}
#endif // WIN32 #endif // WIN32

View File

@ -128,7 +128,7 @@ void CBoot::EmulatedBIOS(bool _bDebug)
u32 iLength = Memory::ReadUnchecked_U32(0x81300008); u32 iLength = Memory::ReadUnchecked_U32(0x81300008);
u32 iDVDOffset = Memory::ReadUnchecked_U32(0x8130000c); u32 iDVDOffset = Memory::ReadUnchecked_U32(0x8130000c);
LOGV(MASTER_LOG, 2, "DVDRead: offset: %08x memOffset: %08x length: %i", iDVDOffset, iRamAddress, iLength); INFO_LOG(MASTER_LOG, "DVDRead: offset: %08x memOffset: %08x length: %i", iDVDOffset, iRamAddress, iLength);
DVDInterface::DVDRead(iDVDOffset, iRamAddress, iLength); DVDInterface::DVDRead(iDVDOffset, iRamAddress, iLength);
} while(PowerPC::ppcState.gpr[3] != 0x00); } while(PowerPC::ppcState.gpr[3] != 0x00);
@ -373,7 +373,7 @@ bool CBoot::EmulatedBIOS_Wii(bool _bDebug)
u32 iLength = Memory::ReadUnchecked_U32(0x81300008); u32 iLength = Memory::ReadUnchecked_U32(0x81300008);
u32 iDVDOffset = Memory::ReadUnchecked_U32(0x8130000c) << 2; u32 iDVDOffset = Memory::ReadUnchecked_U32(0x8130000c) << 2;
LOGV(BOOT, 1, "DVDRead: offset: %08x memOffse: %08x length: %i", iDVDOffset, iRamAddress, iLength); INFO_LOG(BOOT, "DVDRead: offset: %08x memOffse: %08x length: %i", iDVDOffset, iRamAddress, iLength);
DVDInterface::DVDRead(iDVDOffset, iRamAddress, iLength); DVDInterface::DVDRead(iDVDOffset, iRamAddress, iLength);
} while(PowerPC::ppcState.gpr[3] != 0x00); } while(PowerPC::ppcState.gpr[3] != 0x00);

View File

@ -717,7 +717,7 @@ void Callback_VideoCopiedToXFB()
// WARNING - THIS MAY EXECUTED FROM DSP THREAD // WARNING - THIS MAY EXECUTED FROM DSP THREAD
void Callback_DSPLog(const TCHAR* _szMessage, int _v) void Callback_DSPLog(const TCHAR* _szMessage, int _v)
{ {
LOGV(AUDIO, _v, _szMessage); GENERIC_LOG(LogTypes::AUDIO, _v, _szMessage);
} }
// __________________________________________________________________________________________________ // __________________________________________________________________________________________________
@ -769,7 +769,7 @@ void Callback_KeyPress(int key, bool shift, bool control)
// //
void Callback_WiimoteLog(const TCHAR* _szMessage, int _v) void Callback_WiimoteLog(const TCHAR* _szMessage, int _v)
{ {
LOGV(WII_IPC_WIIMOTE, _v, _szMessage); GENERIC_LOG(LogTypes::WII_IPC_WIIMOTE, _v, _szMessage);
} }
// TODO: Get rid of at some point // TODO: Get rid of at some point

View File

@ -404,7 +404,7 @@ void LogPendingEvents()
void Idle() void Idle()
{ {
LOGV(GEKKO, 3, "Idle"); DEBUG_LOG(GEKKO, "Idle");
idledCycles += downcount; idledCycles += downcount;
downcount = 0; downcount = 0;

View File

@ -110,15 +110,17 @@ void PrintCallstack(LogTypes::LOG_TYPE type)
{ {
u32 addr = Memory::ReadUnchecked_U32(PowerPC::ppcState.gpr[1]); // SP u32 addr = Memory::ReadUnchecked_U32(PowerPC::ppcState.gpr[1]); // SP
LOGVP(type, 1, "\n == STACK TRACE - SP = %08x ==\n", PowerPC::ppcState.gpr[1]); GENERIC_LOG(type, LogTypes::LWARNING, "\n == STACK TRACE - SP = %08x ==\n",
PowerPC::ppcState.gpr[1]);
if (LR == 0) { if (LR == 0) {
LOGVP(type, 1, " LR = 0 - this is bad\n"); GENERIC_LOG(type, LogTypes::LWARNING, " LR = 0 - this is bad\n");
} }
int count = 1; int count = 1;
if (g_symbolDB.GetDescription(PowerPC::ppcState.pc) != g_symbolDB.GetDescription(LR)) if (g_symbolDB.GetDescription(PowerPC::ppcState.pc) != g_symbolDB.GetDescription(LR))
{ {
LOGP(type, " * %s [ LR = %08x ]\n", g_symbolDB.GetDescription(LR), LR); GENERIC_LOG(type, LogTypes::LINFO, " * %s [ LR = %08x ]\n",
g_symbolDB.GetDescription(LR), LR);
count++; count++;
} }
@ -129,14 +131,14 @@ void PrintCallstack(LogTypes::LOG_TYPE type)
const char *str = g_symbolDB.GetDescription(func); const char *str = g_symbolDB.GetDescription(func);
if (!str || strlen(str) == 0 || !strcmp(str, "Invalid")) if (!str || strlen(str) == 0 || !strcmp(str, "Invalid"))
str = "(unknown)"; str = "(unknown)";
LOGVP(type, 3, " * %s [ addr = %08x ]\n", str, func); GENERIC_LOG(type, LogTypes::LINFO, " * %s [ addr = %08x ]\n", str, func);
addr = Memory::ReadUnchecked_U32(addr); addr = Memory::ReadUnchecked_U32(addr);
} }
} }
void PrintDataBuffer(LogTypes::LOG_TYPE type, u8* _pData, size_t _Size, const char* _title) void PrintDataBuffer(LogTypes::LOG_TYPE type, u8* _pData, size_t _Size, const char* _title)
{ {
LOGP(type, _title); GENERIC_LOG(type, LogTypes::LDEBUG, "%s", _title);
for (u32 j = 0; j < _Size;) for (u32 j = 0; j < _Size;)
{ {
std::string Temp; std::string Temp;
@ -149,7 +151,7 @@ void PrintDataBuffer(LogTypes::LOG_TYPE type, u8* _pData, size_t _Size, const ch
if (j >= _Size) if (j >= _Size)
break; break;
} }
LOGP(type, " Data: %s", Temp.c_str()); GENERIC_LOG(type, LogTypes::LDEBUG, " Data: %s", Temp.c_str());
} }
} }

View File

@ -598,7 +598,7 @@ void Update_ARAM_DMA()
u32 iARAMAddress = g_arDMA.ARAddr; u32 iARAMAddress = g_arDMA.ARAddr;
//write to g_ARAM //write to g_ARAM
LOGV(DSPINTERFACE, 1, "g_ARAM DMA write %08x bytes from %08x to Aram: %08x", INFO_LOG(DSPINTERFACE, "g_ARAM DMA write %08x bytes from %08x to Aram: %08x",
g_arDMA.Cnt.count, g_arDMA.MMAddr, g_arDMA.ARAddr); g_arDMA.Cnt.count, g_arDMA.MMAddr, g_arDMA.ARAddr);
for (u32 i = 0; i < g_arDMA.Cnt.count; i++) for (u32 i = 0; i < g_arDMA.Cnt.count; i++)
{ {

View File

@ -134,7 +134,7 @@ void CEXIChannel::Update()
void CEXIChannel::Read32(u32& _uReturnValue, const u32 _iRegister) void CEXIChannel::Read32(u32& _uReturnValue, const u32 _iRegister)
{ {
LOGV(EXPANSIONINTERFACE, 3, "ExtensionInterface(R): channel: %i reg: %i", m_ChannelId, _iRegister); DEBUG_LOG(EXPANSIONINTERFACE, "ExtensionInterface(R): channel: %i reg: %i", m_ChannelId, _iRegister);
switch (_iRegister) switch (_iRegister)
{ {
@ -178,7 +178,7 @@ void CEXIChannel::Read32(u32& _uReturnValue, const u32 _iRegister)
void CEXIChannel::Write32(const u32 _iValue, const u32 _iRegister) void CEXIChannel::Write32(const u32 _iValue, const u32 _iRegister)
{ {
LOGV(EXPANSIONINTERFACE, 2, "ExtensionInterface(W): 0x%08x channel: %i reg: %i", _iValue, m_ChannelId, _iRegister); INFO_LOG(EXPANSIONINTERFACE, "ExtensionInterface(W): 0x%08x channel: %i reg: %i", _iValue, m_ChannelId, _iRegister);
switch (_iRegister) switch (_iRegister)
{ {
@ -232,17 +232,17 @@ void CEXIChannel::Write32(const u32 _iValue, const u32 _iRegister)
break; break;
case EXI_DMAADDR: case EXI_DMAADDR:
LOGV(EXPANSIONINTERFACE, 2, "EXI: Wrote DMABuf, chan %i", m_ChannelId); INFO_LOG(EXPANSIONINTERFACE, "EXI: Wrote DMABuf, chan %i", m_ChannelId);
m_DMAMemoryAddress = _iValue; m_DMAMemoryAddress = _iValue;
break; break;
case EXI_DMALENGTH: case EXI_DMALENGTH:
LOGV(EXPANSIONINTERFACE, 2, "EXI: Wrote DMASize, chan %i", m_ChannelId); INFO_LOG(EXPANSIONINTERFACE, "EXI: Wrote DMASize, chan %i", m_ChannelId);
m_DMALength = _iValue; m_DMALength = _iValue;
break; break;
case EXI_DMACONTROL: case EXI_DMACONTROL:
LOGV(EXPANSIONINTERFACE, 2, "EXI: Wrote DMAControl, chan %i", m_ChannelId); INFO_LOG(EXPANSIONINTERFACE, "EXI: Wrote DMAControl, chan %i", m_ChannelId);
m_Control.hex = _iValue; m_Control.hex = _iValue;
if (m_Control.TSTART) if (m_Control.TSTART)
@ -289,7 +289,7 @@ void CEXIChannel::Write32(const u32 _iValue, const u32 _iRegister)
break; break;
case EXI_IMMDATA: case EXI_IMMDATA:
LOGV(EXPANSIONINTERFACE, 2, "EXI: Wrote IMMData, chan %i", m_ChannelId); INFO_LOG(EXPANSIONINTERFACE, "EXI: Wrote IMMData, chan %i", m_ChannelId);
m_ImmData = _iValue; m_ImmData = _iValue;
break; break;
} }

View File

@ -111,17 +111,17 @@ CEXIMic::CEXIMic(int _Index)
IsOpen = false; IsOpen = false;
err = Pa_Initialize(); err = Pa_Initialize();
if (err != paNoError) if (err != paNoError)
LOGV(EXPANSIONINTERFACE, 0, "EXI MIC: PortAudio Initialize error %s", Pa_GetErrorText(err)); ERROR_LOG(EXPANSIONINTERFACE, "EXI MIC: PortAudio Initialize error %s", Pa_GetErrorText(err));
} }
CEXIMic::~CEXIMic() CEXIMic::~CEXIMic()
{ {
err = Pa_CloseStream( stream ); err = Pa_CloseStream( stream );
if (err != paNoError) if (err != paNoError)
LOGV(EXPANSIONINTERFACE, 0, "EXI MIC: PortAudio Close error %s", Pa_GetErrorText(err)); ERROR_LOG(EXPANSIONINTERFACE, "EXI MIC: PortAudio Close error %s", Pa_GetErrorText(err));
err = Pa_Terminate(); err = Pa_Terminate();
if (err != paNoError) if (err != paNoError)
LOGV(EXPANSIONINTERFACE, 0, "EXI MIC: PortAudio Terminate error %s", Pa_GetErrorText(err)); ERROR_LOG(EXPANSIONINTERFACE, "EXI MIC: PortAudio Terminate error %s", Pa_GetErrorText(err));
} }
bool CEXIMic::IsPresent() bool CEXIMic::IsPresent()
@ -146,10 +146,10 @@ void CEXIMic::SetCS(int cs)
// This is probably not a command, but anyway... // This is probably not a command, but anyway...
// The command 0xff seems to be used to get in sync with the microphone or to wake it up. // The command 0xff seems to be used to get in sync with the microphone or to wake it up.
// Normally, it is issued before any other command, or to recover from errors. // Normally, it is issued before any other command, or to recover from errors.
LOGV(EXPANSIONINTERFACE, 1, "EXI MIC: WakeUp cmd"); WARN_LOG(EXPANSIONINTERFACE, "EXI MIC: WakeUp cmd");
break; break;
default: default:
LOGV(EXPANSIONINTERFACE, 1, "EXI MIC: unknown CS command %02x\n", command); WARN_LOG(EXPANSIONINTERFACE, "EXI MIC: unknown CS command %02x\n", command);
break; break;
} }
} }
@ -192,13 +192,13 @@ void CEXIMic::TransferByte(u8 &byte)
case cmdGetStatus: case cmdGetStatus:
{ {
if (m_uPosition != 1 && m_uPosition != 2) if (m_uPosition != 1 && m_uPosition != 2)
LOGV(EXPANSIONINTERFACE, 0, "EXI MIC: WARNING GetStatus @ pos: %d should never happen", m_uPosition); WARN_LOG(EXPANSIONINTERFACE, "EXI MIC: WARNING GetStatus @ pos: %d should never happen", m_uPosition);
if((!Status.button && MicButton)||(Status.button && !MicButton)) if((!Status.button && MicButton)||(Status.button && !MicButton))
LOGV(EXPANSIONINTERFACE, 0, "EXI MIC: Mic button %s", MicButton ? "pressed" : "released"); WARN_LOG(EXPANSIONINTERFACE, "EXI MIC: Mic button %s", MicButton ? "pressed" : "released");
Status.button = MicButton ? 1 : 0; Status.button = MicButton ? 1 : 0;
byte = Status.U8[ (m_uPosition - 1) ? 0 : 1]; byte = Status.U8[ (m_uPosition - 1) ? 0 : 1];
LOGV(EXPANSIONINTERFACE, 1, "EXI MIC: Status is 0x%04x", Status.U16); INFO_LOG(EXPANSIONINTERFACE, "EXI MIC: Status is 0x%04x", Status.U16);
} }
break; break;
case cmdSetStatus: case cmdSetStatus:
@ -225,7 +225,7 @@ void CEXIMic::TransferByte(u8 &byte)
SFreq = 44100; SFreq = 44100;
break; break;
default: default:
LOGV(EXPANSIONINTERFACE, 0, "EXI MIC: Trying to set unknown sampling rate"); ERROR_LOG(EXPANSIONINTERFACE, "EXI MIC: Trying to set unknown sampling rate");
SFreq = 44100; SFreq = 44100;
break; break;
} }
@ -242,14 +242,14 @@ void CEXIMic::TransferByte(u8 &byte)
SNum = 128; SNum = 128;
break; break;
default: default:
LOGV(EXPANSIONINTERFACE, 0, "EXI MIC: Trying to set unknown period length"); ERROR_LOG(EXPANSIONINTERFACE, "EXI MIC: Trying to set unknown period length");
SNum = 128; SNum = 128;
break; break;
} }
LOGV(EXPANSIONINTERFACE, 0, "//////////////////////////////////////////////////////////////////////////"); DEBUG_LOG(EXPANSIONINTERFACE, "//////////////////////////////////////////////////////////////////////////");
LOGV(EXPANSIONINTERFACE, 0, "EXI MIC: Status is now 0x%04x", Status.U16); DEBUG_LOG(EXPANSIONINTERFACE, "EXI MIC: Status is now 0x%04x", Status.U16);
LOGV(EXPANSIONINTERFACE, 0, "\tbutton %i\tsRate %i\tpLength %i\tsampling %i\n", DEBUG_LOG(EXPANSIONINTERFACE, "\tbutton %i\tsRate %i\tpLength %i\tsampling %i\n",
Status.button, SFreq, SNum, Status.sampling); Status.button, SFreq, SNum, Status.sampling);
if(!IsOpen) if(!IsOpen)
@ -267,7 +267,7 @@ void CEXIMic::TransferByte(u8 &byte)
NULL); // Pointer passed to our callback NULL); // Pointer passed to our callback
if (err != paNoError) if (err != paNoError)
{ {
LOGV(EXPANSIONINTERFACE, 0, "EXI MIC: PortAudio error %s", Pa_GetErrorText(err)); ERROR_LOG(EXPANSIONINTERFACE, "EXI MIC: PortAudio error %s", Pa_GetErrorText(err));
} }
else else
IsOpen = true; IsOpen = true;
@ -283,12 +283,12 @@ void CEXIMic::TransferByte(u8 &byte)
// (shuffle2)Seems like games just continuously get the buffer as long as // (shuffle2)Seems like games just continuously get the buffer as long as
// they're sampling and the mic is generating interrupts // they're sampling and the mic is generating interrupts
byte = inputData[pos].byte[ (pos & 1) ? 0 : 1 ]; byte = inputData[pos].byte[ (pos & 1) ? 0 : 1 ];
LOGV(EXPANSIONINTERFACE, 1, "EXI MIC: GetBuffer%s%d/%d byte: 0x%02x", INFO_LOG(EXPANSIONINTERFACE, "EXI MIC: GetBuffer%s%d/%d byte: 0x%02x",
(pos > 9) ? " " : " ", pos, SNum, byte); (pos > 9) ? " " : " ", pos, SNum, byte);
} }
break; break;
default: default:
LOGV(EXPANSIONINTERFACE, 0, "EXI MIC: unknown command byte %02x\n", command); ERROR_LOG(EXPANSIONINTERFACE, "EXI MIC: unknown command byte %02x\n", command);
break; break;
} }
} }

View File

@ -94,8 +94,8 @@ protected:
Buffer.m_Size = Memory::Read_U32(BufferVectorOffset); Buffer.m_Size = Memory::Read_U32(BufferVectorOffset);
BufferVectorOffset += 4; BufferVectorOffset += 4;
LOGV(WII_IPC_HLE, 3, "SIOCtlVBuffer in%i: 0x%08x, 0x%x", DEBUG_LOG(WII_IPC_HLE, "SIOCtlVBuffer in%i: 0x%08x, 0x%x",
i, Buffer.m_Address, Buffer.m_Size); i, Buffer.m_Address, Buffer.m_Size);
InBuffer.push_back(Buffer); InBuffer.push_back(Buffer);
} }
@ -110,8 +110,8 @@ protected:
Buffer.m_Size = Memory::Read_U32(BufferVectorOffset); Buffer.m_Size = Memory::Read_U32(BufferVectorOffset);
BufferVectorOffset += 4; BufferVectorOffset += 4;
LOGV(WII_IPC_HLE, 3, "SIOCtlVBuffer io%i: 0x%08x, 0x%x", DEBUG_LOG(WII_IPC_HLE, "SIOCtlVBuffer io%i: 0x%08x, 0x%x",
i, Buffer.m_Address, Buffer.m_Size); i, Buffer.m_Address, Buffer.m_Size);
PayloadBuffer.push_back(Buffer); PayloadBuffer.push_back(Buffer);
} }
} }
@ -138,21 +138,19 @@ protected:
void DumpCommands(u32 _CommandAddress, size_t _NumberOfCommands = 8, void DumpCommands(u32 _CommandAddress, size_t _NumberOfCommands = 8,
int LogType = LogTypes::WII_IPC_HLE, int Verbosity = 0) int LogType = LogTypes::WII_IPC_HLE, int Verbosity = 0)
{ {
// Because I have to use LOGV here I add this #if GENERIC_LOG(LogType, Verbosity, "CommandDump of %s",
#if defined(_DEBUG) || defined(DEBUGFAST) GetDeviceName().c_str());
LOGVP(LogType, Verbosity, "CommandDump of %s", GetDeviceName().c_str()); for (u32 i = 0; i < _NumberOfCommands; i++)
for (u32 i = 0; i < _NumberOfCommands; i++)
{ {
LOGVP(LogType, Verbosity, " Command%02i: 0x%08x", i, GENERIC_LOG(LogType, Verbosity, " Command%02i: 0x%08x", i,
Memory::Read_U32(_CommandAddress + i*4)); Memory::Read_U32(_CommandAddress + i*4));
} }
#endif
} }
void DumpAsync( u32 BufferVector, u32 _CommandAddress, u32 NumberInBuffer, u32 NumberOutBuffer ) void DumpAsync( u32 BufferVector, u32 _CommandAddress, u32 NumberInBuffer, u32 NumberOutBuffer )
{ {
LOGV(WII_IPC_HLE, 1, "======= DumpAsync ======"); DEBUG_LOG(WII_IPC_HLE, "======= DumpAsync ======");
// write return value // write return value
u32 BufferOffset = BufferVector; u32 BufferOffset = BufferVector;
Memory::Write_U32(1, _CommandAddress + 0x4); Memory::Write_U32(1, _CommandAddress + 0x4);
@ -162,7 +160,7 @@ protected:
u32 InBuffer = Memory::Read_U32(BufferOffset); BufferOffset += 4; u32 InBuffer = Memory::Read_U32(BufferOffset); BufferOffset += 4;
u32 InBufferSize = Memory::Read_U32(BufferOffset); BufferOffset += 4; u32 InBufferSize = Memory::Read_U32(BufferOffset); BufferOffset += 4;
LOGV(WII_IPC_HLE, 1, "%s - IOCtlV InBuffer[%i]:", GetDeviceName().c_str(), i); INFO_LOG(WII_IPC_HLE, "%s - IOCtlV InBuffer[%i]:", GetDeviceName().c_str(), i);
std::string Temp; std::string Temp;
for (u32 j=0; j<InBufferSize; j++) for (u32 j=0; j<InBufferSize; j++)
@ -172,23 +170,21 @@ protected:
Temp.append(Buffer); Temp.append(Buffer);
} }
LOGV(WII_IPC_HLE, 1, " Buffer: %s", Temp.c_str()); DEBUG_LOG(WII_IPC_HLE, " Buffer: %s", Temp.c_str());
} }
for (u32 i = 0; i < NumberOutBuffer; i++) for (u32 i = 0; i < NumberOutBuffer; i++)
{ {
#ifdef LOGGING u32 OutBuffer = Memory::Read_U32(BufferOffset); BufferOffset += 4;
u32 OutBuffer = Memory::Read_U32(BufferOffset); BufferOffset += 4; u32 OutBufferSize = Memory::Read_U32(BufferOffset); BufferOffset += 4;
u32 OutBufferSize = Memory::Read_U32(BufferOffset); BufferOffset += 4;
#endif
Memory::Write_U32(1, _CommandAddress + 0x4); Memory::Write_U32(1, _CommandAddress + 0x4);
LOGV(WII_IPC_HLE, 1, "%s - IOCtlV OutBuffer[%i]:", GetDeviceName().c_str(), i); INFO_LOG(WII_IPC_HLE,"%s - IOCtlV OutBuffer[%i]:", GetDeviceName().c_str(), i);
LOGV(WII_IPC_HLE, 1, " OutBuffer: 0x%08x (0x%x):", OutBuffer, OutBufferSize); INFO_LOG(WII_IPC_HLE, " OutBuffer: 0x%08x (0x%x):", OutBuffer, OutBufferSize);
#ifdef LOGGING #if defined LOGLEVEL && LOGLEVEL > 2
DumpCommands(OutBuffer, OutBufferSize, LogTypes::WII_IPC_HLE, 1); DumpCommands(OutBuffer, OutBufferSize, LogTypes::WII_IPC_HLE, 1);
#endif #endif
} }

View File

@ -284,15 +284,15 @@ extern "C" void DoState(unsigned char **ptr, int mode)
// ---------------- // ----------------
extern "C" void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32 _Size) extern "C" void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32 _Size)
{ {
LOGV(WII_IPC_WIIMOTE, 3, "============================================================="); DEBUG_LOG(WII_IPC_WIIMOTE, "=============================================================");
const u8* data = (const u8*)_pData; const u8* data = (const u8*)_pData;
// Debugging // Debugging
{ {
LOGV(WII_IPC_WIIMOTE, 3, "Wiimote_Input"); DEBUG_LOG(WII_IPC_WIIMOTE, "Wiimote_Input");
LOGV(WII_IPC_WIIMOTE, 3, " Channel ID: %04x", _channelID); DEBUG_LOG(WII_IPC_WIIMOTE, " Channel ID: %04x", _channelID);
std::string Temp = ArrayToString(data, _Size); std::string Temp = ArrayToString(data, _Size);
LOGV(WII_IPC_WIIMOTE, 3, " Data: %s", Temp.c_str()); DEBUG_LOG(WII_IPC_WIIMOTE, " Data: %s", Temp.c_str());
} }
// Decice where to send the message // Decice where to send the message
@ -303,7 +303,7 @@ extern "C" void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32
WiiMoteReal::InterruptChannel(_channelID, _pData, _Size); WiiMoteReal::InterruptChannel(_channelID, _pData, _Size);
#endif #endif
LOGV(WII_IPC_WIIMOTE, 3, "============================================================="); DEBUG_LOG(WII_IPC_WIIMOTE, "=============================================================");
} }
// ============================== // ==============================
@ -313,7 +313,7 @@ extern "C" void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32
// ---------------- // ----------------
extern "C" void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _Size) extern "C" void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _Size)
{ {
LOGV(WII_IPC_WIIMOTE, 3, "============================================================="); DEBUG_LOG(WII_IPC_WIIMOTE, "=============================================================");
const u8* data = (const u8*)_pData; const u8* data = (const u8*)_pData;
// Check for custom communication // Check for custom communication
@ -330,9 +330,9 @@ extern "C" void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _
// Debugging // Debugging
{ {
LOGV(WII_IPC_WIIMOTE, 3, "Wiimote_ControlChannel"); DEBUG_LOG(WII_IPC_WIIMOTE, "Wiimote_ControlChannel");
std::string Temp = ArrayToString(data, _Size); std::string Temp = ArrayToString(data, _Size);
LOGV(WII_IPC_WIIMOTE, 3, " Data: %s", Temp.c_str()); DEBUG_LOG(WII_IPC_WIIMOTE, " Data: %s", Temp.c_str());
//PanicAlert("Wiimote_ControlChannel"); //PanicAlert("Wiimote_ControlChannel");
} }
@ -343,7 +343,7 @@ extern "C" void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _
WiiMoteReal::ControlChannel(_channelID, _pData, _Size); WiiMoteReal::ControlChannel(_channelID, _pData, _Size);
#endif #endif
LOGV(WII_IPC_WIIMOTE, 3, "============================================================="); DEBUG_LOG(WII_IPC_WIIMOTE, "=============================================================");
} }
// ============================== // ==============================