ScoreHero
Home | Forum | Wiki
Inbox [ Login ]Inbox [ Login ]
SearchSearch MemberlistMemberlist
ProfileProfile Log inLog in
Deimos's DTB to DTA Converter

 
Post new topic   Reply to topic    ScoreHero Forum Index -> Software
View previous topic :: View next topic  
Author Message
Deimos  





Joined: 24 Jul 2007
Posts: 1344
Location: Calgary, AB

PostPosted: Mon Jan 05, 2009 12:26 am    Post subject: Deimos's DTB to DTA Converter Reply with quote

Deimos's DTB to DTA Converter

The code, written in C for you to compile yourself is available on my bitbucket account, here: http://bitbucket.org/Deimos/dtb2dta/.

Please read below for more information.

Changes
2009-01-04 - Initial release
2009-02-19 - Moved to bitbucket, added support for newlines

What is it?
This is my attempt at writing a "de-compiler" for DTB files, which converts them back into the DTA format that Harmonix uses to create them.

Uh, ok, what's a DTB file?
Anyone that's spent much time poking around in the files for any of the Harmonix games (GH1, GH2, GH80s, RB, RB2) will have run into DTB files. These are used to store a lot of the game's settings, and sometimes even some of the game's logic. A lot of interesting information can be found in them, everything from scoring formulas to loading screen texts, to lists of all the items available in RB/RB2's Rock Shop.

Why do I want it?
Even though we have a great DTB Editor/Viewer written by Nachyoz, having the same data available in a text format makes some things a lot easier, such as quickly scanning files for "interesting" data, using "find in files" to search through multiple files at once, and doing diffs between files. The ability to do diffs is particularly nice for seeing what's been changed between games and patches.

Also, HMX has chosen to use DTA files instead of DTB files to send out all the song data for RB/RB2 DLC. So in the interest of only having to write a single parser (which perhaps I'll also release eventually), I needed a way to convert the in-game song data into the same format.

Other notes
As far as I know, this program can handle every possible DTB chunk, even multiple ones that Nachyoz had marked as "unknown". If you find anything it's skipping, please let me know.

The output formatting isn't perfect, but it's pretty good. I don't think I can do much more about it without a decent amount of rewriting to parse subtrees before figuring out how to output them.

This program was not written with hand-holding in mind. If you pass it an encrypted DTB, it'll probably blow up. If you pass it a non-DTB file, or an invalid DTB, it'll probably blow up. I am not responsible for any blowing up that may or may not occur.

Thanks
  • Nachyoz for the DTB tree viewer program, and releasing the information he discovered about the format.
  • xorloser for ArkTool
  • Harmonix and Pi Studios for shipping Rock Band for PS2 with both compiled DTB files and the DTA files they were made from, which allowed me to reverse-engineer the unknown chunks, and verify that my output format matched theirs. But more than that, for creating such awesome games, so that I'm even motivated to do this kind of thing for them.


Please let me know if you find any problems or have any questions.
_________________
Sturgeon was an optimist.


Last edited by Deimos on Thu Feb 19, 2009 7:12 am; edited 1 time in total
Back to top
View user's profile Send private message XBL Gamertag: Deimorz
kyle99  





Joined: 26 Jun 2007
Posts: 837
Location: Spokane, WA

PostPosted: Mon Jan 05, 2009 12:32 am    Post subject: Reply with quote

I'll have to try this out, thanks for the post
Back to top
View user's profile Send private message Send e-mail MSN Messenger PSN Name: iamalwayssto
howlong  





Joined: 25 Jun 2007
Posts: 857

PostPosted: Mon Jan 05, 2009 3:26 am    Post subject: Reply with quote

Tested on x360 gh2, works. Interesting tool, make it a bit easier in editing if you know what your looking for, thanks a billion. Nice clean program (didn't compile myself, i trusted you, no computer explosion ;] )


Edit: while poking around in modes.dtb ( now dta ) notice in practice something - (track_surface_override rosewood) means on x360 we could at least change within whats already there the track, well on practice..

Bunch of fun stuff on there, and this is my first dtb/dta i have looked at, this will open up tons of new possibilities on dtb editing.
Back to top
View user's profile Wiki User Page Send private message Send e-mail XBL Gamertag: lilhaywood999
LocalH  





Joined: 30 Oct 2006
Posts: 1400
Location: MiloHax

PostPosted: Mon Jan 05, 2009 5:24 am    Post subject: Reply with quote

I think I might have caught a small bug in the binary - as a test, I decrypted an decompiled some GH2 DTB files, and it seems that kDataUnhandled is consistently being output as kDataUnhandled), which seems like it'd break trying to run it back through GZ's DTBtool.
_________________
MiloHax 2.0 Discord server - Everything GH/RB (RIP MiloHax 1.0 01/30/2017 - 04/04/2022)
O211: An Unofficial Scorehero Alumni Discord


Alakaiser sez: POST BECAUSE YOU HAVE SOMETHING TO SAY, NOT BECAUSE YOU HAVE TO SAY SOMETHING.
Back to top
View user's profile Send private message
Deimos  





Joined: 24 Jul 2007
Posts: 1344
Location: Calgary, AB

PostPosted: Mon Jan 05, 2009 4:24 pm    Post subject: Reply with quote

LocalH wrote:
I think I might have caught a small bug in the binary - as a test, I decrypted an decompiled some GH2 DTB files, and it seems that kDataUnhandled is consistently being output as kDataUnhandled), which seems like it'd break trying to run it back through GZ's DTBtool.

