VOGONS

Common searches


First post, by PlaneVuki

User metadata
Rank Member
Rank
Member

Hi!

I have a pk4 file from an id software game, which is essentially a zip file.

I want to extract files and compress them to rar or 7z, because they achieve much better compression.

But when I want to play the game, I want to re-pack those files back to zip/pk4 with same hash as original, otherwise the game complains about corrupted pk4.

How can this be achieved?

Note: Applying rar/7z directly to the pk4 file doesn't work, that gets only 99% ratio.
Note: I also tried keeping original pk4 file with all files deleted except one, and re-adding those files back, resulting in different hash still.

Last edited by PlaneVuki on 2022-12-14, 05:57. Edited 1 time in total.

Reply 1 of 4, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

you cannot get the same hash.
(or rather it is very hard to get the same hash https://stackoverflow.com/questions/11603615/ … ifferent-hashes)

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 2 of 4, by leileilol

User metadata
Rank l33t++
Rank
l33t++

The engines don't do RAR or 7ZIP formats, and they've already shipped with the best zip compression they can. If your grand plan is to make them solid compressed, then that's not going to have much benefit other than extremely long load times (had it supported RAR or 7Z).

apsosig.png
long live PCem

Reply 3 of 4, by PlaneVuki

User metadata
Rank Member
Rank
Member

The problem is I already searched internet and found tools that pack to the same hash, as long as contents of files are not changed.

But in this case I don't just want same hash, I want the original hash.

The file is from etqw demo, pak000.pk4. Maybe it somehow possible to make the engine not check hash, or some other trick?

Perhaps you guys know a method to compress the pk4 itself?

Pak000.pk4 is 132mb, I need it to be 98mb at most, for storage.

7z/rar can compress the un-packed files to 94mb. But they can't compress the pk4 file directly.

Another file I tried to compress instead was the megatexture, which also can't be compressed, though I don't know much about it, perhaps it is already highly compressed.