lpfaint's fix for compressing small disc images. Fixes issue 2569

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5433 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2010-05-04 18:15:22 +00:00
parent 0ea01d8462
commit 6c934f7951
1 changed files with 4 additions and 2 deletions

View File

@ -216,10 +216,11 @@ bool CompressFileToBlob(const char* infile, const char* outfile, u32 sub_type,
u64 position = 0;
int num_compressed = 0;
int num_stored = 0;
int progress_monitor = max<int>(1, header.num_blocks / 1000);
for (u32 i = 0; i < header.num_blocks; i++)
{
if (i % (header.num_blocks / 1000) == 0)
if (i % progress_monitor == 0)
{
u64 inpos = ftell(inf);
int ratio = 0;
@ -315,10 +316,11 @@ bool DecompressBlobToFile(const char* infile, const char* outfile, CompressCB ca
FILE* f = fopen(outfile, "wb");
const CompressedBlobHeader &header = reader->GetHeader();
u8* buffer = new u8[header.block_size];
int progress_monitor = max<int>(1, header.num_blocks / 100);
for (u64 i = 0; i < header.num_blocks; i++)
{
if (i % (header.num_blocks / 100) == 0)
if (i % progress_monitor == 0)
{
callback("Unpacking", (float)i / (float)header.num_blocks, arg);
}