Maybe I'm misunderstanding what you're saying, but the only time my program ever outputs a ) character is when a subtree ends (or if there's one in a string or something, of course). So it sounds like you're seeing a lot of cases where the kDataUnhandled chunk is the last child in a tree.

A few of the official DTA files seem to have kDataUnhandled) in them, so if GZ's tool isn't able to handle that, it may be a bug in there.

Let me know if I'm going off in the wrong direction, I'm not sure if you were just suggesting that there should be a newline after all instances of kDataUnhandled, and that the closing ) should be on the next line.
_________________
Sturgeon was an optimist.
Back to top
View user's profile Send private message XBL Gamertag: Deimorz
GameZelda  





Joined: 30 Mar 2007
Posts: 1705

PostPosted: Mon Jan 05, 2009 6:26 pm    Post subject: Reply with quote

Deimos wrote:
LocalH wrote:
I think I might have caught a small bug in the binary - as a test, I decrypted an decompiled some GH2 DTB files, and it seems that kDataUnhandled is consistently being output as kDataUnhandled), which seems like it'd break trying to run it back through GZ's DTBtool.

Maybe I'm misunderstanding what you're saying, but the only time my program ever outputs a ) character is when a subtree ends (or if there's one in a string or something, of course). So it sounds like you're seeing a lot of cases where the kDataUnhandled chunk is the last child in a tree.

A few of the official DTA files seem to have kDataUnhandled) in them, so if GZ's tool isn't able to handle that, it may be a bug in there.

Let me know if I'm going off in the wrong direction, I'm not sure if you were just suggesting that there should be a newline after all instances of kDataUnhandled, and that the closing ) should be on the next line.


My program handles it, and I think that it does it correctly. Basically it just checks if the keyword is kDataUnhandled, and if it is, it converts it to the kDataUnhandled type. The ")" is taken separately, since it closes the node.
_________________
(Ok, I failed to do it in 24 hours... ).

GH:WT-PS2 Customization Progress
[100%] Make it work (w/songs loading) in a DVD5 (thanks psychospacefish!)
[100%] Modify audio (Finally done 25/11/2008)
[100%] Modify charts (Done 26/11/2008! Customs finally )
Back to top
View user's profile Send private message
LocalH  





Joined: 30 Oct 2006
Posts: 1400
Location: MiloHax

PostPosted: Mon Jan 05, 2009 7:05 pm    Post subject: Reply with quote

Deimos wrote:
LocalH wrote:
I think I might have caught a small bug in the binary - as a test, I decrypted an decompiled some GH2 DTB files, and it seems that kDataUnhandled is consistently being output as kDataUnhandled), which seems like it'd break trying to run it back through GZ's DTBtool.

Maybe I'm misunderstanding what you're saying, but the only time my program ever outputs a ) character is when a subtree ends (or if there's one in a string or something, of course). So it sounds like you're seeing a lot of cases where the kDataUnhandled chunk is the last child in a tree.

A few of the official DTA files seem to have kDataUnhandled) in them, so if GZ's tool isn't able to handle that, it may be a bug in there.

Let me know if I'm going off in the wrong direction, I'm not sure if you were just suggesting that there should be a newline after all instances of kDataUnhandled, and that the closing ) should be on the next line.

Well, I did a cursory search so I might have jumped the gun on that a bit, as I just looked further and saw some instances where what I stated was not the case. Sorry for the false bug report
_________________
MiloHax 2.0 Discord server - Everything GH/RB (RIP MiloHax 1.0 01/30/2017 - 04/04/2022)
O211: An Unofficial Scorehero Alumni Discord


Alakaiser sez: POST BECAUSE YOU HAVE SOMETHING TO SAY, NOT BECAUSE YOU HAVE TO SAY SOMETHING.
Back to top
View user's profile Send private message
Deimos  





Joined: 24 Jul 2007
Posts: 1344
Location: Calgary, AB

PostPosted: Thu Feb 19, 2009 7:19 am    Post subject: Reply with quote

Bringing this back from the dead for a quick update. I moved the code to my bitbucket account (link in OP), and added support for the \n escape character. Bitbucket is a lot nicer because people can more easily grab the code, see exactly what I changed, subscribe to changes so you get notified when I update the program, etc.

