Modding Dark Souls - An Investigation

Discussion in 'Switch - ROM Hacking, Saves, Translations & Tools' started by mrmole, Oct 22, 2018.

  1. mrmole
    OP

    mrmole Member

    Newcomer
    1
    Jul 20, 2018
    United Kingdom
    So I had a quick look at Dark Souls Remastered file structure and essentially you could mod the movies more or less straight away, however the textures, sounds etc. are contained in BDT file. BDT file is a zlib archive that uses BHD5 for file indexing. You could do a raw extraction of BDT using something like Offzip, however you will not be able to put it back together. So the challenge is to find the right offsets used by the BHD5 header, so we can repack it.

    I have tried to use the already available tools for BDT extraction, however they all seem to not work anymore. The BDT and BHD5 sizes are changed.

    So does anybody have any experience in modding Dark Souls?
     
    IceTeaX likes this.
  2. WadsRUs

    WadsRUs Advanced Member

    Newcomer
    3
    Jun 12, 2009
    United States
    Thanks for what you've done so far. I don't have an answer for you I'm afraid, but I hope that somebody can find a way to replace the current audio files with those of a much higher quality. And sort out the A/B button mappings too ..... :)
     
  3. WadsRUs
    This message by WadsRUs has been removed from public view by x65943, Nov 7, 2018, Reason: Dupe.
    Oct 22, 2018
  4. mrmole
    OP

    mrmole Member

    Newcomer
    1
    Jul 20, 2018
    United Kingdom
    If anybody is interested how to dump BDT file using Offzip, it is:

    This will dump all the compressed zlib content from the file. This can be also tried:

    As it deals with deflate compression. Apparently you can also repack it by using this command:

    I am not sure if this is the best solution, or whether it will actually produce usable results. To my knowledge creating a QuickBMS script would be the best way of unpacking and repacking the files.
     
  5. Bigjokker

    Bigjokker GBAtemp Regular

    Member
    3
    Jan 4, 2015
    United States
    Found this QuickBMS script for Dark Souls (PC/360) BDT/BHD5 by AlphaTwentyThree. I haven't tried it yet so not sure if it is useful.

    Warning: Spoilers inside!

    You need the "func_getTYPE.bms" also to run it.

    Warning: Spoilers inside!
     
    mrmole likes this.
  6. mrmole
    OP

    mrmole Member

    Newcomer
    1
    Jul 20, 2018
    United Kingdom
    Unfortunately this script does not work - it seems that the headers are different now, which renders the available scripts unusable.
     
  7. maxx488

    maxx488 GBAtemp Regular

    Member
    3
    Jun 15, 2018
    Argentina
    I dont care about the A/B "problem" since i've been playing it like that since 2011. When I want to pick up an item my brain commands my thumb to press the bottom button. I would hate having to press the "O" ("A" on switch).
    But replacing those 1950's sound quality files would be awesome.
     
    Last edited by maxx488, Oct 23, 2018
  8. 8BitWonder

    8BitWonder Small Homebrew Dev

    Member
    8
    Jan 23, 2016
    United States
    47 4F 54 20 45 45 4D
    I remember trying to mod in better PC sounds a couple days ago to no avail.

    I was trying to use DeS-BNDBuild (Unpacks/Repacks dvdbnds) but learned pretty quickly that the switch dvdbnds were different than the original DS archives it was made for.

    However the source is available if it seems like something that can be forked or tweaked to work with DS:R.
    https://github.com/Wulf2k/DeS-BNDBuild
     
    Last edited by 8BitWonder, Oct 23, 2018
    mrmole likes this.
  9. mrmole
    OP

    mrmole Member

    Newcomer
    1
    Jul 20, 2018
    United Kingdom
    I found this writeup on the file structure of the original Dark Souls archives: https://sites.google.com/site/fileformats/engines/dark-souls/archive-files

    I doubt that they switch release is much different apart from having some different files in the archives. So it might be just a matter of reexamining the headers in hex editor and correcting the offsets for QuickBMS script.
     
    8BitWonder likes this.
  10. Beware

    Beware GBAtemp Maniac

    Member
    3
    Apr 5, 2007
    United States
    I've written about this issue at length on some other sites and in Discord servers. The Swtich release is certainly little-endian (like all Switch software) while the existing tools expect big-endian. This will be the biggest obstacle to extracting/repacking the BHT and BHD5 files.
     
  11. Bigjokker

    Bigjokker GBAtemp Regular

    Member
    3
    Jan 4, 2015
    United States
    QuickBMS defaults to little endian so that won't be any trouble for it.
     
  12. Beware

    Beware GBAtemp Maniac

    Member
    3
    Apr 5, 2007
    United States
    Sure except we need to repack the compressed resources then repack them to either be used with LayeredFS or repacjed as NSP.
     
  13. horkrux

    horkrux Newbie

    Newcomer
    1
    Oct 26, 2018
    Germany
    I've started modifying Wulf's DeS-BNDBuild since the network test came out to also support all sorts of Switch formats. Just check out my fork (horkrux) on github.

    I think there is one BND3 format missing from the newest release that I haven't pushed yet, but the archives are pretty much all figured out.
    Don't think I've tried rebuilding the dvdbnds yet though, so not sure if that works.
    If you use it, pls let me know if you encounter any oddities.

    There are quite a few other files you won't be able to modify with existing tools, like MSB files (maps) f.e., so modding the Switch version isn't all that great now.
     
    mrmole likes this.
  14. Beware

    Beware GBAtemp Maniac

    Member
    3
    Apr 5, 2007
    United States
    Well I've successfully extracted all the sound files. They are .bank files, which I'm presuming I can unpack with FSBExtractor, but how would I repack them? And continuing from there, how would we get these repacked as proper BHD5? Is there a way to use the loose audio with layeredFS without repacking the BDH5?
     
  15. horkrux

    horkrux Newbie

    Newcomer
    1
    Oct 26, 2018
    Germany
    The bank files are RIFF containers, so you would have to extract the .fsb files from those first. There is a tool to replace sounds in DS1's fsb files, but it doesn't work with these. The samples then are also stored in RIFF containers as raw audio. They have some ADPCM encoding and I couldn't get them to play at all. Not really my field honestly lol
    Suffice it to say, with all these new formats, replacing sounds might be a bitch.

    To repack the BDT, you just open the BHD5 again and click "rebuild" instead. It then takes all the file paths from the filelist.txt it had created during extraction and repacks the archive.

    Loading loose files is probably not possible, unless s.o. changes to executable. That's how easier modding was enabled on the other versions.
     
    mrmole likes this.
  16. Beware

    Beware GBAtemp Maniac

    Member
    3
    Apr 5, 2007
    United States
    When I attempt to rebuild the app just freezes and doesn't seem to move forward. Have you managed to extract the .fsb files from the .banks? I already have all the replacement .FSB files if we can get them out of the .bank then rebuild the .bank files.
     
  17. horkrux

    horkrux Newbie

    Newcomer
    1
    Oct 26, 2018
    Germany
    It's a different FSB format too (FSB4 vs FSB3), so I don't think that would work :P

    I think freezing is normal, since it's taking a while (that's just the way it was originally programmed *cough*), but I don't think I've updated rebuilding those files for Switch yet, so they wouldn't work anyway. Gonna add that next.
     
    mrmole, Bst22322 and 8BitWonder like this.
  18. Beware

    Beware GBAtemp Maniac

    Member
    3
    Apr 5, 2007
    United States
    QuickBMS can extract the fsb from the .bank files and fmod can get the .wavs out of those FSB. So if we can convert .wav files to the proper fsb format then the only missing pieces are the repacking tools (fsb-bank, loose files-BDH5).
     
    mrmole likes this.
  19. mrmole
    OP

    mrmole Member

    Newcomer
    1
    Jul 20, 2018
    United Kingdom
    Amazing work so far @horkrux, great job at supporting the file formats!

    Perhaps using the official FMOD Studio could do the trick of converting .wav to the right version of the FSB format. As for converting loose files to BDH5, I have been asking around ZenHAX forum and there is a new version of QuickBMS script courtesy of aluigi. Personally, I had some problems using it, so let me know if everything works ok for you. With QuickBMS there is a reimport2 feature, which could potentially rebuild the archives.

    Links:
    FMOD Studio: https://www.fmod.com/studio
    QuickBMS script: http://aluigi.org/bms/dark_soul.bms
    horkrux's fork of Wulf's DeS-BNDBuild: https://github.com/horkrux/DeS-BNDBuild/releases
     
  20. horkrux

    horkrux Newbie

    Newcomer
    1
    Oct 26, 2018
    Germany
    I've updated it now. Should work, but I can't really test it myself.
    If you've already extracted the BHD5 with the older version, you need to extract it again before rebuilding. If you've already rebuilt the BHD5, you need to overwrite the BHD5 and BDT with their respective .bak files.
    In short, just get rid of everything but the original files
     
  21. Beware

    Beware GBAtemp Maniac

    Member
    3
    Apr 5, 2007
    United States
    Presuming FMOD can convert high quality .wavs to the proper FSB format, the only missing piece is repacking those FSB back into .bank. What's the proper FSB format for the Switch release?
     
  22. WadsRUs

    WadsRUs Advanced Member

    Newcomer
    3
    Jun 12, 2009
    United States
    Have my fingers crossed that this can all be sorted out and we can have decent audio on the Switch version of Dark Souls. Major thanks to those who are working on this.
     
Loading...