my adm <-> dat converter

dengusdengus Posts: 24
edited September 2012 in General Modding
Since editing the adm files in notepad was turning out to be rather inconvenient, I made a converter that converts either way between the two formats.

It's command-line, and usage is simple: just pass it the filename of the file to convert as the only argument. It will add or remove .adm from the input filename to produce the output filename, depending on if you passed it a dat or adm file.

I tested with converting and replacing a few of the files in Pak.zip, and it seems to work just fine, thought I don't guarantee anything.

I included the source code in case anyone is interested.

edit: I updated it to fix a couple minor issues and made it use CRLF instead of just LF for newlines, so that notepad can read it correctly.

http://rapidshare.com/files/300890118/tldat-2.zip
«1

Comments

  • RickRick Posts: 5
    Hah, good timing. I just finished writing my own. Guess I'll hold off on posting it then. :)
  • SilverDSilverD Posts: 159
    You guys are awesome, thanks so much!
    Reality is what, when you stop believing in it, doesn't go away.
    Failure is not an option. It is a privilege, reserved only for those who try.
  • RickRick Posts: 5
    Oh another thing to clarify, not all ADMs are DATs. There are quite a few .ANIMATION.ADM, the format is the same, just a different extension.
  • Thanks for doing this! I'm eager to begin poking around in some files since the editor release date has not been nailed down for sure yet.
  • CsimbiCsimbi Posts: 26
    Nice, thanks, but it does not compact the files properly (decode one, encode it and compare with the original).
  • You dont need to convert the files in adm for the game to use them.

    Anyway this is pretty nice, one annoyance tho is that the text is continuous with no breaks, which makes it really tough to read in editors.

    edit: nevermind this only happens in notepad for some reason
  • RickRick Posts: 5
    throumbas wrote:
    You dont need to convert the files in adm for the game to use them.

    Anyway this is pretty nice, one annoyance tho is that the text is continuous with no breaks, which makes it really tough to read in editors.

    edit: nevermind this only happens in notepad for some reason
    Notepad doesn't support unix line endings is why, you can hack his code to do \r\n instead of just \n to fix that.
  • VisVis Posts: 159
    Can you post a sample command line using this so I know the format?
  • dengusdengus Posts: 24
    Vis wrote:
    Can you post a sample command line using this so I know the format?

    Actually, it's easiest if you just extract the tldat.exe somewhere and choose "Open with" on the .adm file then browse to the extracted tldat.exe. That way, you can just unzip Pak.zip and double click the .adm files to convert them to .dat.

    But a sample command-line anyhow is tldat.exe SPIDER.DAT.adm
  • hillinhillin Posts: 14
    hi dengus, thanks for this tool. it works great when I'm trying to convert an adm file into a dat file, however, when I finished modifying the dat file and attempt to convert it back, there is an encoding problem occuring. the dat file is ucs-2 encoded, which supports CJK(Chinese, Japanese and Korean) characters, but when I place the adm file which I have just converted back into a mod pack, all CJK chars are showing incorrect in the game, the 2-byte CJK chars are shown as 2 splitted latin chars (e.g. a char, 0x7684 in unicode, is shown as 2 chars in code 0x76 and 0x84). I am wondering if this is caused by the convert tool or it is the game it self reads the adm file in that way. I looked into the source of your tool and got no idea.
    thanks a gain.
  • CsimbiCsimbi Posts: 26
    I do not think it's the tool.
    It appears that there is no real unicode support in the game.
    Have a look at these older threads here:
    viewtopic.php?f=6&t=2811
    and here:
    viewtopic.php?f=6&t=2718
  • hillinhillin Posts: 14
    Csimbi wrote:
    I do not think it's the tool.
    It appears that there is no real unicode support in the game.
    Have a look at these older threads here:
    viewtopic.php?f=6&t=2811
    and here:
    viewtopic.php?f=6&t=2718

    Yeah I have read those posts. I believed the game supports unicode because it could handle most unicode chars in the .layout files correctly (except for the color formatted ones, I think it's because the regular expression don't support unicode). Maybe they just don't read the .dat.adm files in a proper way.
  • dengusdengus Posts: 24
    I tested with a few Unicode characters, and confirmed that my tool correctly stores them in the .adm file (it pretty much does a byte-for-byte copy). But there's really no need to use my tool to convert them back into .adm files, it's better to put .dat files in the mods directory rather than modifying Pak.zip, and then the game will make the .adm files itself.

    I believe they're fixing some Unicode support in the next patch?
  • Hi, i use that program and all ok.

    You can't modified that convert all file on one folder? thanks
  • it just flashes for a sec and closes when i try to use it, any help?
  • dengusdengus Posts: 24
    Daviex wrote:
    Hi, i use that program and all ok.

    You can't modified that convert all file on one folder? thanks

    Try this - viewtopic.php?f=20&t=2985
  • hillinhillin Posts: 14
    dengus wrote:
    I tested with a few Unicode characters, and confirmed that my tool correctly stores them in the .adm file (it pretty much does a byte-for-byte copy). But there's really no need to use my tool to convert them back into .adm files, it's better to put .dat files in the mods directory rather than modifying Pak.zip, and then the game will make the .adm files itself.

    I believe they're fixing some Unicode support in the next patch?

    I didn't know the game could make the .adm files automatically. Hope the unicode problem will be fixed soon. Thanks a lot.
  • Nice work man! :)
  • theduketheduke Posts: 130
    mysteriono wrote:
    it just flashes for a sec and closes when i try to use it, any help?

    having the same issue, windows 7 ultimate
  • dengusdengus Posts: 24
    theduke wrote:
    mysteriono wrote:
    it just flashes for a sec and closes when i try to use it, any help?

    having the same issue, windows 7 ultimate

    That's because it's a console application, nothing is supposed to happen when you start it with no parameters. Instead, right click an .adm file, go Open With -> Choose Default Program -> Browse and browse to tldat.exe. Then double click the .adm file and it'll create a .dat next to it.
  • theduketheduke Posts: 130
    my issue was i was dragging it to the .exe from the zip file. when i take it from the zip, to desktop, then to the .exe, it works fine.
  • mysteriono wrote:
    it just flashes for a sec and closes when i try to use it, any help?

    The easiest way to use it is to put the exe file in your torchlight folder with the main game exe. Then make a short cut to it in the same folder and move that shortcut into your media folder where ever the files you need to convert are. Then just drag those files to the shortcut and itll convert em
    Aridale Noblebrook Belmont
  • mysteriono wrote:
    it just flashes for a sec and closes when i try to use it, any help?

    Just making sure that people who encounter this problem realise that this is a command line program, there isn't a gui. If you just double clikc on the .exe file it will flash up the console then close as it doesn't know what file it's supposed to work on.
  • dengus wrote:
    theduke wrote:
    mysteriono wrote:
    it just flashes for a sec and closes when i try to use it, any help?

    having the same issue, windows 7 ultimate

    That's because it's a console application, nothing is supposed to happen when you start it with no parameters. Instead, right click an .adm file, go Open With -> Choose Default Program -> Browse and browse to tldat.exe. Then double click the .adm file and it'll create a .dat next to it.

    did this and it still flashes for a sec and doesnt convert the file
  • LinkDLinkD Posts: 22
    could you be more clear in your main post, i had no idea what you were talking about when i read it and just accidently found out how to do it

    if you guys are still confused, just drag the .adm file onto the .exe file you downloaded, and a new .dat file should be auto created in that same folder
  • LenorLenor Posts: 131
    Thanks for this handy tool :?
  • AvenueAvenue Posts: 160
    This is amazing dengus, I'll be sure to credit you whenever I use this nifty tool.
  • dengus wrote:
    theduke wrote:
    mysteriono wrote:
    "it just flashes for a sec and closes when i try to use it, any help?

    having the same issue, windows 7 ultimate

    That's because it's a console application, nothing is supposed to happen when you start it with no parameters. Instead, right click an .adm file, go Open With -> Choose Default Program -> Browse and browse to tldat.exe. Then double click the .adm file and it'll create a .dat next to it.

    did this and it still flashes for a sec and doesnt convert the file"

    I have got the same problem, Windows Vista 64-bit here.
  • AkuAku Posts: 1
    Alright, for those who are getting problems with the console window appearing and disappearing, it's not the app's fault. Works just fine.

    As for those who (like me) have a LOT of .adm files to open and who don't want to open them one by one, I decided to tackle the problem myself.

    I tried to make heads or tails of the C++ code, but short variable names confused me, so I decided to take the easy way out instead: The good old batch file.

    Create a new text file and rename it <whatever>.bat. Copy-paste this code into it:

    @ECHO off
    for %%n in (dir *.adm) DO "%appdata%\runic games\Torchlight\converter\tldat.exe" %%n

    Put it in the same directory as the .adm files you want to convert. The .dat files will be in the same directory (tested).

    I've only tried this out on Windows 7. Vista should work, dunno about xp (I don't think %appdata% works in xp), in which case just replace the pathname to wherever you've put the converter.

    Oh yeah, this assumes you put the converter in %appdata%\runic games\Torchlight\converter\, for those who can't figure it out. Just edit it if you don't feel like moving that incredibly heavy 132 kb exe file..... ;)
  • jamesLjamesL Posts: 3,568
    there's no reason for the converter
    just download the editor, TorchEd, and all the .data files are already there
    this converter was released before the editor was, but now that we have the editor we don't need it anymore
    I don't have a sig
«1
Sign In or Register to comment.