chrome-pak-customizer
chrome-pak-customizer copied to clipboard
Brotli support?
A while back, Chromium started using Brotli compression on textual resources. It doesn't look like the unpacker handles that?
If I strip 8 bytes off the front of the file extracted from unpack.bat, I can then use brotli.exe
to uncompress the resource.
References: https://github.com/chromium/chromium/blob/c4d3c31083a2e1481253ff2d24298a1dfe19c754/tools/grit/grit/node/base.py#L657 https://github.com/chromium/chromium/blob/c4d3c31083a2e1481253ff2d24298a1dfe19c754/ui/base/resource/resource_bundle.h#L58 https://datatracker.ietf.org/doc/html/rfc7932#page-31
Format of brotli compressed resource: 2 bytes header: {0x1e, 0x9b} 6 bytes decompressed size: truncated to 6 bytes, little-endian. compressed brotli stream
For unpacking we can detect the header bytes and truncate header and decompressed size from output, ~~but for packing we have to parse the brotli stream, iterating all meta blocks, and restore the decompressed size, which takes time to implement.~~
Update: seems impossible to get uncompressed size without decompression https://github.com/google/brotli/issues/861
Maybe we can make a chromium-specific brotli compression tool for this chromium-specific brotli compression format.
See experimental work at https://github.com/myfreeer/chrome-pak-customizer/tree/3.x