diff --git a/Source/Core/DiscIO/CompressedBlob.cpp b/Source/Core/DiscIO/CompressedBlob.cpp index 5aea9d1184..76b1366db0 100644 --- a/Source/Core/DiscIO/CompressedBlob.cpp +++ b/Source/Core/DiscIO/CompressedBlob.cpp @@ -8,7 +8,6 @@ #endif #include -#include #include #include #include @@ -84,7 +83,7 @@ u64 CompressedBlobReader::GetBlockCompressedSize(u64 block_num) const else if (block_num == m_header.num_blocks - 1) return m_header.compressed_data_size - start; else - PanicAlert("GetBlockCompressedSize - illegal block number %i", (int)block_num); + PanicAlertFmt("{} - illegal block number {}", __func__, block_num); return 0; } @@ -97,7 +96,7 @@ bool CompressedBlobReader::GetBlock(u64 block_num, u8* out_ptr) if (offset & (1ULL << 63)) { if (comp_block_size != m_header.block_size) - PanicAlert("Uncompressed block with wrong size"); + PanicAlertFmt("Uncompressed block with wrong size"); uncompressed = true; offset &= ~(1ULL << 63); } @@ -108,18 +107,19 @@ bool CompressedBlobReader::GetBlock(u64 block_num, u8* out_ptr) m_file.Seek(offset, SEEK_SET); if (!m_file.ReadBytes(m_zlib_buffer.data(), comp_block_size)) { - PanicAlertT("The disc image \"%s\" is truncated, some of the data is missing.", - m_file_name.c_str()); + PanicAlertFmtT("The disc image \"{}\" is truncated, some of the data is missing.", m_file_name); m_file.Clear(); return false; } // First, check hash. - u32 block_hash = Common::HashAdler32(m_zlib_buffer.data(), comp_block_size); + const u32 block_hash = Common::HashAdler32(m_zlib_buffer.data(), comp_block_size); if (block_hash != m_hashes[block_num]) - PanicAlertT("The disc image \"%s\" is corrupt.\n" - "Hash of block %" PRIu64 " is %08x instead of %08x.", - m_file_name.c_str(), block_num, block_hash, m_hashes[block_num]); + { + PanicAlertFmtT("The disc image \"{}\" is corrupt.\n" + "Hash of block {} is {:08x} instead of {:08x}.", + m_file_name, block_num, block_hash, m_hashes[block_num]); + } if (uncompressed) { @@ -132,7 +132,7 @@ bool CompressedBlobReader::GetBlock(u64 block_num, u8* out_ptr) z.avail_in = comp_block_size; if (z.avail_in > m_header.block_size) { - PanicAlert("We have a problem"); + PanicAlertFmt("We have a problem"); } z.next_out = out_ptr; z.avail_out = m_header.block_size; @@ -143,12 +143,12 @@ bool CompressedBlobReader::GetBlock(u64 block_num, u8* out_ptr) { // this seem to fire wrongly from time to time // to be sure, don't use compressed isos :P - PanicAlert("Failure reading block %" PRIu64 " - out of data and not at end.", block_num); + PanicAlertFmt("Failure reading block {} - out of data and not at end.", block_num); } inflateEnd(&z); if (uncomp_size != m_header.block_size) { - PanicAlert("Wrong block size"); + PanicAlertFmt("Wrong block size"); return false; } } @@ -276,10 +276,11 @@ bool ConvertToGCZ(BlobReader* infile, const std::string& infile_path, File::IOFile outfile(outfile_path, "wb"); if (!outfile) { - PanicAlertT("Failed to open the output file \"%s\".\n" - "Check that you have permissions to write the target folder and that the media can " - "be written.", - outfile_path.c_str()); + PanicAlertFmtT( + "Failed to open the output file \"{}\".\n" + "Check that you have permissions to write the target folder and that the media can " + "be written.", + outfile_path); return false; } @@ -367,13 +368,13 @@ bool ConvertToGCZ(BlobReader* infile, const std::string& infile_path, } if (result == ConversionResultCode::ReadFailed) - PanicAlertT("Failed to read from the input file \"%s\".", infile_path.c_str()); + PanicAlertFmtT("Failed to read from the input file \"{}\".", infile_path); if (result == ConversionResultCode::WriteFailed) { - PanicAlertT("Failed to write the output file \"%s\".\n" - "Check that you have enough space available on the target drive.", - outfile_path.c_str()); + PanicAlertFmtT("Failed to write the output file \"{}\".\n" + "Check that you have enough space available on the target drive.", + outfile_path); } return result == ConversionResultCode::Success; diff --git a/Source/Core/DiscIO/DirectoryBlob.cpp b/Source/Core/DiscIO/DirectoryBlob.cpp index 9f5e6a4425..609f98ef4b 100644 --- a/Source/Core/DiscIO/DirectoryBlob.cpp +++ b/Source/Core/DiscIO/DirectoryBlob.cpp @@ -6,7 +6,6 @@ #include #include -#include #include #include #include diff --git a/Source/Core/DiscIO/DriveBlob.cpp b/Source/Core/DiscIO/DriveBlob.cpp index 5aab7b22f8..3a1ba4d275 100644 --- a/Source/Core/DiscIO/DriveBlob.cpp +++ b/Source/Core/DiscIO/DriveBlob.cpp @@ -146,7 +146,7 @@ bool DriveReader::ReadMultipleAlignedBlocks(u64 block_num, u64 num_blocks, u8* o !ReadFile(m_disc_handle, out_ptr, static_cast(GetSectorSize() * num_blocks), &bytes_read, nullptr)) { - PanicAlertT("Disc Read Error"); + PanicAlertFmtT("Disc Read Error"); return false; } return bytes_read == GetSectorSize() * num_blocks; diff --git a/Source/Core/DiscIO/FileBlob.cpp b/Source/Core/DiscIO/FileBlob.cpp index 980b158dc9..13439d029b 100644 --- a/Source/Core/DiscIO/FileBlob.cpp +++ b/Source/Core/DiscIO/FileBlob.cpp @@ -49,10 +49,11 @@ bool ConvertToPlain(BlobReader* infile, const std::string& infile_path, File::IOFile outfile(outfile_path, "wb"); if (!outfile) { - PanicAlertT("Failed to open the output file \"%s\".\n" - "Check that you have permissions to write the target folder and that the media can " - "be written.", - outfile_path.c_str()); + PanicAlertFmtT( + "Failed to open the output file \"{}\".\n" + "Check that you have permissions to write the target folder and that the media can " + "be written.", + outfile_path); return false; } @@ -89,15 +90,15 @@ bool ConvertToPlain(BlobReader* infile, const std::string& infile_path, const u64 sz = std::min(buffer_size, infile->GetDataSize() - inpos); if (!infile->Read(inpos, sz, buffer.data())) { - PanicAlertT("Failed to read from the input file \"%s\".", infile_path.c_str()); + PanicAlertFmtT("Failed to read from the input file \"{}\".", infile_path); success = false; break; } if (!outfile.WriteBytes(buffer.data(), sz)) { - PanicAlertT("Failed to write the output file \"%s\".\n" - "Check that you have enough space available on the target drive.", - outfile_path.c_str()); + PanicAlertFmtT("Failed to write the output file \"{}\".\n" + "Check that you have enough space available on the target drive.", + outfile_path); success = false; break; } diff --git a/Source/Core/DiscIO/FileSystemGCWii.cpp b/Source/Core/DiscIO/FileSystemGCWii.cpp index 71e7fb7ff3..541baf67ee 100644 --- a/Source/Core/DiscIO/FileSystemGCWii.cpp +++ b/Source/Core/DiscIO/FileSystemGCWii.cpp @@ -3,7 +3,6 @@ // Refer to the license.txt file included. #include -#include #include #include #include diff --git a/Source/Core/DiscIO/NANDImporter.cpp b/Source/Core/DiscIO/NANDImporter.cpp index 5bd651be2e..d67bbf047d 100644 --- a/Source/Core/DiscIO/NANDImporter.cpp +++ b/Source/Core/DiscIO/NANDImporter.cpp @@ -6,7 +6,6 @@ #include #include -#include #include #include @@ -60,7 +59,7 @@ bool NANDImporter::ReadNANDBin(const std::string& path_to_bin, const u64 image_size = file.GetSize(); if (image_size != NAND_BIN_SIZE + NAND_KEYS_SIZE && image_size != NAND_BIN_SIZE) { - PanicAlertT("This file does not look like a BootMii NAND backup."); + PanicAlertFmtT("This file does not look like a BootMii NAND backup."); return false; } @@ -273,6 +272,6 @@ void NANDImporter::ExportKeys(const std::string& nand_root) const std::string file_path = nand_root + "/keys.bin"; File::IOFile file(file_path, "wb"); if (!file.WriteBytes(m_nand_keys.data(), NAND_KEYS_SIZE)) - PanicAlertT("Unable to write to file %s", file_path.c_str()); + PanicAlertFmtT("Unable to write to file {}", file_path); } } // namespace DiscIO diff --git a/Source/Core/DiscIO/VolumeVerifier.cpp b/Source/Core/DiscIO/VolumeVerifier.cpp index fc78cdd601..860709448e 100644 --- a/Source/Core/DiscIO/VolumeVerifier.cpp +++ b/Source/Core/DiscIO/VolumeVerifier.cpp @@ -312,11 +312,11 @@ std::vector RedumpVerifier::ScanDatfile(const st // so show a panic alert rather than just using ERROR_LOG // i18n: "Serial" refers to serial numbers, e.g. RVL-RSBE-USA - PanicAlertT("Serial and/or version data is missing from %s\n" - "Please append \"%s\" (without the quotes) to the datfile URL when downloading\n" - "Example: %s", - GetPathForSystem(system).c_str(), "serial,version", - "http://redump.org/datfile/gc/serial,version"); + PanicAlertFmtT("Serial and/or version data is missing from {}\n" + "Please append \"{}\" (without the quotes) to the datfile URL when downloading\n" + "Example: {}", + GetPathForSystem(system), "serial,version", + "http://redump.org/datfile/gc/serial,version"); m_result = {Status::Error, Common::GetStringT("Failed to parse Redump.org data")}; return {}; } diff --git a/Source/Core/DiscIO/VolumeWii.cpp b/Source/Core/DiscIO/VolumeWii.cpp index 9acaa9520b..bad4509b5c 100644 --- a/Source/Core/DiscIO/VolumeWii.cpp +++ b/Source/Core/DiscIO/VolumeWii.cpp @@ -92,7 +92,7 @@ VolumeWii::VolumeWii(std::unique_ptr reader) { // This check is normally done by ES in ES_DiVerify, but that would happen too late // (after allocating the buffer), so we do the check here. - PanicAlert("Invalid TMD size"); + PanicAlertFmt("Invalid TMD size"); return INVALID_TMD; } std::vector tmd_buffer(*tmd_size); diff --git a/Source/Core/DiscIO/WIABlob.cpp b/Source/Core/DiscIO/WIABlob.cpp index 28fc4752c1..a8cce71cbe 100644 --- a/Source/Core/DiscIO/WIABlob.cpp +++ b/Source/Core/DiscIO/WIABlob.cpp @@ -2032,10 +2032,11 @@ bool ConvertToWIAOrRVZ(BlobReader* infile, const std::string& infile_path, File::IOFile outfile(outfile_path, "wb"); if (!outfile) { - PanicAlertT("Failed to open the output file \"%s\".\n" - "Check that you have permissions to write the target folder and that the media can " - "be written.", - outfile_path.c_str()); + PanicAlertFmtT( + "Failed to open the output file \"{}\".\n" + "Check that you have permissions to write the target folder and that the media can " + "be written.", + outfile_path); return false; } @@ -2047,13 +2048,13 @@ bool ConvertToWIAOrRVZ(BlobReader* infile, const std::string& infile_path, chunk_size, callback); if (result == ConversionResultCode::ReadFailed) - PanicAlertT("Failed to read from the input file \"%s\".", infile_path.c_str()); + PanicAlertFmtT("Failed to read from the input file \"{}\".", infile_path); if (result == ConversionResultCode::WriteFailed) { - PanicAlertT("Failed to write the output file \"%s\".\n" - "Check that you have enough space available on the target drive.", - outfile_path.c_str()); + PanicAlertFmtT("Failed to write the output file \"{}\".\n" + "Check that you have enough space available on the target drive.", + outfile_path); } if (result != ConversionResultCode::Success) diff --git a/Source/Core/DiscIO/WbfsBlob.cpp b/Source/Core/DiscIO/WbfsBlob.cpp index 246eda260f..7d24b3b618 100644 --- a/Source/Core/DiscIO/WbfsBlob.cpp +++ b/Source/Core/DiscIO/WbfsBlob.cpp @@ -166,7 +166,7 @@ File::IOFile& WbfsFileReader::SeekToCluster(u64 offset, u64* available) } } - PanicAlert("Read beyond end of disc"); + PanicAlertFmt("Read beyond end of disc"); if (available) *available = 0; m_files[0].file.Seek(0, SEEK_SET);