Merge pull request #9286 from lioncash/core-log6

Frontends: Migrate logs over to fmt
This commit is contained in:
Léo Lam 2020-11-27 02:17:25 +01:00 committed by GitHub
commit cecbc65ea0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 26 additions and 80 deletions

View File

@ -139,28 +139,6 @@ void WritePB(u32 addr, const PB_TYPE& pb, u32 crc)
} }
} }
#if 0
// Dump the value of a PB for debugging
#define DUMP_U16(field) WARN_LOG(DSPHLE, " %04x (%s)", pb.field, #field)
#define DUMP_U32(field) WARN_LOG(DSPHLE, " %08x (%s)", HILO_TO_32(pb.field), #field)
void DumpPB(const PB_TYPE& pb)
{
DUMP_U32(next_pb);
DUMP_U32(this_pb);
DUMP_U16(src_type);
DUMP_U16(coef_select);
#ifdef AX_GC
DUMP_U16(mixer_control);
#else
DUMP_U32(mixer_control);
#endif
DUMP_U16(running);
DUMP_U16(is_stream);
// TODO: complete as needed
}
#endif
// Simulated accelerator state. // Simulated accelerator state.
static PB_TYPE* acc_pb; static PB_TYPE* acc_pb;
static bool acc_end_reached; static bool acc_end_reached;

View File

@ -44,11 +44,6 @@ void AXWiiUCode::HandleCommandList()
u32 pb_addr = 0; u32 pb_addr = 0;
// WARN_LOG(DSPHLE, "Command list:");
// for (u32 i = 0; m_cmdlist[i] != CMD_END; ++i)
// WARN_LOG(DSPHLE, "%04x", m_cmdlist[i]);
// WARN_LOG(DSPHLE, "-------------");
u32 curr_idx = 0; u32 curr_idx = 0;
bool end = false; bool end = false;
while (!end) while (!end)

View File

@ -38,11 +38,6 @@ void Wiimote::HandleReportMode(const OutputReportMode& dr)
// even on REPORT_CORE and continuous off when the buttons haven't changed. // even on REPORT_CORE and continuous off when the buttons haven't changed.
// But.. it is sent after the ACK // But.. it is sent after the ACK
// DEBUG_LOG(WIIMOTE, "Set data report mode");
// DEBUG_LOG(WIIMOTE, " Rumble: %x", dr->rumble);
// DEBUG_LOG(WIIMOTE, " Continuous: %x", dr->continuous);
// DEBUG_LOG(WIIMOTE, " Mode: 0x%02x", dr->mode);
m_reporting_continuous = dr.continuous; m_reporting_continuous = dr.continuous;
m_reporting_mode = dr.mode; m_reporting_mode = dr.mode;

View File

