Hacking RELEASE GFunPAC - A bodged utility to extract files from Pokemon LGPE .gfpac archives

  • Thread starter Thread starter CHEMI6DER
  • Start date Start date
  • Views Views 5,957
  • Replies Replies 8
  • Likes Likes 2

CHEMI6DER

Well-Known Member
Member
Joined
Feb 3, 2016
Messages
105
Reaction score
70
Trophies
0
Location
Houen Chihou
XP
2,385
Country
Russia
This is a small utility bodged together by me from pkNX.
All credit for RE'ing the format and writing the code goes to Kaphotics.

Usage: ./gfunpac <input file name>
Or just drag and drop the .gfpac onto the .exe

I won't be uploading the source code of this to GitHub, because it's a horrible bodge and I hope that someone can develop a better utility.(But you can still find the source code in the downloads section of this post)
 

Attachments

This is a small utility bodged together by me from pkNX.
All credit for RE'ing the format and writing the code goes to Kaphotics.

Usage: ./gfunpac <input file name>
Or just drag and drop the .gfpac onto the .exe

I won't be uploading the source code of this to GitHub, because it's a horrible bodge and I hope that someone can develop a better utility.(But you can still find the source code in the downloads section of this post)

Thanks! At work but definitely giving this a shot later.

Does this extract .dat, .bnt, and .bns flies from the gfpak? I’ve been using a quickbms plugin to do that but I have no idea what to do with the .dat files. I guess it’s too early to extract models from it.
 
Just a heads up, but pkNX's GUI already does this. Download the latest build (commits->checkmark->teamcity download) and just drop gfpak files on the window.
 
Just a heads up, but pkNX's GUI already does this. Download the latest build (commits->checkmark->teamcity download) and just drop gfpak files on the window.
You are talking about commit #6, right? I don't remember there being an option in the gui to do that(I looked through all submenus, but I'm just probably blind. Also it crashed when I attempted to load in a directory with the romfs and exefs folders(I don't remember what the exception window said though)), so that's the reason this whole thing exists. I also bodged a thing that changes the file extension of the extracted file based on the first four bytes and also bodged in upacking zlib compressed files.
Edit: I looked at the source again and found that there is a form called "FileRipper" which does this exact thing. But there's no way of opening that form from the main form
Edit 2: sorry, I'm stupid and just now realized what you were talking about. You should've made it more obvious that dragging and dropping a .gfpac file onto the main form extracts it

Thanks! At work but definitely giving this a shot later.

Does this extract .dat, .bnt, and .bns flies from the gfpak? I’ve been using a quickbms plugin to do that but I have no idea what to do with the .dat files. I guess it’s too early to extract models from it.
As I said above this bodges in "file type detection thingy" that gives files proper extensions instead of just .dat or .bin or whatever. P.S. RTB has already made a .gfbmdl importer for 3dsmax, so you can try imporing some models. I don't know what to recommend for extracting textures from .bntx files. I guess, you could try SmashForge, but there are a few things that don't quite work right.
 
Last edited by CHEMI6DER,
It errors out for me :

Code:
Unhandled Exception: System.ArgumentException: outputLength is not valid
   at LZ4.LZ4Codec.Decode(Byte[] input, Int32 inputOffset, Int32 inputLength, Int32 outputLength)
   at pkNX.Containers.GFPack.Decompress(Byte[] encryptedData, Int32 decryptedLength, CompressionType type)
   at pkNX.Containers.GFPack.ReadPack(BinaryReader br)
   at GFunPAC.Program.Main(String[] args)
 
It errors out for me :

Code:
Unhandled Exception: System.ArgumentException: outputLength is not valid
   at LZ4.LZ4Codec.Decode(Byte[] input, Int32 inputOffset, Int32 inputLength, Int32 outputLength)
   at pkNX.Containers.GFPack.Decompress(Byte[] encryptedData, Int32 decryptedLength, CompressionType type)
   at pkNX.Containers.GFPack.ReadPack(BinaryReader br)
   at GFunPAC.Program.Main(String[] args)
Seems like it can't decompress one of the files. The error log just tell us that the decompressed size of the file is not valid. I'll try looking into the issue, but I honestly have no idea what can cause this(except for a corrupted file maybe)
 
Seems like it can't decompress one of the files. The error log just tell us that the decompressed size of the file is not valid. I'll try looking into the issue, but I honestly have no idea what can cause this(except for a corrupted file maybe)
I can't get PkNx to open my game as it says object reference not set to an instance of an object. Any ideas why this is happening??
 
I can't get PkNx to open my game as it says object reference not set to an instance of an object. Any ideas why this is happening??
Did you extract the romfs and exefs to folders with those corresponding names? That's a requirement.
 
Did you extract the romfs and exefs to folders with those corresponding names? That's a requirement.
What do you mean by that, I just extracted the xci file and got the romfs and exefs from hactool and put it and put it in a new folder on my desktop.
 

Site & Scene News

Popular threads in this forum