How can I remake a tmp file extracted from a compressed PKF?

(Modding and other series related projects)

How can I remake a tmp file extracted from a compressed PKF?

Postby ReeceKun » Tue Dec 22, 2015 6:01 pm

The Shenmue IPAC Browser is great for repacking PKS files , but for some reason it only shows the CHARA.CHT file in PKF files (PKF files contain the PVR textures)

I want to change the textures on the Capsule Toy Machines in Sakuragaoka (Scene/01/JD00)
It contains HI_GACH and GACH (HI_GACH is the machine that loads when you are interacting with it)
If you extract the HI_GACH.PKF with WINRAR you get another file HI_GACH.PKFirs317418335.tmp
Then you can use the MT5Unpacker program to extract PVRs (It will also convert & flip PNGs)
My guess is that this original compression method is GZIP(msdos not updated since 1993)
I'm not sure its even neccessary to recompress the PKF, but I cant test that till I can get the PVRs & Chara.CHT back into a readable uncompressed PKF.tmp container .

TBH i cant be arsed faffing about spending time on this, if IPAC Browser just displayed PVRs and an Import option I wouldnt be asking, I'm kinda surprised there isnt a program that does it. If you know how let me know x
Last edited by ReeceKun on Wed Dec 23, 2015 10:38 pm, edited 4 times in total.
User avatar
ReeceKun
Man Mo Acolyte
Man Mo Acolyte
 
Joined: November 2009
Location: North Wales (UK)
Favorite title: Shenmue
Currently playing: Skyrim

Re: How can I repack a compressed PKF ?

Postby IlDucci » Wed Dec 23, 2015 3:55 pm

You're right, PKF/PKS that are compressed have GZIP compression, and can be recompressed. I don't know if WinRAR has GZIP support, but 7Zip sure does.

And, in the current state of affairs, I never attempted to make the game load an uncompressed PKS/PKF when it was originally compressed. Always respected if the file was compresssed or uncompressed.
IlDucci
Master of the Three Blades
Master of the Three Blades
 
Joined: February 2012
Location: Spain
Favorite title: Shenmue

Re: How can I repack a compressed PKF ?

Postby ReeceKun » Wed Dec 23, 2015 5:19 pm

IlDucci wrote: You're right, PKF/PKS that are compressed have GZIP compression, and can be recompressed. I don't know if WinRAR has GZIP support, but 7Zip sure does.

And, in the current state of affairs, I never attempted to make the game load an uncompressed PKS/PKF when it was originally compressed. Always respected if the file was compresssed or uncompressed.


EDIT: I understand now the HI_GACH.PKFirs317418335.tmp is an uncompressed container for all the files because gzip will only compress one SINGLE file.(The compressed gzip is 'word 8' ) but now I need to find out how to repack the original pvr and cht files into the correct 'tmp' container format with the header 'PAKF............DUMY' it also ends with a lot of specific organised data, I really think this one just needs an updated IPAC Browser to export and import files in thier specific offset locations
User avatar
ReeceKun
Man Mo Acolyte
Man Mo Acolyte
 
Joined: November 2009
Location: North Wales (UK)
Favorite title: Shenmue
Currently playing: Skyrim

Re: How can I remake a tmp file extracted from a compressed

Postby Giorgio » Thu Dec 24, 2015 11:26 am

I went through the struggles of that during the making of this mod. Obviously, It requires tedious hex-editing. And, if I remember well, it went like this (some steps may not be necessarily justified):

- Open the PKF/PKS file with a hex editor and see if it's compressed.
- If it is, then extract it (I used GZIP, both for decompressing and compressing).
- Use a PVR extractor and converter from PVR to PNG. That was helpful to see the order in which the textures appear in the file.
- Edit the PNG image or make a new one.
- Convert the PNG image to PVR. This step needs special attention. It needs to see the attributes of the relevant original PVR. Attributes like its size, the pixel format, its data type etc. [PVR Graphic Format]
- Open the extracted file of the PKF/PKS with a hex editor. Replace the block of bytes of the relevant original PVR data with the new one created.
- (Re)compress the extracted file of the PKF/PKS to a PKF/PKS file. (However. If I remember well, this is not necessary. And, thus, the extracted file could just be renamed to the prefix of the PKF/PKS it got extracted from. I think Dreamcast decompresses GZIP decompressed files on the fly. Decompressing these files reduces the size of data, but it increases the time of loading.)

Giorgio has received a thanks from: ReeceKun
User avatar
Giorgio
"After Burner...Great!"
"After Burner...Great!"
 
Joined: February 2009
Favorite title: Shenmue
Currently playing: Yakuza series

Re: How can I repack a compressed PKF ?

Postby yanmercal » Thu Mar 03, 2016 3:53 am

IlDucci wrote: You're right, PKF/PKS that are compressed have GZIP compression, and can be recompressed. I don't know if WinRAR has GZIP support, but 7Zip sure does.

And, in the current state of affairs, I never attempted to make the game load an uncompressed PKS/PKF when it was originally compressed. Always respected if the file was compresssed or uncompressed.


LZMA2 is faster for 4-threads, if you compress big file (more than 256 MB), so 7-Zip will be able to split it to blocks.

Mercal
yanmercal
Fuku-san
Fuku-san
 
Joined: March 2016


Return to Community Projects

Who is online

Users browsing this forum: No registered users and 1 guest

Powered by phpBB © 2000-
ShenmueDojo.net