ws-game: archive/vpk (Valve VPK v1 / v2 read incl. multi-part via opts.resolve / opts.files, preload, CRC checks; single-file v1 / v2 write with MD5 section)
This commit is contained in:
1 parent
5ec3121f65
commit
34d0600109
6 files changed
+611
No files matched your search
@@ -0,0 +1,20 @@
|
||||
-- tools/fixtures/_vpk_encode.luau: run by tools/fixtures/vpk.py under the luau CLI: writes the files of
|
||||
-- tests/gen/vpk_src as VPK version 1 and 2 with our encoder and prints "<name>\t<hex>" lines for Python's vpk
|
||||
-- package to read back (and verify the version 2 MD5s).
|
||||
local Vpk = require("@formats/archive/vpk")
|
||||
local Src = require("@tests/gen/vpk_src")
|
||||
|
||||
local function hex(b: buffer): string
|
||||
local s = buffer.tostring(b)
|
||||
return (string.gsub(s, ".", function(c: string): string
|
||||
return string.format("%02x", string.byte(c))
|
||||
end))
|
||||
end
|
||||
|
||||
for _, version in { 1, 2 } do
|
||||
local a = Vpk.new(version)
|
||||
for _, f in Src do
|
||||
a:add(f.name, f.data)
|
||||
end
|
||||
print("v" .. version .. "\t" .. hex(a:write() :: buffer))
|
||||
end
|
||||
Reference in new issue
Block a user