mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 12:19:12 +00:00
DiscScrubber: Convert into a class
Allows potential multiple scrubbers to run at once. Also gets rid of the need to explicitly clean up resources.
This commit is contained in:
parent
389f8297c3
commit
4a9bc2340b
3 changed files with 96 additions and 107 deletions
|
@ -173,9 +173,10 @@ bool CompressFileToBlob(const std::string& infile, const std::string& outfile, u
|
|||
return false;
|
||||
}
|
||||
|
||||
DiscScrubber disc_scrubber;
|
||||
if (sub_type == 1)
|
||||
{
|
||||
if (!DiscScrubber::SetupScrub(infile, block_size))
|
||||
if (!disc_scrubber.SetupScrub(infile, block_size))
|
||||
{
|
||||
PanicAlertT("\"%s\" failed to be scrubbed. Probably the image is corrupt.", infile.c_str());
|
||||
return false;
|
||||
|
@ -186,10 +187,7 @@ bool CompressFileToBlob(const std::string& infile, const std::string& outfile, u
|
|||
|
||||
z_stream z = {};
|
||||
if (deflateInit(&z, 9) != Z_OK)
|
||||
{
|
||||
DiscScrubber::Cleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
callback(GetStringT("Files opened, ready to compress."), 0, arg);
|
||||
|
||||
|
@ -243,7 +241,7 @@ bool CompressFileToBlob(const std::string& infile, const std::string& outfile, u
|
|||
|
||||
size_t read_bytes;
|
||||
if (scrubbing)
|
||||
read_bytes = DiscScrubber::GetNextBlock(inf, in_buf.data());
|
||||
read_bytes = disc_scrubber.GetNextBlock(inf, in_buf.data());
|
||||
else
|
||||
inf.ReadArray(in_buf.data(), header.block_size, &read_bytes);
|
||||
if (read_bytes < header.block_size)
|
||||
|
@ -318,7 +316,6 @@ bool CompressFileToBlob(const std::string& infile, const std::string& outfile, u
|
|||
|
||||
// Cleanup
|
||||
deflateEnd(&z);
|
||||
DiscScrubber::Cleanup();
|
||||
|
||||
if (success)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue