Fix RemapStream bug

This commit is contained in:
Alex Barney 2018-07-21 22:25:55 -05:00
parent 83323b58c3
commit 2f00192cc7

View file

@ -53,14 +53,14 @@ namespace libhac.Savefile
if (remaining < count) count = (int)remaining;
var toOutput = count;
int pos = 0;
int outPos = offset;
while (toOutput > 0)
{
var remainInEntry = CurrentEntry.VirtualOffsetEnd - Position;
int toRead = (int)Math.Min(toOutput, remainInEntry);
BaseStream.Read(buffer, pos, toRead);
pos += toRead;
BaseStream.Read(buffer, outPos, toRead);
outPos += toRead;
toOutput -= toRead;
Position += toRead;
}