PDA

View Full Version : Directly edit .pak files.



Dave0910
January 8th, 2019, 22:30
For many of you, I'm sure you've encountered the same frustration I did when working on custom rulesets; that is having to change the .pak file to a .zip, edit the files and the change it back. That gets really trying, really fast. Fortunately, in Windows, that's easy to fix. Friendly warning before you try this, editing registry files can TOTALLY fubar your system if you don't know what you're doing. Make sure, for example, that you don't have other programs that use the file extension .pak.

Anyway, it's a simple registry hack. You just need to make windows recognize .pak files as compressed folders. All you need to do is run CMD as Administrator (Programs->Accessories, the right click command prompt and select Run as Administrator).


reg copy HKEY_CLASSES_ROOT\.zip HKEY_CLASSES_ROOT\.pak /s /f

After this is done, the file will be treated as a normal .zip file, and you can explore or replace files as needed (Remember that you can't edit the files directly unless it's supported by your xml editor. AltovaXML Spy handles this, wonderfully).

Valarian
January 8th, 2019, 22:41
Or you can unzip the .pak file and use a folder instead. Fantasy Grounds will use the unzipped folder, so you can work on the files and then rezip once you've finished development. Just rename the .pak to .zip before you start. This avoids two references to your ruleset in the rulesets folder. Once you're done, rezip from inside the folder (at the base.xml level) and rename the .zip to .pak. Then move the .pak file to the parent rulesets folder, and remove your work folder.

Trenloe
January 8th, 2019, 22:43
Yep, as Valarian says, run your development rulesets in a directory.

Some info on files and locations here: https://www.fantasygrounds.com/wiki/index.php/Data_Files_Overview#Rulesets

LordEntrails
January 8th, 2019, 23:46
Rather than regedit, you can always change file associations through the interface, right mouse, "open with" select your zip program, and check the "Always open with..." box.

damned
January 9th, 2019, 00:29
Unpacking and running from source works for pak/rulesets, ext/extensions, mod/modules too... maybe it works for ppk as well but that is an edge case!

Dave0910
January 9th, 2019, 19:57
Rather than regedit, you can always change file associations through the interface, right mouse, "open with" select your zip program, and check the "Always open with..." box.

Actually, I tried that. Because it isn’t recognized as a compressed folder by default, it goes into ak endless loop tryng to open it a a standard folder. The loop ended 10 minutes later after I manually entered the keys (you can’t copy/paste from within regedit). As soon as the last string was entered, the folder opened.

Dave0910
January 9th, 2019, 20:00
I know. The problem was having to repeatedly change the file extension. When you’re trying to move items around in one of the windows classes, the constant changing gets very tiring. I orefer to have more direct access to the files.
As for the .mod files, I’m not with them, since it’s less trouble to enter the data in FG and export.

superteddy57
January 9th, 2019, 21:39
I just set 7zip as the default program for those extensions and can open and change files from a temporary location. Just copy back the file with the changes. No need to unpack anything.

Talyn
January 9th, 2019, 21:58
7zip will already know it's a .zip file without having to associate it at all. Just right-click -> 7zip -> Open archive.

If you're actively working with rulesets, extensions, or modules, it's always best to work from a folder as has been repeatedly stated above.

JUMBO
April 24th, 2020, 13:34
For many of you, I'm sure you've encountered the same frustration I did when working on custom rulesets; that is having to change the .pak file to a .zip, edit the files and the change it back. That gets really trying, really fast. Fortunately, in Windows, that's easy to fix. Friendly warning before you try this, editing registry files can TOTALLY fubar your system if you don't know what you're doing. Make sure, for example, that you don't have other programs that use the file extension .pak.

Anyway, it's a simple registry hack. You just need to make windows recognize .pak files as compressed folders. All you need to do is run CMD as Administrator (Programs->Accessories, the right click command prompt and select Run as Administrator).



After this is done, the file will be treated as a normal .zip file, and you can explore or replace files as needed (Remember that you can't edit the files directly unless it's supported by your xml editor. AltovaXML Spy handles this, wonderfully).

Hello there, I've done it, but how can I revert it?

Valarian
April 24th, 2020, 15:26
Zip by selecting all files from within the folder. Rename the .zip file to .pak and move the file out to the parent rulesets folder. Move or delete your working folder, so that the .pak is used when you restart Fantasy Grounds.

Dave0910
April 25th, 2020, 11:41
Hello there, I've done it, but how can I revert it?

Run regedit as administrator and erase HKEY_CLASSES_ROOT\.pak

Dave0910
April 30th, 2022, 23:47
I recommend creating a restore point in System Restore before you do this.
Run regedit and open HKEY_CLASSES_ROOT. This contains the default behavior for different file types. Just delete the .pak key.
Alternatively, if you have another .pak file type that runs in a different program, you can just right click any .pak file and set it to open with the correct program.

t3xx3r
May 3rd, 2022, 22:25
For many of you, I'm sure you've encountered the same frustration I did when working on custom rulesets; that is having to change the .pak file to a .zip, edit the files and the change it back. That gets really trying, really fast. Fortunately, in Windows, that's easy to fix. Friendly warning before you try this, editing registry files can TOTALLY fubar your system if you don't know what you're doing. Make sure, for example, that you don't have other programs that use the file extension .pak.

Anyway, it's a simple registry hack. You just need to make windows recognize .pak files as compressed folders. All you need to do is run CMD as Administrator (Programs->Accessories, the right click command prompt and select Run as Administrator).



After this is done, the file will be treated as a normal .zip file, and you can explore or replace files as needed (Remember that you can't edit the files directly unless it's supported by your xml editor. AltovaXML Spy handles this, wonderfully).

It's too risky. I always take the time to copy the .pak file, move it to my desktop, unpack via 7zip and turn it into a folder with all the appropriate files. Once I'm done, all I need to do is archive, and change the .7zip to .pak and then OK it. It's real simple.

Hacking the regedit really can FUBAR your system, which is correct. That's why it's not the best option, even if it's the "quickest" solution.

Trenloe
May 3rd, 2022, 22:31
Don't use 7z compression, or RAR, or anything other than standard ZIP (deflate) compression.

t3xx3r
May 3rd, 2022, 22:36
I've used 7zip without problems. But then again, has anyone had problems with 7zip in the past before?

Trenloe
May 3rd, 2022, 22:40
I've used 7zip without problems. But then again, has anyone had problems with 7zip in the past before?
The native 7Zip (.7z) compression won't work with Fantasy Grounds. You may have used the 7Zip application to compress using standard ZIP compression. FG rulesets (.pak), modules (.mod), extensions (.ext), portrait (.ppk) files only works with ZIP (deflate) compression.

t3xx3r
May 3rd, 2022, 22:44
Thank you. I'll keep that in mind and make sure to use ZIP (deflate) compression.