diff --git a/src/core/achievements.cpp b/src/core/achievements.cpp index ec6b9471d..c27dc83b5 100644 --- a/src/core/achievements.cpp +++ b/src/core/achievements.cpp @@ -903,7 +903,7 @@ void Achievements::ClientLoadGameCallback(int result, const char* error_message, if (result == RC_NO_GAME_LOADED) { // Unknown game. - INFO_LOG("Unknown game '%s', disabling achievements.", s_game_hash); + INFO_LOG("Unknown game '{}', disabling achievements.", s_game_hash); DisableHardcoreMode(); return; } diff --git a/src/core/bus.cpp b/src/core/bus.cpp index 8955a998b..f5f0f1379 100644 --- a/src/core/bus.cpp +++ b/src/core/bus.cpp @@ -677,7 +677,7 @@ void Bus::ClearRAMCodePageFlags() for (const auto& it : s_fastmem_ram_views) { if (!MemMap::MemProtect(it.first, it.second, PageProtect::ReadWrite)) - ERROR_LOG("Failed to unprotect code pages for fastmem view @ %p", static_cast(it.first)); + ERROR_LOG("Failed to unprotect code pages for fastmem view @ {}", static_cast(it.first)); } } #endif diff --git a/src/core/cdrom.cpp b/src/core/cdrom.cpp index 6c8283ecd..7ce8354bc 100644 --- a/src/core/cdrom.cpp +++ b/src/core/cdrom.cpp @@ -2145,7 +2145,7 @@ void CDROM::ExecuteTestCommand(u8 subcommand) default: [[unlikely]] { - ERROR_LOG("Unknown test command 0x{:02X}, %u parameters", subcommand, s_param_fifo.GetSize()); + ERROR_LOG("Unknown test command 0x{:02X}, {} parameters", subcommand, s_param_fifo.GetSize()); SendErrorResponse(STAT_ERROR, ERROR_REASON_INVALID_COMMAND); EndCommand(); return; @@ -3282,7 +3282,7 @@ void CDROM::LoadDataFIFO() sb.size = 0; } - DEBUG_LOG("Loaded %u bytes to data FIFO from buffer {}", s_data_fifo.GetSize(), s_current_read_sector_buffer); + DEBUG_LOG("Loaded {} bytes to data FIFO from buffer {}", s_data_fifo.GetSize(), s_current_read_sector_buffer); SectorBuffer& next_sb = s_sector_buffers[s_current_write_sector_buffer]; if (next_sb.size > 0) diff --git a/src/core/cpu_core.cpp b/src/core/cpu_core.cpp index 2c548250e..ee572d35a 100644 --- a/src/core/cpu_core.cpp +++ b/src/core/cpu_core.cpp @@ -710,7 +710,7 @@ void CPU::PrintInstruction(u32 bits, u32 pc, bool regs, const char* prefix) } } - DEV_LOG("{}{:08x}: {:08x} %s", prefix, pc, bits, instr); + DEV_LOG("{}{:08x}: {:08x} {}", prefix, pc, bits, instr); } void CPU::LogInstruction(u32 bits, u32 pc, bool regs) @@ -2061,7 +2061,7 @@ bool CPU::AddBreakpoint(BreakpointType type, VirtualMemoryAddress address, bool if (HasBreakpointAtAddress(type, address)) return false; - INFO_LOG("Adding {} breakpoint at {:08X}, auto clear = %u", GetBreakpointTypeName(type), address, + INFO_LOG("Adding {} breakpoint at {:08X}, auto clear = {}", GetBreakpointTypeName(type), address, static_cast(auto_clear)); Breakpoint bp{address, nullptr, auto_clear ? 0 : s_breakpoint_counter++, 0, type, auto_clear, enabled}; diff --git a/src/core/game_list.cpp b/src/core/game_list.cpp index ce87f415f..8af7f20aa 100644 --- a/src/core/game_list.cpp +++ b/src/core/game_list.cpp @@ -1010,7 +1010,7 @@ GameList::PlayedTimeMap GameList::LoadPlayedTimeMap(const std::string& path) if (ret.find(serial) != ret.end()) { - WARNING_LOG("Duplicate entry: '%s'", serial); + WARNING_LOG("Duplicate entry: '{}'", serial); continue; } @@ -1074,7 +1074,7 @@ GameList::PlayedTimeEntry GameList::UpdatePlayedTimeFile(const std::string& path if (FileSystem::FSeek64(fp.get(), line_pos, SEEK_SET) != 0 || std::fwrite(new_line.data(), new_line.length(), 1, fp.get()) != 1) { - ERROR_LOG("Failed to update '%s'.", path); + ERROR_LOG("Failed to update '{}'.", path); } return line_entry; @@ -1087,7 +1087,7 @@ GameList::PlayedTimeEntry GameList::UpdatePlayedTimeFile(const std::string& path if (FileSystem::FSeek64(fp.get(), 0, SEEK_END) != 0 || std::fwrite(new_line.data(), new_line.length(), 1, fp.get()) != 1) { - ERROR_LOG("Failed to write '%s'.", path); + ERROR_LOG("Failed to write '{}'.", path); } } diff --git a/src/core/memory_card_image.cpp b/src/core/memory_card_image.cpp index 57167452c..8044235dc 100644 --- a/src/core/memory_card_image.cpp +++ b/src/core/memory_card_image.cpp @@ -451,7 +451,7 @@ bool MemoryCardImage::UndeleteFile(DataArray* data, const FileInfo& fi) { if (df->block_allocation_state != 0xA3) { - ERROR_LOG("Incorrect block state for %u, expected 0xA3 got 0x{:02X}", this_block_number, + ERROR_LOG("Incorrect block state for {}, expected 0xA3 got 0x{:02X}", this_block_number, df->block_allocation_state); return false; } diff --git a/src/core/texture_replacements.cpp b/src/core/texture_replacements.cpp index a4edae46e..a746d66a5 100644 --- a/src/core/texture_replacements.cpp +++ b/src/core/texture_replacements.cpp @@ -277,7 +277,7 @@ const TextureReplacementTexture* TextureReplacements::LoadTexture(const std::str RGBA8Image image; if (!image.LoadFromFile(filename.c_str())) { - ERROR_LOG("Failed to load '%s'", Path::GetFileName(filename)); + ERROR_LOG("Failed to load '{}'", Path::GetFileName(filename)); return nullptr; } diff --git a/src/core/timers.cpp b/src/core/timers.cpp index 6c2aeb377..109a4142d 100644 --- a/src/core/timers.cpp +++ b/src/core/timers.cpp @@ -400,7 +400,7 @@ void Timers::WriteRegister(u32 offset, u32 value) case 0x08: { - DEBUG_LOG("Timer %u write target 0x{:04X}", timer_index, ZeroExtend32(Truncate16(value))); + DEBUG_LOG("Timer {} write target 0x{:04X}", timer_index, ZeroExtend32(Truncate16(value))); cs.target = value & u32(0xFFFF); CheckForIRQ(timer_index, cs.counter); if (timer_index == 2 || !cs.external_counting_enabled) diff --git a/src/duckstation-qt/gdbconnection.cpp b/src/duckstation-qt/gdbconnection.cpp index e00f5d6a5..cd7acc3e2 100644 --- a/src/duckstation-qt/gdbconnection.cpp +++ b/src/duckstation-qt/gdbconnection.cpp @@ -58,7 +58,7 @@ void GDBConnection::receivedData() } else if (GDBProtocol::IsPacketComplete(m_readBuffer)) { - DEBUG_LOG("{} > %s", m_descriptor, m_readBuffer.c_str()); + DEBUG_LOG("{} > {}", m_descriptor, m_readBuffer); writePacket(GDBProtocol::ProcessPacket(m_readBuffer)); m_readBuffer.erase(); } @@ -66,7 +66,7 @@ void GDBConnection::receivedData() } if (bytesRead == -1) { - ERROR_LOG("{} failed to read from socket: %s", m_descriptor, errorString().toStdString()); + ERROR_LOG("{} failed to read from socket: {}", m_descriptor, errorString().toStdString()); } } diff --git a/src/duckstation-regtest/regtest_host.cpp b/src/duckstation-regtest/regtest_host.cpp index 2adf5d784..6dbbaf995 100644 --- a/src/duckstation-regtest/regtest_host.cpp +++ b/src/duckstation-regtest/regtest_host.cpp @@ -710,7 +710,7 @@ int main(int argc, char* argv[]) INFO_LOG("Dumping every {}th frame to '{}'.", s_frame_dump_interval, s_dump_base_directory); } - INFO_LOG("Running for %d frames...", s_frames_to_run); + INFO_LOG("Running for {} frames...", s_frames_to_run); System::Execute(); INFO_LOG("Exiting with success."); diff --git a/src/util/cd_image_chd.cpp b/src/util/cd_image_chd.cpp index 49976b912..6a2be8c3b 100644 --- a/src/util/cd_image_chd.cpp +++ b/src/util/cd_image_chd.cpp @@ -561,7 +561,7 @@ ALWAYS_INLINE_RELEASE bool CDImageCHD::UpdateHunkBuffer(const Index& index, LBA const chd_error err = chd_read(m_chd, hunk_index, m_hunk_buffer.data()); if (err != CHDERR_NONE) { - ERROR_LOG("chd_read({}) failed: %s", hunk_index, chd_error_string(err)); + ERROR_LOG("chd_read({}) failed: {}", hunk_index, chd_error_string(err)); // data might have been partially written m_current_hunk_index = static_cast(-1); diff --git a/src/util/cd_image_pbp.cpp b/src/util/cd_image_pbp.cpp index bda985a27..e6da1e408 100644 --- a/src/util/cd_image_pbp.cpp +++ b/src/util/cd_image_pbp.cpp @@ -475,7 +475,7 @@ bool CDImagePBP::Open(const char* filename, Error* error) // Ignore encrypted files if (disc_table[0] == 0x44475000) // "\0PGD" { - ERROR_LOG("Encrypted PBP images are not supported, skipping %s", m_filename); + ERROR_LOG("Encrypted PBP images are not supported, skipping {}", m_filename); Error::SetString(error, "Encrypted PBP images are not supported"); return false; } diff --git a/src/util/cd_image_ppf.cpp b/src/util/cd_image_ppf.cpp index 4c627b658..eb56d8ca9 100644 --- a/src/util/cd_image_ppf.cpp +++ b/src/util/cd_image_ppf.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin +// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin // SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0) #include "cd_image.h" @@ -7,6 +7,7 @@ #include "common/assert.h" #include "common/file_system.h" #include "common/log.h" +#include "common/path.h" #include #include @@ -69,7 +70,7 @@ bool CDImagePPF::Open(const char* filename, std::unique_ptr parent_imag auto fp = FileSystem::OpenManagedSharedCFile(filename, "rb", FileSystem::FileShareMode::DenyWrite); if (!fp) { - ERROR_LOG("Failed to open '%s'", filename); + ERROR_LOG("Failed to open '{}'", Path::GetFileName(filename)); return false; } @@ -78,7 +79,7 @@ bool CDImagePPF::Open(const char* filename, std::unique_ptr parent_imag u32 magic; if (std::fread(&magic, sizeof(magic), 1, fp.get()) != 1) { - ERROR_LOG("Failed to read magic from '%s'", filename); + ERROR_LOG("Failed to read magic from '{}'", Path::GetFileName(filename)); return false; } @@ -140,7 +141,7 @@ u32 CDImagePPF::ReadFileIDDiz(std::FILE* fp, u32 version) return 0; } - INFO_LOG("File_Id.diz: %s", fdiz); + INFO_LOG("File_Id.diz: {}", fdiz); return dlen; } @@ -206,7 +207,7 @@ bool CDImagePPF::ReadV2Patch(std::FILE* fp) return false; } - INFO_LOG("Patch description: %s", desc); + INFO_LOG("Patch description: {}", desc); const u32 idlen = ReadFileIDDiz(fp, 2); diff --git a/src/util/d3d11_device.cpp b/src/util/d3d11_device.cpp index e215275c9..7a6698c16 100644 --- a/src/util/d3d11_device.cpp +++ b/src/util/d3d11_device.cpp @@ -126,7 +126,7 @@ bool D3D11Device::CreateDevice(std::string_view adapter, bool threaded_presentat ComPtr dxgi_device; if (SUCCEEDED(m_device.As(&dxgi_device)) && SUCCEEDED(dxgi_device->GetParent(IID_PPV_ARGS(dxgi_adapter.GetAddressOf())))) - INFO_LOG("D3D Adapter: %s", D3DCommon::GetAdapterName(dxgi_adapter.Get())); + INFO_LOG("D3D Adapter: {}", D3DCommon::GetAdapterName(dxgi_adapter.Get())); else ERROR_LOG("Failed to obtain D3D adapter name."); INFO_LOG("Max device feature level: {}", D3DCommon::GetFeatureLevelString(m_max_feature_level)); diff --git a/src/util/jit_code_buffer.cpp b/src/util/jit_code_buffer.cpp index 052f02573..0f7a5f179 100644 --- a/src/util/jit_code_buffer.cpp +++ b/src/util/jit_code_buffer.cpp @@ -104,7 +104,7 @@ bool JitCodeBuffer::TryAllocateAt(const void* addr) if (!m_code_ptr) { if (!addr) - ERROR_LOG("VirtualAlloc(RWX, %u) for internal buffer failed: {}", m_total_size, GetLastError()); + ERROR_LOG("VirtualAlloc(RWX, {}) for internal buffer failed: {}", m_total_size, GetLastError()); return false; } @@ -134,7 +134,7 @@ bool JitCodeBuffer::TryAllocateAt(const void* addr) if (!m_code_ptr) { if (!addr) - ERROR_LOG("mmap(RWX, %u) for internal buffer failed: {}", m_total_size, errno); + ERROR_LOG("mmap(RWX, {}) for internal buffer failed: {}", m_total_size, errno); return false; } @@ -229,10 +229,10 @@ void JitCodeBuffer::Destroy() { #if defined(_WIN32) if (!VirtualFree(m_code_ptr, 0, MEM_RELEASE)) - ERROR_LOG("Failed to free code pointer %p", static_cast(m_code_ptr)); + ERROR_LOG("Failed to free code pointer {}", static_cast(m_code_ptr)); #elif defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) || defined(__HAIKU__) || defined(__FreeBSD__) if (munmap(m_code_ptr, m_total_size) != 0) - ERROR_LOG("Failed to free code pointer %p", static_cast(m_code_ptr)); + ERROR_LOG("Failed to free code pointer {}", static_cast(m_code_ptr)); #endif } else if (m_code_ptr) @@ -240,10 +240,10 @@ void JitCodeBuffer::Destroy() #if defined(_WIN32) DWORD old_protect = 0; if (!VirtualProtect(m_code_ptr, m_total_size, m_old_protection, &old_protect)) - ERROR_LOG("Failed to restore protection on %p", static_cast(m_code_ptr)); + ERROR_LOG("Failed to restore protection on {}", static_cast(m_code_ptr)); #else if (mprotect(m_code_ptr, m_total_size, m_old_protection) != 0) - ERROR_LOG("Failed to restore protection on %p", static_cast(m_code_ptr)); + ERROR_LOG("Failed to restore protection on {}", static_cast(m_code_ptr)); #endif } diff --git a/src/util/postprocessing_shader.cpp b/src/util/postprocessing_shader.cpp index 0e96e6f4f..21979dd3a 100644 --- a/src/util/postprocessing_shader.cpp +++ b/src/util/postprocessing_shader.cpp @@ -91,7 +91,7 @@ void PostProcessing::Shader::LoadOptions(const SettingsInterface& si, const char ShaderOption::ParseFloatVector(config_value, &value); if (value_vector_size != option.vector_size) { - WARNING_LOG("Only got {} of {} elements for '{}' in config section %s.", value_vector_size, + WARNING_LOG("Only got {} of {} elements for '{}' in config section {}.", value_vector_size, option.vector_size, option.name, section); } } diff --git a/src/util/vulkan_loader.cpp b/src/util/vulkan_loader.cpp index 22a13bd39..8089ffd8a 100644 --- a/src/util/vulkan_loader.cpp +++ b/src/util/vulkan_loader.cpp @@ -104,7 +104,7 @@ bool Vulkan::LoadVulkanInstanceFunctions(VkInstance instance) *func_ptr = vkGetInstanceProcAddr(instance, name); if (!(*func_ptr) && is_required) { - std::fprintf(stderr, "Vulkan: Failed to load required instance function %s\n", name); + ERROR_LOG("Vulkan: Failed to load required instance function {}", name); required_functions_missing = true; } }; @@ -124,7 +124,7 @@ bool Vulkan::LoadVulkanDeviceFunctions(VkDevice device) *func_ptr = vkGetDeviceProcAddr(device, name); if (!(*func_ptr) && is_required) { - std::fprintf(stderr, "Vulkan: Failed to load required device function %s\n", name); + ERROR_LOG("Vulkan: Failed to load required device function {}", name); required_functions_missing = true; } };