As of now I think the program is functionally complete, I'm planning to do another patch mostly to add some usage niceties, like having a screen explain usage if you launch it without an argument (instead of crashing), and adding support for things like "*.dtb" to process all the dtb files in a directory.
_________________
Sturgeon was an optimist.
Back to top
View user's profile Send private message XBL Gamertag: Deimorz
bdwwashburn  





Joined: 13 Jul 2008
Posts: 10

PostPosted: Sat Mar 21, 2009 2:44 am    Post subject: Reply with quote

I can't get this to work. I tried compiling with MS Visual C++, Deb-cpp, and had a buddy do it on his linux machine and nothing works. I either get errors compiling, an NTVDM error when running, or it creates the dta file but there are only 2 songs listed.

Can someone tell me what to use to compile or send me a precompiled exe?

Thanks
Back to top
View user's profile Send private message
GameZelda  





Joined: 30 Mar 2007
Posts: 1705

PostPosted: Sat Mar 21, 2009 6:49 am    Post subject: Reply with quote

I've tried to use this program (to try to help the user above), and I've found one bug that makes the program fail (mostly) on Windows.

Code:
dtb_file = fopen(argv[1], "r");


should be changed to
Code:
dtb_file = fopen(argv[1], "rb");


Also, there isn't a cast to "(char *)" in two malloc's, so it doesn't compile in a C++ compiler.

After fixing that, the program seems to work correctly (and seems pretty useful )
_________________
(Ok, I failed to do it in 24 hours... ).

GH:WT-PS2 Customization Progress
[100%] Make it work (w/songs loading) in a DVD5 (thanks psychospacefish!)
[100%] Modify audio (Finally done 25/11/2008)
[100%] Modify charts (Done 26/11/2008! Customs finally )
Back to top
View user's profile Send private message
bdwwashburn  





Joined: 13 Jul 2008
Posts: 10

PostPosted: Sat Mar 21, 2009 1:02 pm    Post subject: Reply with quote

Quote:
Also, there isn't a cast to "(char *)" in two malloc's, so it doesn't compile in a C++ compiler.


How do I fix this?

*Edit*

Ok, I think I got it.

Changed the first one to 'void*' and the second to 'int*' and it made me a dta.

Thanks for the help!!
Back to top
View user's profile Send private message
GameZelda  





Joined: 30 Mar 2007
Posts: 1705

PostPosted: Sat Mar 21, 2009 5:28 pm    Post subject: Reply with quote

bdwwashburn wrote:
Quote:
Also, there isn't a cast to "(char *)" in two malloc's, so it doesn't compile in a C++ compiler.


How do I fix this?

*Edit*

Ok, I think I got it.

Changed the first one to 'void*' and the second to 'int*' and it made me a dta.

Thanks for the help!!


What ? The only thing that you should do to compile it in a C++ compiler is to add
Code:
(char *)

just between the "=" and the "malloc" in the lines 21 and 42.

Anyway, the "important" thing is the first fix, to change the "r" with "rb", since otherwise it fails on Windows.
_________________
(Ok, I failed to do it in 24 hours... ).

GH:WT-PS2 Customization Progress
[100%] Make it work (w/songs loading) in a DVD5 (thanks psychospacefish!)
[100%] Modify audio (Finally done 25/11/2008)
[100%] Modify charts (Done 26/11/2008! Customs finally )
Back to top
View user's profile Send private message
Rosemarry  





Joined: 23 Jun 2010
Posts: 1

PostPosted: Wed Jun 23, 2010 10:45 am    Post subject: Reply with quote

A data converter that translates Guitar Hero 1/2/80s + Rock Band 1/2 (Harmonix games) DTB files back into the DTA format that they are originally written in.
_________________
Back to top
View user's profile Send private message
hpacheco  





Joined: 20 Sep 2011
Posts: 3

PostPosted: Tue Sep 20, 2011 9:17 pm    Post subject: Reply with quote

Hi, I have successfully used this tool to decrypt dtb files to dta text files. However, I am not being able to find a similar dta2dtb tool that re-encrypts them back to dtb.
Back to top
View user's profile Send private message
LocalH  





Joined: 30 Oct 2006
Posts: 1400
Location: MiloHax

PostPosted: Sat Sep 24, 2011 5:18 pm    Post subject: Reply with quote

Use GameZelda's DTBTool, handily uploaded by me here.
_________________
MiloHax 2.0 Discord server - Everything GH/RB (RIP MiloHax 1.0 01/30/2017 - 04/04/2022)
O211: An Unofficial Scorehero Alumni Discord


Alakaiser sez: POST BECAUSE YOU HAVE SOMETHING TO SAY, NOT BECAUSE YOU HAVE TO SAY SOMETHING.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ScoreHero Forum Index -> Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Copyright © 2006-2024 ScoreHero, LLC
Terms of Use | Privacy Policy


Powered by phpBB