TvC FPK tool

Discussion in 'Wii - Hacking' started by RupertAvery, Feb 4, 2010.

Feb 4, 2010

TvC FPK tool by RupertAvery at 7:50 AM (9,113 Views / 1 Likes) 18 replies

  1. RupertAvery
    OP

    Newcomer RupertAvery Member

    Joined:
    Feb 1, 2010
    Messages:
    16
    Country:
    Philippines
    I've written an FPK packer for Tatsunoko vs Capcom. It will scan a folder recursively and compress the files into a fpk.

    The fpk files generated by the packer can be unpacked with unFPK, but I haven't been able to test by replacing files on the ISO. The files are generally larger by around 1k or 2k than the original fpk files.

    The entire file format is accounted for except for the first 4 bytes, which changes from file to file. I think it's a checksum, but I haven't yet been able to figure out how it's computed.

    Hopefully TvC will accept FPKs with the first 4 bytes set to zero.

    You can download the tool (and VS2005 source code) here.

    CODETo create an FPK:

    fpktool -p

    To unpack an FPK:

    fpktool -u

    Would anyone like to help with testing?
     
    TanookiMario likes this.
  2. WiiShizzza

    Member WiiShizzza Graphics juggler

    Joined:
    Oct 10, 2008
    Messages:
    1,201
    Country:
    Germany
    Nice!! Thank you!

    unpacking/packing seems to work. packing is a bit slow. Later on today I'm going to test if the created fpk files work with TvC UAS partition.
     
  3. ganons

    Member ganons GBAtemp Advanced Maniac

    Joined:
    Jun 12, 2005
    Messages:
    1,944
    Country:
    United Kingdom
    what does it exactly do?
     
  4. Tonitonichopchop

    Member Tonitonichopchop GBAtemp Maniac

    Joined:
    Dec 9, 2009
    Messages:
    1,210
    Country:
    United States
    You can upack a model, edit it, and then repack it for use with a game that uses fpk (Such as TvC).
     
  5. ganons

    Member ganons GBAtemp Advanced Maniac

    Joined:
    Jun 12, 2005
    Messages:
    1,944
    Country:
    United Kingdom
    model as in character?
     
  6. RupertAvery
    OP

    Newcomer RupertAvery Member

    Joined:
    Feb 1, 2010
    Messages:
    16
    Country:
    Philippines
    @ganons:

    FPK is more or less an archive file, used to store related sets of data.

    The TvC FPKs seem to store data related to the characters, as they are stored in folders such as "fpk/ryu" and "fpk/sak". When unpacked, you get a bunch of folders and files, with various extensions like *.MOT, *.BRRES, *.SEQ. I suppose in TvC these files are used for the character models, as some of them likely contain textures.

    I'm not too well versed with GC/Wii/Ninty file formats as I'm new to the scene (just bought my Wii a month ago). I was just bored at work/home and wanted to get back into programming-for-fun.

    @WiiShizzza:

    Yeah, it is a bit slow. The compression algorithm currently does a brute-force search for matching sequences, so there's still room for improvement. However if TvC actually does require the checksum and refuses to load the fpk, speed will be the last of our problems [​IMG]
     
  7. Tonitonichopchop

    Member Tonitonichopchop GBAtemp Maniac

    Joined:
    Dec 9, 2009
    Messages:
    1,210
    Country:
    United States
    If you can make a .brsar uncopiler/recompiler I will fucking love you. [​IMG]
     
  8. TyRaNtM

    Member TyRaNtM I did some projects..

    Joined:
    Oct 13, 2007
    Messages:
    999
    Location:
    Chile
    Country:
    Chile
    I think if he can make a .ssd/.srt uncompiler/recompiler, will be AWESOME.
     
  9. ganons

    Member ganons GBAtemp Advanced Maniac

    Joined:
    Jun 12, 2005
    Messages:
    1,944
    Country:
    United Kingdom
    thanks for answer and welcome to the wii scene, looking forward to some of your work
     
  10. oddgriffin

    Newcomer oddgriffin Member

    Joined:
    Nov 13, 2009
    Messages:
    46
    Location:
    akron, ohio usa
    Country:
    United States
    very cool.
     
  11. RupertAvery
    OP

    Newcomer RupertAvery Member

    Joined:
    Feb 1, 2010
    Messages:
    16
    Country:
    Philippines
    I was thinking about how to reverse those formats when it occurred to me that we have the code for reading the formats. It's a long shot, but shouldn't the game contain the code for reading those files?

    The main.dol of TvC contains the folder names for the ssds, fpks and other resources.

    If they are aligned sequentially and of the same size, then I would assume that some code references them via an index, and a pointer to the first item. If the binary contains a "%s.fpk" string, some code pointing to that would likely call a sprintf routine of some sort to build the path prior to loading it. Of course I have no idea as of yet how memory is loaded into the wii and how it is referenced in code.

    If two games both use a certain file format, the dols might contain the same code, making identifying the code a matter of diff-comparing the two dols. Anyway, all this is just to help make identifying which portion of the code to disassemble much easier.

    I was also thinking that maybe the dolphin emulator could be modified to break when it tries to "load" a certain file in the ISO, or access a certain part of memory. I know Dolphin has a debug mode, but it doesn't seem to have the ability to trigger a break on memory access, nor can I actively scan memory for some strings.

    If anyone can point me to good information about dols, how they are loaded, disassemblers and PPC assembly, it would help a lot.

    I've done some NES and SNES assembly in the past. I tried to convert Willow to a SRAM- instead of password-based save for the NES, and for SNES I started a ROM translation project for Akazukin Cha Cha RPG, adding roman font and variable font width routines.
     
  12. DIXES

    Member DIXES GBAtemp Regular

    Joined:
    Aug 3, 2008
    Messages:
    115
    Country:
    Taiwan
    Is there a way to play the ssd, music files of TvC?
     
  13. vashgs

    Member vashgs GBAtemp Regular

    Joined:
    Feb 1, 2008
    Messages:
    236
    Country:
    United States
    If it requires the checksum, we have a checksum library used by the game save. I doubt it'd be the same routine (as FPK file format is used in other games as well), but it's worth a shot. Drop me a PM if interested.
     
  14. RupertAvery
    OP

    Newcomer RupertAvery Member

    Joined:
    Feb 1, 2010
    Messages:
    16
    Country:
    Philippines
    I don't know if I did this correctly, but I replaced ryu's 0000.fpk file with a recompiled one using WiiScrubber's replace function.

    Unfortunately, TvC now freezes whenever I select Ryu. [​IMG] So it's either my compression is wrong in some places, or the checksum thing...

    Things to try with a clean ISO:

    1. Extract a file and replace without changes, to show that replacing works without issues.
    2. Extract a file, modify the "checksum" bytes, replace, to confirm that TvC actually does something with those bytes.

    I doesn't make sense to put a checksum in there though, the game usually expects all the data to be good. I mean, it won't throw a checksum error because there would be no way to recover from it anyway.

    Oh well, back to the drawing board...
     
  15. TempusC

    Member TempusC GBAtemp Regular

    Joined:
    Nov 22, 2006
    Messages:
    229
    Country:
    Canada
    Well, while true, it could be some data which is equivalent to a checksum, such as a hash, a count of the number of entries of something or other, or even a simple file length. If you do indeed find it to be a checksum, you may want to contact megazig - he has gone checksum discovering crazy lately and is the creator of the library vashgs was speaking of.



    There are several places to gain further support into Wii hacking - the Wiibrew forums (which is good), #wiidev on irc.efnet.net (which is kind to newbies), #HACKERCHANNEL on irc.freenode.net (which will probably kick you if you can’t operate your computer entirely via command line), or here (though developments questions can get bogged down fast here - this is truly more of an end-user forum). Lastly, you could ask the original dev - devs are often willing to put in some more effort when someone else with skill shows a little interest.
     
  16. tmdaonline

    Newcomer tmdaonline Newbie

    Joined:
    Sep 17, 2009
    Messages:
    2
    Country:
    United States
    Were you aware that there was already an implmentation for extracting TvC FPK's? Check it out:

    http://forum.xentax.com/viewtopic.php?p=30387#p30387

    Does the implementation for the FPK Extractor differ from yours? Perhaps you can update your tool to use this implementation and see if it works (since the tool available on the above post does not include a re-packer).
     
  17. TempusC

    Member TempusC GBAtemp Regular

    Joined:
    Nov 22, 2006
    Messages:
    229
    Country:
    Canada
    This is a compressor, not an extractor.
     
  18. guysensei

    Newcomer guysensei Member

    Joined:
    May 4, 2009
    Messages:
    18
    Country:
    Japan
  19. Doux91

    Member Doux91 GBAtemp Regular

    Joined:
    Feb 23, 2014
    Messages:
    128
    Country:
    Honduras
    How can i use it i want to extract a 0000.fpk file but i dont know how to make it work can you help me, give me an example at least please i know to open it but how to use it
    fpktool -u <input file> <ouput folder> if i use the < i get an error, if i dont use it doesnt do anything, please help me, or make a GUI for make simple the extraction please
     

Share This Page