[Release] EditTMD - edit tmd files.

Discussion in '3DS - ROM Hacking, Translations and Utilities' started by cearp, Dec 18, 2014.

  1. cearp
    OP

    cearp the ticket master

    Member
    7,521
    4,776
    May 26, 2008
    Tuvalu
    Here is just a simple python tool that I created. I could have kept it for myself, but I added some nice error checking to make it more friendly.

    It can change the version and title id stored in tmd files.

    You can do this: python EditTMD.py inputtmd -versionH FFFF
    and that will set the title version to the maximum it can be.
    You could do the same if you want in decimal: python EditTMD.py inputtmd -versionD 65535
    You cannot try to set a new version using both versionH and versionD options, the program will not let you.

    You can also set a new title id, like: python EditTMD.py inputtmd -title 0123456789ABCDEF
    The title id must be 16 hexadecimal characters long.

    You can make the tool apply the values for a whole directory of tmd files. (The tool looks for files that end in 'tmd', and files that end in 'tmd.out') The folder is searched recursively, so it will go into sub folders, and their subfolders, etc etc, looking for tmd files and setting the values you specify.
    To do this, instead of giving the tool a path to a file, simply give it a path to a folder.

    Code:
    usage: edittmd.py [-h] [-title TITLE]
                      [-versionH VERSIONH | -versionD VERSIOND]
                      inputfile
     
    positional arguments:
      inputfile          Input a TMD file, or a directory that will be
                          recursively searched for TMD files with filenames ending
                          in 'tmd' and 'tmd.out'
     
    optional arguments:
      -h, --help          show this help message and exit
      -title TITLE        Enter a new Title ID, which must be 16 hexadecimal
                          characters long
      -versionH VERSIONH  Enter a new version number in hex. 0 to FFFF/0x0 to
                          0xFFFF
      -versionD VERSIOND  Enter a new version number in decimal. 0 to 65535
    
    Let me know if there are problems, etc.
    This is version 1.0, I can maybe update it if needed, like editing more values etc. At the moment I only added what I personally wanted.
     

    Attached Files:

    ihaveamac, Ryccardo, FONZD and 6 others like this.
  2. cearp
    OP

    cearp the ticket master

    Member
    7,521
    4,776
    May 26, 2008
    Tuvalu
    -- just for the record, one or two people told me they got some errors using this on some tmds on windows, i tried the tmds they used and it worked perfectly for me on mac. no idea what went wrong...
    if you can see something weird in my code etc, let me know!
     
  3. Raugo

    Raugo GBAtemp Fan

    Member
    302
    118
    Nov 22, 2014
    Hi, I am trying to edit a tmd of a system module downloaded with UpdateCDN but does nothing, only showed me "Is this really a (decrypted) tmd file?"

    Thank You
     
  4. liomajor

    liomajor GBAtemp Maniac

    Member
    1,463
    1,065
    Jun 10, 2008
    United States
    UpdateCDN loads it directly from Nintendo and doesn't decrypt it!

    TMD Editor works only for decrypted .tmd.
     
    cearp likes this.
  5. Raugo

    Raugo GBAtemp Fan

    Member
    302
    118
    Nov 22, 2014
    Then how could I edit the title or version of a system file update?
     
  6. cearp
    OP

    cearp the ticket master

    Member
    7,521
    4,776
    May 26, 2008
    Tuvalu
    tmds are decrypted when you get them from CDN.
    This is the problem, on my mac it works fine but people said not always on windows. I'll see what I can do.
     
  7. Raugo

    Raugo GBAtemp Fan

    Member
    302
    118
    Nov 22, 2014
    Ok, I tested the application on Linux and it works fine, the problem is that the cia make with this tmd fails when installing with devmenu
     
  8. cearp
    OP

    cearp the ticket master

    Member
    7,521
    4,776
    May 26, 2008
    Tuvalu
    everything i have tested from this tool installs fine, the tmd can be edited, it will install (at least using GW), but the signature will not be valid so it will not run without gw's patches


    -so, what 3ds fw are you on, are you using gw or the 4.5 cfw, what cia... etc :)
     
  9. Raugo

    Raugo GBAtemp Fan

    Member
    302
    118
    Nov 22, 2014
    I tried in CFW and GW emunand. I tried to install a modified System Modules but when I install this cia with devmenu I get the error 0xD8808040.
     
  10. cearp
    OP

    cearp the ticket master

    Member
    7,521
    4,776
    May 26, 2008
    Tuvalu
    is the tmd the only thing you changed in the system module? :)
     
  11. Raugo

    Raugo GBAtemp Fan

    Member
    302
    118
    Nov 22, 2014
    Yes, I only changed the title of the tmd and use make_cdn_cia to convert the file.
     
  12. cearp
    OP

    cearp the ticket master

    Member
    7,521
    4,776
    May 26, 2008
    Tuvalu
    and it works before changing the tmd? weird...
    what is the title id, i can test if you want.
     
  13. Raugo

    Raugo GBAtemp Fan

    Member
    302
    118
    Nov 22, 2014
    Yes it work before change the tmd. The title id is 00001A02 and I'm trying to change it to 000F1A02
     
  14. cearp
    OP

    cearp the ticket master

    Member
    7,521
    4,776
    May 26, 2008
    Tuvalu
    what is the full title id?
    sorry, i didn't realize this was about changing the title id, yes... maybe devmenu does not install them. the version can be edited, but i guess because the title id does not match up to the title id in the contents/in the ticket, etc etc, then that is why you are getting problems.
    change the title id in every instance of the contents (you will need to decrypt them fully), in the exheader (little endian) - when you rebuild it, provided it is done correctly, i guess it should work. :)
     
  15. Raugo

    Raugo GBAtemp Fan

    Member
    302
    118
    Nov 22, 2014
    Thanks for try cearp. The problem of decrypting the file is to encrypt it again, the ctrtool not create this type of cia.
     
    cearp likes this.
  16. Rhapsody

    Rhapsody GBAtemp Regular

    Member
    210
    87
    Jan 4, 2016
    United States
    United States
    I've decrypted the spider browser with Decrypt9 and ctrtools, and I have the files now, including the TMD file. I'm trying to change the TitleID of this to the TitleID of the skater browser, but EditTMD throws out an error, saying "Is this really a (decrypted) tmd file?".

    Is there anything I can do about this?
     
  17. cearp
    OP

    cearp the ticket master

    Member
    7,521
    4,776
    May 26, 2008
    Tuvalu
    weird, i'm not sure why but there is a lot more to changing the title id that the one in the tmd :(
     
  18. Rhapsody

    Rhapsody GBAtemp Regular

    Member
    210
    87
    Jan 4, 2016
    United States
    United States
    If you want to go over it and try to solve this (I'm by no means an expert in anything, though), I'm hanging out in the #3dshacks IRC on Rizon, if you want to chat.
     
  19. cearp
    OP

    cearp the ticket master

    Member
    7,521
    4,776
    May 26, 2008
    Tuvalu
    well some people did have some weird errors on windows but i couldn't really debug because on my mac it worked fine
    but anyway, what i mean is that fixing this bit for you still would not give you the result you want because the title id is stored in many areas of the contents, at least in the exheader as well :)