Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] How does the decompression of files within pk3s work?

#1
So I'm trying to read the darkplaces/fs.c code but it's sort of hard to understand. The big thing that I don't get is where decompression happens. Does it happen all at once for each pk3, and then the decompressed pk3 is stored in RAM/virtual memory, or does decompression happen as-needed for each requested file? I suspect it's the latter. However what I don't get is where this happens, unless inflateInit2 decompresses files (but the zlib manual says it doesn't). You'd expect that fs.c would work in such a way such that when an already-decompressed file is requested, the address to its location in RAM would be provided, and if the file requested isn't already decompressed, then fs.c would decompress it and return its address. I don't see where this is going on. In fact, there's only one place in the Darkplaces engine where an actual inflate() call is made, and the function that contains it is only called once in cl_parse.c for decompressing files downloaded from a server. So can someone explain how fs.c handles decompressing files within pak3 files?
Reply

#2
Welcome to Xonotic! May I recommend to you: Xonotic development IRC channel #xonotic on freenode. I am sure that this channel would be a valuable medium for information exchange for you. You will probably receive an answer on this forum, too, but this sounds just like a question someone like divVerent would be able to answer to you within minutes via IRC (no warranty tho).

I for one can identify myself only with your first sentence except that I don't try to read the code.

Edit: Just for the avoidance of doubts: I didn't mean to tell you this forum is wrong for asking such specific questions, just wanted to point you to an additional communication channel that might prove effevtive.
[Image: 249.png] Latest track on soundcloud: Farewell - to a better Place (piano improvisation)
New to Xonotic? Check out my Newbie Corner!
<ZeRoQL> i think i got 1 proper quad and that cunt halogen fuck me over with a laser
Reply

#3
It is happening on FS_Read() in fs.c, which calls qz_Inflate, which points to zlib's inflate function.
BRLOGENSHFEGLE (core dumped)

The Bot Orchestra is back! | Xoylent Easter Egg | 5bots1piano
My music on Google Play and SoundCloud
Reply

#4
Thanks!
Reply



Possibly Related Threads...
Thread Author Replies Views Last Post
Thumbs Up I would like to work with Xonotic spcdrgn 2 1,611 03-16-2016, 10:57 AM
Last Post: spcdrgn
  missing shader files BuddyFriendGuy 0 1,316 07-05-2015, 07:19 PM
Last Post: BuddyFriendGuy
  [SOLVED] Orienting weapons to bones (CSQC) toneddu2000 3 4,478 03-30-2015, 04:26 PM
Last Post: toneddu2000
  Xonotic gfx work dca 8 4,432 01-27-2014, 10:55 AM
Last Post: poVoq
Brick Weapons defined in text files / de-harding weapons [feature debate] MirceaKitsune 41 24,775 10-10-2012, 03:59 PM
Last Post: hutty
Question media source files of vehicles? poVoq 13 6,505 02-21-2012, 06:16 PM
Last Post: tZork
  [SOLVED] Compiling from GIT fails: darkplaces unfa 10 10,109 06-20-2011, 07:58 AM
Last Post: unicornsteak
  [solved] 'all' script problems xeros 4 3,391 10-16-2010, 03:37 PM
Last Post: xeros
  [SOLVED] GIT: insufficient permission on ./all update Wii-Wii 4 5,718 06-08-2010, 06:47 PM
Last Post: XV22

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB original theme © iAndrew 2016, remixed by -z-