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

Discussion in 'Switch - Exploits, Custom Firmwares & Soft Mods' started by CHEMI6DER, Nov 17, 2018.

  1. CHEMI6DER
    OP

    CHEMI6DER Advanced Member

    Newcomer
    4
    Feb 3, 2016
    Russia
    Houen Chihou
    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)
     

    Attached Files:

    lordelan likes this.
  2. Cruizeez96

    Cruizeez96 Newbie

    Newcomer
    1
    Nov 16, 2018
    United States
    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.
     
  3. Kaphotics

    Kaphotics badc0ded

    Member
    5
    Sep 10, 2010
    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.
     
  4. CHEMI6DER
    OP

    CHEMI6DER Advanced Member

    Newcomer
    4
    Feb 3, 2016
    Russia
    Houen Chihou
    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

    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, Nov 17, 2018
  5. lorddusk

    lorddusk Member

    Newcomer
    1
    Mar 20, 2010
    Netherlands
    Deurne
    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)
    
     
  6. CHEMI6DER
    OP

    CHEMI6DER Advanced Member

    Newcomer
    4
    Feb 3, 2016
    Russia
    Houen Chihou
    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)
     
  7. AKANE11

    AKANE11 Newbie

    Newcomer
    1
    Nov 27, 2018
    United States
    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??
     
  8. Josephvb10

    Josephvb10 I like Pokémon

    Member
    6
    Aug 26, 2009
    Costa Rica
    Did you extract the romfs and exefs to folders with those corresponding names? That's a requirement.
     
  9. AKANE11

    AKANE11 Newbie

    Newcomer
    1
    Nov 27, 2018
    United States
    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.
     
Loading...