djey47/tdumt

Corrupt bnk file after repacking

Opened this issue · 2 comments

Open, extract .2db file then repack, then game won't load it anymore

Supposedly huge count of 2DB files

Check impact on : tdumt lib 2.0, tdumt2 2.2.1

Need release tduf with fix as well

Investigation details

Due to additional single byte in file tree (with value 0x1), it is ignored when reading and not written back. Happens with files like hud.bnk. Here, .2db extension group (directory), contains 176 files.

Game seems to crash when this byte is missing. Does it instruct game engine to handle high file count?

Other issue in dealer interior: icd12a2.bnk or icd12e2.bnk, can't just replace single .wav file in them.

Two interesting findings:

  • last size info acts just as a pointer to the end of last real packed file (previously used as info for padding file); start address in this size info should be end of the packed file, without its own padding.
  • this last size info should have file length to 0 to indicate it's the beginning of padding

As per PR: https://github.com/djey47/tdumt/pull/2/files

some fixes have been made, now testing in progress (with game engine)

STILL FAILING:

  • icd_12e2.bnk
  • icd_8f.bnk
  • icd_10a.bnk
  • icd_15a.bnk
  • ibd_12c.bnk