@ -25,7 +25,6 @@ void I2CBus::Reset()
int I2CBus::BusRead(u8 slave_addr, u8 addr, int count, u8* data_out) int I2CBus::BusRead(u8 slave_addr, u8 addr, int count, u8* data_out)
{ {
// INFO_LOG(WIIMOTE, "i2c bus read: 0x%02x @ 0x%02x (%d)", slave_addr, addr, count);
for (auto& slave : m_slaves) for (auto& slave : m_slaves)
{ {
auto const bytes_read = slave->BusRead(slave_addr, addr, count, data_out); auto const bytes_read = slave->BusRead(slave_addr, addr, count, data_out);
@ -40,7 +39,6 @@ int I2CBus::BusRead(u8 slave_addr, u8 addr, int count, u8* data_out)
int I2CBus::BusWrite(u8 slave_addr, u8 addr, int count, const u8* data_in) int I2CBus::BusWrite(u8 slave_addr, u8 addr, int count, const u8* data_in)
{ {
// INFO_LOG(WIIMOTE, "i2c bus write: 0x%02x @ 0x%02x (%d)", slave_addr, addr, count);
for (auto& slave : m_slaves) for (auto& slave : m_slaves)
{ {
auto const bytes_written = slave->BusWrite(slave_addr, addr, count, data_in); auto const bytes_written = slave->BusWrite(slave_addr, addr, count, data_in);

View File

@ -735,7 +735,7 @@ void gdb_handle_exception()
break; break;
case 'k': case 'k':
gdb_deinit(); gdb_deinit();
INFO_LOG(GDB_STUB, "killed by gdb"); INFO_LOG_FMT(GDB_STUB, "killed by gdb");
return; return;
case 'g': case 'g':
gdb_read_registers(); gdb_read_registers();

View File

@ -184,7 +184,7 @@ void ConvertDialog::OnFormatChanged()
constexpr int FALLBACK_BLOCK_SIZE = 0x4000; constexpr int FALLBACK_BLOCK_SIZE = 0x4000;
if (!block_size_ok(FALLBACK_BLOCK_SIZE)) if (!block_size_ok(FALLBACK_BLOCK_SIZE))
{ {
ERROR_LOG(MASTER_LOG, "Failed to find a block size which does not cause problems " ERROR_LOG_FMT(MASTER_LOG, "Failed to find a block size which does not cause problems "
"when decompressing using an old version of Dolphin"); "when decompressing using an old version of Dolphin");
} }
AddToBlockSizeComboBox(FALLBACK_BLOCK_SIZE); AddToBlockSizeComboBox(FALLBACK_BLOCK_SIZE);

View File

@ -373,7 +373,7 @@ void GCMemcardManager::ImportFile()
} }
if (!m_slot_memcard[m_active_slot]->Save()) if (!m_slot_memcard[m_active_slot]->Save())
PanicAlertT("File write failed"); PanicAlertFmtT("File write failed");
UpdateSlotTable(m_active_slot); UpdateSlotTable(m_active_slot);
} }
@ -401,7 +401,7 @@ void GCMemcardManager::CopyFiles()
for (int i = 0; i < SLOT_COUNT; i++) for (int i = 0; i < SLOT_COUNT; i++)
{ {
if (!m_slot_memcard[i]->Save()) if (!m_slot_memcard[i]->Save())
PanicAlertT("File write failed"); PanicAlertFmtT("File write failed");
UpdateSlotTable(i); UpdateSlotTable(i);
} }
@ -444,7 +444,7 @@ void GCMemcardManager::DeleteFiles()
if (!memcard->Save()) if (!memcard->Save())
{ {
PanicAlertT("File write failed"); PanicAlertFmtT("File write failed");
} }
else else
{ {
@ -461,7 +461,7 @@ void GCMemcardManager::FixChecksums()
memcard->FixChecksums(); memcard->FixChecksums();
if (!memcard->Save()) if (!memcard->Save())
PanicAlertT("File write failed"); PanicAlertFmtT("File write failed");
} }
void GCMemcardManager::CreateNewCard(int slot) void GCMemcardManager::CreateNewCard(int slot)

View File

@ -1601,10 +1601,10 @@ void MenuBar::SearchInstruction()
QString::fromStdString(PPCTables::GetInstructionName(PowerPC::HostRead_U32(addr))); QString::fromStdString(PPCTables::GetInstructionName(PowerPC::HostRead_U32(addr)));
if (op == ins_name) if (op == ins_name)
{ {
NOTICE_LOG(POWERPC, "Found %s at %08x", op.toStdString().c_str(), addr); NOTICE_LOG_FMT(POWERPC, "Found {} at {:08x}", op.toStdString(), addr);
found = true; found = true;
} }
} }
if (!found) if (!found)
NOTICE_LOG(POWERPC, "Opcode %s not found", op.toStdString().c_str()); NOTICE_LOG_FMT(POWERPC, "Opcode {} not found", op.toStdString());
} }

View File

