State
PBO entry compression and += in a non-binarized config.cpp.
I pack my mods with my own PBO packer and fully control the header format: offsets, packing method, original and packed sizes. After today's update I found two problems.
1. Array += behaves differently in config.cpp and config.bin
Mod config example:
class CfgVehicles
{
class Inventory_Base;
class Edible_Base: Inventory_Base
{
inventorySlot[] += {"DirectCookingD", "SmokingE"};
};
class PigSteakMeat: Edible_Base
{
inventorySlot[] += {"DirectCookingE", "SmokingF"};
};
};Config binarized to config.bin: PigSteakMeat.inventorySlot = the vanilla slots (Ingredient, DirectCookingA–C, SmokingA–D, Trap_Bait_2) plus ours. Correct.
Plain-text config.cpp in the PBO: the vanilla slots are lost. Only our values from Edible_Base and PigSteakMeat remain, some of them twice.
It looks like the text parser resolves += immediately, against the class and its ancestors inside the same file. If it finds an array there (here, the += on Edible_Base), it copies those values and clears the append flag. The result is a plain assignment that overwrites the vanilla value. The binary loader keeps the append flag (entry type 5) and appends to the vanilla array correctly. Expected: += behaves the same in both formats.
2. If a PBO contains compressed entries, its uncompressed entries are read incorrectly
The mod contains .c, .layout, .xml, .imageset, .edds/.paa and config.bin. The PBO header is valid: every entry has the correct offset, packing method (Cprs), original and data size; the sum of the data sizes matches the file size; and every uncompressed entry holds the correct bytes at its offset. Results:
Nothing compressed: everything works.
.c and .layout compressed, everything else stored: scripts and layouts load. The stored files fail: [Inputs] Cannot read inputs default ".../data/inputs.xml", parser error and ImageWidget::LoadImageFile can't load 'set:... image:...' (imagesets from this PBO).
Only .c compressed: the stored layout fails: Cannot load layout '.../loading.layout', followed by NULL widgets and a client crash.
Only .layout compressed: the stored .c files are read wrongly: Unknown type ..., Can't compile "GameLib" script module! on both client and server.
config.bin compressed: the config itself is read correctly, but the imagesets and other stored files in the same PBO stop loading.
Conclusion: compressed entries are read correctly, but stored entries break as soon as the PBO contains at least one compressed entry. Stored data seems to be read through the shared PBO buffer (FileBufferDecrypting) while compressed data uses its own stream, and the first path fails when entries are mixed. Expected: mixing compressed and stored entries in one PBO works.
-
Activity
Addendum: a PBO with every entry compressed works
I tested one more variant: every file in the PBO compressed with LZSS (Cprs), with no exceptions: .c, .layout, .xml, .imageset, .edds, .paa, config.bin and the rest. Such a PBO loads without errors: scripts compile, and layouts, imagesets, inputs.xml and the config are all read correctly.
This confirms the conclusion of my first report. Compressed entries are read correctly; the stored entries break as soon as the same PBO contains at least one compressed entry. So right now a PBO has to be either fully stored or fully compressed.
But compressing everything is wasteful:
- .edds, .paa, .ogg and other already-compressed formats do not shrink with LZSS and sometimes grow slightly. I had to force-compress them only so that no stored entries were left in the PBO.
- Every compressed entry is fully unpacked into memory when it is opened. For large textures that means extra load time and memory, and partial reads (mip streaming) become impossible.
Expected behavior: a single PBO can mix compressed and stored entries. The packer compresses only what benefits from it (scripts, layouts, configs, text files) and keeps binary assets stored as they are. That is how DayZ worked before. Please check how stored entries are read in a PBO that also contains Cprs entries.
You are not signed in. Please sign in to see more details and to reply.
State