Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

Bms script to unpack .tpk files from NFS games (PS2)

Featured Replies

  • Author
  • Localization

Alpha1001, posted Sat Feb 26, 2022 4:16 pm (70127)


Hi guys, I would like to know if someone can make for me a bms script to dump the files of this archive https://drive.google.com/file/d/1YgENZo ... sp=sharing
This is a tpk archive from NFS Carbon and I'm trying to make mods to this game, but first I need to dump the files inside many .tpk archives.
The TOC of this tpk begins at 0xD0 and the first file in the 0x3C80, but in the TOC is 0xC0391F00, what is a confused value and I don't have idea how to dump the files using the infos of the TOC.
Someone know how to get the proper offset from the TOC, e.g, how to get 0x3C80 from 0xC0391F00?
The first file is a compressed HUFF file
  • Author
  • Localization

Alpha1001, posted Sat Feb 26, 2022 7:43 pm (70129)


Yeah, but this bms script don't work with Tpk files, the nfsu_bun.bms works only with the ZZDATA archives, HUFF, JDLZ and COMP, the Tpk archives are different, unfortunatelly.
  • Author
  • Localization

DKDave, posted Sat Feb 26, 2022 8:10 pm (70131)


From looking at the sample, the "proper" TOC actually begins at 0xf64, with 0x18 bytes per entry. Each entry seems to start with the same value as in the first TOC at 0xd4.

In the TOC, it looks like you have something like: unknown value, data offset, compressed size, uncompressed size, then a couple of other values. Note that the files are not in any particular order either, so the first one in the TOC is offset 0x5a700.

There are two different compressed types - "HUFF" and "JDLZ". I only looked at the HUFF blocks, but I couldn't find a QuickBMS compression type that worked, although I'm not sure what the final decompressed file is supposed to look like ...
  • Author
  • Localization

Alpha1001, posted Sun Feb 27, 2022 9:21 am (70134)


Hi, thanks, I think that I can dump some files now, really the files are not any particular order. Is a little strange some values, but the offset values and size values it seems ok.
  • Author
  • Localization

Alpha1001, posted Sun Feb 27, 2022 1:28 pm (70136)


Hi DKDAVE, thank you very much by your explanation about the format. I've managed to create now a tool to dump and repack the files from Tpk archive, thanks your explanation! There is another Tpk archive with an structure a little different, soon later I would like to request your help with the format, but for now I will try to do something mods in the files.
Once more time, thank you!
  • Author
  • Localization

Alpha1001, posted Mon Feb 28, 2022 6:54 pm (70154)


Hey DKDAVE, I've made some tests and after rebuild the Tpk archive and update the values as offset and dize from 0xf64, the game won't crash but instead of textures, the game shows a background screen. I believe that is because of the unknown values from 0xD0, that values it seems offset, but I can't understand how to compute it. It seems there is really 2 TOC in this archive.
Some tip?
  • Author
  • Localization

Alpha1001, posted Thu Mar 03, 2022 3:01 pm (70225)


Do you have some idea, Aluigi?
  • Author
  • Localization

rabatini, posted Thu Mar 03, 2022 3:25 pm (70227)


You?ve to post your script here.
or the new tpk file format.
To aluigi or some expert guys take a look.
Is kind dificult figure out without even see an example.
  • Author
  • Localization

rabatini, posted Thu Mar 03, 2022 8:20 pm (70235)


Alpha1001 wrote:

Quote:
Hey DKDAVE, I've made some tests and after rebuild the Tpk archive and update the values as offset and dize from 0xf64, the game won't crash but instead of textures, the game shows a background screen. I believe that is because of the unknown values from 0xD0, that values it seems offset, but I can't understand how to compute it. It seems there is really 2 TOC in this archive.
Some tip?


you quote that you have managed extract and rebuild the file, it is a bms script?
How are you rebuilding those files?
are you repacking using reimporter2?
this kind of information is missing.

Or you simple need to aluigi or some other guy to take a look in the file again, because your extractor is not working proprely?
  • Author
  • Localization

Alpha1001, posted Fri Mar 04, 2022 1:28 pm (70259)


Hi, I managed to rebuild properly the archive now, I am using a tool made by me to dump and rebuild. I managed to find out the problem, this game has a duplicated TOC in another file, so is needed to fix the TOC and paste It in the duplicated TOC. After some days I have found this duplicated TOC and now the game works fine.
But now there is another problem, the comoressed HUFF and the JDLZ files, I can decompress the HUFF and the JDLZ files using an bms script made by Aluigi, but the script won't recompress again and I need to recompress this files to test some changes in the textures.
I've tried to use the reimport.bat in Quickbms but won't works, so I would like to know if the Aluigi or another guy can make an script to recompress the HUFF and JDLZ files used in the NFS games. Unfortunatelly, I don't understand about compress formats.
  • Author
  • Localization

aluigi, posted Fri Mar 04, 2022 7:19 pm (70271)


This is the script for that TPK format:
http://aluigi.org/bms/nfsps2_tpk.bms

Reimporting is not possible and even editing the entry by hand would be painful (probably you have to set the type to "RAWW")
  • Author
  • Localization

Alpha1001, posted Fri Mar 04, 2022 7:33 pm (70274)


Thanks Aluigi, but I didn't understood about the "set the type to RAWW". In the RAWW mode the script will try to compress?
  • Author
  • Localization

aluigi, posted Mon Mar 07, 2022 12:44 pm (70339)


I mean that the only way to disable compression would be to manually editing each file entry and using the "RAWW" type.
It's not really something that can be done by hand because probably other fields must be changed accordingly (compressed and decompressed size of both the main entry and file entry for sure), so it's just an information.
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.