Dune: Spice Wars (.pak)

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Dune: Spice Wars (.pak)

Post by spiritovod »

Here is script for unpacking pak file from Dune: Spice Wars. It's not valid for re-import because there are checksums for every file (adler32) and also because it has workaround for offsets over 2GB (those fields are actually double in binary64 format).
Update: Checksums are not validated against files, so it's possible to modify package (proof).

Also, files are using extensions of their sources instead of actual ones: png are dds of various types, fbx are hmd, and so on.

=====================================

Script for repacking added. You need to place modified file, script and pak archive in the same folder and run script on modified file - it will be appended to selected archive (can be specified in the script), if original file was there. Make sure to backup original archive and extracted files, as modified archive can't be extracted anymore (you can still add other modified files to it though). You can find example of how the script should be used in this post - also, reimport mode is not required, script is created to be used directly on modified file.
It may be updated in the future, since current script is built with workarounds due to quickbms limitations.

Alternatively you can use native build tool from the engine as explained here, or other standalone tool from here.

Update: Repacking script is updated to handle all files, though currently modified data.cdb should be smaller or equal to original file.
Last edited by spiritovod on Tue May 10, 2022 1:44 pm, edited 13 times in total.
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: Dune: Spice Wars (.pak)

Post by spiritovod »

If anyone wonders, the game is built with Heaps engine and native IDE for it (hide) works more or less fine with basic formats, if they're properly renamed/converted, including animations.
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: Dune: Spice Wars (.pak)

Post by spiritovod »

Script for repacking added to the first post. It has limitations, such as only one file can be packed at once and only archives smaller than 4GB can be processed, but in general it works. Tested on text files.
hrsr
Posts: 14
Joined: Mon Jan 22, 2018 7:30 pm

Re: Dune: Spice Wars (.pak)

Post by hrsr »

thanks for the script, indeed it works for <texts> as in texts.xml file and texts inside that

however upon modifing another file ,either hexedit or with an notepad, an unit cost from 20 man to 19 the game doesnt start , i rekon some/or one? checksums are kicking in?

yes the archive size increases slightly if any text is modified here > texts.xml
or unit hex/text edit in the coresponding file, however the game doesnt start anymore if an modified unit/building file is repacked.

of course restoring the original archive , the game launches ok.
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: Dune: Spice Wars (.pak)

Post by spiritovod »

@hrsr: I've updated the script and added support for all files (previously not all of them could be packed back). As for data.cdb, there are additional checks in hlboot and hlbootdx, but it's covered by the script now - though modified file must be smaller or equal to original file at the moment. For other files there shouldn't be any size limits.
hrsr
Posts: 14
Joined: Mon Jan 22, 2018 7:30 pm

Re: Dune: Spice Wars (.pak)

Post by hrsr »

thank you for your work.
Spid3rCZ
Posts: 1
Joined: Sat Apr 30, 2022 8:38 pm

Re: Dune: Spice Wars (.pak)

Post by Spid3rCZ »

Hi guys, I´ve extracted all files, edited it - but I still can´t put the texts in the game. I run the repack, but it goes blank... :-/
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: Dune: Spice Wars (.pak)

Post by spiritovod »

@Spid3rCZ: Could you provide more info about your problem, like quickbms logs and more detailed explanation of the issue? You need to put modified texts (for example, texts.xml for english or texts_xx.xml for other languages), bms script and pak file in the same folder, use repack script on xml file, then rename result _mod file to original pak name (you can backup or move somewhere original file).

Also, there is other standalone tool for the game in xentax topic, but it seems it can't handle cdb properly yet.
Multicor
Posts: 15
Joined: Fri Mar 04, 2022 3:48 pm

Re: Dune: Spice Wars (.pak)

Post by Multicor »

spiritovod wrote:@Spid3rCZ: Could you provide more info about your problem, like quickbms logs and more detailed explanation of the issue? You need to put modified texts (for example, texts.xml for english or texts_xx.xml for other languages), bms script and pak file in the same folder, use repack script on xml file, then rename result _mod file to original pak name (you can backup or move somewhere original file).

Also, there is other standalone tool for the game in xentax topic, but it seems it can't handle cdb properly yet.



Hi!

Thanks for the script, but the import does not work for me! :( I just try to put back the "texts.xml" file, but I don't understand how to import it back. Could you describe the method step by step please?

I have the xml file, the pak file and the bms file in one folder. I am using the reimport3_localizations.bat file, but I tried the others, but it does not create the new pak_mod file.

(I tried the other toolt that works for the xml, but the .cdb doesn't work there.)
Thank you.
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: Dune: Spice Wars (.pak)

Post by spiritovod »

@Multicor: But it's already explained in my previous post above. You don't need to use reimport mode, script is written to be used directly (like, open quickbms, choose repack script -> choose modified file you want to put back -> choose output folder). In case of data.cdb you need to place hlboot.dat and hlbootdx.dat in same folder as well, it will be written in logs.
Arqwell
Posts: 2
Joined: Tue May 10, 2022 9:06 am

Re: Dune: Spice Wars (.pak)

Post by Arqwell »

Hi, I'm trying to reimport a text.xml file - I'm following the instructions. One directory, select script - select file.pak, choose directory. Whatever I try, it always ends with an error message ... "Selected archive doesn't contain this file". But it contains it, it must contain it! :?:
Folder-files.jpg
Error_message.jpg
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: Dune: Spice Wars (.pak)

Post by spiritovod »

@Arqwell: Please read this post carefully, it was already explained there.
Arqwell
Posts: 2
Joined: Tue May 10, 2022 9:06 am

Re: Dune: Spice Wars (.pak)

Post by Arqwell »

Thanks, I already understood that it is necessary to change the order compared to the normal reimport... :idea:
hrsr
Posts: 14
Joined: Mon Jan 22, 2018 7:30 pm

Re: Dune: Spice Wars (.pak)

Post by hrsr »

Error: impossible to write 0x8f727db8 bytes (total 0x8f727db8)
Check your disk space or the script is wrong

Last script line before the error or that produced the error:
89 log ARCHIVE BASE_OFF TMP2 1

after dune spice wars corino house update