1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-11 23:12:02 +00:00

Use backup when PTC compression is corrupt (#1704)

* Use backup when PTC compression is corrupt

* Apply suggestions from code review

Co-authored-by: LDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com>

Co-authored-by: LDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com>
This commit is contained in:
riperiperi 2020-11-20 01:51:59 +00:00 committed by GitHub
parent c2356a7653
commit 9852cb9c9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 3 deletions

View file

@ -196,7 +196,16 @@ namespace ARMeilleure.Translation.PTC
{ {
int hashSize = md5.HashSize / 8; int hashSize = md5.HashSize / 8;
try
{
deflateStream.CopyTo(stream); deflateStream.CopyTo(stream);
}
catch
{
InvalidateCompressedStream(compressedStream);
return false;
}
stream.Seek(0L, SeekOrigin.Begin); stream.Seek(0L, SeekOrigin.Begin);

View file

@ -120,7 +120,16 @@ namespace ARMeilleure.Translation.PTC
{ {
int hashSize = md5.HashSize / 8; int hashSize = md5.HashSize / 8;
try
{
deflateStream.CopyTo(stream); deflateStream.CopyTo(stream);
}
catch
{
InvalidateCompressedStream(compressedStream);
return false;
}
stream.Seek(0L, SeekOrigin.Begin); stream.Seek(0L, SeekOrigin.Begin);