Skip to content

Normalize entry paths like the engine, add editing, nested reading and Verify - #41

Merged
xPaw merged 7 commits into
ValveResourceFormat:masterfrom
w1tcherrr:vrf-vpk-editing
Oct 21, 2026
Merged

xPaw merged 7 commits into
ValveResourceFormat:masterfrom
w1tcherrr:vrf-vpk-editing

Conversation

@w1tcherrr

@w1tcherrr w1tcherrr commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor
  • Paths are normalized the way the engine does it: \ and / are separators, empty and . segments are dropped, x/.. is resolved, ASCII letters are lowercased and the type is split at the last dot. FindEntry normalizes the same way. Adding refuses paths that can't hold a file: a trailing separator, .. above the root, an empty name or one ending in a dot, and names over the tree's length limits (NormalizeEntryPath, NormalizeDirectoryPath, public ParseEntryPath, PathComparer).
  • New RenameDirectory, RemoveDirectory and RequiresRepack. Like AddFile and RenameFile, they don't check for duplicates.
  • Repacking a package without chunk files into a _dir.vpk moves its data into chunk files.
  • Zero-length entries are written at the data offset like Valve's packer does.
  • New FilePath, HasChunkFiles, chunk file paths, EnumerateEntries, EntryCount, size limit constants and OpenArchiveStream.
  • Open and OpenPackage read a package inside another package in place, at any depth.
  • Verify checks the signature, the checksums, the chunk hashes, and the CRCs of entries no hash covers.
  • Unchanged from before: leftover chunk files are deleted when writing a new package.

@w1tcherrr w1tcherrr changed the title Make ParseEntryPath public and delete stale chunk files Normalize entry paths like the engine, add editing, nested reading and Verify Oct 19, 2026
… entries by their normalized names and refuse names that can not be stored
…a of a package without chunk files into chunk files when it is repacked into a _dir.vpk, and write zero-length entries at the data offset
… EnumerateEntries, EntryCount, size limit constants and OpenArchiveStream
…ksum mismatches when the package has a signature header
…into TryParseEntryPath, remove EntryCount and EnumerateEntries, report Verify steps with their count, find entries without allocating, reject null characters, unpaired surrogates and names ending in a dot without an extension, and hash chunk files that have no hashes when writing
@xPaw
xPaw merged commit 5217689 into ValveResourceFormat:master Oct 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants