Heart of Darkness PAF decompiling

Programming related discussions related to game research
thesir
Posts: 3
Joined: Mon Jan 01, 2018 1:43 am

Heart of Darkness PAF decompiling

Post by thesir »

Hi guys, I have been trying to pull files from HoD's paf file using the decoder attached with my post
Source files found here:
http://cyxdown.free.fr/pafdec/

Thing is though I have been unable to get the program to work correctly. The program would either result in the error "Unable to read .PAF file header" or would simply crash upon decoding the first of the 4095 files. I have swapped various versions of libpng3.dll and zlib1.dll and tried various versions of HoD but have had little success.

Anyone know how to get the decoder working or have the extracted files on hand? Any help would be very much appreciated.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Heart of Darkness PAF decompiling

Post by aluigi »

The code of ReadPafHeader() is very simple, it just reads a static signature in the file so I guess your files are different.
Upload your paf archive.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Heart of Darkness PAF decompiling

Post by aluigi »

I have attached the paf_decoder.exe created with gcc, just in case:
g++ -s -O2 -o paf_decoder.exe *.cpp -lpng -lz -static
thesir
Posts: 3
Joined: Mon Jan 01, 2018 1:43 am

Re: Heart of Darkness PAF decompiling

Post by thesir »

Thanks for the quick reply. I don't think its my files causing the error as I am using a copy of the file pulled straight from the disc and its last modification date is 1998.

Oddly enough, I tested the compiler you provided with the demo and full game version paf files, the demo paf is able to be decoded while the full game version is not.

I'm not sure if this information helps but I checked both files with a hex editor and found that the demo header signature starts at the first line while the full game's signature comes after a few lines. The signature that the program looks for is "Packed Animation File V1.0 (c) 1992-96 Amazing Studio".

