kind of hacky but all the test files work now

This commit is contained in:
Michael Becker 2022-03-21 15:31:58 -04:00
parent 3eaf148e31
commit 4f05e15621
No known key found for this signature in database
GPG Key ID: DA394832305DA332

View File

@ -268,7 +268,15 @@ namespace UniversalEditor.Plugins.CRI.DataFormats.FileSystem.CPK
uint decompressedLength = (uint)dtUTFTOC.Records[i].Fields["FileSize"].Value;
uint compressedLength = (uint)dtUTFTOC.Records[i].Fields["ExtractSize"].Value;
ulong offset = (ulong)dtUTFTOC.Records[i].Fields["FileOffset"].Value;
ulong lTocOffset = (ulong)dtUTF.Records[0].Fields["TocOffset"].Value;
ulong lContentOffset = (ulong)dtUTF.Records[0].Fields["ContentOffset"].Value;
// HACK: according to kamikat cpk tools, the real content offset is whichever is smaller TocOffset vs ContentOffset
// https://github.com/kamikat/cpktools/blob/master/cpkunpack.py
// this feels EXTREMELY hacky, but it works... for now
ulong lRealContentOffset = Math.Min(lTocOffset, lContentOffset);
offset += lContentOffset;
File f = fsom.AddFile(fileName);