DiscIO: Migrate logging over to fmt

Eliminates quite a bit of the PRI* macros used for handling 64-bit
values.
This commit is contained in:
Lioncash
2020-10-21 14:58:08 -04:00
parent 09e87b79f1
commit e93fbb7c5e
12 changed files with 79 additions and 85 deletions

View File

@ -502,9 +502,9 @@ void DirectoryBlobReader::SetWiiRegionData(const std::string& game_partition_roo
const std::string region_bin_path = game_partition_root + "disc/region.bin";
const size_t bytes_read = ReadFileToVector(region_bin_path, &m_wii_region_data);
if (bytes_read < 0x4)
ERROR_LOG(DISCIO, "Couldn't read region from %s", region_bin_path.c_str());
ERROR_LOG_FMT(DISCIO, "Couldn't read region from {}", region_bin_path);
else if (bytes_read < 0x20)
ERROR_LOG(DISCIO, "Couldn't read age ratings from %s", region_bin_path.c_str());
ERROR_LOG_FMT(DISCIO, "Couldn't read age ratings from {}", region_bin_path);
constexpr u64 WII_REGION_DATA_ADDRESS = 0x4E000;
[[maybe_unused]] constexpr u64 WII_REGION_DATA_SIZE = 0x20;
@ -644,7 +644,7 @@ void DirectoryBlobPartition::SetDiscHeaderAndDiscType(std::optional<bool> is_wii
m_disc_header.resize(DISCHEADER_SIZE);
const std::string boot_bin_path = m_root_directory + "sys/boot.bin";
if (ReadFileToVector(boot_bin_path, &m_disc_header) < 0x20)
ERROR_LOG(DISCIO, "%s doesn't exist or is too small", boot_bin_path.c_str());
ERROR_LOG_FMT(DISCIO, "{} doesn't exist or is too small", boot_bin_path);
m_contents.Add(DISCHEADER_ADDRESS, m_disc_header);
@ -657,7 +657,7 @@ void DirectoryBlobPartition::SetDiscHeaderAndDiscType(std::optional<bool> is_wii
m_is_wii = Common::swap32(&m_disc_header[0x18]) == 0x5d1c9ea3;
const bool is_gc = Common::swap32(&m_disc_header[0x1c]) == 0xc2339f3d;
if (m_is_wii == is_gc)
ERROR_LOG(DISCIO, "Couldn't detect disc type based on %s", boot_bin_path.c_str());
ERROR_LOG_FMT(DISCIO, "Couldn't detect disc type based on {}", boot_bin_path);
}
m_address_shift = m_is_wii ? 2 : 0;
@ -675,7 +675,7 @@ void DirectoryBlobPartition::SetBI2()
const std::string bi2_path = m_root_directory + "sys/bi2.bin";
const size_t bytes_read = ReadFileToVector(bi2_path, &m_bi2);
if (!m_is_wii && bytes_read < 0x1C)
ERROR_LOG(DISCIO, "Couldn't read region from %s", bi2_path.c_str());
ERROR_LOG_FMT(DISCIO, "Couldn't read region from {}", bi2_path);
m_contents.Add(BI2_ADDRESS, m_bi2);
}
@ -689,14 +689,14 @@ u64 DirectoryBlobPartition::SetApploader()
m_apploader.resize(file.GetSize());
if (m_apploader.size() < 0x20 || !file.ReadBytes(m_apploader.data(), m_apploader.size()))
{
ERROR_LOG(DISCIO, "%s couldn't be accessed or is too small", path.c_str());
ERROR_LOG_FMT(DISCIO, "{} couldn't be accessed or is too small", path);
}
else
{
const size_t apploader_size = 0x20 + Common::swap32(*(u32*)&m_apploader[0x14]) +
Common::swap32(*(u32*)&m_apploader[0x18]);
if (apploader_size != m_apploader.size())
ERROR_LOG(DISCIO, "%s is the wrong size... Is it really an apploader?", path.c_str());
ERROR_LOG_FMT(DISCIO, "{} is the wrong size... Is it really an apploader?", path);
else
success = true;
}