Link to the full game paf file below (It's 400mb):
https://mega.nz/#!IvhnTYAR!0KRJnn2Fyac- ... lKCEdz_Bmk
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Heart of Darkness PAF decompiling

Post by aluigi »

Use this script to dump all the paf files from that hod.paf container:
http://aluigi.org/bms/hod_paf_splitter.bms
finsterhund
Posts: 3
Joined: Mon Jan 01, 2018 6:53 pm

Re: Heart of Darkness PAF decompiling

Post by finsterhund »

aluigi wrote:Use this script to dump all the paf files from that hod.paf container:
http://aluigi.org/bms/hod_paf_splitter.bms

Sorry I'm not the original requester but I'm so thankful to you for making this. Wonderful way to start the year off.
I don't think the PAF decoder has ever worked (at least on Windows) as I've been trying to use it without success for years now.

I'm having issues with that script though. Not sure if it's a problem on my end, but for certain PAF files like for the demos I'm getting an "Error: impossible to write 0xffc0df38 bytes (total 0xffx0df38) Check your disk space
Last script line before the error or that produced the error: 55 log NAME OFFSET SIZE"
It would seem I don't have enough disk space, except I have it in spades. But your version of paf_decoder.exe does seem to handle them, I'm just getting an error and it's not getting all of them. Like it thinks it ran out of disc space and only gets three PAFs from the demo version.

It does rip the individual PAF files out of the container for the full game just fine from what I can tell though, however the version of the PAF decoder you created with gcc doesn't like these PAF files and gives me this error, sometimes with a garbage 1kb WAV file that doesn't work. For certain paf files it manages to produce two or three frames that are all black before "terminating in an unusual way." Other files it will have varying degrees of success. It doesn't like the PAFs of any full version of the game I've put it through, but it will actually successfully get PNGs and audio from the demo files after I've gotten some (but not all for whatever reason) of them separate using your paf splitter, but like I said, the frames and audio aren't complete.
Still, it's better than the PAF decoder has ever worked before and I'll be messing around a lot with it now.

Any help would be very much appreciated.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Heart of Darkness PAF decompiling

Post by aluigi »

I have just updated the script to avoid the "impossible to write 0xffc0df38 bytes" error with hod_demo.paf.
The problem was caused by some zero offsets in the list at the beginning of the paf container.

Regarding paf_decoder, unfortunately I can't help with that since it's not my stuff and I don't know if someone knows about this format or if the original author of the tool can work on it again.
finsterhund
Posts: 3
Joined: Mon Jan 01, 2018 6:53 pm

Re: Heart of Darkness PAF decompiling

Post by finsterhund »

aluigi wrote:I have just updated the script to avoid the "impossible to write 0xffc0df38 bytes" error with hod_demo.paf.
The problem was caused by some zero offsets in the list at the beginning of the paf container.

Regarding paf_decoder, unfortunately I can't help with that since it's not my stuff and I don't know if someone knows about this format or if the original author of the tool can work on it again.

Thank you. It's working a lot better with the demo PAF files now. Still no real progress with the ones from the full versions for me though. I'm interested to see how well thesir has gotten it to work on their end.

I have every official PC release on hand and I've had pretty much the same problem with every single one. I'm not sure if it might be because my particular ISOs have bad files on them resulting from faulty rips, but the cutscenes play when running the game just fine so I largely suspect the issue is with the PAF decoder itself.
The most noticeable problem I can find when the decoder does work with the demo PAF files is that there seems to be graphical problems when there's a large patch of solid black color in the frame for example:
Image
I agree with you, and think that I should look into contacting the creator of the decoder, and planned to a year or so ago but the decoder was actually not online when I wanted to, and I assumed he didn't want to work on it anymore but recently I discovered him active online and it's available on his site again. Cyxx is active on his Github and twitter, so I'll probably try talking provided he's not busy.

I'd also be interested in how and what for thesir wanted these extracted files, as over 2017 I've come up with a temporary solution I've been using myself that while considerably more tedious and taxing is still able to obtain the cinematics frame by frame if that was what was wanted.
thesir
Posts: 3
Joined: Mon Jan 01, 2018 1:43 am

Re: Heart of Darkness PAF decompiling

Post by thesir »

Cheers for that aluigi! The script works and is able to pull the 50 smaller PAF files for use with the decompiler. It seems that Cyxx's decompiler was supposed to be for those files rather than the PAF containing them which might explain why it never worked (That or he had a version without an offset before the header).

The only bugs I have seen crop up with the decoder is the yellow corruption specks, as mentioned by finsterhund, which I assume is caused by the decoder attempting to read extremely dark colours given that is it only appears to happen to certain blackened areas but that is a small issue as it only happened a few times and appears in a few select frames. The other odd bug is with the wav files which consists of the decoder producing a 50 minute file from a 3 minute clip with the other 47 minutes afterwards being corrupted nothingness however this can be worked around by putting the file in Audacity and exporting it again to restore the proper time duration.

I'll upload both the extracted PAF and dumped png/wav files here in case anyone wants them (900mb):
https://mega.nz/#!VvwVWRiK!kjODmZKPMReC ... go8yxPxRwQ
Note: The extracted HoD files related to the main menu have zero byte wav files. This is due to the sound and music being layered over the FMV and not actually being part of it.
finsterhund
Posts: 3
Joined: Mon Jan 01, 2018 6:53 pm

Re: Heart of Darkness PAF decompiling

Post by finsterhund »

thesir wrote:Cheers for that aluigi! The script works and is able to pull the 50 smaller PAF files for use with the decompiler. It seems that Cyxx's decompiler was supposed to be for those files rather than the PAF containing them which might explain why it never worked (That or he had a version without an offset before the header).

The only bugs I have seen crop up with the decoder is the yellow corruption specks, as mentioned by finsterhund, which I assume is caused by the decoder attempting to read extremely dark colours given that is it only appears to happen to certain blackened areas but that is a small issue as it only happened a few times and appears in a few select frames. The other odd bug is with the wav files which consists of the decoder producing a 50 minute file from a 3 minute clip with the other 47 minutes afterwards being corrupted nothingness however this can be worked around by putting the file in Audacity and exporting it again to restore the proper time duration.

I'll upload both the extracted PAF and dumped png/wav files here in case anyone wants them (900mb):
https://mega.nz/#!VvwVWRiK!kjODmZKPMReC ... go8yxPxRwQ
Note: The extracted HoD files related to the main menu have zero byte wav files. This is due to the sound and music being layered over the FMV and not actually being part of it.


Geez that's a big file. Kinda baffling that every single frame of those cinematics is in there. It feels great to finally have them all ripped though. I'm glad you were able to get it working with a copy of the full game. Thank you for uploading them.

Thank you for the fix with the audio. I noticed the 52 or so minutes in the file when I put it into a player but it didn't have any adverse effects when playing so I didn't really mess with it but it's nice to have a way of making it a more typical file.
I wonder why the full version came out properly for you. Maybe a compatibility issue? The yellow corruption seemed to be in the exact same places in your dumped png files as they did mine. So there isn't a difference with the frames themselves. Maybe the compiler just doesn't like my OS.

Now if only we can get an LVL MST or SSS decompiler hahahaha. ;)
nicecat
Posts: 1
Joined: Sun Dec 11, 2022 7:51 pm

Re: Heart of Darkness PAF decompiling

Post by nicecat »

Hi, I would like to refresh this fascinating topic or I will make new one if needed.
I am looking for a way to extract Heart of Darkness game sounds.
I'm a sound designer and this game was one of my career inspirations, it would be great to be able to play/listen to all sounds from the game
(sound effects and dialogue and music cues) (sound effects are most important to me). If possible in original non degraded quality.

p.s. I don't know what was included in that 900MB Mega.nz folder as is not avalaible online anymore..

I don't have IT background just guessing that sounds probably are hidden in HOD.paf file.
I was hoping that this is some sort of compression method used by some game software so there is tool to uncompress it and extract or decompile these files but it looks like it's a lot more complicated..
If anyone could help with it or point me to right direction..