@ -427,7 +427,7 @@ void NetPlayDialog::OnStart()
const auto game = FindGameFile(m_current_game_identifier); const auto game = FindGameFile(m_current_game_identifier);
if (!game) if (!game)
{ {
PanicAlertT("Selected game doesn't exist in game list!"); PanicAlertFmtT("Selected game doesn't exist in game list!");
return; return;
} }
@ -876,7 +876,7 @@ void NetPlayDialog::OnMsgStartGame()
if (auto game = FindGameFile(m_current_game_identifier)) if (auto game = FindGameFile(m_current_game_identifier))
client->StartGame(game->GetFilePath()); client->StartGame(game->GetFilePath());
else else
PanicAlertT("Selected game doesn't exist in game list!"); PanicAlertFmtT("Selected game doesn't exist in game list!");
} }
UpdateDiscordPresence(); UpdateDiscordPresence();
}); });
@ -1099,7 +1099,7 @@ void NetPlayDialog::LoadSettings()
} }
else else
{ {
WARN_LOG(NETPLAY, "Unknown network mode '%s', using 'fixeddelay'", network_mode.c_str()); WARN_LOG_FMT(NETPLAY, "Unknown network mode '{}', using 'fixeddelay'", network_mode);
m_fixed_delay_action->setChecked(true); m_fixed_delay_action->setChecked(true);
} }
} }

View File

@ -150,23 +150,23 @@ public:
if (!file) if (!file)
{ {
WARN_LOG(COMMON, "Error reading MO file '%s'", filename.c_str()); WARN_LOG_FMT(COMMON, "Error reading MO file '{}'", filename);
m_data = {}; m_data = {};
return; return;
} }
u32 magic = ReadU32(&m_data[0]); const u32 magic = ReadU32(&m_data[0]);
if (magic != MO_MAGIC_NUMBER) if (magic != MO_MAGIC_NUMBER)
{ {
ERROR_LOG(COMMON, "MO file '%s' has bad magic number %x\n", filename.c_str(), magic); ERROR_LOG_FMT(COMMON, "MO file '{}' has bad magic number {:x}\n", filename, magic);
m_data = {}; m_data = {};
return; return;
} }
u16 version_major = ReadU16(&m_data[4]); const u16 version_major = ReadU16(&m_data[4]);
if (version_major > 1) if (version_major > 1)
{ {
ERROR_LOG(COMMON, "MO file '%s' has unsupported version number %i", filename.c_str(), ERROR_LOG_FMT(COMMON, "MO file '{}' has unsupported version number {}", filename,
version_major); version_major);
m_data = {}; m_data = {};
return; return;
@ -300,7 +300,7 @@ static bool TryInstallTranslator(const QString& exact_language_code)
} }
translator->deleteLater(); translator->deleteLater();
} }
ERROR_LOG(COMMON, "No suitable translation file found"); ERROR_LOG_FMT(COMMON, "No suitable translation file found");
return false; return false;
} }

View File

