[Release]A darc tool for Nintendo3DS

Discussion in '3DS - ROM Hacking, Translations and Utilities' started by LITTOMA, Apr 4, 2015.

  1. LITTOMA
    OP

    LITTOMA Advanced Member

    Newcomer
    67
    42
    Nov 14, 2014
    Switzerland
    This is a tool for modifying data-archive(darc) files using in Nintendo3DS games.

    Usage:
    darc.py [options] [object]

    PLATFORM:
    Python 2.7:https://www.python.org/downloads/release/python-279/
    compression only on WindowsXP+ .

    options:
    • -u ...... Unpack specified darc
    • -p ...... Pack up specified folder
    • -i ...... Inject file(s) to specified darc
    • -o ...... Set out put name
    • -d ...... Set work directory
    You can use '-d' option to contain multiple objects in a directory.

    GitHub: https://github.com/LITTOMA/DARCTool

    This tool hasn't been tested completely, so it may not work in some cases, please tell me while errors occur.
    Thanks Smariter for help!

    UPDATE:

    By using CUE's lzx tool, this darc tool support compress/decompress darc files now.
    You can use these following commands to compress darc files(decompress is automatically):
    • -evb .... VRAM compatible, big-endian (LZ11)
    • -ewb .... WRAM compatbile, big-endian (LZ11)
    • -evl .... VRAM compatible, little-endian (LZ40)
    • -ewl .... WRAM compatbile, little-endian (LZ40)
    You should place the lzx.exe in 'C:\Windows\' to make drag&drop unpacking available.

    UPDATE 2:

    Add inject feature,Modified files can work in game now.

    inject usage:
    darc.py -i [darc file] [file to inject]
     
    Ridge, _eyCaRambA_, cearp and 8 others like this.
  2. Asia81

    Asia81 In my Ecchi World <3

    Member
    5,134
    2,561
    Nov 15, 2014
    France
    Albi
    nice, thanks :)
     
    Margen67 likes this.
  3. ChrisX930

    ChrisX930 Banned

    Banned
    788
    317
    Sep 3, 2013
    Gambia, The
    Germany
    Thank you man! :D

    I've rebuilt a darc-file and I'll try to rebuild the rom with the modified file today.
    I just added a file to test this (left: repacked file, right: original file)
    [​IMG]
     
    Margen67 likes this.
  4. ChrisX930

    ChrisX930 Banned

    Banned
    788
    317
    Sep 3, 2013
    Gambia, The
    Germany
    Updated the file.
    Took the original one, replaced one bclim-file (edited the original one), repacked the darc-file and rebuilt the romfs.
    None of the images would be shown ingame, neither the unmodified ones in the repacked file nor the edited ones. :/
    I just uploaded both (the original one and the modified one. hopefully you can find the reason.
    puu.sh/h1LM6/66340b73fa.rar

    There are two files in this rar-archive.
    - The untouched darc-file "(original)TitleUpper.arc"
    - The repacked darc-file "(repacked)TitleUpper.arc" which contains a modified bclim-file "03.bclim" in "timg"-folder.

    Even If I just repack the darc-file, not all images would be shown. Before I replaced the bclim-file, only the 03.bclim-image was shown ingame.

    It seems that something doesn't work well
     
    Margen67 likes this.
  5. Apache Thunder

    Apache Thunder I have cameras in your head!

    Member
    4,109
    4,063
    Oct 7, 2007
    United States
    Levelland, Texas
    It appears this tool doesn't handle LZ compressed DARC archives. I had to manually decompress/recompress one when I tried this tool. (Would be nice if this tool had an option to handle this. It currently doesn't even recognize LZ compressed DARC files and the repacked ones it makes have to be recompressed for the application I wanted to use this for)

    I attempted to modify a bclim inside the logo.bin file. (it's basically an LZ compressed DARC file). I repacked it correctly, but as soon as I attempt to use it, the app I tried it on would immediately show the "SD Card has been removed" message when I boot it. It may just be a limitation on how logo.bin should be modified. (perhaps there is other files that have to be modified to account for the altered image perhaps).

    Could also be an issue with how this program is repacking the DARC or a general issue with how EveryFileExplorer saves new BCLIM files or the BCLIM files it makes are not compatible with logo.bin file configuration.
     
    Margen67 likes this.
  6. ChrisX930

    ChrisX930 Banned

    Banned
    788
    317
    Sep 3, 2013
    Gambia, The
    Germany
    - I unpacked the archive
    - I repacked the archive without doing any changes on it
    - I rebuilt the romfs with makeromfs
    - only one (or two?) of all (6) Images was shown ingame.

    There's probably a problem with the pyton code and some code is wrong/missing.
    I'm not familiar with Pyton so I can't check the code for errors :/

    EDIT:
    The repacked file is a little bit smaller than the original one.
    My original file has 988'712 bytes
    My repacked file has 987'804 bytes
     
    Margen67 likes this.
  7. Smariter

    Smariter Member

    Newcomer
    29
    4
    Dec 23, 2014
    I think the reason is origin file store with padding, but the repacked one doesn't , so it can't show ingame. Unfortunately, the padding rule still a puzzle...:unsure:
     
    Margen67 likes this.
  8. ChrisX930

    ChrisX930 Banned

    Banned
    788
    317
    Sep 3, 2013
    Gambia, The
    Germany
    thats weird :/ without this, i'm not able to modify the game ~_~
     
    Margen67 likes this.
  9. tarovisions

    tarovisions GBAtemp Regular

    Member
    100
    43
    Jan 19, 2015
    United States
    Sucks, but I'm sure someone will work on it eventually
     
    Margen67 likes this.
  10. ChrisX930

    ChrisX930 Banned

    Banned
    788
    317
    Sep 3, 2013
    Gambia, The
    Germany
    That would be awesome :D i Hope someone will do it :)
     
    Margen67 likes this.
  11. Helmax

    Helmax GBAtemp Regular

    Member
    188
    276
    Feb 17, 2011
    United States
    I noticed the update. Keep up the good work my friend
     
    Margen67 likes this.
  12. LITTOMA
    OP

    LITTOMA Advanced Member

    Newcomer
    67
    42
    Nov 14, 2014
    Switzerland
    You should modify the logo's file header and hash store in the exefs header, read the document about ExeFS on 3DBrew for help.
     
    Margen67 likes this.
  13. Apache Thunder

    Apache Thunder I have cameras in your head!

    Member
    4,109
    4,063
    Oct 7, 2007
    United States
    Levelland, Texas
    I would assume the hash in the ExeFS is built for me when I go to rebuild the rom? The exefs.bin file is never fed directly into makerom. It just builds a new one with the banner, icon, and code bin files when building a new rom.

    Editing the exefs already in a built rom is a nogo unless it's not encrypted?. The logo.bin I import as a command with my makerom. I know the way I have it setup works because the stock logo.bin file works.

    But the part where you said I need to alter the logo.bin header. That I was not aware I had to do. I can look into that next time I attempt a custom logo.
     
    Margen67 likes this.
  14. ChrisX930

    ChrisX930 Banned

    Banned
    788
    317
    Sep 3, 2013
    Gambia, The
    Germany
    Okay, He sent me a modified darc-file for HM3D today.
    It worked so he fixed the padding problem.

    The weird thing is: He still doesn't updated his github...
    that means, I can't create darc-files by myself x_x

    Here's a Proof that the modified darc-file he sent me works ingame:
    Warning: Spoilers inside!

    I uploaded a modified bclim-file here on gbatemp some days ago.
    I removed the "A New Beginning" in the Logo for testing purposes
     
    I pwned U! and Margen67 like this.
  15. Helmax

    Helmax GBAtemp Regular

    Member
    188
    276
    Feb 17, 2011
    United States
    Looks like the github repo is updated, I pulled down the latest and there is an executable distribution of the python logic. I ran that to inject several files which then successfully unpacked, unlike last time.
    Using the repack option (-p), he warns us it is not fully tested or working yet.

    So I used the new option (-i) to inject [file] into [darc], and then afterwards unpacked to see if the modified files were there. They went into the rgiht places as well (subdirectories).
    Building a new ROMFS right now adn testing my .3DS to see if it works correctly.
    My goal here was a FONT swap, since my game has 6 font sizes, i wanted to use all the smallest font across to board to maximize word space (in english coming from japanese).

    I'll let you guys know how it works out. Either way, lots of props to LITTOMA
     
  16. ChrisX930

    ChrisX930 Banned

    Banned
    788
    317
    Sep 3, 2013
    Gambia, The
    Germany
    Worked well for me, injected files into a darc-archive for HM3D. It works :)
     
  17. pdensco

    pdensco Banned

    Banned
    389
    69
    Nov 9, 2014
    Pakistan
    what r darc files?
     
  18. ChrisX930

    ChrisX930 Banned

    Banned
    788
    317
    Sep 3, 2013
    Gambia, The
    Germany
    Archive Files in some Games.
    (like arc, garc)
     
  19. pdensco

    pdensco Banned

    Banned
    389
    69
    Nov 9, 2014
    Pakistan
    3ds games? and can we edit games with it?
     
  20. ChrisX930

    ChrisX930 Banned

    Banned
    788
    317
    Sep 3, 2013
    Gambia, The
    Germany