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?

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?

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.
My Xonstats Profile
Latest track on soundcloud: Farewell - to a better Place (piano improvisation)
New to Xonotic? Check out the Newbie Corner!


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


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Info] Fedora / Redhat / CentOS -- FirewallD and SystemD Service Files for dedicated TimelesslyPrecise 3 2,744 06-04-2020, 09:36 PM
Last Post: BuddyFriendGuy
Heart Paid work to help demo an integration into Xonotic stuart 9 6,344 02-04-2020, 09:23 AM
Last Post: stuart
Thumbs Up I would like to work with Xonotic spcdrgn 2 3,525 03-16-2016, 10:57 AM
Last Post: spcdrgn
  missing shader files BuddyFriendGuy 0 2,693 07-05-2015, 07:19 PM
Last Post: BuddyFriendGuy
  [SOLVED] Orienting weapons to bones (CSQC) toneddu2000 3 6,737 03-30-2015, 04:26 PM
Last Post: toneddu2000
  Xonotic gfx work dca 8 7,551 01-27-2014, 10:55 AM
Last Post: poVoq
Brick Weapons defined in text files / de-harding weapons [feature debate] MirceaKitsune 41 44,610 10-10-2012, 03:59 PM
Last Post: hutty
  What role does the Hagar have in Duel? Loafers 34 31,505 06-01-2012, 04:56 PM
Last Post: hutty
Question media source files of vehicles? poVoq 13 10,546 02-21-2012, 06:16 PM
Last Post: tZork
  [SOLVED] Compiling from GIT fails: darkplaces unfa 10 15,387 06-20-2011, 07:58 AM
Last Post: unicornsteak

Forum Jump:

Users browsing this thread:
1 Guest(s)

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