From 39a014353eaa43397f555c25b6181d3c2a01a0f1 Mon Sep 17 00:00:00 2001 From: Soren Jorvang Date: Wed, 26 May 2010 21:07:13 +0000 Subject: [PATCH] Simplify logging a bit. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5497 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/Log.h | 34 +++---------------- .../Core/Core/Src/HW/ProcessorInterface.cpp | 2 -- Source/Core/Core/Src/HW/SI.cpp | 8 ++--- Source/Core/Core/Src/HW/VideoInterface.cpp | 2 -- .../Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp | 2 ++ .../Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp | 25 +++----------- Source/Core/DebuggerWX/Src/CodeWindow.cpp | 6 ++-- 7 files changed, 17 insertions(+), 62 deletions(-) diff --git a/Source/Core/Common/Src/Log.h b/Source/Core/Common/Src/Log.h index 2ca5bb10c6..9734f6fe20 100644 --- a/Source/Core/Common/Src/Log.h +++ b/Source/Core/Common/Src/Log.h @@ -99,12 +99,6 @@ enum LOG_LEVELS { #endif // loglevel #endif // logging -#define ERROR_LOG(...) {} -#define WARN_LOG(...) {} -#define NOTICE_LOG(...) {} -#define INFO_LOG(...) {} -#define DEBUG_LOG(...) {} - void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char *file, int line, const char *fmt, ...); @@ -116,29 +110,11 @@ void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, #define GENERIC_LOG(t, v, ...) {if (v <= MAX_LOGLEVEL) {GenericLog(v, t, __FILE__, __LINE__, __VA_ARGS__);}} #endif -#if MAX_LOGLEVEL >= ERROR_LEVEL -#undef ERROR_LOG -#define ERROR_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__)} -#endif // loglevel ERROR+ - -#if MAX_LOGLEVEL >= WARNING_LEVEL -#undef WARN_LOG -#define WARN_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__)} -#endif // loglevel WARNING+ - -#if MAX_LOGLEVEL >= NOTICE_LEVEL -#undef NOTICE_LOG -#define NOTICE_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LNOTICE, __VA_ARGS__)} -#endif // loglevel NOTICE+ -#if MAX_LOGLEVEL >= INFO_LEVEL -#undef INFO_LOG -#define INFO_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__)} -#endif // loglevel INFO+ - -#if MAX_LOGLEVEL >= DEBUG_LEVEL -#undef DEBUG_LOG -#define DEBUG_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__)} -#endif // loglevel DEBUG+ +#define ERROR_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__) } +#define WARN_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__) } +#define NOTICE_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LNOTICE, __VA_ARGS__) } +#define INFO_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__) } +#define DEBUG_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__) } #if MAX_LOGLEVEL >= DEBUG_LEVEL #define _dbg_assert_(_t_, _a_) \ diff --git a/Source/Core/Core/Src/HW/ProcessorInterface.cpp b/Source/Core/Core/Src/HW/ProcessorInterface.cpp index e18a7b7d94..97efc1245e 100644 --- a/Source/Core/Core/Src/HW/ProcessorInterface.cpp +++ b/Source/Core/Core/Src/HW/ProcessorInterface.cpp @@ -206,7 +206,6 @@ void UpdateException() PowerPC::ppcState.Exceptions &= ~EXCEPTION_EXTERNAL_INT; } -#if MAX_LOGLEVEL >= DEBUG_LEVEL static const char *Debug_GetInterruptName(u32 _causemask) { switch (_causemask) @@ -230,7 +229,6 @@ static const char *Debug_GetInterruptName(u32 _causemask) default: return "!!! ERROR-unknown Interrupt !!!"; } } -#endif void SetInterrupt(u32 _causemask, bool _bSet) { diff --git a/Source/Core/Core/Src/HW/SI.cpp b/Source/Core/Core/Src/HW/SI.cpp index db3dffb49e..e069ca735e 100644 --- a/Source/Core/Core/Src/HW/SI.cpp +++ b/Source/Core/Core/Src/HW/SI.cpp @@ -604,12 +604,8 @@ void RunSIBuffer() else outLength++; -#if MAX_LOGLEVEL >= DEBUG_LEVEL - int numOutput = -#endif - g_Channel[g_ComCSR.CHANNEL].m_pDevice->RunBuffer(g_SIBuffer, inLength); - - DEBUG_LOG(SERIALINTERFACE, "RunSIBuffer (intLen: %i outLen: %i) (processed: %i)", inLength, outLength, numOutput); + DEBUG_LOG(SERIALINTERFACE, "RunSIBuffer (intLen: %i outLen: %i) (processed: %i)", inLength, + outLength, g_Channel[g_ComCSR.CHANNEL].m_pDevice->RunBuffer(g_SIBuffer, inLength)); // Transfer completed GenerateSIInterrupt(INT_TCINT); diff --git a/Source/Core/Core/Src/HW/VideoInterface.cpp b/Source/Core/Core/Src/HW/VideoInterface.cpp index 2d1c9b14e1..69a2c284d8 100644 --- a/Source/Core/Core/Src/HW/VideoInterface.cpp +++ b/Source/Core/Core/Src/HW/VideoInterface.cpp @@ -769,9 +769,7 @@ static void BeginField(FieldType field) u32 xfbAddr = (field == FIELD_LOWER) ? GetXFBAddressBottom() : GetXFBAddressTop(); -#if MAX_LOGLEVEL >= DEBUG_LEVEL static const char* const fieldTypeNames[] = { "Progressive", "Upper", "Lower" }; -#endif DEBUG_LOG(VIDEOINTERFACE, "(VI->BeginField): addr: %.08X | FieldSteps %u | FbSteps %u | ACV %u | Field %s", xfbAddr, m_HorizontalStepping.FieldSteps, m_HorizontalStepping.FbSteps, m_VerticalTimingRegister.ACV, diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp index d6a736cfc0..1ef195d4cc 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp @@ -210,12 +210,14 @@ bool CWII_IPC_HLE_Device_FileIO::Write(u32 _CommandAddress) INFO_LOG(WII_IPC_FILEIO, "FileIO: Write 0x%04x bytes from 0x%08x to %s", Size, Address, m_Name.c_str()); +#if MAX_LOGLEVEL >= DEBUG_LEVEL if (m_pFileHandle) { size_t Result = fwrite(Memory::GetPointer(Address), Size, 1, m_pFileHandle); _dbg_assert_msg_(WII_IPC_FILEIO, Result == 1, "fwrite failed"); ReturnValue = Size; } +#endif Memory::Write_U32(ReturnValue, _CommandAddress + 0x4); return true; diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp index 5f29557ce1..74efe59246 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp @@ -494,7 +494,9 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update() { if (m_WiiMotes[i].IsConnected() == 3 && m_FreqDividerMote == 150 / (i + 1)) { +#if defined(HAVE_WX) && HAVE_WX NetPlay_WiimoteUpdate(i); +#endif CPluginManager::GetInstance().GetWiimote(0)->Wiimote_Update(i); return true; } @@ -675,14 +677,12 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventConnectionComplete(const bdad AddEventToQueue(Event); -#if MAX_LOGLEVEL >= DEBUG_LEVEL static char s_szLinkType[][128] = { { "HCI_LINK_SCO 0x00 - Voice"}, { "HCI_LINK_ACL 0x01 - Data"}, { "HCI_LINK_eSCO 0x02 - eSCO"}, }; -#endif INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventConnectionComplete"); INFO_LOG(WII_IPC_WIIMOTE, " Connection_Handle: 0x%04x", pConnectionComplete->Connection_Handle); @@ -711,7 +711,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRequestConnection(CWII_IPC_HL pEventRequestConnection->LinkType = HCI_LINK_ACL; // Log -#if MAX_LOGLEVEL >= DEBUG_LEVEL +#if 0 static char LinkType[][128] = { { "HCI_LINK_SCO 0x00 - Voice"}, @@ -1037,9 +1037,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventLinkKeyNotification(const CWI pEventLinkKey->bdaddr.b[0], pEventLinkKey->bdaddr.b[1], pEventLinkKey->bdaddr.b[2], pEventLinkKey->bdaddr.b[3], pEventLinkKey->bdaddr.b[4], pEventLinkKey->bdaddr.b[5]); -#if MAX_LOGLEVEL >= DEBUG_LEVEL LOG_LinkKey(pEventLinkKey->LinkKey); -#endif return true; }; @@ -1427,13 +1425,11 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandAcceptCon(u8* _Input) m_LastCmd = 0; } -#if MAX_LOGLEVEL >= DEBUG_LEVEL static char s_szRole[][128] = { { "Master (0x00)"}, { "Slave (0x01)"}, }; -#endif INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_ACCEPT_CON"); DEBUG_LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", @@ -1741,10 +1737,8 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteLocalName(u8* _Input) // But not from homebrew games that use lwbt. Why not? void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWritePageTimeOut(u8* _Input) { -#if MAX_LOGLEVEL >= DEBUG_LEVEL // command parameters hci_write_page_timeout_cp* pWritePageTimeOut = (hci_write_page_timeout_cp*)_Input; -#endif // reply hci_host_buffer_size_rp Reply; @@ -1767,7 +1761,6 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteScanEnable(u8* _Input) hci_write_scan_enable_rp Reply; Reply.status = 0x00; -#if MAX_LOGLEVEL >= DEBUG_LEVEL static char Scanning[][128] = { { "HCI_NO_SCAN_ENABLE"}, @@ -1775,7 +1768,6 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteScanEnable(u8* _Input) { "HCI_PAGE_SCAN_ENABLE"}, { "HCI_INQUIRY_AND_PAGE_SCAN_ENABLE"}, }; -#endif INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_WRITE_SCAN_ENABLE: (0x%02x)", pWriteScanEnable->scan_enable); DEBUG_LOG(WII_IPC_WIIMOTE, " scan_enable: %s", Scanning[pWriteScanEnable->scan_enable]); @@ -1848,10 +1840,9 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteLinkSupervisionTimeout(u8* void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteInquiryScanType(u8* _Input) { -#if MAX_LOGLEVEL >= DEBUG_LEVEL // command parameters hci_write_inquiry_scan_type_cp* pSetEventFilter = (hci_write_inquiry_scan_type_cp*)_Input; -#endif + // reply hci_write_inquiry_scan_type_rp Reply; Reply.status = 0x00; @@ -1864,23 +1855,19 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteInquiryScanType(u8* _Input void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteInquiryMode(u8* _Input) { -#if MAX_LOGLEVEL >= 4 // command parameters hci_write_inquiry_mode_cp* pInquiryMode = (hci_write_inquiry_mode_cp*)_Input; -#endif // reply hci_write_inquiry_mode_rp Reply; Reply.status = 0x00; -#if MAX_LOGLEVEL >= DEBUG_LEVEL static char InquiryMode[][128] = { { "Standard Inquiry Result event format (default)" }, { "Inquiry Result format with RSSI" }, { "Inquiry Result with RSSI format or Extended Inquiry Result format" } }; -#endif INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_WRITE_INQUIRY_MODE:"); DEBUG_LOG(WII_IPC_WIIMOTE, " mode: %s", InquiryMode[pInquiryMode->mode]); @@ -1889,22 +1876,18 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteInquiryMode(u8* _Input) void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWritePageScanType(u8* _Input) { -#if MAX_LOGLEVEL >= DEBUG_LEVEL // command parameters hci_write_page_scan_type_cp* pWritePageScanType = (hci_write_page_scan_type_cp*)_Input; -#endif // reply hci_write_page_scan_type_rp Reply; Reply.status = 0x00; -#if MAX_LOGLEVEL >= DEBUG_LEVEL static char PageScanType[][128] = { { "Mandatory: Standard Scan (default)" }, { "Optional: Interlaced Scan" } }; -#endif INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_WRITE_PAGE_SCAN_TYPE:"); DEBUG_LOG(WII_IPC_WIIMOTE, " type: %s", PageScanType[pWritePageScanType->type]); diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.cpp b/Source/Core/DebuggerWX/Src/CodeWindow.cpp index 75cb555ddf..1bfc095fce 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindow.cpp +++ b/Source/Core/DebuggerWX/Src/CodeWindow.cpp @@ -575,8 +575,10 @@ void CCodeWindow::OnJitMenu(wxCommandEvent& event) str = wxGetTextFromUser(_(""), wxT("Op?"), wxEmptyString, this); for (u32 addr = 0x80000000; addr < 0x80100000; addr += 4) { const char *name = PPCTables::GetInstructionName(Memory::ReadUnchecked_U32(addr)); - if (name && !strcmp((const char *)str.mb_str(), name)) - NOTICE_LOG(POWERPC, "Found %s at %08x", str.c_str(), addr); + if (name && !strcmp((const char *)str.mb_str(), name)) { + std::string mb_str(str.mb_str()); + NOTICE_LOG(POWERPC, "Found %s at %08x", mb_str.c_str(), addr); + } } break; }