Atvaark / BinderTool

Dark Souls II / Dark Souls III / Bloodborne / Elden Ring bdt, bhd, bnd, dcx, tpf, fmg and param unpacking tool
MIT License
310 stars 50 forks source link

how to pack back Data0.bdt or other .bdt? #53

Open haohao698690 opened 2 years ago

haohao698690 commented 2 years ago

Or any method to let the game load loose file located at /sound? It seems nether the patch of UXM and mod engine 2 do this. So I am considering how to re-pack the .bdt files.

googleben commented 2 years ago

See https://github.com/Atvaark/BinderTool/issues/45#issuecomment-1068733147. You're right about UXM and Mod Engine. If you read UXM's warnings, it notes that patching a vanilla Sekiro will crash the game - it's likely that will happen with Elden Ring as well. As for Mod Engine, its method is much more sophisticated than UXM's and is the approach I recommend in the linked issue, but will take effort to update for ER.

As far as repacking .bdt files, it's not easy. .bhd and .bdt files use several forms of encryption - some of which are symmetric (i.e. reproducible since we need the key to decrypt them), but they also use RSA encryption which is asymmetric, which means we don't have the key we need to encrypt the files. I'm rusty on my encryption but I believe you can derive the RSA public key from its paired private key, but not vice versa. FromSoft likely ships the public key and encrypts with the private key to prevent modification. Because of that there has been little effort to make a .bdt repacker.

In order to load custom files without waiting for a Mod Engine update you'll have to do some programming legwork yourself, either updating Mod Engine or writing code to repack .bdt files and then modifying the .exe with your RSA key.

If all of that sounds like gibberish, the tl;dr is that you'll just have to wait for Mod Engine or similar.