From eedfe2abf17a154efacd096701447fcca88f3ea5 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 23 Nov 2020 11:55:49 -0500 Subject: [PATCH] Core: Convert missed log calls over to fmt --- Source/Core/Core/ARDecrypt.cpp | 5 ++- Source/Core/Core/Boot/Boot.cpp | 48 +++++++++++------------ Source/Core/Core/HW/AudioInterface.cpp | 5 ++- Source/Core/Core/HW/EXI/EXI_DeviceAGP.cpp | 2 +- Source/Core/Core/HW/WII_IPC.cpp | 2 +- Source/Core/Core/NetPlayServer.cpp | 6 +-- 6 files changed, 35 insertions(+), 33 deletions(-) diff --git a/Source/Core/Core/ARDecrypt.cpp b/Source/Core/Core/ARDecrypt.cpp index c321381778..c6e454c4a0 100644 --- a/Source/Core/Core/ARDecrypt.cpp +++ b/Source/Core/Core/ARDecrypt.cpp @@ -470,8 +470,9 @@ void DecryptARCode(std::vector vCodes, std::vector* ops) if (ret) { // Return value is index + 1, 0 being the success flag value. - PanicAlertT("Action Replay Code Decryption Error:\nParity Check Failed\n\nCulprit Code:\n%s", - vCodes[ret - 1].c_str()); + PanicAlertFmtT( + "Action Replay Code Decryption Error:\nParity Check Failed\n\nCulprit Code:\n{0}", + vCodes[ret - 1]); } else if (!batchdecrypt(uCodes.data(), (u16)vCodes.size() << 1)) { diff --git a/Source/Core/Core/Boot/Boot.cpp b/Source/Core/Core/Boot/Boot.cpp index 02fd7beccd..6a8a4461f8 100644 --- a/Source/Core/Core/Boot/Boot.cpp +++ b/Source/Core/Core/Boot/Boot.cpp @@ -78,11 +78,11 @@ static std::vector ReadM3UFile(const std::string& m3u_path, while (std::getline(s, line)) { // This is the UTF-8 representation of U+FEFF. - const std::string utf8_bom = "\xEF\xBB\xBF"; + constexpr std::string_view utf8_bom = "\xEF\xBB\xBF"; if (StringBeginsWith(line, utf8_bom)) { - WARN_LOG(BOOT, "UTF-8 BOM in file: %s", m3u_path.c_str()); + WARN_LOG_FMT(BOOT, "UTF-8 BOM in file: {}", m3u_path); line.erase(0, utf8_bom.length()); } @@ -100,13 +100,13 @@ static std::vector ReadM3UFile(const std::string& m3u_path, if (!nonexistent.empty()) { - PanicAlertT("Files specified in the M3U file \"%s\" were not found:\n%s", m3u_path.c_str(), - JoinStrings(nonexistent, "\n").c_str()); + PanicAlertFmtT("Files specified in the M3U file \"{0}\" were not found:\n{1}", m3u_path, + JoinStrings(nonexistent, "\n")); return {}; } if (result.empty()) - PanicAlertT("No paths found in the M3U file \"%s\"", m3u_path.c_str()); + PanicAlertFmtT("No paths found in the M3U file \"{0}\"", m3u_path); return result; } @@ -135,7 +135,7 @@ BootParameters::GenerateFromFile(std::vector paths, // that gave an incorrect file name if (!is_drive && !File::Exists(paths.front())) { - PanicAlertT("The specified file \"%s\" does not exist", paths.front().c_str()); + PanicAlertFmtT("The specified file \"{0}\" does not exist", paths.front()); return {}; } @@ -185,15 +185,15 @@ BootParameters::GenerateFromFile(std::vector paths, if (is_drive) { - PanicAlertT("Could not read \"%s\". " - "There is no disc in the drive or it is not a GameCube/Wii backup. " - "Please note that Dolphin cannot play games directly from the original " - "GameCube and Wii discs.", - path.c_str()); + PanicAlertFmtT("Could not read \"{0}\". " + "There is no disc in the drive or it is not a GameCube/Wii backup. " + "Please note that Dolphin cannot play games directly from the original " + "GameCube and Wii discs.", + path); } else { - PanicAlertT("\"%s\" is an invalid GCM/ISO file, or is not a GC/Wii ISO.", path.c_str()); + PanicAlertFmtT("\"{0}\" is an invalid GCM/ISO file, or is not a GC/Wii ISO.", path); } return {}; } @@ -208,7 +208,7 @@ BootParameters::GenerateFromFile(std::vector paths, return std::make_unique(std::move(*wad), savestate_path); } - PanicAlertT("Could not recognize file %s", path.c_str()); + PanicAlertFmtT("Could not recognize file {0}", path); return {}; } @@ -338,15 +338,15 @@ bool CBoot::Load_BS2(const std::string& boot_rom_filename) known_ipl = true; break; default: - PanicAlertT("The IPL file is not a known good dump. (CRC32: %x)", ipl_hash); + PanicAlertFmtT("The IPL file is not a known good dump. (CRC32: {0:x})", ipl_hash); break; } const DiscIO::Region boot_region = SConfig::GetInstance().m_region; if (known_ipl && pal_ipl != (boot_region == DiscIO::Region::PAL)) { - PanicAlertT("%s IPL found in %s directory. The disc might not be recognized", - pal_ipl ? "PAL" : "NTSC", SConfig::GetDirectoryForRegion(boot_region)); + PanicAlertFmtT("{0} IPL found in {1} directory. The disc might not be recognized", + pal_ipl ? "PAL" : "NTSC", SConfig::GetDirectoryForRegion(boot_region)); } // Run the descrambler over the encrypted section containing BS1/BS2 @@ -417,7 +417,7 @@ bool CBoot::BootUp(std::unique_ptr boot) BootTitle() : config(SConfig::GetInstance()) {} bool operator()(BootParameters::Disc& disc) const { - NOTICE_LOG(BOOT, "Booting from disc: %s", disc.path.c_str()); + NOTICE_LOG_FMT(BOOT, "Booting from disc: {}", disc.path); const DiscIO::VolumeDisc* volume = SetDisc(std::move(disc.volume), disc.auto_disc_change_paths); @@ -437,14 +437,14 @@ bool CBoot::BootUp(std::unique_ptr boot) bool operator()(const BootParameters::Executable& executable) const { - NOTICE_LOG(BOOT, "Booting from executable: %s", executable.path.c_str()); + NOTICE_LOG_FMT(BOOT, "Booting from executable: {}", executable.path); if (!executable.reader->IsValid()) return false; if (!executable.reader->LoadIntoMemory()) { - PanicAlertT("Failed to load the executable to memory."); + PanicAlertFmtT("Failed to load the executable to memory."); return false; } @@ -497,13 +497,13 @@ bool CBoot::BootUp(std::unique_ptr boot) bool operator()(const BootParameters::IPL& ipl) const { - NOTICE_LOG(BOOT, "Booting GC IPL: %s", ipl.path.c_str()); + NOTICE_LOG_FMT(BOOT, "Booting GC IPL: {}", ipl.path); if (!File::Exists(ipl.path)) { if (ipl.disc) - PanicAlertT("Cannot start the game, because the GC IPL could not be found."); + PanicAlertFmtT("Cannot start the game, because the GC IPL could not be found."); else - PanicAlertT("Cannot find the GC IPL."); + PanicAlertFmtT("Cannot find the GC IPL."); return false; } @@ -512,7 +512,7 @@ bool CBoot::BootUp(std::unique_ptr boot) if (ipl.disc) { - NOTICE_LOG(BOOT, "Inserting disc: %s", ipl.disc->path.c_str()); + NOTICE_LOG_FMT(BOOT, "Inserting disc: {}", ipl.disc->path); SetDisc(DiscIO::CreateDisc(ipl.disc->path), ipl.disc->auto_disc_change_paths); } @@ -524,7 +524,7 @@ bool CBoot::BootUp(std::unique_ptr boot) bool operator()(const BootParameters::DFF& dff) const { - NOTICE_LOG(BOOT, "Booting DFF: %s", dff.dff_path.c_str()); + NOTICE_LOG_FMT(BOOT, "Booting DFF: {}", dff.dff_path); return FifoPlayer::GetInstance().Open(dff.dff_path); } diff --git a/Source/Core/Core/HW/AudioInterface.cpp b/Source/Core/Core/HW/AudioInterface.cpp index 810336130f..4ccf581e9c 100644 --- a/Source/Core/Core/HW/AudioInterface.cpp +++ b/Source/Core/Core/HW/AudioInterface.cpp @@ -284,8 +284,9 @@ static void IncreaseSampleCount(const u32 amount) if ((s_interrupt_timing - old_sample_counter) <= (s_sample_counter - old_sample_counter)) { - DEBUG_LOG(AUDIO_INTERFACE, "GenerateAudioInterrupt %08x:%08x @ %08x s_control.AIINTVLD=%d", - s_sample_counter, s_interrupt_timing, PowerPC::ppcState.pc, s_control.AIINTVLD); + DEBUG_LOG_FMT(AUDIO_INTERFACE, + "GenerateAudioInterrupt {:08x}:{:08x} at PC {:08x} s_control.AIINTVLD={}", + s_sample_counter, s_interrupt_timing, PowerPC::ppcState.pc, s_control.AIINTVLD); GenerateAudioInterrupt(); } } diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceAGP.cpp b/Source/Core/Core/HW/EXI/EXI_DeviceAGP.cpp index 1556a51119..4dd3960400 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceAGP.cpp +++ b/Source/Core/Core/HW/EXI/EXI_DeviceAGP.cpp @@ -259,7 +259,7 @@ u32 CEXIAgp::ImmRead(u32 _uSize) m_current_cmd = 0; break; } - DEBUG_LOG(EXPANSIONINTERFACE, "AGP read %x", uData); + DEBUG_LOG_FMT(EXPANSIONINTERFACE, "AGP read {:x}", uData); return uData; } diff --git a/Source/Core/Core/HW/WII_IPC.cpp b/Source/Core/Core/HW/WII_IPC.cpp index d47fb3fc0f..c9c828d3e6 100644 --- a/Source/Core/Core/HW/WII_IPC.cpp +++ b/Source/Core/Core/HW/WII_IPC.cpp @@ -193,7 +193,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base) g_gpio_out.m_hex = val & gpio_owner.m_hex; if (g_gpio_out[GPIO::DO_EJECT]) { - INFO_LOG(WII_IPC, "Ejecting disc due to GPIO write"); + INFO_LOG_FMT(WII_IPC, "Ejecting disc due to GPIO write"); DVDInterface::EjectDisc(DVDInterface::EjectCause::Software); } // SENSOR_BAR is checked by WiimoteEmu::CameraLogic diff --git a/Source/Core/Core/NetPlayServer.cpp b/Source/Core/Core/NetPlayServer.cpp index 979902dfe6..2543b85937 100644 --- a/Source/Core/Core/NetPlayServer.cpp +++ b/Source/Core/Core/NetPlayServer.cpp @@ -1079,8 +1079,8 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, Client& player) break; default: - PanicAlertT( - "Unknown SYNC_SAVE_DATA message with id:%d received from player:%d Kicking player!", + PanicAlertFmtT( + "Unknown SYNC_SAVE_DATA message with id:{0} received from player:{1} Kicking player!", sub_id, player.pid); return 1; } @@ -1415,7 +1415,7 @@ bool NetPlayServer::SyncSaveData() const auto game = m_dialog->FindGameFile(m_selected_game_identifier); if (game == nullptr) { - PanicAlertT("Selected game doesn't exist in game list!"); + PanicAlertFmtT("Selected game doesn't exist in game list!"); return false; }