Skip to content

Backport SRB2 2.2's PK3 loader code fixes

X.organic requested to merge X.organic/Kart-Public:futurepk3 into next

This branch contains SRB2 2.2's PK3 loading code, backported to SRB2Kart. Also provides long name lookup functions based on those of SRB2 2.2, kept reasonably close to 2.2.9 to minimize merge conflicts should DRRR pull from Kart v1.4. The primary effects of this branch are as follows:

  1. The use of SRB2 2.2's ResGetLumpsZip adds proper handling of PK3s with comments and extra fields.
  2. PK3 handling code no longer expects the presence of trailing directory entries (as created by SLADE), though it still handles them.
  3. The W_VerifyFile function is extended to support PK3s, allowing them to be marked "unimportant", i.e. loadable clientside without being present on the server – as was already possible with WADs, especially for music replacement.

Points 1 and 2 together allow PK3s created with basically any .zip archiver, including 7z, bsdtar and Info-ZIP – so long as the file doesn't use features above the baseline, such as encryption or compression methods other than Deflate (i.e. the "lowest common denominator" – Windows's file explorer supports about this much), and the folder structure and file order are valid for a PK3 – to be loaded. It's worth noting that some PK3s for SRB2 are already produced this way, for example MRCE is packaged using 7-Zip's command line interface. This introduces a netgame incompatibility for servers – if a server uses a PK3 that only loads properly with this patch, clients without this patch will most likely crash and burn when joining.

Point 3 allows music PK3s to be loaded the same way as music WADs. This introduces a further, minor netgame incompatibility – if a server without this patch loads a PK3 that falls into this category, attempting to rejoin that server from a client with this patch will fail with a "you have the wrong addons loaded" message.

However, an otherwise netgame-compatible build with this patch works just fine connecting as a client to pure 1.3 servers, with the minor caveat mentioned in point 3.

Edited by X.organic

Merge request reports

Loading