Closed snake-biscuits closed 2 weeks ago
Testing
nexon.PakFile
via CS:O2.bsp
s is failing in a really wierd way
Not a bug, just failed to remember intended behaviour:
bsp_tool
doesn't recompress Valve's LZMA compression when saving to bytes
nexon.PakFile
uses Valve's LZMA compression on file data
The 11 byte difference is the compression savings:
>>> import bsp_tool
>>> bsp = bsp_tool.load_bsp("E:/Mod/CSO2/maps/gb_varena.bsp")
>>> {path: (lf.compressed_size, lf.uncompressed_size) for path, lf in bsp.PAKFILE.local_files.items()}
{'materials/maps/gb_varena/cubemapdefault.vtf': (196, 207),
'materials/maps/gb_varena/c0_0_64.vtf': (0, 4401),
'materials/maps/gb_varena/c-1536_0_64.vtf': (0, 4278),
'materials/maps/gb_varena/c1536_0_64.vtf': (0, 4310),
'materials/maps/gb_varena/cubemapdefault.hdr.vtf': (0, 181),
'materials/maps/gb_varena/c0_0_64.hdr.vtf': (0, 40279),
'materials/maps/gb_varena/c-1536_0_64.hdr.vtf': (0, 39699),
'materials/maps/gb_varena/c1536_0_64.hdr.vtf': (0, 39702)}
>>> 207 - 196
11
nexon uses LZMA compression again inside cubemap
.vtf
s, in chunks https://github.com/snake-biscuits/bsp_tool_examples/blob/master/nexon/cso2_cubemaps.py which is likely why the larger files haven't been compressed again
This is why we need extensions.diff
, to confirm data is a valid copy when bytes don't match
Flagging uncompressed data is a good idea though, so we know why it's different
Taken from notes in #194
TODO list
tests.archives.nexon.test_PakFile
deflate
testtests.branches.nexon.cso2
testbsp.PAKFILE.as_bytes()
on real.bsp
sInitial Thoughts
nexon.PakFile.as_bytes()
is really important to test, since it's required forNexonBsp.save_as()
We need some specificSpecialLumpClass
tests for this But afaik no public source tool for making these PakFiles existsWhich means the only real-world examples of the format we're going to find are inside maps Tho we can test
.from_bytes()
like we do forpkware.Zip
...ArchiveClasses don't have to have
.as_bytes()
methods Except forpkware.Zip
&nexon.PakFile
, since they both get used asSpecialLumpClasses
But we should keep links etc. for external tools used with each format in
docs/
Something to add to the DBAfter https://github.com/snake-biscuits/bsp_tool/commit/7ba0efbee56d8965b00b78a5f2b0f24362ae4ac1
Testing
nexon.PakFile
via CS:O2.bsp
s is failing in a really wierd wayReally need to be testing this w/ a handmade
deflate
for.from_bytes()
And as aSpecialLumpClass
, though that requires local test maps:39
38
Or grabbing MegaTest files for
tests.branches.nexon.cso2
:195