@ -39,7 +39,7 @@ bool ToggleFullscreen(Display* dpy, Window win)
if (!XSendEvent(dpy, DefaultRootWindow(dpy), False, if (!XSendEvent(dpy, DefaultRootWindow(dpy), False,
SubstructureRedirectMask | SubstructureNotifyMask, &event)) SubstructureRedirectMask | SubstructureNotifyMask, &event))
{ {
ERROR_LOG(VIDEO, "Failed to switch fullscreen/windowed mode."); ERROR_LOG_FMT(VIDEO, "Failed to switch fullscreen/windowed mode.");
return false; return false;
} }
@ -60,7 +60,7 @@ void InhibitScreensaver(Window win, bool suspend)
while (waitpid(pid, &status, 0) == -1) while (waitpid(pid, &status, 0) == -1)
; ;
INFO_LOG(VIDEO, "Started xdg-screensaver (PID = %d)", (int)pid); INFO_LOG_FMT(VIDEO, "Started xdg-screensaver (PID = {})", pid);
} }
} }
@ -75,7 +75,7 @@ XRRConfiguration::XRRConfiguration(Display* _dpy, Window _win)
if (!XRRQueryVersion(dpy, &XRRMajorVersion, &XRRMinorVersion) || if (!XRRQueryVersion(dpy, &XRRMajorVersion, &XRRMinorVersion) ||
(XRRMajorVersion < 1 || (XRRMajorVersion == 1 && XRRMinorVersion < 3))) (XRRMajorVersion < 1 || (XRRMajorVersion == 1 && XRRMinorVersion < 3)))
{ {
WARN_LOG(VIDEO, "XRRExtension not supported."); WARN_LOG_FMT(VIDEO, "XRRExtension not supported.");
bValid = false; bValid = false;
return; return;
} }
@ -88,7 +88,7 @@ XRRConfiguration::XRRConfiguration(Display* _dpy, Window _win)
fb_width_mm = DisplayWidthMM(dpy, screen); fb_width_mm = DisplayWidthMM(dpy, screen);
fb_height_mm = DisplayHeightMM(dpy, screen); fb_height_mm = DisplayHeightMM(dpy, screen);
INFO_LOG(VIDEO, "XRRExtension-Version %d.%d", XRRMajorVersion, XRRMinorVersion); INFO_LOG_FMT(VIDEO, "XRRExtension-Version {}.{}", XRRMajorVersion, XRRMinorVersion);
Update(); Update();
} }
@ -204,11 +204,11 @@ void XRRConfiguration::Update()
if (outputInfo && crtcInfo && fullMode) if (outputInfo && crtcInfo && fullMode)
{ {
INFO_LOG(VIDEO, "Fullscreen Resolution %dx%d", fullWidth, fullHeight); INFO_LOG_FMT(VIDEO, "Fullscreen Resolution {}x{}", fullWidth, fullHeight);
} }
else else
{ {
ERROR_LOG(VIDEO, "Failed to obtain fullscreen size.\n" ERROR_LOG_FMT(VIDEO, "Failed to obtain fullscreen size.\n"
"Using current desktop resolution for fullscreen."); "Using current desktop resolution for fullscreen.");
} }
} }

View File

@ -16,24 +16,6 @@
namespace namespace
{ {
template <int N>
void LOG_TEX();
template <>
void LOG_TEX<1>()
{
// warning: mapping buffer should be disabled to use this
// PRIM_LOG("tex: %f, ", ((float*)g_vertex_manager_write_ptr)[-1]);
}
template <>
void LOG_TEX<2>()
{
// warning: mapping buffer should be disabled to use this
// PRIM_LOG("tex: %f %f, ", ((float*)g_vertex_manager_write_ptr)[-2],
// ((float*)g_vertex_manager_write_ptr)[-1]);
}
void TexCoord_Read_Dummy(VertexLoader* loader) void TexCoord_Read_Dummy(VertexLoader* loader)
{ {
loader->m_tcIndex++; loader->m_tcIndex++;
@ -63,7 +45,6 @@ void TexCoord_ReadDirect(VertexLoader* loader)
g_vertex_manager_write_ptr = dst.GetPointer(); g_vertex_manager_write_ptr = dst.GetPointer();
g_video_buffer_read_ptr = src.GetPointer(); g_video_buffer_read_ptr = src.GetPointer();
LOG_TEX<N>();
++loader->m_tcIndex; ++loader->m_tcIndex;
} }
@ -84,7 +65,6 @@ void TexCoord_ReadIndex(VertexLoader* loader)
dst.Write(TCScale(Common::FromBigEndian(data[i]), scale)); dst.Write(TCScale(Common::FromBigEndian(data[i]), scale));
g_vertex_manager_write_ptr = dst.GetPointer(); g_vertex_manager_write_ptr = dst.GetPointer();
LOG_TEX<N>();
++loader->m_tcIndex; ++loader->m_tcIndex;
} }