ISO compression: Report filename in corruption warnings.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4807 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
c840297615
commit
ddcb39d8e3
|
@ -40,6 +40,7 @@ public:
|
|||
|
||||
virtual u64 GetRawSize() const = 0;
|
||||
virtual u64 GetDataSize() const = 0;
|
||||
// NOT thread-safe - can't call this from multiple threads.
|
||||
virtual bool Read(u64 offset, u64 size, u8* out_ptr) = 0;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace DiscIO
|
|||
|
||||
CompressedBlobReader::CompressedBlobReader(const char *filename)
|
||||
{
|
||||
file_name = filename;
|
||||
file = fopen(filename, "rb");
|
||||
fseek(file, 0, SEEK_END);
|
||||
file_size = ftell(file);
|
||||
|
@ -118,8 +119,10 @@ void CompressedBlobReader::GetBlock(u64 block_num, u8 *out_ptr)
|
|||
// First, check hash.
|
||||
u32 block_hash = HashAdler32(source, comp_block_size);
|
||||
if (block_hash != hashes[block_num])
|
||||
PanicAlert("Hash of block %i is %08x instead of %08x. Your ISO is corrupt.",
|
||||
block_num, block_hash, hashes[block_num]);
|
||||
PanicAlert("Hash of block %i is %08x instead of %08x.\n"
|
||||
"Your ISO, %s, is corrupt.",
|
||||
block_num, block_hash, hashes[block_num],
|
||||
file_name.c_str());
|
||||
|
||||
if (uncompressed)
|
||||
{
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#define COMPRESSED_BLOB_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
|
||||
#include "Blob.h"
|
||||
|
||||
namespace DiscIO
|
||||
|
@ -56,18 +58,6 @@ struct CompressedBlobHeader // 32 bytes
|
|||
|
||||
class CompressedBlobReader : public SectorReader
|
||||
{
|
||||
private:
|
||||
CompressedBlobHeader header;
|
||||
u64 *block_pointers;
|
||||
u32 *hashes;
|
||||
int data_offset;
|
||||
FILE *file;
|
||||
u64 file_size;
|
||||
u8 *zlib_buffer;
|
||||
int zlib_buffer_size;
|
||||
|
||||
CompressedBlobReader(const char *filename);
|
||||
|
||||
public:
|
||||
static CompressedBlobReader* Create(const char *filename);
|
||||
~CompressedBlobReader();
|
||||
|
@ -76,6 +66,18 @@ public:
|
|||
u64 GetRawSize() const { return file_size; }
|
||||
u64 GetBlockCompressedSize(u64 block_num) const;
|
||||
void GetBlock(u64 block_num, u8 *out_ptr);
|
||||
private:
|
||||
CompressedBlobReader(const char *filename);
|
||||
|
||||
CompressedBlobHeader header;
|
||||
u64 *block_pointers;
|
||||
u32 *hashes;
|
||||
int data_offset;
|
||||
FILE *file;
|
||||
u64 file_size;
|
||||
u8 *zlib_buffer;
|
||||
int zlib_buffer_size;
|
||||
std::string file_name;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
|
Loading…
Reference in New Issue