Surviving Mars

Surviving Mars

Not enough ratings
Extract HPK files
By ChoGGi
How to extract files from HPK files
   
Award
Favorite
Favorited
Unfavorite
How to
Get a copy of hpk.exe from https://github.com/nickelc/hpk/releases
(if you're uncertain of which file: x86_64-pc-windows-msvc.zip)

Put this in a batch file (make a new .txt file and rename it to extract.bat)
for %%g in (*.hpk) do mkdir "%%~ng" for %%g in (*.hpk) do hpk.exe extract "%%g" "%%~ng" @echo All Done! pause


Copy hpk.exe, somefile.hpk, and extract.bat to the same location.


Run extract.bat.


Google what you don't know.
https://www.makeuseof.com/tag/write-simple-batch-bat-file/

To create hpk archives use: hpk.exe create FolderContainingFiles ModContent.hpk
Misc
If you're wondering why your image editor/exporter doesn't work with DDS files from Armstrong update (quote from dev):
For the UI images shipped with the game we switched to BC7 compression format, which we store in DDS files. We use Intel's ispc_texcomp conversion library (on GitHub).
Because BC7 works on 4x4 blocks of pixels, and thus requires image dimensions to be multiples of 4; we internally pad the images to 4x4, but still store the "real" dimensions in the header, because we need the exact original size to do UI layout. This probably makes them look corrupted to some tools.

You can directly edit them in Paint*NET[getpaint.net]

Or you can use Texconv[github.com] to convert them for other programs:
texconv.exe *.dds -ft tga
(or png)
To convert images to the dds format used by the game:
texconv.exe *.tga -ft dds -f BC7_UNORM

To get a copy of texconv.exe: look for releases with 5 assets
https://github.com/microsoft/DirectXTex/releases

Chef Niko:
Script to convert dds to png using texconv. Place texconv in c:\ and run the script from the root of the directories with dds files in them.
forfiles /s /m *.dds /C "CMD /c c:\texconv.exe @path -ft png"


You can use my ECM mod to extract mods (Menu>Help>Extract Mods).


If you're extracting lua files to decompile them; then add --fix-lua-files to help out unluac (more help[github.com]).
64 Comments
ChoGGi  [author] 15 Apr @ 6:15pm 
I haven't done anything with JA3 in a good year or two, so maybe they changed hpk file structure or something nothing I can do about that :)
ChoGGi  [author] 15 Apr @ 6:14pm 
I would open a cmd prompt and manually try extracting an hpk file so you can see the error msg?

hpk.exe extract input.hpk output.hpk
M E G A D E T H 14 Mar @ 10:29am 
followed the 'how to', and it worked. extracted Surviving Mars "Quantum Sonics" Radio Station. thanks!!
ChoGGi  [author] 12 Feb @ 6:13pm 
This is to extract them, you shouldn't be creating them, as that probably means you're replacing the game files instead of modding something.
ZaiPsy 12 Feb @ 5:57pm 
Thanks for the article!
PLEASE add clarification:

To create an HPK archive:
Put all the necessary files in one Folder.
Put this Folder and the hpk.exe file in the same location.
Create create.bat file in this location:

hpk.exe create "FolderContainingFiles" ModContent.hpk
@echo All Done!
pause

Replace FolderContainingFiles with the name of your folder with files.
ChoGGi  [author] 24 Sep, 2024 @ 9:16pm 
Sorry if I wasn't clear, but don't repack them. That'll be a lot of work, look into making it into a mod instead.
Một Thời Để Nhớ 26 Aug, 2024 @ 11:04pm 
I used the command Don't-Compress-Files to repack a new hpk and copy it in. But when I entered the game, it was still in English, nothing changed and no error message. I don't know which step I did wrong?
ChoGGi  [author] 26 Aug, 2024 @ 4:31pm 
Check your log file, if there's no errors than you probably aren't loading it.

and repacking a game hpk means you'll need to redo it every time the game updates.
Một Thời Để Nhớ 26 Aug, 2024 @ 1:14am 
@SupremeMaster Hello! Have you successfully translated jagged alliance 3? I have unpacked to translate the .csv file and successfully repacked it into an hpk file. But the game was not successfully localized. Please help me.
ChoGGi  [author] 8 Oct, 2023 @ 8:06pm 
I really should get around to playing it...

and maybe some modding ;)