Skip to content

Commit cf006e2

Browse files
committed
Merge branch 'dev/v3.17.9.x' into dev/v3.17.x.x
2 parents d2dd433 + c62515d commit cf006e2

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

Assets/PatchKit Patcher/Scripts/AppData/Remote/Downloaders/ChunkedFileStream.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,18 @@ public void Write([NotNull] byte[] buffer, int offset, int count)
188188

189189
if (ChunkFullyInBuffer())
190190
{
191-
if (BufferedChunkValid())
191+
byte[] bufferHash = _hashFunction(_buffer, 0, (int) Math.Min(_chunksData.ChunkSize, RemainingLength));
192+
byte[] chunkHash = _chunksData.Chunks[_chunkIndex + _startChunk].Hash;
193+
194+
if (BufferedChunkValid(bufferHash, chunkHash))
192195
{
193196
FlushBuffer();
194197
}
195198
else
196199
{
197200
DiscardBuffer();
198-
throw new InvalidChunkDataException("Invalid chunk data.");
201+
throw new InvalidChunkDataException("Invalid chunk data. Expected " +
202+
BitConverter.ToString(chunkHash) + ", got " + BitConverter.ToString(bufferHash));
199203
}
200204
}
201205
} while (count > 0);
@@ -206,11 +210,8 @@ private bool ChunkFullyInBuffer()
206210
return _bufferPos == Math.Min(_chunksData.ChunkSize, RemainingLength);
207211
}
208212

209-
private bool BufferedChunkValid()
213+
private bool BufferedChunkValid(byte[] bufferHash, byte[] chunkHash)
210214
{
211-
byte[] bufferHash = _hashFunction(_buffer, 0, (int) Math.Min(_chunksData.ChunkSize, RemainingLength));
212-
byte[] chunkHash = _chunksData.Chunks[_chunkIndex + _startChunk].Hash;
213-
214215
return bufferHash.SequenceEqual(chunkHash);
215216
}
216217

Assets/PatchKit Patcher/Scripts/UI/ScreenScale.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ public static float Value
1313
{
1414
float screenScale;
1515
float screenDpi = Screen.dpi;
16-
if (screenDpi >= 400)
16+
if (screenDpi >= 384)
1717
{
1818
screenScale = 4;
1919
}
20-
else if (screenDpi >= 200)
20+
else if (screenDpi >= 192)
2121
{
2222
screenScale = 2;
2323
}

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1111
### Fixed
1212
- Retrying the failed operation from error dialog
1313

14+
## [3.17.9.3]
15+
### Added
16+
- More information about invalid chunk data exception
17+
18+
## [3.17.9.2]
19+
### Changed
20+
- HDPI scale thresholds
21+
22+
## [3.17.9.1]
23+
### Changed
24+
- HDPI scale thresholds
25+
1426
## [3.17.9.0]
1527
### Added
1628
- Support HDPI for debug menu

0 commit comments

Comments
 (0)