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

CHEMI6DER

Well-Known Member
OP
Member
Joined
Feb 3, 2016
Messages
105
Trophies
0
Location
Houen Chihou
XP
2,053
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

  • GFunPAC_win32.zip
    136.1 KB · Views: 442
  • GFunPAC_src.zip
    851.8 KB · Views: 336

Cruizeez96

New Member
Newbie
Joined
Nov 16, 2018
Messages
2
Trophies
0
Age
40
XP
53
Country
United States
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.
 

Kaphotics

badc0ded
Member
Joined
Sep 10, 2010
Messages
612
Trophies
0
XP
626
Country
United States
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.
 

CHEMI6DER

Well-Known Member
OP
Member
Joined
Feb 3, 2016
Messages
105
Trophies
0
Location
Houen Chihou
XP
2,053
Country
Russia
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,

lorddusk

Active Member
Newcomer
Joined
Mar 20, 2010
Messages
28
Trophies
0
Age
32
Location
Deurne
Website
Visit site
XP
86
Country
Netherlands
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)
 

CHEMI6DER

Well-Known Member
OP
Member
Joined
Feb 3, 2016
Messages
105
Trophies
0
Location
Houen Chihou
XP
2,053
Country
Russia
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)
 

AKANE11

Member
Newcomer
Joined
Nov 27, 2018
Messages
8
Trophies
0
Age
23
XP
48
Country
United States
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??
 

Astoria

Well-Known Member
Member
Joined
Aug 26, 2009
Messages
658
Trophies
1
XP
1,271
Country
Costa Rica
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.
 

AKANE11

Member
Newcomer
Joined
Nov 27, 2018
Messages
8
Trophies
0
Age
23
XP
48
Country
United States
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

General chit-chat
Help Users
  • No one is chatting at the moment.
    OctoAori20 @ OctoAori20: Nice nice-