From 16115590878b9f2a4b0338db1e4eaf480ec95cdd Mon Sep 17 00:00:00 2001 From: Anthony Miles Date: Sat, 8 Jun 2019 23:56:48 +1200 Subject: [PATCH] Remove DBG_PRINTF and remaining usages --- src/common/Logging.h | 7 +- .../DSOUND/DirectSound/DirectSoundInline.hpp | 70 ++++++++++--------- src/core/kernel/support/EmuFS.cpp | 2 +- src/devices/EmuNVNet.cpp | 25 ++++--- src/devices/usb/USBDevice.cpp | 3 +- 5 files changed, 54 insertions(+), 53 deletions(-) diff --git a/src/common/Logging.h b/src/common/Logging.h index e966b37e9..483954756 100644 --- a/src/common/Logging.h +++ b/src/common/Logging.h @@ -400,9 +400,6 @@ extern thread_local std::string _logThreadPrefix; } \ } -#define DBG_PRINTF(fmt, ...) \ - DBG_PRINTF_EX(LOG_PREFIX, fmt, ##__VA_ARGS__) - #ifdef _MSC_VER #pragma warning(pop) #endif @@ -429,10 +426,10 @@ extern thread_local std::string _logThreadPrefix; // RETURN_TYPE logs the given typed result and then returns it (so this should appear last in functions) #define RETURN_TYPE(type, r) do { if (g_bPrintfOn) LOG_CHECK_ENABLED(LOG_LEVEL::DEBUG) { LOG_FUNC_RESULT_TYPE(type, r) } return r; } while (0) -#define LOG_ONCE(msg, ...) { static bool bFirstTime = true; if(bFirstTime) { bFirstTime = false; DBG_PRINTF("TRAC: " ## msg, __VA_ARGS__); } } +#define LOG_ONCE(msg, ...) { static bool bFirstTime = true; if(bFirstTime) { bFirstTime = false; EmuLog(LOG_LEVEL::DEBUG, "TRAC: " ## msg, __VA_ARGS__); } } #define LOG_XBOX_CALL(func) EmuLog(LOG_LEVEL::DEBUG, "TRAC: Xbox " ## func ## "() call"); -#define LOG_FIRST_XBOX_CALL(func) LOG_ONCE("First Xbox " ## func ## "() call\n"); +#define LOG_FIRST_XBOX_CALL(func) LOG_ONCE("First Xbox " ## func ## "() call"); // // Headers for rendering enums, flags and (pointer-to-)types : diff --git a/src/core/hle/DSOUND/DirectSound/DirectSoundInline.hpp b/src/core/hle/DSOUND/DirectSound/DirectSoundInline.hpp index ef4a854f1..c3c6e2b25 100644 --- a/src/core/hle/DSOUND/DirectSound/DirectSoundInline.hpp +++ b/src/core/hle/DSOUND/DirectSound/DirectSoundInline.hpp @@ -90,23 +90,24 @@ inline void XADPCM2PCMFormat(LPWAVEFORMATEX lpwfxFormat) { #if 0 //For testing purpose if XADPCM to PCM is not accurate. - DBG_PRINTF("EmuDSound: XADPCM WAVEFORMATEX\n" - "{\n" - " wFormatTag : 0x%.04hX\n" - " nChannels : 0x%.02hd\n" - " nSamplesPerSec : 0x%.08X\n" - " nAvgBytesPerSec : 0x%.08X\n" - " nBlockAlign : 0x%.02hd\n" - " wBitsPerSample : 0x%.04hX\n" - " cbSize : 0x%.04hX\n" - "}\n", - lpwfxFormat->wFormatTag, - lpwfxFormat->nChannels, - lpwfxFormat->nSamplesPerSec, - lpwfxFormat->nAvgBytesPerSec, - lpwfxFormat->nBlockAlign, - lpwfxFormat->wBitsPerSample, - lpwfxFormat->cbSize); + EmuLog(LOG_LEVEL::DEBUG, + "EmuDSound: XADPCM WAVEFORMATEX\n" + "{\n" + " wFormatTag : 0x%.04hX\n" + " nChannels : 0x%.02hd\n" + " nSamplesPerSec : 0x%.08X\n" + " nAvgBytesPerSec : 0x%.08X\n" + " nBlockAlign : 0x%.02hd\n" + " wBitsPerSample : 0x%.04hX\n" + " cbSize : 0x%.04hX\n" + "}\n", + lpwfxFormat->wFormatTag, + lpwfxFormat->nChannels, + lpwfxFormat->nSamplesPerSec, + lpwfxFormat->nAvgBytesPerSec, + lpwfxFormat->nBlockAlign, + lpwfxFormat->wBitsPerSample, + lpwfxFormat->cbSize); #endif lpwfxFormat->wFormatTag = WAVE_FORMAT_PCM; @@ -132,23 +133,24 @@ inline void XADPCM2PCMFormat(LPWAVEFORMATEX lpwfxFormat) #endif #if 0 //For testing purpose if XADPCM to PCM is not accurate. - DBG_PRINTF("EmuDSound: Converted to PCM WAVEFORMATEX\n" - "{\n" - " wFormatTag : 0x%.04hX\n" - " nChannels : 0x%.02hd\n" - " nSamplesPerSec : 0x%.08X\n" - " nAvgBytesPerSec : 0x%.08X\n" - " nBlockAlign : 0x%.02hd\n" - " wBitsPerSample : 0x%.04hX\n" - " cbSize : 0x%.04hX\n" - "}\n", - lpwfxFormat->wFormatTag, - lpwfxFormat->nChannels, - lpwfxFormat->nSamplesPerSec, - lpwfxFormat->nAvgBytesPerSec, - lpwfxFormat->nBlockAlign, - lpwfxFormat->wBitsPerSample, - lpwfxFormat->cbSize); + EmuLog(LOG_LEVEL::DEBUG, + "EmuDSound: Converted to PCM WAVEFORMATEX\n" + "{\n" + " wFormatTag : 0x%.04hX\n" + " nChannels : 0x%.02hd\n" + " nSamplesPerSec : 0x%.08X\n" + " nAvgBytesPerSec : 0x%.08X\n" + " nBlockAlign : 0x%.02hd\n" + " wBitsPerSample : 0x%.04hX\n" + " cbSize : 0x%.04hX\n" + "}\n", + lpwfxFormat->wFormatTag, + lpwfxFormat->nChannels, + lpwfxFormat->nSamplesPerSec, + lpwfxFormat->nAvgBytesPerSec, + lpwfxFormat->nBlockAlign, + lpwfxFormat->wBitsPerSample, + lpwfxFormat->cbSize); #endif } diff --git a/src/core/kernel/support/EmuFS.cpp b/src/core/kernel/support/EmuFS.cpp index 3553c3f2a..48f2872df 100644 --- a/src/core/kernel/support/EmuFS.cpp +++ b/src/core/kernel/support/EmuFS.cpp @@ -581,7 +581,7 @@ void EmuGenerateFS(Xbe::TLS *pTLS, void *pTLSData) uint8_t *bByte = (uint8_t*)pNewTLS + v; if (v % 0x10 == 0) { - DBG_PRINTF("0x%.8X:", (xbaddr)bByte); + EmuLog(LOG_LEVEL::DEBUG, "0x%.8X:", (xbaddr)bByte); } // Note : Use printf instead of DBG_PRINTF here, which prefixes with GetCurrentThreadId() : diff --git a/src/devices/EmuNVNet.cpp b/src/devices/EmuNVNet.cpp index 59840e8aa..becdccfa1 100644 --- a/src/devices/EmuNVNet.cpp +++ b/src/devices/EmuNVNet.cpp @@ -336,10 +336,11 @@ void EmuNVNet_DMAPacketFromGuest() memcpy(&desc, (void*)(tx_ring_addr | CONTIGUOUS_MEMORY_BASE), sizeof(desc)); - DBG_PRINTF("Looking at ring desc %d (%llx): ", s->tx_ring_index, tx_ring_addr); - DBG_PRINTF("Buffer: 0x%x, ", desc.packet_buffer); - DBG_PRINTF("Length: 0x%x, ", desc.length); - EmuLog(LOG_LEVEL::DEBUG, "Flags: 0x%x", desc.flags); + EmuLog(LOG_LEVEL::DEBUG, "Looking at ring desc %d (%llx): " + "\n Buffer: 0x%x " + "\n Length: 0x%x " + "\n Flags: 0x%x ", + s->tx_ring_index, tx_ring_addr, desc.packet_buffer, desc.length, desc.flags); s->tx_ring_index += 1; @@ -390,10 +391,11 @@ bool EmuNVNet_DMAPacketToGuest(void* packet, size_t size) memcpy(&desc, (void*)(rx_ring_addr | CONTIGUOUS_MEMORY_BASE), sizeof(desc)); - DBG_PRINTF("Looking at ring descriptor %d (0x%llx): ", s->rx_ring_index, rx_ring_addr); - DBG_PRINTF("Buffer: 0x%x, ", desc.packet_buffer); - DBG_PRINTF("Length: 0x%x, ", desc.length); - EmuLog(LOG_LEVEL::DEBUG, "Flags: 0x%x", desc.flags); + EmuLog(LOG_LEVEL::DEBUG, "Looking at ring descriptor %d (0x%llx): " + "\n Buffer: 0x%x " + "\n Length: 0x%x " + "\n Flags: 0x%x ", + s->rx_ring_index, rx_ring_addr, desc.packet_buffer, desc.length, desc.flags); s->rx_ring_index += 1; @@ -409,9 +411,10 @@ bool EmuNVNet_DMAPacketToGuest(void* packet, size_t size) desc.length = (uint16_t)size; desc.flags = NV_RX_BIT4 | NV_RX_DESCRIPTORVALID; memcpy((void*)(rx_ring_addr | CONTIGUOUS_MEMORY_BASE), &desc, sizeof(desc)); - DBG_PRINTF("Updated ring descriptor: "); - DBG_PRINTF("Length: 0x%x, ", desc.length); - EmuLog(LOG_LEVEL::DEBUG, "Flags: 0x%x", desc.flags); + EmuLog(LOG_LEVEL::DEBUG, "Updated ring descriptor: " + "\n Length: 0x%x " + "\n Flags: 0x%x ", + desc.flags, desc.length); /* Trigger interrupt */ EmuLog(LOG_LEVEL::DEBUG, "Triggering interrupt"); diff --git a/src/devices/usb/USBDevice.cpp b/src/devices/usb/USBDevice.cpp index efa6cc417..5accabfc8 100644 --- a/src/devices/usb/USBDevice.cpp +++ b/src/devices/usb/USBDevice.cpp @@ -955,8 +955,7 @@ int USBDevice::USBDesc_HandleControl(XboxDeviceState* dev, USBPacket *p, // From the USB 1.1 standard: "This request allows the host to select an alternate setting for the specified interface" // wValue = Alternative Setting; wIndex = Interface ret = USBDesc_SetInterface(dev, index, value); - DBG_PRINTF("Received standard SetInterface() request for device at address 0x%X. Interface selected is %d, Alternative Setting \ -is %d and returned %d\n", dev->Addr, index, value, ret); + EmuLog(LOG_LEVEL::DEBUG, "Received standard SetInterface() request for device at address 0x%X. Interface selected is %d, Alternative Setting is %d and returned %d", dev->Addr, index, value, ret); break; }