Misc: More format string fixes

This commit is contained in:
Stenzek 2024-05-25 15:45:17 +10:00
parent a75e61e1d6
commit 1565a2667d
No known key found for this signature in database
17 changed files with 33 additions and 32 deletions

View file

@ -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;
}

View file

@ -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<void*>(it.first));
ERROR_LOG("Failed to unprotect code pages for fastmem view @ {}", static_cast<void*>(it.first));
}
}
#endif

View file

@ -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)

View file

@ -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<unsigned>(auto_clear));
Breakpoint bp{address, nullptr, auto_clear ? 0 : s_breakpoint_counter++, 0, type, auto_clear, enabled};

View file

@ -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);
}
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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)

View file

@ -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());
}
}

View file

@ -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.");

View file

@ -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<u32>(-1);

View file

@ -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;
}

View file

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
// 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 <algorithm>
#include <cerrno>
@ -69,7 +70,7 @@ bool CDImagePPF::Open(const char* filename, std::unique_ptr<CDImage> 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<CDImage> 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);

View file

@ -126,7 +126,7 @@ bool D3D11Device::CreateDevice(std::string_view adapter, bool threaded_presentat
ComPtr<IDXGIDevice> 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));

View file

@ -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<void*>(m_code_ptr));
ERROR_LOG("Failed to free code pointer {}", static_cast<void*>(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<void*>(m_code_ptr));
ERROR_LOG("Failed to free code pointer {}", static_cast<void*>(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<void*>(m_code_ptr));
ERROR_LOG("Failed to restore protection on {}", static_cast<void*>(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<void*>(m_code_ptr));
ERROR_LOG("Failed to restore protection on {}", static_cast<void*>(m_code_ptr));
#endif
}

View file

@ -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);
}
}

View file

@ -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;
}
};