AutoCIA - bash script and tools to generate CIA files from eshop files

Discussion in '3DS - Flashcards & Custom Firmwares' started by cearp, Nov 18, 2014.

  1. cearp
    OP

    cearp the ticket master

    Member
    7,406
    4,658
    May 26, 2008
    Tuvalu
    This is a script I made that generates cia files from eshop stuff.
    At the moment I think some people are converting eshop stuff to 3ds, and then back to cia... it's weird.
    I think this is the cleanest solution...

    It is painfully simple to use. I used it to build those 127 Japanese updates into cia. (It took about 4 minutes!)
    It also works for games, applications... etc.
    It does not work for DLC. (I can implement it, but I won't do it yet).

    In the AutoCIA folder, place your 'title' folder (containing the stuff you want processed), in the 'Action' folder.
    Place all the xorpads in the 'Xorpads' folder. (They should have names like this 'title.00040000.000a2700.content.00000000.app.xorpad' - it's vital they do)

    Then, just 'cd' into AutoCIA and type ./AutoCIA.sh :) (make sure it is executable - chmod u+x it)

    You will see lots of output.
    Files will be XORd, versions and save sizes will be extracted from TMD files, the type of the CXI (app, manual.. etc) will be checked (using ctrtool), and the correct content specified in makerom.
    (The content of the cxi needs to be checked because the application is not always the first numerical .app file...)
    Then makerom builds all the CIAs to the OutputCIA folder (this is created if it does not exist).

    You are then asked (y/n) if you want to clean up all the intermediate files, like .out files, little ugly text files I resorted to making to hold version data, and .rsf files.

    It's not the most elegant solution, but it works for me perfectly :)
    I hope someone can improve it, steal from it (as I have stolen from others), whatever.
    I wanted to make an actual cross platform executable to do this, but I won't really have much more time at the moment.
    If this is only useful to one other person, I'm still happy!

    (The required (for this script) applications in the 'tools' folder are for osx, I compiled them and they work fine for me on yosemite)

    LINK BE BACK SOON
    let me know how you get on :)

    woah i nearly forgot!! i have to thank riku and friendxsis for all their help with 3ds stuff!
    and all the people who i borrowed source code off, like 3dstmd, ctrtool, etc :) thanks
     
    gtaking112, ztoben, telon22 and 9 others like this.


  2. tjexp

    tjexp Happy New Year!

    Member
    735
    233
    May 20, 2012
    England
    Great work cearp! :lol:
    You'll become a Gyarados at this rate
     
    emo kid 68, Zidapi, Celice and 3 others like this.
  3. hippy dave

    hippy dave Butts Butts Megabutts

    Member
    2,572
    1,792
    Apr 30, 2012
    Sounds really helpful, thanks! Any chance of the source for your custom tools? Need a 32bit build for my clunky old Mac.
     
  4. cearp
    OP

    cearp the ticket master

    Member
    7,406
    4,658
    May 26, 2008
    Tuvalu
    yeah, i mean, i'm happy to share the sources i butchered, i'm not sure how 'ok' it is, since they are copyrighted or something, i'm not sure about all the legal stuff of copyright with open source stuff, i just put online and let people steal. but yeah - i'll upload them in a bit
     
    hippy dave likes this.
  5. drfsupercenter

    drfsupercenter Flash Cart Aficionado

    Member
    1,896
    234
    Mar 26, 2008
    United States
    As a Windows user... dang!

    I love stuff like this though, it sounds insanely useful. Are you planning on releasing the source code? I can probably compile some Windows binaries if you do.
     
    cearp likes this.
  6. Canzah

    Canzah GBAtemp Fan

    Member
    345
    228
    Jul 8, 2012
    Poland
    Any reason in particular why you won't implement an option for DLC?
     
  7. Askedforthis

    Askedforthis GBAtemp Regular

    Member
    117
    67
    Oct 15, 2013
    Norway
    It's always nice to see some OS X love once in a while. Most of the out-of-the-box scene tools are usually compiled for Windows, so seeing these compiled for OS X is lovely.
     
    cearp likes this.
  8. hippy dave

    hippy dave Butts Butts Megabutts

    Member
    2,572
    1,792
    Apr 30, 2012
    Thanks! When I've done similar a couple of times, I've just made sure to credit where I took it from. If you were feeling particularly motivated, you could read the licence that comes with the source you used, but whatever. You can always pm me if you're not sure about making your source public, but I don't see there being any problem with it :)
     
  9. cearp
    OP

    cearp the ticket master

    Member
    7,406
    4,658
    May 26, 2008
    Tuvalu
    the actual reason is because all (i think) dlc stores it's junk in a folder called '00000000' inside of 'contents'.
    everything else just has the stuff in 'contents', so it is simple.
    it's just a little modification i need to make to support dlc... :)
     
  10. Canzah

    Canzah GBAtemp Fan

    Member
    345
    228
    Jul 8, 2012
    Poland
    Ah I see, well good luck then, hopefully you can add support for DLC.
     
  11. cearp
    OP

    cearp the ticket master

    Member
    7,406
    4,658
    May 26, 2008
    Tuvalu
    sure, when we can actually make the majority DLC work :)
     
  12. drfsupercenter

    drfsupercenter Flash Cart Aficionado

    Member
    1,896
    234
    Mar 26, 2008
    United States

    I like when they include source code ;)

    Then you can just compile your own.
     
    cearp likes this.
  13. Canzah

    Canzah GBAtemp Fan

    Member
    345
    228
    Jul 8, 2012
    Poland
    We can already successfully repack any DLC we want actually, it's just that the method is similarly complicated to rebuilding roms before universal tools were made.
     
  14. Gh0sti

    Gh0sti iOS Guru

    Member
    1,317
    49
    Aug 19, 2009
    United States
    Inside you, all around you


    can i convert my .3dz, 3ds files into cia doing this?
     
  15. cearp
    OP

    cearp the ticket master

    Member
    7,406
    4,658
    May 26, 2008
    Tuvalu
    nope
    maybe, maybe not. most dlc does not work, maybe because makerom is not perfect, maybe it's GW's problem to fix...

    and ha... sorry guys, i think i just noticed a problem, i'll put the links back up when i'm done!
     
  16. b17bomber

    b17bomber GBAtemp Fan

    Member
    458
    76
    Jun 15, 2009
    United States
    Do you think this will work with Four Swords Anniversary/
     
  17. telon22

    telon22 GBAtemp Regular

    Member
    282
    66
    Jun 28, 2014
    India
    I have a simple question
    Say I buy the eshop version of ORAS. lets consider it is almost same as X and y. So can I convert it to cia?
    Or there isnt any public method?
     
  18. cearp
    OP

    cearp the ticket master

    Member
    7,406
    4,658
    May 26, 2008
    Tuvalu
    because it is an eshop game, it is basically already a cia.
    so it is easy to make it into a cia :)
    (at least it was easy for the one game i tried) :)
     
    telon22 likes this.
  19. telon22

    telon22 GBAtemp Regular

    Member
    282
    66
    Jun 28, 2014
    India
    Thanks so there is some hope :yay:
     
  20. cearp
    OP

    cearp the ticket master

    Member
    7,406
    4,658
    May 26, 2008
    Tuvalu
    yes :) i do not know how to easily make it into a .3ds file though. haha