blog: Asset packing with zip.c - add images
This commit is contained in:
@ -10,6 +10,8 @@ have to worry about this too much right now, since I've reimplemented asset pack
|
|||||||
zip library by \`kuba--\` (Polska GUROM!!!111!!). In this article I'd like to demonstrate how I've
|
zip library by \`kuba--\` (Polska GUROM!!!111!!). In this article I'd like to demonstrate how I've
|
||||||
minimised the size of our assets using \`zip\` and \`incbin\`.
|
minimised the size of our assets using \`zip\` and \`incbin\`.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
- zip: https://raw.githubusercontent.com/kuba--/zip/refs/heads/master/src/zip.c
|
- zip: https://raw.githubusercontent.com/kuba--/zip/refs/heads/master/src/zip.c
|
||||||
@ -256,6 +258,10 @@ void init_baked_resources(void)
|
|||||||
which is unpacking an in-memory .zip file. We iterate each entry in the bundle, get the name and size, preallocate
|
which is unpacking an in-memory .zip file. We iterate each entry in the bundle, get the name and size, preallocate
|
||||||
a buffer and read said entry into the buffer. We can then add the resource to the hash table as we did previously.
|
a buffer and read said entry into the buffer. We can then add the resource to the hash table as we did previously.
|
||||||
|
|
||||||
|
## Conclusion
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
One question you may ask is, how much space are we saving? I don't remeber the exact sizes of the binary, but
|
One question you may ask is, how much space are we saving? I don't remeber the exact sizes of the binary, but
|
||||||
I remember that before compression it was \`~1.2M\` and now after compression is implemented, it's \`~1.6M\`. How is
|
I remember that before compression it was \`~1.2M\` and now after compression is implemented, it's \`~1.6M\`. How is
|
||||||
that an improvement if the binary gained weight? That \`~.4M\` is likely due to zip format overhead - metadata, file and
|
that an improvement if the binary gained weight? That \`~.4M\` is likely due to zip format overhead - metadata, file and
|
||||||
|
2
build.c
2
build.c
@ -34,6 +34,8 @@ int main(int argc, char ** argv)
|
|||||||
"./etc/me.jpg", \
|
"./etc/me.jpg", \
|
||||||
"./etc/tmoa-engine.jpg", \
|
"./etc/tmoa-engine.jpg", \
|
||||||
"./etc/tmoa-garbage.jpg", \
|
"./etc/tmoa-garbage.jpg", \
|
||||||
|
"./etc/apwz-zip-icon.png", \
|
||||||
|
"./etc/apwz-xkcd1.png", \
|
||||||
"./blog/blog-welcome.md", \
|
"./blog/blog-welcome.md", \
|
||||||
"./blog/blog-weird-page.md", \
|
"./blog/blog-weird-page.md", \
|
||||||
"./blog/blog-curious-case-of-gebs.md", \
|
"./blog/blog-curious-case-of-gebs.md", \
|
||||||
|
BIN
etc/apwz-xkcd1.png
Normal file
BIN
etc/apwz-xkcd1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
BIN
etc/apwz-zip-icon.png
Normal file
BIN
etc/apwz-zip-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
Reference in New Issue
Block a user