Skip to content

Commit

Permalink
Fixed RLE compression producing empty subfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
bbepis committed Apr 27, 2016
1 parent 5f4818e commit 1b0e6e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions SB3UtilityPP/ppHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ public override void WriteRLEHeader(Stream stream, List<Tuple<IWriteFile, uint,
int index = data.IndexOf(data.GetRange(0, i)
.First(x => x.Item2 == hash));

size = data[index].Item3;

currentOffset = offsets[index];
}

Expand Down
14 changes: 8 additions & 6 deletions SB3UtilityPP/ppParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,20 @@ void writeArchiveWorker_DoWork(object sender, DoWorkEventArgs e)

if (Hashes.Any(x => x.Item2 == hash))
{
meta = Hashes.First(x => x.Item2 == hash).Item4;
var first = Hashes.First(x => x.Item2 == hash);

Hashes.Add(new Tuple<IWriteFile, uint, uint, object>(
Subfiles[i], hash, first.Item3, first.Item4));
}
else
{
mem.WriteTo(stream);
metadata[i] = meta = Format.FinishWriteTo(stream);
}

long ppos = writer.BaseStream.Position;
long ppos = writer.BaseStream.Position;

Hashes.Add(new Tuple<IWriteFile, uint, uint, object>(
Subfiles[i], hash, (uint)(ppos - offset), meta));
Hashes.Add(new Tuple<IWriteFile, uint, uint, object>(
Subfiles[i], hash, (uint)(ppos - offset), meta));
}
}
}
else
Expand Down

0 comments on commit 1b0e6e2

Please sign in to comment.