[Archive] Parsing DBC files?
[Archive] Parsing DBC files?
Archived author: FiftyTifty • Posted: 2019-06-27T19:11:58+00:00
Original source
While there is MyDBCEditor, it's very unwieldy for the more exotic .DBC files, with it being rather useless for editing LightIntBand.dbc due to it treating four byte integers as a single dword integer, with no way to change that.
So what I want to do, is create a tool that is designed for editing LightIntBand.dbc. Problem is, the documentation on the DBC files is rather jumbled, and there's no solid examples to work from.
As in, take the header: https://wowdev.wiki/DBC There is no documentation on how to read, parse, and get to the data. It seems like the header even encases the actual game data, from what I could tell, with no mention of how to work with it.
On the other hand, the documentation for https://wowdev.wiki/DB/LightIntBand Is pretty clear. The data is of a fixed size: There is one dword containing the ID, another dword containing the number of entries in the two following arrays, one array containing dword integers (16 entries * 4 bytes = 64 bytes), and another array containing 16 * 4 byte matrices (1 byte for blue value, 1 byte for green value, 1 byte for red value, 1 byte for whatever X is). That means every single record in the .dbc file is 136 bytes long, so once the header is taken care of, the rest is already laid out.
So how do I read the header, in order to get access to the records inside the .dbc file?
Archived author: wungasaurus • Posted: 2019-06-28T06:50:15+00:00
Original source
It does not?
The header surely does not contain the record data, just magic, record and field count, record and string block size.
The file contains a header, the records and the string block, with the header given sizes each.
From the DBC point of view, the structure of the data is irrelevant and a byte blob of record_size * record_count. As you noticed, the LoghtIntBand page then explains the structure inside each record.
In the string Block section there is also code that gives an example of navigating the entire file.
![[Image: D2A6CFF4-D48F-4BF3-8308-37A3E3774C58.jpe...a13ea.jpeg]](https://www.wowmodding.net/uploads/monthly_2019_06/D2A6CFF4-D48F-4BF3-8308-37A3E3774C58.jpeg.f4ae169713da2f5bd64e8815053a13ea.jpeg)
Archived author: wungasaurus • Posted: 2019-06-28T06:51:45+00:00
Original source
Oh, and if you think the wiki is too confusing even after you understood it, please reword stuff there, it is a wiki after all.
Archived author: Gratural • Posted: 2019-06-28T14:46:14+00:00
Original source
MyDBCEditor in 2019?! Open for yourself WDBX Editor!
https://github.com/WowDevTools/WDBXEditor
Dont make bicycle!) Speak with author about repository access.
If you can add some features (like multiple select, edit, replace and delete lines) - it be a wonderful!
Quote: 12 hours ago, wungasaurus said:Aye I would, the problem is that it's not written in a way that can be understood by people who don't already know how it works. That code example isn't even code, it's psuedocode that shows how the header is arranged. And that Struct{} part throws me off. If I understand it correctly:
Oh, and if you think the wiki is too confusing even after you understood it, please reword stuff there, it is a wiki after all.
Quote: 4 hours ago, Gratural said:Ooh, good find. I looked at the tool, and it's not exactly pristine in the way it's organized. There's also no documentation, so it's really not clear how everything is being handled. That's compounded by all the nested functions.
MyDBCEditor in 2019?! Open for yourself WDBX Editor!
https://github.com/WowDevTools/WDBXEditor
Dont make bicycle!) Speak with author about repository access.
If you can add some features (like multiple select, edit, replace and delete lines) - it be a wonderful!
Archived author: FiftyTifty • Posted: 2019-06-28T19:51:59+00:00
Original source
Quote: 12 hours ago, wungasaurus said:Aye I would, the problem is that it's not written in a way that can be understood by people who don't already know how it works. That code example isn't even code, it's psuedocode that shows how the header is arranged. And that Struct{} part throws me off. If I understand it correctly:
Oh, and if you think the wiki is too confusing even after you understood it, please reword stuff there, it is a wiki after all.
Quote: 4 hours ago, Gratural said:Ooh, good find. I looked at the tool, and it's not exactly pristine in the way it's organized. There's also no documentation, so it's really not clear how everything is being handled. That's compounded by all the nested functions.
MyDBCEditor in 2019?! Open for yourself WDBX Editor!
https://github.com/WowDevTools/WDBXEditor
Dont make bicycle!) Speak with author about repository access.
If you can add some features (like multiple select, edit, replace and delete lines) - it be a wonderful!
Archived author: wungasaurus • Posted: 2019-06-29T16:03:49+00:00
Original source
Huh? The code on wiki is valid C++ except for the array lengths in dbc_file.
the WDBX code linked is not for dbc but db2. Header size is 5*4, I guarantee.
string block is a pure character dump that in the case of light will be always of size 1. it is used by columns that contain strings, where the field value is an offset into that block.
Quote: On 6/29/2019 at 5:03 PM, wungasaurus said:Aye that clears it up, thanks.
Huh? The code on wiki is valid C++ except for the array lengths in dbc_file.
the WDBX code linked is not for dbc but db2. Header size is 5*4, I guarantee.
string block is a pure character dump that in the case of light will be always of size 1. it is used by columns that contain strings, where the field value is an offset into that block.
Archived author: FiftyTifty • Posted: 2019-07-01T02:56:35+00:00
Original source
Quote: On 6/29/2019 at 5:03 PM, wungasaurus said:Aye that clears it up, thanks.
Huh? The code on wiki is valid C++ except for the array lengths in dbc_file.
the WDBX code linked is not for dbc but db2. Header size is 5*4, I guarantee.
string block is a pure character dump that in the case of light will be always of size 1. it is used by columns that contain strings, where the field value is an offset into that block.
![[Image: VFR9rCr.png]](https://i.imgur.com/VFR9rCr.png)
Archived author: FiftyTifty • Posted: 2019-07-02T13:35:07+00:00
Original source
As an update, here's what I've got so far: ![[Image: VFR9rCr.png]](https://i.imgur.com/VFR9rCr.png)
The only thing I need to know now, is how to handle the string block. Is it just 1 character for each record in LightIntBand.dbc?
Archived author: wungasaurus • Posted: 2019-07-03T09:36:18+00:00
Original source
String block size is for entire file, not per record. For that dbc it will be 1, as no column is a string. If it were, the record field would give an offset into the file global stringblock.
Quote: 8 hours ago, wungasaurus said:Wait, it's just one byte in size? If that's the case, I can just add a wee button that allows the modder to append a new record.
String block size is for entire file, not per record. For that dbc it will be 1, as no column is a string. If it were, the record field would give an offset into the file global stringblock.
Archived author: FiftyTifty • Posted: 2019-07-03T18:29:55+00:00
Original source
Quote: 8 hours ago, wungasaurus said:Wait, it's just one byte in size? If that's the case, I can just add a wee button that allows the modder to append a new record.
String block size is for entire file, not per record. For that dbc it will be 1, as no column is a string. If it were, the record field would give an offset into the file global stringblock.