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.

[PSP] THFS file unpack/repack script

Featured Replies

  • Author
  • Localization

Ensight, posted Fri Jan 13, 2023 9:32 am (74987)


Hi, guys. I want to translate PSP game Shinseiki Evangelion Koutetsu no Girl Friend 2nd Portable. I need to repack THFS files, but i can`t make QuickBMS script for this file format. Can you help me with this?

The THFS file starts with a 16 byte header:
4 byte ASCII encoded "THFS" string
Little-endian 32bit unsigned integer: the total size of the THFS file.
Little-endian 32bit unsigned integer: the number of files in the table of contents.
4 null bytes

After the header there's the table of contents with each entry being 64 bytes:
8 bytes of unknown data that I couldn't identify. Perhaps a hash or cipher of some sort.
File name 40 bytes long and padded at the end with nulls.
Little-endian 32bit unsigned integer that represents the offset of data in the THFS file.
Little-endian 32bit unsigned integer filesize.
4 null bytes.
Little-endian 32bit unsigned integer filesize (again for some reason).
After the table of contents there is the data of the files. For some reason the file data offsets start at multiples of 0x1000, I don't know why but it's irrelevant.
  • Author
  • Localization

BloodRaynare, posted Fri Jan 13, 2023 11:19 am (74990)


You can extract it with this script below:

Code:
comtype zlib_noerror

IDString "THFS"
get THPS_SZ long
get FILES long
get ZERO long

for i = 0 < FILES
   get UNK1 long
   get UNK2 long
   getDstring NAME 40
   get OFFSET long
   get ZSIZE long
   get IS_COMPRESSED long
   get SIZE long
   if IS_COMPRESSED == 1
      clog NAME OFFSET ZSIZE SIZE
   else
      log NAME OFFSET SIZE
   endif
next i


However, repacking files might be a different story. You can try repack the files with:

Code:
quickbms -w -r -r


or

Code:
quickbms -w -r -r -r


or just use the GUI way: reimport2.bat/reimport3.bat

But, expect the game's crashing if those unknown 8-byte values were indeed a hashes.
It's currently unknown how they were calculated and what are those hashes represents. You're going have to reverse-engineer the game yourself or ask some TL groups that handled this game.
  • Author
  • Localization

Ensight, posted Mon Jan 16, 2023 5:54 am (75030)


Thank you, it works fine. I use reimport2 with quickbms -w -r -r -r and it successfully works!
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.