savestate: rzip size must be 64-bit on all platforms
This commit is contained in:
parent
d6545b253b
commit
c73bbc85bd
|
@ -39,6 +39,12 @@ bool RZipFile::Open(const std::string& path, bool write)
|
|||
Close();
|
||||
return false;
|
||||
}
|
||||
// savestates created on 32-bit platforms used to have a 32-bit size
|
||||
if (size >> 32 != 0)
|
||||
{
|
||||
size &= 0xffffffff;
|
||||
std::fseek(file, -4, SEEK_CUR);
|
||||
}
|
||||
chunk = new u8[maxChunkSize];
|
||||
chunkIndex = 0;
|
||||
chunkSize = 0;
|
||||
|
@ -109,9 +115,10 @@ size_t RZipFile::Write(const void *data, size_t length)
|
|||
verify(std::ftell(file) == 0);
|
||||
|
||||
maxChunkSize = 1024 * 1024;
|
||||
size = length;
|
||||
if (std::fwrite(RZipHeader, sizeof(RZipHeader), 1, file) != 1
|
||||
|| std::fwrite(&maxChunkSize, sizeof(maxChunkSize), 1, file) != 1
|
||||
|| std::fwrite(&length, sizeof(length), 1, file) != 1)
|
||||
|| std::fwrite(&size, sizeof(size), 1, file) != 1)
|
||||
return 0;
|
||||
const u8 *p = (const u8 *)data;
|
||||
// compression output buffer must be 0.1% larger + 12 bytes
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
|
||||
private:
|
||||
FILE *file = nullptr;
|
||||
size_t size = 0;
|
||||
u64 size = 0;
|
||||
u32 maxChunkSize = 0;
|
||||
u8 *chunk = nullptr;
|
||||
u32 chunkSize = 0;
|
||||
|
|
Loading…
Reference in New Issue