Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
turtle-insect committed Nov 17, 2024
1 parent 9d46a11 commit eee986a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions LINKDATA/ViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -396,22 +396,19 @@ private void PackIDXzrc(object? param)
Array.Copy(Buffer, PackSplitSize * pack, tmp, 0, tmp.Length);
tmp = Comp(tmp);

int index = 0;
int size = tmp.Length;

// rewrite chunk size
ms.Seek(0x0C + pack * 4, SeekOrigin.Begin);
ms.Write(BitConverter.GetBytes(size + 4), 0, 4);
ms.Write(BitConverter.GetBytes(tmp.Length + 4), 0, 4);
// chunk data
// size & bytes
ms.Seek(0, SeekOrigin.End);
ms.Write(BitConverter.GetBytes(size), 0, 4);
ms.Write(BitConverter.GetBytes(tmp.Length), 0, 4);
ms.Write(tmp, 0, tmp.Length);

// padding.
count = 0x80 - ((int)ms.Length % 0x80);
if (count == 0x80) count = 0;
for (index = 0; index < count; index++)
for (int index = 0; index < count; index++)
{
ms.WriteByte(0);
}
Expand Down

0 comments on commit eee986a

Please sign in to comment.