ProgressCallback: Eliminate redundancy and drop C format strings

This commit is contained in:
Stenzek
2024-07-19 14:49:12 +10:00
parent 24ef76bfee
commit 6176a21ff1
20 changed files with 345 additions and 731 deletions

View File

@ -29,8 +29,7 @@ bool CDImageHasher::ReadIndex(CDImage* image, u8 track, u8 index, MD5Digest* dig
if (!image->Seek(index_start))
{
progress_callback->DisplayFormattedModalError("Failed to seek to sector %u for track %u index %u", index_start,
track, index);
progress_callback->FormatModalError("Failed to seek to sector {} for track {} index {}", index_start, track, index);
return false;
}
@ -42,7 +41,7 @@ bool CDImageHasher::ReadIndex(CDImage* image, u8 track, u8 index, MD5Digest* dig
if (!image->ReadRawSector(sector.data(), nullptr))
{
progress_callback->DisplayFormattedModalError("Failed to read sector %u from image", image->GetPositionOnDisc());
progress_callback->FormatModalError("Failed to read sector {} from image", image->GetPositionOnDisc());
return false;
}

View File

@ -62,17 +62,17 @@ bool CDImageMemory::CopyImage(CDImage* image, ProgressCallback* progress)
if ((static_cast<u64>(RAW_SECTOR_SIZE) * static_cast<u64>(m_memory_sectors)) >=
static_cast<u64>(std::numeric_limits<size_t>::max()))
{
progress->DisplayFormattedModalError("Insufficient address space");
progress->ModalError("Insufficient address space");
return false;
}
progress->SetFormattedStatusText("Allocating memory for %u sectors...", m_memory_sectors);
progress->FormatStatusText("Allocating memory for {} sectors...", m_memory_sectors);
m_memory =
static_cast<u8*>(std::malloc(static_cast<size_t>(RAW_SECTOR_SIZE) * static_cast<size_t>(m_memory_sectors)));
if (!m_memory)
{
progress->DisplayFormattedModalError("Failed to allocate memory for %u sectors", m_memory_sectors);
progress->FormatModalError("Failed to allocate memory for {} sectors", m_memory_sectors);
return false;
}

View File

@ -417,7 +417,7 @@ void PostProcessing::Chain::LoadStages()
}
lock.unlock();
progress.SetFormattedStatusText("Loading shader %s...", stage_name.c_str());
progress.FormatStatusText("Loading shader {}...", stage_name);
std::unique_ptr<Shader> shader = TryLoadingShader(stage_name, false, &error);
if (!shader)
@ -585,7 +585,7 @@ bool PostProcessing::Chain::CheckTargets(GPUTexture::Format target_format, u32 t
{
Shader* const shader = m_stages[i].get();
progress->SetFormattedStatusText("Compiling %s...", shader->GetName().c_str());
progress->FormatStatusText("Compiling {}...", shader->GetName());
if (!shader->CompilePipeline(target_format, target_width, target_height, progress) ||
!shader->ResizeOutput(target_format, target_width, target_height))